public bool ValidCreateObject(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService, IEmployeeService _employeeService)
 {
     VHasOtherExpense(otherExpenseDetail, _otherExpenseService);
     if (!isValid(otherExpenseDetail))
     {
         return(false);
     }
     VHasEmployee(otherExpenseDetail, _employeeService);
     if (!isValid(otherExpenseDetail))
     {
         return(false);
     }
     VHasEffectiveDate(otherExpenseDetail);
     if (!isValid(otherExpenseDetail))
     {
         return(false);
     }
     VHasAmount(otherExpenseDetail);
     if (!isValid(otherExpenseDetail))
     {
         return(false);
     }
     VHasRecurring(otherExpenseDetail);
     FixDate(otherExpenseDetail, _otherExpenseService);
     return(isValid(otherExpenseDetail));
 }
        public OtherExpenseDetail FixDate(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService)
        {
            otherExpenseDetail.EndDate = otherExpenseDetail.EffectiveDate;
            OtherExpense otherExpense = _otherExpenseService.GetObjectById(otherExpenseDetail.OtherExpenseId);

            if (otherExpense != null)
            {
                DateTime curDay = otherExpenseDetail.EffectiveDate;
                int      cnt    = otherExpenseDetail.Recurring;
                while (cnt > 1)
                {
                    switch ((Constant.SalaryItemStatus)otherExpense.SalaryStatus)
                    {
                    case Constant.SalaryItemStatus.Daily: otherExpenseDetail.EndDate = curDay.AddDays(1); break;

                    case Constant.SalaryItemStatus.Weekly: otherExpenseDetail.EndDate = curDay.AddDays(7); break;

                    case Constant.SalaryItemStatus.Monthly: otherExpenseDetail.EndDate = curDay.AddMonths(1); break;

                    case Constant.SalaryItemStatus.Yearly: otherExpenseDetail.EndDate = curDay.AddYears(1); break;
                    }
                    curDay = otherExpenseDetail.EndDate;
                    cnt--;
                }
            }
            return(otherExpenseDetail);
        }
 public OtherExpenseController()
 {
     _otherExpenseService       = new OtherExpenseService(new OtherExpenseRepository(), new OtherExpenseValidator());
     _employeeService           = new EmployeeService(new EmployeeRepository(), new EmployeeValidator());
     _salaryItemService         = new SalaryItemService(new SalaryItemRepository(), new SalaryItemValidator());
     _otherExpenseDetailService = new OtherExpenseDetailService(new OtherExpenseDetailRepository(), new OtherExpenseDetailValidator());
 }
示例#4
0
 public OtherExpense VHasUniqueCode(OtherExpense otherExpense, IOtherExpenseService _otherExpenseService)
 {
     if (String.IsNullOrEmpty(otherExpense.Code) || otherExpense.Code.Trim() == "")
     {
         otherExpense.Errors.Add("Code", "Tidak boleh kosong");
     }
     else if (_otherExpenseService.IsCodeDuplicated(otherExpense))
     {
         otherExpense.Errors.Add("Code", "Tidak boleh ada duplikasi");
     }
     return(otherExpense);
 }
 public BatchService(IBatchDataService dataService, IUserService userService, ISupplyDataService supplyDataService,
                     IFactoryExpenseService factoryExpenseService, ILabourCostService labourCostService,
                     IMachineRepairService machineRepairService, IOtherExpenseService otherExpenseService,
                     IBatchOutPutService batchOutPutService, ISupplyService supplyService)
 {
     this._dataService           = dataService;
     this._userService           = userService;
     this._supplyDataService     = supplyDataService;
     this._factoryExpenseService = factoryExpenseService;
     this._labourCostService     = labourCostService;
     this._machineRepairService  = machineRepairService;
     this._otherExpenseService   = otherExpenseService;
     this._batchOutPutService    = batchOutPutService;
     this._supplyService         = supplyService;
 }
 public bool ValidUpdateObject(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService, IEmployeeService _employeeService)
 {
     otherExpenseDetail.Errors.Clear();
     ValidCreateObject(otherExpenseDetail, _otherExpenseService, _employeeService);
     return(isValid(otherExpenseDetail));
 }
        public OtherExpenseDetail VHasOtherExpense(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService)
        {
            OtherExpense otherExpense = _otherExpenseService.GetObjectById(otherExpenseDetail.OtherExpenseId);

            if (otherExpense == null)
            {
                otherExpenseDetail.Errors.Add("OtherExpense", "Tidak ada");
            }
            return(otherExpenseDetail);
        }
 public OtherExpenseApiController(IOtherExpenseService otherExpenseService, IUserService userService)
 {
     this._otherExpenseService = otherExpenseService;
     this._userService         = userService;
     userId = Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(RequestContext.Principal.Identity);
 }
示例#9
0
 public bool ValidUpdateObject(OtherExpense otherExpense, IOtherExpenseService _otherExpenseService)
 {
     otherExpense.Errors.Clear();
     ValidCreateObject(otherExpense, _otherExpenseService);
     return(isValid(otherExpense));
 }
示例#10
0
 public bool ValidCreateObject(OtherExpense otherExpense, IOtherExpenseService _otherExpenseService)
 {
     VHasUniqueCode(otherExpense, _otherExpenseService);
     return(isValid(otherExpense));
 }
示例#11
0
 public SalaryProcessController()
 {
     _userAccountService          = new UserAccountService(new UserAccountRepository(), new UserAccountValidator());
     _companyInfoService          = new CompanyInfoService(new CompanyInfoRepository(), new CompanyInfoValidator());
     _branchOfficeService         = new BranchOfficeService(new BranchOfficeRepository(), new BranchOfficeValidator());
     _departmentService           = new DepartmentService(new DepartmentRepository(), new DepartmentValidator());
     _divisionService             = new DivisionService(new DivisionRepository(), new DivisionValidator());
     _titleInfoService            = new TitleInfoService(new TitleInfoRepository(), new TitleInfoValidator());
     _employeeService             = new EmployeeService(new EmployeeRepository(), new EmployeeValidator());
     _employeeEducationService    = new EmployeeEducationService(new EmployeeEducationRepository(), new EmployeeEducationValidator());
     _salaryItemService           = new SalaryItemService(new SalaryItemRepository(), new SalaryItemValidator());
     _formulaService              = new FormulaService(new FormulaRepository(), new FormulaValidator());
     _workingTimeService          = new WorkingTimeService(new WorkingTimeRepository(), new WorkingTimeValidator());
     _workingDayService           = new WorkingDayService(new WorkingDayRepository(), new WorkingDayValidator());
     _employeeWorkingTimeService  = new EmployeeWorkingTimeService(new EmployeeWorkingTimeRepository(), new EmployeeWorkingTimeValidator());
     _salaryStandardService       = new SalaryStandardService(new SalaryStandardRepository(), new SalaryStandardValidator());
     _salaryStandardDetailService = new SalaryStandardDetailService(new SalaryStandardDetailRepository(), new SalaryStandardDetailValidator());
     _salaryEmployeeService       = new SalaryEmployeeService(new SalaryEmployeeRepository(), new SalaryEmployeeValidator());
     _salaryEmployeeDetailService = new SalaryEmployeeDetailService(new SalaryEmployeeDetailRepository(), new SalaryEmployeeDetailValidator());
     _employeeAttendanceService   = new EmployeeAttendanceService(new EmployeeAttendanceRepository(), new EmployeeAttendanceValidator());
     //_employeeAttendanceDetailService = new EmployeeAttendanceDetailService(new EmployeeAttendanceDetailRepository(), new EmployeeAttendanceDetailValidator());
     _salarySlipService         = new SalarySlipService(new SalarySlipRepository(), new SalarySlipValidator());
     _salarySlipDetailService   = new SalarySlipDetailService(new SalarySlipDetailRepository(), new SalarySlipDetailValidator());
     _employeeLeaveService      = new EmployeeLeaveService(new EmployeeLeaveRepository(), new EmployeeLeaveValidator());
     _generalLeaveService       = new GeneralLeaveService(new GeneralLeaveRepository(), new GeneralLeaveValidator());
     _spklService               = new SPKLService(new SPKLRepository(), new SPKLValidator());
     _ptkpService               = new PTKPService(new PTKPRepository(), new PTKPValidator());
     _pph21sptService           = new PPH21SPTService(new PPH21SPTRepository(), new PPH21SPTValidator());
     _otherExpenseService       = new OtherExpenseService(new OtherExpenseRepository(), new OtherExpenseValidator());
     _otherExpenseDetailService = new OtherExpenseDetailService(new OtherExpenseDetailRepository(), new OtherExpenseDetailValidator());
     _otherIncomeService        = new OtherIncomeService(new OtherIncomeRepository(), new OtherIncomeValidator());
     _otherIncomeDetailService  = new OtherIncomeDetailService(new OtherIncomeDetailRepository(), new OtherIncomeDetailValidator());
     _thrService              = new THRService(new THRRepository(), new THRValidator());
     _thrDetailService        = new THRDetailService(new THRDetailRepository(), new THRDetailValidator());
     _slipGajiMiniService     = new SlipGajiMiniService(new SlipGajiMiniRepository(), new SlipGajiMiniValidator());
     _slipGajiDetailService   = new SlipGajiDetailService(new SlipGajiDetailRepository(), new SlipGajiDetailValidator());
     _slipGajiDetail1Service  = new SlipGajiDetail1Service(new SlipGajiDetail1Repository(), new SlipGajiDetail1Validator());
     _slipGajiDetail2AService = new SlipGajiDetail2AService(new SlipGajiDetail2ARepository(), new SlipGajiDetail2AValidator());
     _salaryProcessService    = new SalaryProcessService(new SalaryProcessValidator()
     {
         _employeeAttendanceService  = _employeeAttendanceService,
         _employeeLeaveService       = _employeeLeaveService,
         _employeeService            = _employeeService,
         _employeeWorkingTimeService = _employeeWorkingTimeService,
         _formulaService             = _formulaService,
         _generalLeaveService        = _generalLeaveService,
         _spklService               = _spklService,
         _ptkpService               = _ptkpService,
         _pph21sptService           = _pph21sptService,
         _otherExpenseService       = _otherExpenseService,
         _otherExpenseDetailService = _otherExpenseDetailService,
         _otherIncomeService        = _otherIncomeService,
         _otherIncomeDetailService  = _otherIncomeDetailService,
         _thrService                  = _thrService,
         _thrDetailService            = _thrDetailService,
         _workingDayService           = _workingDayService,
         _workingTimeService          = _workingTimeService,
         _salaryEmployeeDetailService = _salaryEmployeeDetailService,
         _salaryEmployeeService       = _salaryEmployeeService,
         _salaryItemService           = _salaryItemService,
         _salarySlipDetailService     = _salarySlipDetailService,
         _salarySlipService           = _salarySlipService,
         _slipGajiDetail1Service      = _slipGajiDetail1Service,
         _slipGajiDetail2AService     = _slipGajiDetail2AService,
         _slipGajiDetailService       = _slipGajiDetailService,
         _slipGajiMiniService         = _slipGajiMiniService,
     });
 }
 public OtherExpenseDetail UpdateObject(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService, IEmployeeService _employeeService)
 {
     return(otherExpenseDetail = _validator.ValidUpdateObject(otherExpenseDetail, _otherExpenseService, _employeeService) ? _repository.UpdateObject(otherExpenseDetail) : otherExpenseDetail);
 }
 public OtherExpenseDetail CreateObject(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService, IEmployeeService _employeeService)
 {
     otherExpenseDetail.Errors = new Dictionary <String, String>();
     return(_validator.ValidCreateObject(otherExpenseDetail, _otherExpenseService, _employeeService) ? _repository.CreateObject(otherExpenseDetail) : otherExpenseDetail);
 }