public override void Run(HMOPremiumPayableLoanCmd request) { short planYear = request.m_NewMasterData.PlanYear; short payPeriodID = request.m_NewMasterData.PayRunID; var loan = p_Processor.Run(new GetLoanQr(LoanCodeConstants.HMOPremiumPayable)); var existingLoan = FindExistingLoan(request.m_NewMasterData, request.Loan); var employeeLoan = p_Processor.Run(new GetEmployeeLoanQr ( planYear, payPeriodID, request.m_NewMasterData.EmployeeID, LoanCodeConstants.HMOPremiumPayable )); MasterEmployeeLoanBO newComputedLoan = null; if (employeeLoan != null) { newComputedLoan = new MasterEmployeeLoanBO { LoanID = loan.LoanID, RecordStatus = RecordStatus.Active, ShortDesc = employeeLoan.N_EmployeeLoanRef.OvrdShortDesc ?? loan.ShortDesc, LongDesc = employeeLoan.N_EmployeeLoanRef.OvrdLongDesc ?? loan.LongDesc, AltDesc = employeeLoan.N_EmployeeLoanRef.OvrdAltDesc ?? loan.AltDesc, Amount = employeeLoan.Amount }; } if (HasChanges(existingLoan, newComputedLoan)) { request.m_NewMasterData.AddNewEmployeeLoan(newComputedLoan); } }
protected virtual bool HasChanges(MasterEmployeeLoanBO prev, MasterEmployeeLoanBO next) { if (prev == null || (prev != null && next == null)) { return(true); } if (prev.Amount != next.Amount) { return(true); } return(false); }