示例#1
0
        public int CheckUser(User user)
        {
            bool isPresent = userGateway.CheckUser(user);

            if (isPresent)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
示例#2
0
    protected void logInButton_Click(object sender, EventArgs e)
    {
        string userType = null;

        try
        {
            UserGateway UserGatewayObject = new UserGateway();
            userType = UserGatewayObject.CheckUser(employeeIdDropDownList.SelectedItem.Value, passwordTextBox.Text);
        }
        catch (SqlException sqlExceptionObj)
        {
            Label4.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            Label4.Text = exceptionObj.Message;
        }

        Session["UserType"] = userType;
        switch (userType)
        {
        case "Admin":
            Session["userID"] = employeeIdDropDownList.SelectedItem.Value;
            Response.Redirect("HomePage.aspx");
            break;

        case "Normal":
            Session["userID"] = employeeIdDropDownList.SelectedItem.Value;
            Response.Redirect("HomePage.aspx");
            break;

        default:
            Label4.Text = " Invalid Password! Please retype the Password";
            break;
        }
    }