protected void Page_Load(object sender, EventArgs e)
        {
            bool isTempHead = false;
            RegistrationService rser = new RegistrationService();
            string userId = HttpContext.Current.User.Identity.Name;
            isTempHead = rser.IsTempDepHead(userId);

            if ((HttpContext.Current.User.IsInRole("Department Head") != true) && (isTempHead != true))
            {
                Response.Redirect("/Presentation/Login.aspx");

            }

            _EmployeeService = new EmployeeService();
            _DepartmentService = new DepartmentService();

            if (!IsPostBack)
            {
                int i = Convert.ToInt32(Session["userid"].ToString());
                currentEmployee = new employee();
                currentEmployee = _EmployeeService.GetEmployeeDetailsByEmpID(i);

                if (currentEmployee!=null)
                {
                    int DepID = currentEmployee.EmployeeDepId ?? default(int);
                    currentDepartment = new department();
                    currentDepartment = _DepartmentService.GetdepartmentDetailsByDeptID(DepID);

                    lblDeptName.Text = currentDepartment.DepName;
                    txtDeptContactName.Text = currentDepartment.DepContactName;
                    txtDeptContactNum.Text = currentDepartment.DepContactNumber.ToString();
                    lblCurrentDeptRep.Text = currentDepartment.DepRepName;

                }
                else
                {
                    PanelError.Visible = true;
                }

                int curdeptID = currentEmployee.EmployeeDepId ?? default(int);
                employeeList = new List<employee>();
                employeeList = _EmployeeService.GetEmployeeDetailsByDeptID(curdeptID, i);

                if (employeeList!=null)
                {
                    ddlDeptRep.DataSource = employeeList;
                    ddlDeptRep.DataTextField = "EmployeeName";
                    ddlDeptRep.DataValueField = "EmployeeID";
                    ddlDeptRep.DataBind();
                }
                else
                {
                    PanelError.Visible = true;
                }
                ddlCollectionID.SelectedValue = currentDepartment.DepCollectionPointID.ToString();
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isTempHead = false;
            RegistrationService rser = new RegistrationService();
            string userId = HttpContext.Current.User.Identity.Name;
            isTempHead = rser.IsTempDepHead(userId);

            if ((HttpContext.Current.User.IsInRole("Department Head")!= true) && (isTempHead!=true))
            {
                Response.Redirect("/Presentation/Login.aspx");

            }

            _RequisitionService = new RequisitionService();
            _EmployeeService = new EmployeeService();

            if (!IsPostBack)
            {
                int LoginId = Convert.ToInt32(Session["userid"].ToString());
                currentEmp = new employee();
                currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(LoginId);
                if (currentEmp!=null)
                {
                    int curdeptID = currentEmp.EmployeeDepId ?? default(int);
                    LoadAllGridView(curdeptID);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isTempHead = false;
            RegistrationService rser = new RegistrationService();
            string userId = HttpContext.Current.User.Identity.Name;
            isTempHead=rser.IsTempDepHead(userId);

            if ((HttpContext.Current.User.IsInRole("Department Head") != true) && (isTempHead != true))
            {
                Response.Redirect("/Presentation/Login.aspx");

            }

            _EmployeeService = new EmployeeService();
            _DepartmentService = new DepartmentService();
            _DelegationService = new DelegationService();

            if (!IsPostBack)
            {
                #region ** ClearAll
                ClearNewAllData();
                BtnEnable(false);
                #endregion

                #region ** DataBind for ddl with DeptID
                int LoginId = Convert.ToInt32(Session["userid"].ToString());

                currentEmp = new employee();
                currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(LoginId);

                int curdeptID = currentEmp.EmployeeDepId ?? default(int);
                employeeList = new List<employee>();
                employeeList = _EmployeeService.GetEmployeeDetailsByDeptID(curdeptID, LoginId);
                ddlEmpName.DataSource = employeeList;
                ddlEmpName.DataBind();
                #endregion

                searchDelegation();
            }
        }