private Loan CreateLoan() { var credit = new Loan(_product, ServicesHelper.ConvertStringToDecimal(nudLoanAmount.Text, _product.UseCents), nudInterestRate.Value / 100m, Convert.ToInt32(nudLoanNbOfInstallments.Value), Convert.ToInt32(numericUpDownLoanGracePeriod.Value), dateLoanStart.Value, dtpDateOfFirstInstallment.Value, User.CurrentUser, ServicesProvider.GetInstance().GetGeneralSettings(), ServicesProvider.GetInstance().GetNonWorkingDate(), CoreDomainProvider.GetInstance().GetProvisioningTable(), CoreDomainProvider.GetInstance().GetChartOfAccounts()) { Guarantors = _listGuarantors, Collaterals = _collaterals, LoanShares = _loanShares }; credit.InstallmentList = ServicesProvider.GetInstance().GetContractServices().SimulateScheduleCreation(credit); if (!string.IsNullOrEmpty(tbLocAmount.Text)) credit.AmountUnderLoc = decimal.Parse(tbLocAmount.Text); if (textBoxLoanContractCode.Text != "") credit.Code = textBoxLoanContractCode.Text; _toChangeAlignDate = false; credit.FirstInstallmentDate = dtpDateOfFirstInstallment.Value; _toChangeAlignDate = true; credit.InstallmentType = ServicesProvider.GetInstance().GetProductServices().FindInstallmentType( (int)comboBoxLoanInstallmentType.Tag); _firstInstallmentDate = dtpDateOfFirstInstallment.Value; credit.AlignDisbursementDate = credit.CalculateAlignDisbursementDate(_firstInstallmentDate); credit.AnticipatedTotalRepaymentPenalties = ServicesHelper.ConvertStringToNullableDouble(textBoxLoanAnticipatedTotalFees.Text, true, -1).Value; credit.AnticipatedPartialRepaymentPenalties = ServicesHelper.ConvertStringToNullableDouble(tbLoanAnticipatedPartialFees.Text, true, -1).Value; credit.NonRepaymentPenalties.InitialAmount = ServicesHelper.ConvertStringToNullableDouble(textBoxLoanLateFeesOnAmount.Text, true, -1).Value; credit.NonRepaymentPenalties.OLB = ServicesHelper.ConvertStringToNullableDouble(textBoxLoanLateFeesOnOLB.Text, true, -1).Value; credit.NonRepaymentPenalties.OverDueInterest = ServicesHelper.ConvertStringToNullableDouble(textBoxLoanLateFeesOnOverdueInterest.Text, true, -1).Value; credit.NonRepaymentPenalties.OverDuePrincipal = ServicesHelper.ConvertStringToNullableDouble(textBoxLoanLateFeesOnOverduePrincipal.Text, true, -1).Value; credit.GracePeriod = Convert.ToInt32(numericUpDownLoanGracePeriod.Value); credit.GracePeriodOfLateFees = Convert.ToInt32(_gracePeriodOfLateFees); credit.FundingLine = comboBoxLoanFundingLine.Tag != null ? (FundingLine)comboBoxLoanFundingLine.Tag : null; credit.LoanOfficer = (User)cmbLoanOfficer.SelectedItem; credit.LoanPurpose = textBoxLoanPurpose.Text; credit.Comments = textBoxComments.Text; credit.CompulsorySavings = GetSelectedSavingProduct(); credit.CompulsorySavingsPercentage = (int)numCompulsoryAmountPercent.Value; credit.LoanEntryFeesList = new List<LoanEntryFee>(); foreach (ListViewItem item in lvEntryFees.Items) { if (item.Tag is LoanEntryFee) { ((LoanEntryFee)item.Tag).FeeValue = decimal.Parse(item.SubItems[1].Text); credit.LoanEntryFeesList.Add((LoanEntryFee)item.Tag); } } if (credit.Product.CycleId != null) { credit.AmountMin = _product.AmountMin; credit.AmountMax = _product.AmountMax; credit.InterestRateMin = _product.InterestRateMin; credit.InterestRateMax = _product.InterestRateMax; credit.NmbOfInstallmentsMin = _product.NbOfInstallmentsMin; credit.NmbOfInstallmentsMax = _product.NbOfInstallmentsMax; credit.LoanCycle = _client.LoanCycle; } credit.Insurance = decimal.Parse(tbInsurance.Text); if (_credit != null && _credit.ScheduleChangedManually) { credit.ScheduleChangedManually = _credit.ScheduleChangedManually; //credit.InstallmentList = _credit.InstallmentList; } credit.EconomicActivity = eacLoan.Activity; return credit; }