Example #1
0
        protected void cmdLogin_Click(object sender, EventArgs e)
        {
            var data = (from c in account.GetallData() where c.Username == txtUsername.Text && c.Password == txtPassword.Text select c).SingleOrDefault();

            if (data != null)
            {
                Account a = account.getAccount(txtUsername.Text, txtPassword.Text);
                if (a.Role == "Admin")
                {
                    Response.Redirect("~/Admin/AdminHomePage.aspx");
                }
                else if (a.Role == "User")
                {
                    var id = user.IdSearch(txtUsername.Text, txtPassword.Text);

                    Session["UserId"] = id;
                    Response.Redirect("~/Customer/UserHomePage.aspx");
                }
                else
                {
                    lblerror.Visible = true;
                }
            }
            else
            {
                lblerror.Visible = true;
            }
        }
Example #2
0
        //protected void CmdRegister_Click(object sender, EventArgs e)
        //{
        //    Response.Redirect("~/Customer/UserRegistration.aspx");
        //}

        protected void cmdLogin_Click(object sender, EventArgs e)
        {
            Account a = account.getAccount(txtUsername.Text, txtPassword.Text);

            if (a != null)
            {
                if (a.Role == "Admin")
                {
                    Response.Redirect("~/Admin/AdminHomePage.aspx");
                }
                else if (a.Role == "User")
                {
                    var id = user.IdSearch(txtUsername.Text, txtPassword.Text);
                    Session["UserId"] = id;
                    Response.Redirect("~/Customer/UserHomePage.aspx");
                }
            }
            else
            {
                //  Lblinvalid.Visible = true;
            }
        }