using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace Publishmentation
{
    class LoginClass
    {
        Connector connection=new Connector();
        SqlDataReader dataReader;
        public bool loginVerification(string userName,string password)
        {
            try
            {
                connection.connect();
                dataReader = connection.select("select userName,password from userTable where userName='" + userName +
                    "' and password='" + password + "'");
                if (!dataReader.Read())
                    return false;
            }
            catch (Exception e)
            {
                MessageBox.Show("!ارتباط با بانک اطلاعاتی با مشکل روبرو شده است", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            finally 
            {
                connection.disConnect();
            }
            return true;
        }
    }
}
