예제 #1
0
    protected void btn_login_Click(object sender, EventArgs e)
    {
        LoginModel model = new LoginModel();

        model.LoginId   = txt_loginid.Text;
        model.Password  = txt_Password.Text;
        model.LoginType = ddl_logintype.Text;

        Session["type"] = model.LoginType;

        if (model.LoginType == "Student")
        {
            LibraryDAL dal    = new LibraryDAL();
            bool       status = dal.Login(model);
            if (status == true)
            {
                Session["loginid"] = txt_loginid.Text;
                Response.Redirect("~/Home.aspx");
            }
            else
            {
                lbl_msg.Text = "Invalid User";
            }
        }
        else if (model.LoginId == "Admin" && model.Password == "Admin@123" && model.LoginType == "Admin")
        {
            Session["loginid"] = txt_loginid.Text;
            Response.Redirect("~/AdminHome.aspx");
        }

        else
        {
            lbl_msg.Text = "Invalid User";
        }
    }