示例#1
0
    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
        DataTable uname = MenuMasterLogicLayer.GetUserId(txt_name.Text);

        if (uname.Rows.Count > 0)
        {
            DataTable login = MenuMasterLogicLayer.GetLogin(txt_name.Text, txtPassword.Text);
            if (login.Rows.Count > 0)
            {
                Session["AdminUserId"] = Convert.ToString(login.Rows[0]["LoginId"]);
                Response.Redirect("dashboard.aspx", false);
            }
            else
            {
                lblError.Text = "Error : Invalid Password.";
                txtPassword.Focus();
                txtPassword.Text = "";
            }
        }
        else
        {
            lblError.Text = "Error : Invalid User Id.";
            txt_name.Focus();
            txt_name.Text = "";
        }
    }
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (TxtEmailAddress.Text != "" && TxtPassword.Text != "")
         {
             UserMasterLogicLayer User = new UserMasterLogicLayer();
             User.EmailAddress = TxtEmailAddress.Text.Trim();
             User.Password     = TxtPassword.Text.Trim();
             DataTable login = MenuMasterLogicLayer.GetLogin(TxtEmailAddress.Text, TxtPassword.Text);
             if (login.Rows.Count > 0)
             {
                 Session["UserId"] = Convert.ToString(login.Rows[0]["UserId"]);
                 string ProfileName = Convert.ToString(login.Rows[0]["ProfileName"]);
                 if (ProfileName.Length < 15)
                 {
                     Session["UserName"] = ProfileName;
                 }
                 else
                 {
                     Session["UserName"] = ProfileName.Substring(0, 13) + "..";
                 }
                 Response.Redirect("Default.aspx", false);
             }
             else
             {
                 //txtPassword.Focus();
                 //txtPassword.Text = "";
             }
         }
     }
     catch (Exception)
     {
     }
 }
示例#3
0
    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
        DataTable uname = MenuMasterLogicLayer.GetUserId(txt_name.Text);

        if (uname.Rows.Count > 0)
        {
            DataTable login = MenuMasterLogicLayer.GetLogin(txt_name.Text, txtPassword.Text);
            if (login.Rows.Count > 0)
            {
                if (Convert.ToString(login.Rows[0]["IsAdmin"]) == "1")
                {
                    Session["AdminUserId"]   = Convert.ToString(login.Rows[0]["UserId"]);
                    Session["UserId"]        = Convert.ToString(login.Rows[0]["UserId"]);
                    Session["AdminUserName"] = Convert.ToString(login.Rows[0]["ProfileName"]);
                    string ProfileName = Convert.ToString(login.Rows[0]["ProfileName"]);
                    if (ProfileName.Length < 15)
                    {
                        Session["UserName"] = ProfileName;
                    }
                    else
                    {
                        Session["UserName"] = ProfileName.Substring(0, 13) + "..";
                    }
                    Response.Redirect("dashboard.aspx", false);
                }
                else if (Convert.ToString(login.Rows[0]["IsAdmin"]) == "3")
                {
                    Session["AdminUserId"]   = Convert.ToString(login.Rows[0]["UserId"]);
                    Session["UserId"]        = Convert.ToString(login.Rows[0]["UserId"]);
                    Session["AdminUserName"] = Convert.ToString(login.Rows[0]["ProfileName"]);
                    Session["TheatresId"]    = Convert.ToString(login.Rows[0]["TheatresId"]);
                    string ProfileName = Convert.ToString(login.Rows[0]["ProfileName"]);
                    if (ProfileName.Length < 15)
                    {
                        Session["UserName"] = ProfileName;
                    }
                    else
                    {
                        Session["UserName"] = ProfileName.Substring(0, 13) + "..";
                    }
                    Response.Redirect("TheatresDashboard.aspx", false);
                }
                else if (Convert.ToString(login.Rows[0]["IsAdmin"]) == "4")
                {
                    Session["AdminUserId"]   = Convert.ToString(login.Rows[0]["UserId"]);
                    Session["UserId"]        = Convert.ToString(login.Rows[0]["UserId"]);
                    Session["AdminUserName"] = Convert.ToString(login.Rows[0]["ProfileName"]);
                    Session["TheatresId"]    = Convert.ToString(login.Rows[0]["TheatresId"]);
                    string ProfileName = Convert.ToString(login.Rows[0]["ProfileName"]);
                    if (ProfileName.Length < 15)
                    {
                        Session["UserName"] = ProfileName;
                    }
                    else
                    {
                        Session["UserName"] = ProfileName.Substring(0, 13) + "..";
                    }
                    Response.Redirect("CateenDashboard.aspx", false);
                }
                else
                {
                    Session["UserId"] = Convert.ToString(login.Rows[0]["UserId"]);
                    string ProfileName = Convert.ToString(login.Rows[0]["ProfileName"]);
                    if (ProfileName.Length < 15)
                    {
                        Session["UserName"] = ProfileName;
                    }
                    else
                    {
                        Session["UserName"] = ProfileName.Substring(0, 13) + "..";
                    }
                    Response.Redirect("../Default.aspx", false);
                }
            }
            else
            {
                lblError.Text = "Error : Invalid Password.";
                txtPassword.Focus();
                txtPassword.Text = "";
            }
        }
        else
        {
            lblError.Text = "Error : Invalid User Id.";
            txt_name.Focus();
            txt_name.Text = "";
        }
    }