コード例 #1
0
    protected void btnAgentLogin_Click(object sender, EventArgs e)
    {
        try
        {
            ClsBAL objManabusBAL = new ClsBAL();
            objManabusBAL.userName = Convert.ToString(txtAgentName.Text);
            objManabusBAL.password = Convert.ToString(txtAgentPassword.Text);

            if (objManabusBAL.CheckUser() == "Valid User")
            {
                if (Session["Role"] != null)
                {

                     if (Session["Role"].ToString() == "Agent")
                    {
                        System.Data.DataSet ds = objManabusBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                        Session["Balance"] = ds.Tables[0].Rows[0]["Balance"].ToString();
                        Session["View"] = "AgentView";
                        string ss = ds.Tables[0].Rows[0]["Status"].ToString();
                        if (ss.ToUpper().ToString() != "HOLD")
                        {
                            Response.Redirect("~/Default.aspx", false);
                        }
                        else
                        {
                            lblEmpMsg.Text = "Your account is on HOLD. Please contact the administrator.";
                            lblEmpMsg.ForeColor = System.Drawing.Color.Red;
                            Session["UserID"] = null;
                        }
                    }

                    else
                    {
                        lblEmpMsg.Text = "UserName / Password Is Incorrect.";
                        lblEmpMsg.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
            else
            {
                lblEmpMsg.Text = "UserName / Password Is Incorrect.";
                lblEmpMsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw ex;
        }
    }
コード例 #2
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        ClsBAL objManabusBAL = new ClsBAL();
        objManabusBAL.userName = Convert.ToString(txtEmpLoginName.Text);
        objManabusBAL.password = Convert.ToString(txtEmpPassword.Text);

        if (objManabusBAL.CheckUser() == "Valid User")
        {
            if (Session["Role"] != null)
            {
                if (Session["Role"].ToString() == "Employee" || Session["Role"].ToString() == "BSD"||Session["Role"].ToString() == "CSE")
                {
                    System.Data.DataSet ds = objManabusBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                    Session["Balance"] = ds.Tables[0].Rows[0]["Balance"].ToString();
                    Session["View"] = "AgentView";
                    string ss = ds.Tables[0].Rows[0]["Status"].ToString();
                    if (ss.ToUpper().ToString() != "HOLD")
                    {
                        Response.Redirect("~/Users/AdminDb/AdminDb.aspx", false);
                    }
                    else
                    {
                        lblEmpMsg.Text = "Your account is on HOLD. Please contact the administrator.";
                        lblEmpMsg.ForeColor = System.Drawing.Color.Red;
                        Session["UserID"] = null;
                    }

                }
            }

        }
        else
        {
            lblEmpMsg.Text = "UserName/Password Incorrect.";
            lblEmpMsg.ForeColor = System.Drawing.Color.Red;
            Session["Role"] = null;
            Session["UserID"] = null;

        }
    }