protected void Page_Load(object sender, EventArgs e)
        {
            //Session["HODID"] = 104;
            Session["departmentid"] = "ARTS";
            Session["employeeid"]   = 78;
            departmentCode          = (string)Session["departmentid"];
            hodID      = (int)Session["HODID"];
            employeeID = (int)Session["employeeid"];

            if (!IsPostBack)
            {
                //populate employee list excluding the HOD
                dgvAssignRep.DataSource = BusinessLogic_Sam.EmployeeList(departmentCode, hodID);
                dgvAssignRep.DataBind();
                //check current rep name
                repName = BusinessLogic_Sam.checkCurrentRep(departmentCode);
                for (int rowIndex = 0; rowIndex < dgvAssignRep.Rows.Count; rowIndex++)
                {
                    if (dgvAssignRep.Rows[rowIndex].Cells[0].Text == repName)
                    {
                        Button buttonAssign = (Button)dgvAssignRep.Rows[rowIndex].FindControl("btnAssign");
                        buttonAssign.Text      = "Current";
                        buttonAssign.BackColor = System.Drawing.Color.Red;
                        dgvAssignRep.Rows[rowIndex].BackColor = System.Drawing.Color.LightBlue;
                        lblRepName.Text       = repName;
                        Session["CurrentRep"] = repName;
                        lblRepSubtitle1.Text  = " is the current Department Representative.";
                    }
                }
            }
        }
Пример #2
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;
                        }
                    }
                }
            }
        }