Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AuthLevel"] == null)
            {
                Response.Redirect("Login.aspx?ref=EmployeeInquiry", true);
            }

            emp = loadEmployee(Convert.ToInt32(Session["EmployeeId"]));

            txtDateRangeA.Attributes.Add("readonly", "readonly");
            txtDateRangeB.Attributes.Add("readonly", "readonly");

            txtEmpId.Text         = emp.EmployeeId.ToString();
            txtFname.Text         = emp.FirstName;
            txtLName.Text         = emp.LastName;
            txtMiddleInitial.Text = emp.MiddleInitial;
            txtAddress.Text       = emp.Address;
            txtCity.Text          = emp.City;
            txtProvince.Text      = emp.Province;
            txtPostalCode.Text    = emp.PostalCode;

            string status = string.Empty;

            switch (emp.Status)
            {
            case 1:
                status = "Active";
                break;

            case 2:
                status = "Retired";
                break;

            case 3:
                status = "Terminated";
                break;
            }

            txtEmpStatus.Text = status;

            txtDOB.Text          = emp.DateOfBirth.ToShortDateString();
            txtSIN.Text          = emp.SIN;
            txtJobTitle.Text     = emp.JobTitle;
            txtDept.Text         = emp.Department.ToString();
            txtJobStartDate.Text = emp.JobStartDate.ToShortDateString();
            txtHireDate.Text     = emp.HireDate.ToShortDateString();
            txtSupervisor.Text   = emp.Supervisor;
            lblSickDays.Text     = "Sick days: " + emp.SickDays.Count;

            //Get paystubs
            var stubs = new List <PayStub>();

            stubs = PayStubLists.GetPayStubsByEmpId(emp.EmployeeId);

            txtYTDSalary.Text     = (stubs[0].YTDGrossPay + stubs[0].YTDBonusPay).ToString("c");
            txtYTDBonus.Text      = stubs[0].YTDBonusPay.ToString("c");
            txtYTDDeductions.Text = (stubs[0].YTDIncomeTaxDeduction + stubs[0].YTDEIDeduction
                                     + stubs[0].YTDPensionDeduction + stubs[0].YTDCPPDeduction).ToString("c");

            //Load sick day detail
            var sickdays = emp.SickDays;

            lblSickDayDetail.Text = string.Empty;
            foreach (SickDay s in sickdays)
            {
                var day = "";
                if (s.IsFullDay == true)
                {
                    day = "Full Day";
                }
                else
                {
                    day = "Half Day";
                }
                lblSickDayDetail.Text += s.Date.ToShortDateString() + " - " + day + "<br />";
            }
        }
Пример #2
0
        private void showEmployeeDetails(Employee employee)
        {
            //Fill personal details
            txtEmpIdDisplay.Text = employee.EmployeeId.ToString();
            txtFirstName.Text    = employee.FirstName;
            txtMiddleInital.Text = employee.MiddleInitial;
            txtLastName.Text     = employee.LastName;
            txtAddress.Text      = employee.Address;
            txtCity.Text         = employee.City;
            txtProvince.Text     = employee.Province;
            txtPostalCode.Text   = employee.PostalCode;
            txtEmail.Text        = employee.Email;
            txtWorkPhone.Text    = employee.WorkPhone;
            txtCellPhone.Text    = employee.CellPhone;

            //Fill employment details
            if (employee.Status == 1)
            {
                txtStatus.Text      = "Active";
                txtStatus.BackColor = Color.ForestGreen;
            }
            else
            {
                txtStatus.Text = "Inactive";
            }

            txtJobTitle.Text     = employee.JobTitle;
            txtDept.Text         = employee.Department.ToString();
            txtJobStartDate.Text = employee.JobStartDate.ToShortDateString();
            txtHireDate.Text     = employee.HireDate.ToShortDateString();
            txtDateOfBirth.Text  = employee.DateOfBirth.ToShortDateString();
            txtSIN.Text          = employee.SIN.ToString();
            txtSupervisor.Text   = employee.Supervisor;

            //Get sick day info
            dgvSickDays.AutoGenerateColumns = false;
            dgvSickDays.DataSource          = employee.SickDays;
            tabSickDay.Text = "Sick Days " + "(" + dgvSickDays.Rows.Count + ")";

            //Payroll Info
            txtSalary.Text           = string.Format("{0:c}", employee.Salary / 26);
            txtSalaryCap.Text        = string.Format("{0:c}", employee.JobAssignment.MaxSalary / 26);
            txtPrevSalary.Text       = string.Format("{0:c}", employee.PrevSalary);
            txtSalaryChangeDate.Text = employee.SalaryEffectiveDate.ToShortDateString();

            payStubs = PayStubLists.GetPayStubsByEmpId(employee.EmployeeId);
            dgvPaystub.AutoGenerateColumns = false;
            dgvPaystub.DataSource          = payStubs;
            dgvPaystub.Columns["NetPay"].DefaultCellStyle.Format    = "c";
            dgvPaystub.Columns["NetPay"].DefaultCellStyle.Alignment =
                DataGridViewContentAlignment.MiddleRight;

            if (payStubs.Count > 0)
            {
                var p = payStubs[0];
                txtYTDGross.Text = string.Format("{0:c}", p.YTDGrossPay + p.YTDBonusPay);
                txtYTDDed.Text   = string.Format("{0:c}", p.YTDIncomeTaxDeduction + p.YTDCPPDeduction
                                                 + p.YTDEIDeduction + p.YTDPensionDeduction);

                txtYTDNet.Text = string.Format("{0:c}", p.YTDNetPay);

                //YTD Tab
                txtYTDSalary.Text    = string.Format("{0:c}", p.YTDGrossPay);
                txtYTDBonus.Text     = string.Format("{0:c}", p.YTDBonusPay);
                txtYTDGross2.Text    = txtYTDGross.Text;
                txtYTDIncomeTax.Text = string.Format("{0:c}", p.YTDIncomeTaxDeduction);
                txtYTDCpp.Text       = string.Format("{0:c}", p.YTDCPPDeduction);
                txtYTDEI.Text        = string.Format("{0:c}", p.YTDEIDeduction);
                txtYTDPenDed.Text    = string.Format("{0:c}", p.YTDPensionDeduction);
            }
            else
            {
                txtYTDGross.Text = "N/A";
                txtYTDDed.Text   = "N/A";
                txtYTDNet.Text   = "N/A";

                //YTD Tab
                txtYTDSalary.Text    = "N/A";
                txtYTDBonus.Text     = "N/A";
                txtYTDGross2.Text    = "N/A";
                txtYTDIncomeTax.Text = "N/A";;
                txtYTDCpp.Text       = "N/A";
                txtYTDEI.Text        = "N/A";
                txtYTDPenDed.Text    = "N/A";
            }

            //Load salary increase details
            salaryIncreasePending = new BindingList <SalaryAdjustment>(employee.SalaryAdjustmentsPending);
            dgvSalaryIncrease.AutoGenerateColumns = false;
            dgvSalaryIncrease.DataSource          = salaryIncreasePending;

            salaryIncHistory = employee.SalaryAdjustmentsHistory;
            dgvSalaryIncHistory.AutoGenerateColumns = false;
            dgvSalaryIncHistory.DataSource          = salaryIncHistory;

            //Load Bonus details
            bonusPending = new BindingList <Bonus>(employee.BonusPending);
            dgvBonusPending.AutoGenerateColumns = false;
            dgvBonusPending.DataSource          = bonusPending;

            bonusHistory = employee.BonusHistory;
            dgvBonusHistory.AutoGenerateColumns = false;
            dgvBonusHistory.DataSource          = bonusHistory;
        }
Пример #3
0
 public static List <PayStub> getPayStubs(int empId, DateTime dateFrom, DateTime dateTo)
 {
     return(PayStubLists.GetPayStubsByDateRange(empId, dateFrom, dateTo));
 }