private void button1_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text;
            string password = textBox2.Text;

            if (validation())
            {
                int userID = dalUser.userLogin(username, password);
                if (userID != -1)
                {
                    int userPermission = dalUser.getPermissionLevel(userID);

                    if (userPermission < MainDashboard.ACTION_LVL_ONE)
                    {
                        MessageBox.Show("Access denied. Contact your administrator.");
                        tool.historyRecord(text.LogIn, text.Failed, DateTime.Now, userID);
                    }
                    else
                    {
                        frmLoading.ShowLoadingScreen();
                        tool.historyRecord(text.LogIn, text.Success, DateTime.Now, userID);
                        MainDashboard frm = new MainDashboard(userID);
                        frm.Show();
                        frmLoading.CloseForm();
                        Hide();
                    }
                }
                else
                {
                    MessageBox.Show("username or password invalid. please try again.");
                }
            }
        }
Esempio n. 2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            userDAL dal = new userDAL();
            //GEt Values from UI
            string username  = txtUsername.Text;
            string password  = txtPassword.Text;
            bool   isSuccess = dal.userLogin(username, password);

            if (isSuccess == true)
            {
                //Login Success
                Session["login"] = username;
                Response.Redirect("~/admin/Dashboard.aspx");
            }
            else
            {
                //Login Fail
                lblResult.Text = "Username or Password or Both invalid. Please Try Again.";
                Response.Redirect("~/pages/Login.aspx");
            }
        }
Esempio n. 3
0
 public int userLogin(user m_user)
 {
     return(d_userDAL.userLogin(m_user.UserName, m_user.Password));
 }
 public int userLogin(UserInfo m_userInfo)                                     //把model层的值传过来进行比对
 {
     return(d_userAccess.userLogin(m_userInfo.username, m_userInfo.password)); //如果有返回值则登录成功
 }
Esempio n. 5
0
 public string  loginManager(userinfo user)
 {
     return(userD.userLogin(user));
 }