예제 #1
0
        public void MaintainCookies(string _username, string _password)
        {
            bool   blValidUser  = false;
            string _strUserType = string.Empty;
            string strLoggedHistoryId;

            try
            {
                objML_Login.UserName = _username;
                objML_Login.Password = objCommonClass.GetEncrptPassword(_password);
                DataTable dt = objBL_Login.BL_LoginUser(objML_Login);
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        MaintainHistory();
                        txtUserName.Text    = dt.Rows[0]["User_Code"].ToString();
                        Session["UserName"] = txtUserName.Text;
                        Session["Name"]     = dt.Rows[0]["First_Name"].ToString();
                        //Response.Redirect("Index.aspx");
                        Response.RedirectToRoute("DashBoard#One", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('UserName and Password Not Correct OR Not Authorizd to Access !');", true);
                    }
                }
                else
                {
                    txtUserName.Text = "";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Email and Password Incorrect !');", true);
                }
            }

            catch (Exception e)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('" + e.Message.ToString() + "');", true);
            }
        }