예제 #1
0
        /// <summary>
        /// This method enables user to log into the system
        /// </summary>

        protected void btnLogIn_Click1(object sender, EventArgs e)
        {
            IAdminBLL objBLL   = AdminBLLFactory.CreateAdminBLLObject();
            ILogin    objLogin = LoginBOFactory.CreateLoginObject();

            try
            {
                objLogin.EmployeeId = Convert.ToInt32(txtUserName.Text);
                objLogin.Password   = Convert.ToString(txtPassword.Text);

                int roleID = objBLL.ChkLogInCredentials(objLogin);
                if (roleID != 0)
                {
                    lblMessage.Text   = "Role Id is " + roleID;
                    objLogin.Role     = roleID;
                    Session["userID"] = objLogin.EmployeeId;
                    ILogon user = LogonBOFactory.CreateLogonObject();

                    user = objBLL.GetUserMenu(objLogin);
                    Session["ObjUserInfo"] = user;
                    Response.Redirect("HomePage.aspx");
                }
                else
                {
                    lblMessage.Text = "Incorrect Id or password.";
                }
            }

            catch (Exception ex)
            {
                lblMessage.Text = "Incorrect User Id or password";
            }
        }