Esempio n. 1
0
    protected void button_appAuth_remove_Click(object sender, EventArgs e)
    {
        int outgoingDeputyHeadCode = ApproveAuthorityController.getDeputyHeadOfDepartment(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo)).EmpNo;

        ApproveAuthorityController.removeAuthority(Profile.EmpNo, ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo), outgoingDeputyHeadCode);

        Employee me = ApproveAuthorityController.getHeadOfDepartment(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo));

        txtBox_appAuth_currentHead.Text = me.EmpName; //getting head from method

        button_appAuth_remove.Enabled = false;

        BindGrid();
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //get current Acting Head and print on webpage
            Employee deputyHead = ApproveAuthorityController.getDeputyHeadOfDepartment(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo));
            Employee me         = ApproveAuthorityController.getHeadOfDepartment(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo));
            txtBox_appAuth_currentHead.Text = deputyHead.EmpName;

            //getDepartmentEmployeeList
            ddl_appAuth_deptEmps.DataSource = ApproveAuthorityController
                                              .getEmployeesNameInDepartment(Profile.EmpNo)
                                              .Where(x => !x.Equals(me.EmpName));
            ddl_appAuth_deptEmps.DataBind();

            //set date so that dates past are not allowed.
            txtbox_dateStart.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd");
            txtbox_dateEnd.Attributes["min"]   = DateTime.Now.ToString("yyyy-MM-dd");

            Employee head = ApproveAuthorityController.getHeadOfDepartment(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo));

            if (head.EmpNo != deputyHead.EmpNo)
            {
                Deputy d = ApproveAuthorityController.getDeputyDetails(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo).ToString());

                txtbox_dateStart.Text = Convert.ToDateTime(d.FromDate).ToString("yyyy-MM-dd");
                txtbox_dateEnd.Text   = Convert.ToDateTime(d.ToDate).ToString("yyyy-MM-dd");
            }
            else
            {
                txtbox_dateStart.Text = DateTime.Now.ToString("yyyy-MM-dd");
                txtbox_dateEnd.Text   = DateTime.Now.ToString("yyyy-MM-dd");
            }

            button_appAuth_remove.Enabled  = false;
            lbl_currentFutureAppts.Visible = false;
        }
        //populate gridview
        gridView_AppAuthCurrFutAppts.DataSource = ApproveAuthorityController.getDeputyDetailsForDept(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo).ToString());
        if (ApproveAuthorityController.getDeputyDetailsForDept(ApproveAuthorityController.getDepartmentNoFromProfile(Profile.EmpNo).ToString()).Count != 0)
        {
            lbl_currentFutureAppts.Visible = true;
            button_appAuth_remove.Enabled  = true;
        }
        BindGrid();
    }