Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["ISADMIN"].ToString() == "N")
            {
                txtEmpId.Text = Session["EMPID"].ToString().ToUpper();
                this.SearchEmployee();
                btnSearch.Visible  = false;
                txtEmpId.Enabled   = false;
                pnlEmpList.Visible = true;

                if (Session["COUNTRYDIRECTOR"].ToString() == "N")
                {
                    grEmpList.DataSource = objEmpInfoMgr.GetSuperVisiorWiseEmp(Session["EMPID"].ToString().ToUpper(), Session["OFFICEID"].ToString());
                }
                else
                {
                    grEmpList.DataSource = objEmpInfoMgr.GetSuperviseeEmp(Session["EMPID"].ToString().ToUpper());
                }

                grEmpList.DataBind();
                if (grEmpList.Rows.Count > 1)
                {
                    btnSearch.Visible = true;
                }
                else
                {
                    btnSearch.Visible = false;
                }
            }

            else if (Session["ISADMIN"].ToString() == "Y")
            {
                if (Session["USERID"].ToString().ToUpper() != "ADMIN")
                {
                    txtEmpId.Text = Session["EMPID"].ToString().ToUpper();
                    this.SearchEmployee();
                    btnSearch.Visible    = false;
                    txtEmpId.Enabled     = false;
                    pnlEmpList.Visible   = true;
                    grEmpList.DataSource = objEmpInfoMgr.SelectDivisionWiseEmp(Session["EMPID"].ToString().ToUpper());
                    grEmpList.DataBind();
                    if (grEmpList.Rows.Count > 1)
                    {
                        btnSearch.Visible = true;
                    }
                    else
                    {
                        btnSearch.Visible = false;
                    }
                }
                else
                {
                    txtEmpId.Text      = "";
                    btnSearch.Visible  = true;
                    txtEmpId.Enabled   = true;
                    pnlEmpList.Visible = false;
                }
            }
        }
    }