using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class LoginPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Btn_Login_Click(object sender, EventArgs e)
    {
        Class_tblDriver ClsDrv = new Class_tblDriver(Txt_UserName.Text.Trim(), Txt_Password.Text.Trim());
        ClsDrv.UDF_CheckUserValidation();
        if (ClsDrv.Is_LogedIn != true)
        {
            Lbl_Error.Visible = true;
            Lbl_Error.Text = "نام کاربری / کلمه عبور اشتباه می باشد";
        }
        else
        {
            Session.Add("UserName", Txt_UserName.Text.Trim());
            Session.Add("UserTypeID", ClsDrv.int_UserTypeIDD);
            Session.Add("NameFamily", ClsDrv.Str_NameSname);
            Session.Add("Email", ClsDrv.Str_EmailAddress);    
            Response.Redirect("Default.aspx?ID=" + DateTime.Now.Ticks.ToString());      
        }
    }
    protected void Btn_Refresh_Click(object sender, EventArgs e)
    {
        Txt_Password.Text = String.Empty;
        Txt_UserName.Text = String.Empty;
    }
}