Exemplo n.º 1
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");

            }

            _RequisitionService = new RequisitionService();
            _EmployeeService = new EmployeeService();
            _DepartmentService = new DepartmentService();
            _ItemService = new ItemService();

            if (!IsPostBack)
            {
                int QueryStringReqID = Int32.Parse(Request.QueryString["ID"]);

                var Req_Emp_DeptDetails = _RequisitionService.GetReq_Emp_DeptDetailsListByReqId(QueryStringReqID);

                Type t = Req_Emp_DeptDetails.GetType();

                PropertyInfo EmployeeName = t.GetProperty("EmployeeName");
                lblEmployeeName.Text = Convert.ToString(EmployeeName.GetValue(Req_Emp_DeptDetails,null));
                PropertyInfo EmpNo = t.GetProperty("EmployeeID");
                lblEmpNo.Text = Convert.ToString(EmpNo.GetValue(Req_Emp_DeptDetails, null));
                PropertyInfo EmpEmail = t.GetProperty("EmployeeEmail");
                lblEmpEmail.Text = Convert.ToString(EmpEmail.GetValue(Req_Emp_DeptDetails, null));

                PropertyInfo DeptName = t.GetProperty("DepName");
                lblDeptName.Text = Convert.ToString(DeptName.GetValue(Req_Emp_DeptDetails, null));
                PropertyInfo DeptCode = t.GetProperty("DepID");
                lblDeptCode.Text = Convert.ToString(DeptCode.GetValue(Req_Emp_DeptDetails, null));
                PropertyInfo reason=t.GetProperty("ReqReason");
                txtReason.Text = Convert.ToString(reason.GetValue(Req_Emp_DeptDetails, null));

                PropertyInfo status= t.GetProperty("ReqStatus");
                string searchStatus = Convert.ToString(status.GetValue(Req_Emp_DeptDetails, null));
                if (searchStatus == "approved")
                {
                    btnConfirmRequisition.Enabled = false;
                    btnRejectRequisition.Enabled = false;
                    txtReason.Enabled = false;
                    PanelApprove.Visible = true;
                }

                loadItemGridViewData(QueryStringReqID);
            }
        }