Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Inf_UserLoginData userData = new Inf_UserLoginData();
                if (Session["UserLoginData"] == null)
                {
                    Response.BufferOutput = true;
                    Response.Redirect("~/SSO.aspx");
                }
                else
                {
                    userData = (Inf_UserLoginData)Session["UserLoginData"];
                    if (userData != null)
                    {
                        string _EmployeeID  = userData.EmployeeID.Trim();
                        string _displayName = userData.DisplayName;
                        lblLoginName.Text = _displayName;

                        HREmployee_Manage manage = new HREmployee_Manage();
                        HREmployee        hrData = new HREmployee();
                        hrData = manage.GetHREmployeeData(_EmployeeID);
                        if (hrData == null || string.IsNullOrEmpty(hrData.EmployeeID))
                        {
                            MenuItem parent2 = NavigationMenu.FindItem("2");
                            NavigationMenu.Items.Remove(parent2);

                            MenuItem parent3 = NavigationMenu.FindItem("3");
                            NavigationMenu.Items.Remove(parent3);

                            MenuItem parent5 = NavigationMenu.FindItem("5");
                            NavigationMenu.Items.Remove(parent5);
                        }
                    }
                    else
                    {
                        Response.BufferOutput = true;
                        Response.Redirect("~/Unauthorized.aspx");
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UserLoginData"] == null)
                {
                    Response.BufferOutput = true;
                    Response.Redirect("~/SSO.aspx");
                }
                else
                {
                    Inf_UserLoginData userData = new Inf_UserLoginData();
                    userData = (Inf_UserLoginData)Session["UserLoginData"];
                    userData = (Inf_UserLoginData)Session["UserLoginData"];
                    if (userData != null)
                    {
                        string _EmployeeID = userData.EmployeeID.Trim();

                        HREmployee_Manage manage = new HREmployee_Manage();
                        HREmployee        hrData = new HREmployee();
                        hrData = manage.GetHREmployeeData(_EmployeeID);
                        if (hrData == null || string.IsNullOrEmpty(hrData.EmployeeID))
                        {
                            lbtnSelEmployee.Visible   = false;
                            lbtnPrintForm.Visible     = false;
                            lbtnReportSummary.Visible = false;
                        }
                    }
                    else
                    {
                        Response.BufferOutput = true;
                        Response.Redirect("~/Unauthorized.aspx");
                    }
                }
            }
        }
Пример #3
0
        private void BindingGrid()
        {
            try
            {
                string sName       = string.Empty;
                string sEmpID      = string.Empty;
                string sCompany    = string.Empty;
                string sDepartment = string.Empty;

                if (!string.IsNullOrEmpty(txtEmpName.Text.Trim()))
                {
                    sName = txtEmpName.Text.Trim();
                }
                if (!string.IsNullOrEmpty(txtEmpID.Text.Trim()))
                {
                    sEmpID = txtEmpID.Text.Trim();
                }
                if (ddlCompany.SelectedIndex > 0)
                {
                    sCompany = ddlCompany.SelectedValue.Trim();
                }
                if (ddlDepartment.SelectedIndex > 0)
                {
                    sDepartment = ddlDepartment.SelectedItem.ToString().Trim();
                }

                EmployeeMaster_Manage   manager   = new EmployeeMaster_Manage();
                List <Inf_TaskListData> lEmployee = new List <Inf_TaskListData>();
                string _DomainName = hdfUserLogin.Value.Trim();

                HREmployee_Manage manage      = new HREmployee_Manage();
                HREmployee        hrData      = new HREmployee();
                string            _EmployeeID = hdfUserLoginID.Value.Trim();
                hrData = manage.GetHREmployeeData(_EmployeeID);
                if (hrData != null && !string.IsNullOrEmpty(hrData.EmployeeID))
                {
                    //For search all data
                    _DomainName = string.Empty;
                }

                lEmployee = manager.ListAppraisalHistory(_DomainName);
                if (!string.IsNullOrEmpty(sName))
                {
                    lEmployee = lEmployee.Where(c => c.EmployeeName.Contains(sName)).ToList();
                }

                if (!string.IsNullOrEmpty(sEmpID))
                {
                    lEmployee = lEmployee.Where(c => c.EmployeeID.Contains(sEmpID)).ToList();
                }

                if (!string.IsNullOrEmpty(sCompany))
                {
                    lEmployee = lEmployee.Where(c => c.CompanyID.Contains(sCompany)).ToList();
                }

                if (!string.IsNullOrEmpty(sDepartment))
                {
                    lEmployee = lEmployee.Where(c => c.DepartmentName.Contains(sDepartment)).ToList();
                }

                gvEmployee.DataSource = lEmployee;
                gvEmployee.DataBind();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }