当前位置: 首页>>代码示例>>C#>>正文


C# Loan.Copy方法代码示例

本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Loans.Loan.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Loan.Copy方法的具体用法?C# Loan.Copy怎么用?C# Loan.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenCBS.CoreDomain.Contracts.Loans.Loan的用法示例。


在下文中一共展示了Loan.Copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EditSchedule

        public Loan EditSchedule(Loan pLoan, int roundTo)
        {
            Loan temp = pLoan.Copy();
            int sum = 0;
            if (roundTo == 0)
                return pLoan;

            foreach (Installment installment in temp.InstallmentList)
            {
                if (installment.Number != temp.InstallmentList.Count)
                {
                    int dif = Convert.ToInt32(installment.CapitalRepayment.Value + installment.InterestsRepayment.Value) % roundTo;
                    dif = dif > roundTo - dif ? roundTo - dif : -dif;
                    installment.CapitalRepayment += dif;
                    sum += dif;
                }
                else
                {
                    installment.CapitalRepayment -= sum;
                }
            }
            return temp;
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:23,代码来源:FlatRoundingSchedule.cs

示例2: SimulateRescheduling

        public Loan SimulateRescheduling(Loan loan, ScheduleConfiguration rescheduleConfiguration)
        {
            var copyOfLoan = loan.Copy();
            var scheduleConfiguration = _configurationFactory
                .Init()
                .WithLoan(copyOfLoan)
                .Finish()
                .GetConfiguration();

            var schedule = Mapper.Map<IEnumerable<Installment>, IEnumerable<IInstallment>>(copyOfLoan.InstallmentList);
            var scheduleBuilder = new ScheduleBuilder();
            var rescheduleAssembler = new RescheduleAssembler();
            var copyOfRescheduleConfiguration = (IScheduleConfiguration) rescheduleConfiguration.Clone();
            copyOfRescheduleConfiguration.InterestRate *=
                (decimal) scheduleConfiguration.PeriodPolicy.GetNumberOfPeriodsInYear(
                    copyOfRescheduleConfiguration.StartDate,
                    scheduleConfiguration.YearPolicy);

            schedule = rescheduleAssembler.AssembleRescheduling(
                schedule,
                scheduleConfiguration,
                copyOfRescheduleConfiguration,
                scheduleBuilder,
                loan.CalculateActualOlb().Value);

            var newSchedule = Mapper.Map<IEnumerable<IInstallment>, List<Installment>>(schedule);

            copyOfLoan.InstallmentList = newSchedule;
            copyOfLoan.NbOfInstallments = newSchedule.Count();
            return copyOfLoan;
        }
开发者ID:jay3126,项目名称:opencbs,代码行数:31,代码来源:LoanServices.cs

示例3: ShowNewContract

        public KeyValuePair<Loan, RepaymentEvent> ShowNewContract(Loan pContract,
                                                                  int installmentNumber,
                                                                  DateTime date,
                                                                  OCurrency amount,
                                                                  bool disableFees,
                                                                  OCurrency manualFeesAmount,
                                                                  OCurrency manualCommissionAmount,
                                                                  bool disableInterests,
                                                                  OCurrency manualInterests,
                                                                  bool pKeepExpectedInstallment,
                                                                  bool doProportionPayment,
                                                                  PaymentMethod pPaymentMethod,
                                                                  bool pPending,
                                                                  bool isTotalRepayment)
        {
            if (!pContract.UseCents)
            {
                if (amount != Decimal.Ceiling(amount.Value))
                {
                    throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.DecimalAmount);
                }
            }
            else if (amount < 0)
                throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.NegativeAmount);

            Loan fakeContract = pContract.Copy();

            OCurrency expectedMaxAmount = fakeContract.CalculateMaximumAmountAuthorizedToRepay(installmentNumber, date,
                                                                                               disableFees,
                                                                                               manualFeesAmount,
                                                                                               manualCommissionAmount,
                                                                                               disableInterests,
                                                                                               manualInterests,
                                                                                               pKeepExpectedInstallment);

            expectedMaxAmount = fakeContract.UseCents
                                    ? Math.Round(expectedMaxAmount.Value, 2, MidpointRounding.AwayFromZero)
                                    : expectedMaxAmount;

            if (!disableFees && !isTotalRepayment)
            {
                if (AmountComparer.Compare(amount, expectedMaxAmount) > 0)
                    throw new OpenCbsRepayException(OpenCbsRepayExceptionsEnum.AmountGreaterThanTotalRemainingAmount);

            }
            else
            {
                if (isTotalRepayment)
                    amount = expectedMaxAmount;
            }

            RepaymentEvent e = fakeContract.Repay(installmentNumber, date, amount, disableFees, manualFeesAmount,
                                                  manualCommissionAmount, disableInterests, manualInterests,
                                                  pKeepExpectedInstallment, doProportionPayment, pPaymentMethod, null,
                                                  pPending);

            return new KeyValuePair<Loan, RepaymentEvent>(fakeContract, e);
        }
开发者ID:jay3126,项目名称:opencbs,代码行数:58,代码来源:LoanServices.cs

示例4: AddManualScheduleChangeEvent

        public Loan AddManualScheduleChangeEvent(Loan loan, ManualScheduleChangeEvent manualScheduleChangeEvent)
        {
            using (SqlConnection conn = _savingEventManager.GetConnection())
            using (SqlTransaction sqlTransaction = conn.BeginTransaction())
            {
                try
                {
                    Loan copyOfLoan = loan.Copy();
                    _ePs.FireEvent(manualScheduleChangeEvent, loan, sqlTransaction);
                    ArchiveInstallments(copyOfLoan, manualScheduleChangeEvent, sqlTransaction);

                    sqlTransaction.Commit();
                    return loan;
                }
                catch (Exception ex)
                {
                    sqlTransaction.Rollback();
                    throw ex;
                }
            }
        }
开发者ID:jay3126,项目名称:opencbs,代码行数:21,代码来源:LoanServices.cs

示例5: AddTranche

        public Loan AddTranche(Loan pContract, IClient pClient, DateTime pDate, int pNbOfMaturity, int pTrancheAmount, bool pApplyNewInterestOnOLB, decimal pNewInterestRate)
        {
            using (SqlConnection conn = _loanManager.GetConnection())
            using (SqlTransaction sqlTransaction = conn.BeginTransaction())
            {
                try
                {
                    CheckTranche(pDate, pContract, pTrancheAmount);

                    Loan copyOfLoan = pContract.Copy();

                    TrancheOptions to = new TrancheOptions
                                            {
                                                TrancheDate = pDate,
                                                CountOfNewInstallments = pNbOfMaturity,
                                                TrancheAmount = pTrancheAmount,
                                                InterestRate = pNewInterestRate,
                                                ApplyNewInterestOnOLB = pApplyNewInterestOnOLB
                                            };

                    TrancheEvent trancheEvent = pContract.CalculateTranche(to);
                    trancheEvent.User = _user;

                    //insert into table TrancheEvent
                    _ePs.FireEvent(trancheEvent, pContract, sqlTransaction);

                    ArchiveInstallments(copyOfLoan, trancheEvent, sqlTransaction);

                    //delete all the old installments of the table Installments
                    _instalmentManager.DeleteInstallments(pContract.Id, sqlTransaction);

                    //insert all the new installments in the table Installments
                    _instalmentManager.AddInstallments(pContract.InstallmentList, pContract.Id, sqlTransaction);

                    //Activate the contract if it's closed because of new tranch
                    if (pContract.Closed)
                    {
                        pContract.ContractStatus = OContractStatus.Active;
                        pContract.Closed = false;
                        _loanManager.UpdateLoan(pContract, sqlTransaction);
                    }
                    //in the feature might be combine UpdateLoan + UpdateLoanWithinTranche
                    _loanManager.UpdateLoanWithinTranche(to.InterestRate, pContract.NbOfInstallments, pContract,
                                                         sqlTransaction);
                    pContract.Events.Add(trancheEvent);
                    pContract.GivenTranches.Add(trancheEvent);
                    sqlTransaction.Commit();

                    SetClientStatus(pContract, pClient);
                    return pContract;
                }
                catch (Exception ex)
                {
                    if (sqlTransaction != null)
                        sqlTransaction.Rollback();

                    throw ex;
                }
            }
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:60,代码来源:LoanServices.cs

示例6: TestMethodeCopyCredit

        public void TestMethodeCopyCredit()
        {
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.DecliningFixedInstallments,
                                          ChargeInterestWithinGracePeriod = true,
                                          Currency = new Currency { Id = 1 }
                                      };
            package.KeepExpectedInstallment = false;
            Loan contractSource = new Loan(package,1500,0.03m,9,1,new DateTime(2006,1,2),
                new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
                ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
            RepaymentEvent rE1 = new RepaymentEvent
                                     {
                                         Id = 1,
                                         InstallmentNumber = 1,
                                         Principal = 200,
                                         Interests = 100,
                                         Commissions = 0,
                                         Penalties = 0,
                                         ClientType = OClientTypes.Group
                                     };
            LoanDisbursmentEvent lDE = new LoanDisbursmentEvent{Id = 2,Date = DateTime.Today,Amount = 100, ClientType = OClientTypes.Group};

            contractSource.Code = "HHHHJKLLJJBNBJJ";
            contractSource.AnticipatedTotalRepaymentPenalties = 0.02;
            contractSource.Events.Add(rE1);
            contractSource.Events.Add(lDE);

            Loan contractDestination = contractSource.Copy();

            Assert.AreEqual(contractSource.Amount.Value, contractDestination.Amount.Value);
            Assert.AreEqual(contractSource.AnticipatedTotalRepaymentPenalties,contractDestination.AnticipatedTotalRepaymentPenalties);
            Assert.AreEqual(contractSource.Code,contractDestination.Code);
            Assert.AreEqual(contractSource.ClientType,contractDestination.ClientType);
            Assert.AreEqual(contractSource.InstallmentList.Count,contractDestination.InstallmentList.Count);
            Assert.AreEqual(contractSource.InstallmentList[0].Number,contractDestination.InstallmentList[0].Number);
            Assert.AreEqual(contractSource.InstallmentList[1].Number,contractDestination.InstallmentList[1].Number);

            //            ((LoanDisbursmentEvent)contractSource.Events.GetEvent(1)).Commission = 22;
            //            Assert.IsTrue(((LoanDisbursmentEvent)contractDestination.Events.GetEvent(1)).Commission == 0);
            //            Assert.IsFalse(((LoanDisbursmentEvent)contractDestination.Events.GetEvent(1)).Commission == 22);

            contractSource.InstallmentList[0].Number = 4;
            Assert.IsFalse(contractDestination.InstallmentList[0].Number == 4);
            Assert.IsTrue(contractDestination.InstallmentList[0].Number == 1);
        }
开发者ID:BillTheBest,项目名称:opencbs,代码行数:48,代码来源:TestCreditContract.cs

示例7: ConfirmPendingRepayment

        public Loan ConfirmPendingRepayment(Loan pLoan, IClient pClient)
        {
            Loan savedContract = pLoan.Copy();
            using (SqlConnection conn = _loanManager.GetConnection())
            using (SqlTransaction sqlTransaction = conn.BeginTransaction())
            {
                try
                {
                    RepaymentEvent repayEvent = savedContract.ConfirmPendingRepayment();
                    repayEvent.User = _user;
                    if (Teller.CurrentTeller != null && Teller.CurrentTeller.Id != 0)
                        repayEvent.TellerId = Teller.CurrentTeller.Id;

                    FundingLineEvent repayFlFundingLineEvent = new FundingLineEvent
                        {
                            Code =
                                String.Concat("RE_", pLoan.Code, "_INS_",
                                              repayEvent.InstallmentNumber),
                            Type = OFundingLineEventTypes.Repay,
                            Amount =
                                ApplicationSettings.GetInstance(_user != null
                                                                    ? _user.
                                                                          Md5
                                                                    : "").
                                                    InterestsCreditedInFL
                                    ? repayEvent.Principal +
                                      repayEvent.Interests
                                    : repayEvent.Principal,
                            Movement = OBookingDirections.Credit,
                            CreationDate = TimeProvider.Now,
                            FundingLine = pLoan.FundingLine
                            ,
                            AttachTo = repayEvent
                        };

                    if (Teller.CurrentTeller != null && Teller.CurrentTeller.Id != 0)
                        repayFlFundingLineEvent.TellerId = Teller.CurrentTeller.Id;

                    //this line is to prevent errors from popping up when client makes a repayment of
                    //everything but the principal
                    if (repayFlFundingLineEvent.Amount > 0 ||
                        ApplicationSettings.GetInstance(_user != null ? _user.Md5 : "").InterestsCreditedInFL)
                        pLoan.FundingLine.AddEvent(
                            new FundingLineServices(_user).AddFundingLineEvent(repayFlFundingLineEvent, sqlTransaction));

                    _ePs.FireEvent(repayEvent, savedContract, sqlTransaction);
                    // Put a copy of installments into the history
                    ArchiveInstallments(pLoan, repayEvent, sqlTransaction);

                    //Update Installments
                    foreach (Installment installment in savedContract.InstallmentList)
                    {
                        _instalmentManager.UpdateInstallment(installment, savedContract.Id, repayEvent.Id,
                                                             sqlTransaction);
                    }

                    for (int i = savedContract.Events.GetNumberOfEvents - 1; i >= 0; i--)
                    {
                        Event e = savedContract.Events.GetEvent(i);
                        if ((e is RepaymentEvent) || (e is LoanDisbursmentEvent))
                        {
                            e.Cancelable = true; //EventIsCancelable(e.Id, sqlTransaction);
                            if (!e.Cancelable)
                                break;
                        }
                        else
                        {
                            break;
                        }
                    }

                    _loanManager.UpdateLoan(savedContract, sqlTransaction);
                    if (sqlTransaction != null) sqlTransaction.Commit();

                    SetClientStatus(savedContract, pClient);

                    return savedContract;
                }
                catch (Exception)
                {
                    if (sqlTransaction != null) sqlTransaction.Rollback();
                    throw;
                }
            }
        }
开发者ID:jay3126,项目名称:opencbs,代码行数:85,代码来源:LoanServices.cs

示例8: AddLoan

        private void AddLoan(ref Loan pLoan, int pProjectId, ref IClient pClient, SqlTransaction transaction)
        {
            if (pProjectId == 0)
                throw new OpenCbsContractSaveException(OpenCbsContractSaveExceptionEnum.ProjectIsNull);

            ApplicationSettings appSettings = ApplicationSettings.GetInstance(_user.Md5);

            if (!appSettings.IsAllowMultipleLoans && pClient.Active)
                throw new OpenCbsContractSaveException(OpenCbsContractSaveExceptionEnum.BeneficiaryIsActive);

            Loan clonedLoan = pLoan.Copy();
            IClient clonedClient = pClient.Copy();
            try
            {
                string branchCode = pClient.Branch.Code;
                if (String.IsNullOrEmpty(branchCode))
                    branchCode = _branchService.FindBranchCodeByClientId(pClient.Id, transaction);

                pLoan.ContractStatus = OContractStatus.Pending;
                pLoan.CreationDate = pLoan.StartDate;
                pLoan.CloseDate = (pLoan.InstallmentList[pLoan.InstallmentList.Count - 1]).ExpectedDate;
                pLoan.BranchCode = branchCode;

                pLoan.Id = AddLoanInDatabase(pLoan, pProjectId, pClient, transaction);
                pLoan.Code = GenerateContractCode(pClient, pLoan, transaction);
                _loanManager.UpdateContractCode(pLoan.Id, pLoan.Code, transaction);
            }
            catch
            {
                pLoan = clonedLoan;
                pClient = clonedClient;
                throw;
            }
        }
开发者ID:jay3126,项目名称:opencbs,代码行数:34,代码来源:LoanServices.cs

示例9: SimulateTranche

        public Loan SimulateTranche(Loan loan, ITrancheConfiguration trancheConfiguration)
        {
            var copyOfLoan = loan.Copy();
            var scheduleConfiguration = _configurationFactory
                .Init()
                .WithLoan(copyOfLoan)
                .Finish()
                .GetConfiguration();

            var schedule = copyOfLoan.InstallmentList;
            var scheduleBuilder = new ScheduleBuilder();
            var trancheBuilder = new TrancheBuilder();
            var trancheAssembler = new TrancheAssembler();
            var copyOfTrancheConfiguration = (ITrancheConfiguration)trancheConfiguration.Clone();

            var newSchedule = new List<Installment>();
            if (loan.Product.ScriptName == null)
                newSchedule = trancheAssembler.AssembleTranche(
                    schedule,
                    scheduleConfiguration,
                    copyOfTrancheConfiguration,
                    scheduleBuilder,
                    trancheBuilder).ToList();
            else
                newSchedule = AssembleTranche(copyOfLoan, scheduleConfiguration, trancheConfiguration);

            foreach (var installment in newSchedule)
            {
                var oldInstallment = copyOfLoan.InstallmentList.Find(i => i.Number == installment.Number);
                if (oldInstallment == null) break;

                installment.Comment = oldInstallment.Comment;
                installment.PaidFees = oldInstallment.PaidFees;
                installment.PaidCommissions = oldInstallment.PaidCommissions;
                installment.FeesUnpaid = oldInstallment.FeesUnpaid;
                installment.CommissionsUnpaid = oldInstallment.CommissionsUnpaid;
                installment.IsPending = oldInstallment.IsPending;
                //installment.PaidDate = oldInstallment.PaidDate;
            }
            copyOfLoan.InstallmentList = newSchedule;
            copyOfLoan.NbOfInstallments = newSchedule.Count();
            copyOfLoan.Amount += trancheConfiguration.Amount;
            return copyOfLoan;
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:44,代码来源:LoanServices.cs

示例10: SimulateRescheduling

        public Loan SimulateRescheduling(Loan loan, ScheduleConfiguration rescheduleConfiguration)
        {
            var copyOfLoan = loan.Copy();
            var scheduleConfiguration = _configurationFactory
                .Init()
                .WithLoan(copyOfLoan)
                .Finish()
                .GetConfiguration();

            var schedule = copyOfLoan.InstallmentList;
            var scheduleBuilder = new ScheduleBuilder();
            var rescheduleAssembler = new RescheduleAssembler();
            var copyOfRescheduleConfiguration = (IScheduleConfiguration)rescheduleConfiguration.Clone();
            if (loan.Product.ScriptName == null)
                schedule = rescheduleAssembler.AssembleRescheduling(
                    schedule,
                    scheduleConfiguration,
                    copyOfRescheduleConfiguration,
                    scheduleBuilder,
                    loan.CalculateActualOlb().Value).ToList();
            else
                schedule = AssembleRescheduling(loan, rescheduleConfiguration, scheduleConfiguration);

            copyOfLoan.InstallmentList = schedule;
            copyOfLoan.NbOfInstallments = schedule.Count();
            return copyOfLoan;
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:27,代码来源:LoanServices.cs

示例11: FakeReschedule

 public Loan FakeReschedule(Loan contract, DateTime date, int nbOfMaturity, int dateOffset, bool pAccruedInterestDuringTheGracePeriod, decimal pNewInterestRate, int gracePeriod, bool chargeInterestDuringGracePeriod)
 {
     Loan fakeContract = contract.Copy();
     ReschedulingOptions ro = new ReschedulingOptions
                                  {
                                      ChargeInterestDuringShift = pAccruedInterestDuringTheGracePeriod,
                                      NewInstallments = nbOfMaturity,
                                      InterestRate = pNewInterestRate,
                                      RepaymentDateOffset = dateOffset,
                                      ReschedulingDate = date,
                                      GracePeriod = gracePeriod,
                                      ChargeInterestDuringGracePeriod = chargeInterestDuringGracePeriod
                                  };
     fakeContract.Reschedule(ro);
     return fakeContract;
 }
开发者ID:evgeniyabdukarimov,项目名称:opencbs,代码行数:16,代码来源:LoanServices.cs

示例12: AddLoan

        private void AddLoan(ref Loan pLoan, int pProjectId, ref IClient pClient, SqlTransaction transaction)
        {
            if (pProjectId == 0)
                throw new OpenCbsContractSaveException(OpenCbsContractSaveExceptionEnum.ProjectIsNull);

            ApplicationSettings appSettings = ApplicationSettings.GetInstance(_user.Md5);

            if (!appSettings.IsAllowMultipleLoans && pClient.Active)
                throw new OpenCbsContractSaveException(OpenCbsContractSaveExceptionEnum.BeneficiaryIsActive);

            Loan clonedLoan = pLoan.Copy();
            IClient clonedClient = pClient.Copy();
            try
            {
                var clientName = (pClient is Person) ? ((Person)pClient).LastName : pClient.Name;
                string branchCode = pClient.Branch.Code;
                if (String.IsNullOrEmpty(branchCode))
                    branchCode = _branchService.FindBranchCodeByClientId(pClient.Id, transaction);

                pLoan.ContractStatus = OContractStatus.Pending;
                pLoan.CreationDate = pLoan.StartDate;
                pLoan.CloseDate = (pLoan.InstallmentList[pLoan.InstallmentList.Count - 1]).ExpectedDate;
                pLoan.BranchCode = branchCode;

                if (string.IsNullOrEmpty(clonedLoan.Code))
                {
                    int len = 1 == pClient.District.Name.Length ? 1 : 2;
                    pLoan.Code = pLoan.GenerateLoanCode(appSettings.ContractCodeTemplate
                        , branchCode
                        , pClient.District.Name.Substring(0, len)
                        , (pClient.LoanCycle + 1).ToString(CultureInfo.InvariantCulture)
                        , pClient.Projects.Count.ToString(CultureInfo.InvariantCulture)
                        , pClient.Id.ToString(CultureInfo.InvariantCulture)
                        , clientName);
                }

                pLoan.Id = AddLoanInDatabase(pLoan, pProjectId, pClient, transaction);
                pLoan.Code = pLoan.Code + '/' + pLoan.Id;
                _loanManager.UpdateContractCode(pLoan.Id, pLoan.Code, transaction);
            }
            catch
            {
                pLoan = clonedLoan;
                pClient = clonedClient;
                throw;
            }
        }
开发者ID:evgeniyabdukarimov,项目名称:opencbs,代码行数:47,代码来源:LoanServices.cs

示例13: Reschedule

        public Loan Reschedule(Loan pContract, DateTime pDate, int pNbOfMaturity, int dateOffset,
            bool pAccruedInterestDuringTheGracePeriod, decimal pNewInterestRate, int gracePeriod, bool chargeInterestDuringGracePeriod)
        {
            using (SqlConnection conn = _loanManager.GetConnection())
            using (SqlTransaction sqlTransac = conn.BeginTransaction())
            {
                try
                {
                    Loan copyOfLoan = pContract.Copy();

                    //create the rescheduling loan event
                    ReschedulingOptions ro = new ReschedulingOptions
                                                 {
                                                     ReschedulingDate = pDate,
                                                     ChargeInterestDuringShift = pAccruedInterestDuringTheGracePeriod,
                                                     InterestRate = pNewInterestRate,
                                                     RepaymentDateOffset = dateOffset,
                                                     NewInstallments = pNbOfMaturity,
                                                     GracePeriod = gracePeriod,
                                                     ChargeInterestDuringGracePeriod = chargeInterestDuringGracePeriod
                                                 };
                    RescheduleLoanEvent rescheduleLoanEvent = pContract.Reschedule(ro);
                    rescheduleLoanEvent.User = _user;

                    //insert into table ReschedulingOfALoanEvents
                    _ePs.FireEvent(rescheduleLoanEvent, pContract, sqlTransac);
                    OverdueEvent overdueEvent = pContract.AddRecheduleTransformationEvent(pDate);
                    if (overdueEvent != null) _ePs.FireEvent(overdueEvent, pContract, sqlTransac);

                    ArchiveInstallments(copyOfLoan, rescheduleLoanEvent, sqlTransac);

                    //delete all the old installments of the table Installments
                    _instalmentManager.DeleteInstallments(pContract.Id, sqlTransac);

                    //insert all the new installments in the table Installments
                    _instalmentManager.AddInstallments(pContract.InstallmentList, pContract.Id, sqlTransac);

                    _loanManager.UpdateLoanToRescheduled(pNewInterestRate, pNbOfMaturity, pContract, sqlTransac);

                    sqlTransac.Commit();
                    return pContract;
                }
                catch (Exception ex)
                {
                    sqlTransac.Rollback();
                    throw ex;
                }
            }
        }
开发者ID:evgeniyabdukarimov,项目名称:opencbs,代码行数:49,代码来源:LoanServices.cs

示例14: FakeTranche

        public Loan FakeTranche(Loan pContract, DateTime pDate, int pNbOfMaturity, int pTrancheAmount, bool pApplyNewInterestOnOLB, decimal pNewInterestRate)
        {
            Loan fakeContract = pContract.Copy();

            TrancheOptions to = new TrancheOptions
            {
                TrancheDate = pDate,
                CountOfNewInstallments = pNbOfMaturity,
                TrancheAmount = pTrancheAmount,
                InterestRate = pNewInterestRate,
                ApplyNewInterestOnOLB = pApplyNewInterestOnOLB
            };

            fakeContract.CalculateTranche(to);
            return fakeContract;
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:16,代码来源:LoanServices.cs

示例15: SimulateTranche

        public Loan SimulateTranche(Loan loan, ITrancheConfiguration trancheConfiguration)
        {
            var copyOfLoan = loan.Copy();
            var scheduleConfiguration = _configurationFactory
                .Init()
                .WithLoan(copyOfLoan)
                .Finish()
                .GetConfiguration();

            var schedule = Mapper.Map<IEnumerable<Installment>, IEnumerable<IInstallment>>(copyOfLoan.InstallmentList);
            var scheduleBuilder = new ScheduleBuilder();
            var trancheBuilder = new TrancheBuilder();
            var trancheAssembler = new TrancheAssembler();
            var copyOfTrancheConfiguration = (ITrancheConfiguration) trancheConfiguration.Clone();
            copyOfTrancheConfiguration.InterestRate *=
                (decimal) scheduleConfiguration.PeriodPolicy.GetNumberOfPeriodsInYear(
                    copyOfTrancheConfiguration.StartDate,
                    scheduleConfiguration.YearPolicy);

            schedule = trancheAssembler.AssembleTranche(
                schedule,
                scheduleConfiguration,
                copyOfTrancheConfiguration,
                scheduleBuilder,
                trancheBuilder);

            var newSchedule = Mapper.Map<IEnumerable<IInstallment>, List<Installment>>(schedule);

            foreach (var installment in newSchedule)
            {
                var oldInstallment = copyOfLoan.InstallmentList.Find(i => i.Number == installment.Number);
                if (oldInstallment == null) break;

                installment.Comment = oldInstallment.Comment;
                installment.PaidFees = oldInstallment.PaidFees;
                installment.PaidCommissions = oldInstallment.PaidCommissions;
                installment.FeesUnpaid = oldInstallment.FeesUnpaid;
                installment.CommissionsUnpaid = oldInstallment.CommissionsUnpaid;
                installment.IsPending = oldInstallment.IsPending;
                //installment.PaidDate = oldInstallment.PaidDate;
            }
            copyOfLoan.InstallmentList = newSchedule;
            copyOfLoan.NbOfInstallments = newSchedule.Count();
            copyOfLoan.Amount += trancheConfiguration.Amount;
            return copyOfLoan;
        }
开发者ID:jay3126,项目名称:opencbs,代码行数:46,代码来源:LoanServices.cs


注:本文中的OpenCBS.CoreDomain.Contracts.Loans.Loan.Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。