예제 #1
0
    void CheckLogin(string accountid, string password)
    {
        Account account = new Account();
        if (account.CheckIfLoginIsValid(accountid, password))
        {
            string usertype = account.GetLoginUserType(accountid, password);
            string name = account.GetLoginFullName(txtAccountID.Text, txtPassword.Text);
            Session["AccountId"] = accountid;
            Session["UserType"] = usertype;
            Session["Name"] = name;

            audit.AddAuditTrail(accountid, usertype, "User Login");

            if (usertype.Equals("Admin"))
                Response.Redirect("../LMS/Admin/Profile.aspx");
            else if (usertype.Equals("Librarian"))
                Response.Redirect("../LMS/Librarian/Profile.aspx");
            else if (usertype.Equals("Finance"))
                Response.Redirect("../LMS/Finance/Profile.aspx");
            else if (usertype.Equals("Student") || usertype.Equals("Faculty"))
                Response.Redirect("../LMS/StudentFaculty/Profile.aspx");
        }
        else
        {
            labelError.Visible = true;
            Label1.Visible = true;
            labelError.Text = "<i class='icon-remove-sign'></i>&nbsp; Incorrect Login. <a href='#loginModal' data-toggle='modal' style='color:inherit'><strong>Try again</strong></a>.";
            Label1.Text = "<i class='icon-remove-sign'></i>&nbsp; Login Attempt Unsuccessful. Try again.";
        }
    }