Exemplo n.º 1
0
        private async Task UpdateSelectedPayslipAsync()
        {
            ucPayslips1.txtPayDate.Text          = Convert.ToString(Payslips.GetInstance().payDate);
            ucPayslips1.txtPublicSalary.Text     = Convert.ToString(Payslips.GetInstance().publicSalary);
            ucPayslips1.txtWorkingSalary.Text    = Convert.ToString(Payslips.GetInstance().workingSalary);
            ucPayslips1.txtOvertimeSalary.Text   = Convert.ToString(Payslips.GetInstance().overtimeSalary);
            ucPayslips1.txtOtherSalary.Text      = Convert.ToString(Payslips.GetInstance().otherSalary);
            ucPayslips1.txtBonus.Text            = Convert.ToString(Payslips.GetInstance().bonus);
            ucPayslips1.txtDeductionSalary.Text  = Convert.ToString(Payslips.GetInstance().deductionSalary);
            ucPayslips1.txtAllowance.Text        = Convert.ToString(Payslips.GetInstance().allowance);
            ucPayslips1.txtAnualLeaveSalary.Text = Convert.ToString(Payslips.GetInstance().annualLeaveSalary);
            ucPayslips1.txtTax.Text = Convert.ToString(Payslips.GetInstance().tax);

            Users tempUser = new Users();

            tempUser = await _usersRepository.GetByIdAsync(Payslips.GetInstance().userId);

            ucPayslips1.cbbUser.Items.Add(tempUser.id + "." + tempUser.fullName);
        }
        private void dgvManagement_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                numrow = e.RowIndex;
                DataGridViewRow data = dgvManagement.Rows[numrow];
                frmManagementSystem.selectedId = Convert.ToInt32(data.Cells[0].Value);

                switch (frmManagementSystem.flag)
                {
                case 1:
                {
                    // Department
                    Departments.GetInstance().departmentName = data.Cells[1].Value.ToString();
                    Departments.GetInstance().shiftId        = Convert.ToInt32(data.Cells[2].Value.ToString());
                }
                break;

                case 2:
                {
                    // Role
                    Roles.GetInstance().roleName    = data.Cells[1].Value.ToString();
                    Roles.GetInstance().note        = data.Cells[2].Value.ToString();
                    Roles.GetInstance().description = data.Cells[3].Value.ToString();
                    Roles.GetInstance().fixedSalary = Convert.ToDouble(data.Cells[4].Value);
                }
                break;

                case 3:
                {
                    // User
                    Users.GetInstance().fullName     = data.Cells[1].Value.ToString();
                    Users.GetInstance().pin          = data.Cells[3].ToString();
                    Users.GetInstance().dob          = Convert.ToDateTime(data.Cells[4].Value);
                    Users.GetInstance().homeAddress  = data.Cells[5].Value.ToString();
                    Users.GetInstance().grossSalary  = Convert.ToDouble(data.Cells[6].Value);
                    Users.GetInstance().netSalary    = Convert.ToDouble(data.Cells[7].Value);
                    Users.GetInstance().note         = data.Cells[8].Value.ToString();
                    Users.GetInstance().departmentId = Convert.ToInt32(data.Cells[10].Value);
                    Users.GetInstance().roleId       = Convert.ToInt32(data.Cells[13].Value);
                    Users.GetInstance().shiftId      = Convert.ToInt32(data.Cells[14].Value);
                }
                break;

                case 4:
                {
                    // Shift
                    Shifts.GetInstance().shiftName = Convert.ToString(data.Cells[1].Value);
                    Shifts.GetInstance().timeStart = Convert.ToString(data.Cells[2].Value);
                    Shifts.GetInstance().timeEnd   = Convert.ToString(data.Cells[3].Value);
                }
                break;

                case 5:
                {
                    // Attendance
                    Attendances.GetInstance().dateCheck    = data.Cells[1].Value.ToString();
                    Attendances.GetInstance().status       = Convert.ToBoolean(data.Cells[2].Value);
                    Attendances.GetInstance().note         = data.Cells[3].Value.ToString();
                    Attendances.GetInstance().workingHours = Convert.ToInt32(data.Cells[4].Value);
                    Attendances.GetInstance().checkinAt    = Convert.ToDateTime(data.Cells[5].Value);
                    Attendances.GetInstance().checkoutAt   = Convert.ToDateTime(data.Cells[6].Value);
                    Attendances.GetInstance().userId       = Convert.ToInt32(data.Cells[7].Value);
                }
                break;

                case 6:
                {
                    // Payslip
                    Payslips.GetInstance().payDate           = Convert.ToDateTime(data.Cells[1].Value);
                    Payslips.GetInstance().workingSalary     = Convert.ToDouble(data.Cells[2].Value);
                    Payslips.GetInstance().publicSalary      = Convert.ToDouble(data.Cells[3].Value);
                    Payslips.GetInstance().otherSalary       = Convert.ToDouble(data.Cells[4].Value);
                    Payslips.GetInstance().annualLeaveSalary = Convert.ToDouble(data.Cells[5].Value);
                    Payslips.GetInstance().overtimeSalary    = Convert.ToDouble(data.Cells[6].Value);
                    Payslips.GetInstance().allowance         = Convert.ToDouble(data.Cells[7].Value);
                    Payslips.GetInstance().bonus             = Convert.ToDouble(data.Cells[8].Value);
                    Payslips.GetInstance().tax             = Convert.ToDouble(data.Cells[9].Value);
                    Payslips.GetInstance().userId          = Convert.ToInt64(data.Cells[10].Value);
                    Payslips.GetInstance().deductionSalary = Convert.ToDouble(data.Cells[11].Value);
                }
                break;

                default:
                    break;
                }
            }
            catch (Exception)
            {
            }
        }