예제 #1
0
    protected void btLogin_Click(object sender, EventArgs e)
    {
        LoginDAO loginDAO = new LoginDAO();
        LoginRole loginRole;

        loginRole = loginDAO.GetLoginRole(tbUserName.Text, tbPassword.Text);

        if (loginRole.Role == null)
        {
            lbMessage.Text = "Username/password do not match. Try again.";
        }

        if (loginRole.Role != null)
        {
            Session["username"] = tbUserName.Text;

            if (loginRole.Role == "administrator")
            {
                Session["administrator"] = tbUserName.Text;
            }

            lbMessage.Text = "";
            Page.Response.Redirect("HomePage.aspx");
        }
    }
예제 #2
0
    /// <summary>
    /// btLogin_Click: DO LOGIN
    /// </summary>

    protected void Button1_Click(object sender, EventArgs e)
    {
        LoginDAO  loginDAO  = new LoginDAO();
        LoginRole loginRole = new LoginRole();

        loginRole = loginDAO.GetLoginRole(tbUserName.Text, tbPassword.Text);

        if (loginRole.Role == string.Empty)
        {
            lbMessage.Text = "Username/password do not match. Try again.";
        }

        if (loginRole.Role != string.Empty)
        {
            Session["username"] = tbUserName.Text;

            if (loginRole.Role == "administrator")
            {
                Session["administrator"] = tbUserName.Text;
            }

            lbMessage.Text = "";
            Page.Response.Redirect("Default.aspx");
        }
    }
    /// <summary>
    /// btLogin_Click: DO LOGIN
    /// </summary>
    protected void btLogin_Click(object sender, EventArgs e)
    {
        LoginDAO  loginDAO = new LoginDAO();
        LoginRole loginRole;

        loginRole = loginDAO.GetLoginRole(tbUsername.Text, tbPassword.Text);

        if (loginRole.Role == null)
        {
            lbMessage.Text = "Username/password do not match. Try again.";
        }

        if (loginRole.Role != null)
        {
            Session["username"] = tbUsername.Text;

            if (loginRole.Role == "administrator")
            {
                Session["administrator"] = tbUsername.Text;
            }

            lbMessage.Text = "";
            Page.Response.Redirect("HomePage.aspx");
        }
    }