示例#1
0
        public void AddNewPayroll(int employeeId, decimal philhealth, decimal sss, decimal pagibig, decimal grosspay)
        {
            decimal netPayComputation = grosspay - (philhealth + sss + pagibig);

            try {
                using (var uow = new UnitOfWork.UnitOfWork()) {
                    var viewmodel = new PayrollViewModel()
                    {
                        EmployeeId = employeeId,
                        GrossPay   = grosspay,
                        PagIbig    = pagibig,
                        SSS        = sss,
                        PhilHealth = philhealth,
                        NetPay     = netPayComputation
                    };

                    uow.Payroll.AddNewPayroll(viewmodel);
                    uow.SaveChanges();
                }
            }
            catch (FieldAccessException ex) {
            }
            catch (EncoderFallbackException ex) {
                //todo: add logger here...
            }
            catch (Exception ex) {
                //todo: add logger here...
            }
        }
        public void InvokeDbContextOnce()
        {
            var mockedContext = new Mock <IPortfolioCmsDbContext>();
            var unitOfWork    = new UnitOfWork.UnitOfWork(mockedContext.Object);

            unitOfWork.SaveChanges();

            mockedContext.Verify(mock => mock.SaveChanges(), Times.Once());
        }
示例#3
0
 public void TransferPayrollToHistory()
 {
     try {
         uo.Payroll.TransferPayrollToHistory();
         uo.SaveChanges();
     }
     catch (Exception ex) {
     }
 }
示例#4
0
 public void EnroleUserToMicroCredentialCourse(int candidateId, int microCredentialId)
 {
     _unitOfWork.CandidateMicroCredentialCourseRepository.Add(new CandidateMicroCredentialCourse {
         CandidateId = candidateId, MicroCredentialId = microCredentialId
     });
     _unitOfWork.SaveChanges();
 }
 public void Delete(int id)
 {
     _employees.Remove(_employees.Find(id));
     _unitOfWork.SaveChanges();
 }