Beispiel #1
0
 public Payslip Create(Payslip item)
 {
     return(Payslips.Create(item));
 }
Beispiel #2
0
 public Payslip Update(Payslip item)
 {
     return(Payslips.Update(item));
 }
Beispiel #3
0
 public IEnumerable <Payslip> Create(IEnumerable <Payslip> items)
 {
     return(Payslips.Create(items));
 }
Beispiel #4
0
 public async Task <IEnumerable <Payslip> > CreateAsync(IEnumerable <Payslip> items)
 {
     return(await Payslips.CreateAsync(items));
 }
Beispiel #5
0
 public IEnumerable <Payslip> Update(IEnumerable <Payslip> items)
 {
     return(Payslips.Update(items));
 }
Beispiel #6
0
 public async Task <Payslip> UpdateAsync(Payslip item)
 {
     return(await Payslips.UpdateAsync(item));
 }
        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)
            {
            }
        }
Beispiel #8
0
 public Task <IEnumerable <Payslip> > UpdateAsync(IEnumerable <Payslip> items)
 {
     return(Payslips.UpdateAsync(items));
 }
Beispiel #9
0
 public Task <Payslip> CreateAsync(Payslip item)
 {
     return(Payslips.CreateAsync(item));
 }
        public List <WeeklyPayslip> RetrievePayslip()
        {
            var _payservice  = new PayService();
            var payslips_all = new List <WeeklyPayslip>();

            using (var context = new TimesheetsContext())
            {
                LambdaLogger.Log("Context Retrieval");

                var payAgreements = context.PayAgreements;

                var timesheets = context.Timesheets
                                 .Where(x => x.Date >= MinDate(false) &&
                                        x.Date < MaxDate(false));

                foreach (var payAgr in payAgreements)
                {
                    var empTimesheet = timesheets
                                       .Where(x => x.EmployeeId == payAgr.EmployeeId &&
                                              x.CompanyAbn == payAgr.CompanyAbn).ToList();

                    var employee = context.AspNetUsers
                                   .Include(x => x.Payslips)
                                   .SingleOrDefault(x => x.Id == payAgr.EmployeeId);

                    var company = context.Companies
                                  .SingleOrDefault(x => x.Abn == payAgr.CompanyAbn);

                    if (empTimesheet.Count > 0)
                    {
                        try
                        {
                            var payslip_print = _payservice.GetEmpoyeeTimesheet(employee, company, empTimesheet, payAgr);

                            payslips_all.Add(payslip_print);

                            var payslip_database = new Payslips()
                            {
                                WeekBegininning = MinDate(false),
                                GrossPay        = Convert.ToDouble(payslip_print.Pay),
                                PayYtd          = Convert.ToDouble(payslip_print.PayYTD),
                                Tax             = Convert.ToDouble(payslip_print.Tax),
                                BaseHours       = Convert.ToDouble(payslip_print.BaseHours),
                                SatHours        = Convert.ToDouble(payslip_print.SatHours),
                                SunHours        = Convert.ToDouble(payslip_print.SunHours),
                                CompanyAbn      = Convert.ToInt64(payslip_print.CompanyABN),
                                EmployeeId      = payslip_print.EmpId
                            };

                            context.Payslips.Add(payslip_database);
                        }
                        catch (Exception e)
                        {
                            LambdaLogger.Log(e.Message);
                        }
                    }
                }
                LambdaLogger.Log("Save Changes to Context");

                context.SaveChanges();
            };

            return(payslips_all);
        }