Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Need to check the identity of the logged in user before we can load the employee list.
            //Need to get the HODID based on logged in employeeID
            //For now, we will always load the ARTS employee list.
            //Need to filter the HOD ID from the employee list from display[get from session state].

            //Change: Need to get employeeid, HODID, departmentid from Session state.
            //Session["HODID"] = 104;
            Session["departmentid"] = "ARTS";
            Session["employeeid"]   = 78;
            departmentCode          = (string)Session["departmentid"];
            hodID      = (int)Session["HODID"];
            employeeID = (int)Session["employeeid"];

            if (!IsPostBack)
            {       //Change: need to rename businesslogic path here
                    //only shows a particular employee list, excluding HOD name on the list to prevent unnecessary click.
                dgvDelegateApproval.DataSource = BusinessLogic_Sam.EmployeeList(departmentCode, hodID);
                dgvDelegateApproval.DataBind();

                //Check who is the current approver (if any) and change the button text to "Undelegate" & color to red, current approver row is highlighted
                approverName = BusinessLogic_Sam.checkCurrentApprover(departmentCode);
                if (approverName != null)
                {
                    for (int rowIndex = 0; rowIndex < dgvDelegateApproval.Rows.Count; rowIndex++)
                    {
                        if (dgvDelegateApproval.Rows[rowIndex].Cells[0].Text == approverName)
                        {
                            Button buttonDelegate = (Button)dgvDelegateApproval.Rows[rowIndex].FindControl("btnDelegate");
                            buttonDelegate.Text      = "Undelegate";
                            buttonDelegate.BackColor = System.Drawing.Color.Red;
                            dgvDelegateApproval.Rows[rowIndex].BackColor = System.Drawing.Color.LightBlue;
                        }
                    }
                }
            }
        }