public static List<AmortizationScheduleModel> CreateScheduleItems(LoanApplication loanApplication, AmortizationSchedule schedule) { var today = DateTime.Now; LoanCalculatorOptions options = new LoanCalculatorOptions(); options.LoanReleaseDate = schedule.LoanReleaseDate; options.PaymentStartDate = schedule.PaymentStartDate; options.LoanAmount = loanApplication.LoanAmount; options.LoanTerm = loanApplication.LoanTermLength; options.LoanTermId = loanApplication.LoanTermUomId; var paymentMode = UnitOfMeasure.GetByID(loanApplication.PaymentModeUomId); options.PaymentMode = paymentMode.Name; options.PaymentModeId = paymentMode.Id; var aiInterestComputationMode = ApplicationItem.GetFirstActive(loanApplication.Application, ProductFeatureCategory.InterestComputationModeType); int interestComputation = 0; if (aiInterestComputationMode != null) interestComputation = aiInterestComputationMode.ProductFeatureApplicability.ProductFeatureId; var interestComputationMode = ProductFeature.GetById(interestComputation); var interestRate = ProductFeature.GetByName(loanApplication.InterestRateDescription); options.InterestComputationMode = interestComputationMode.Name; options.InterestRateDescription = interestRate.Name; options.InterestRate = loanApplication.InterestRate ?? 0; options.InterestRateDescriptionId = interestRate.Id; LoanCalculator calculator = new LoanCalculator(); var items = calculator.GenerateLoanAmortization(options); return items; }
public static ControlNumber Create(LoanApplication loanapplication) { var controlNumber = _Create(FormType.PromissoryNoteType); controlNumber.LoanApplication = loanapplication; return controlNumber; }
public static PartyRole CreateAndUpdateCurrentLoanApplicationRole(LoanApplication loanApplication, Party party, RoleType roletype, DateTime today) { PartyRole role = GetPartyRoleFromLoanApplication(loanApplication, roletype); if (role != null) role.EndDate = today; return CreateLoanApplicationRole(loanApplication, roletype, party, today); }
public static LoanApplicationStatu ChangeStatus(LoanApplication loanApplication, LoanApplicationStatusType statusTo, DateTime today) { LoanApplicationStatu status = GetActive(loanApplication); if (CanChangeStatusTo(status.LoanApplicationStatusType, statusTo)) { return CreateOrUpdateCurrent(status, statusTo, today); } return status; }
public static bool CanChangeStatusTo(LoanApplication loanApplication, LoanApplicationStatusType statusTo) { LoanApplicationStatu status = GetActive(loanApplication); if (status == null) return true; return CanChangeStatusTo(status.LoanApplicationStatusType, statusTo); }
public void FillCustomerDetails(int partyRoleId, LoanApplication loan) { List<int> partyRoleCoborrower = new List<int>(); List<int> partyRoleCoBorrower = new List<int>(); LoanApplicationForm form = this.CreateOrRetrieve<LoanApplicationForm>(); form.Retrieve(loan.ApplicationId); form.PartyRoleId = partyRoleId; CustomerDetailsModel model = new CustomerDetailsModel(partyRoleId); this.lblCustomerName.Text = model.Name; this.lblBorrowerName.Text = model.Name.ToUpper(); var taxpayer = ObjectContext.Taxpayers.SingleOrDefault(x => x.PartyRoleId == partyRoleId); if (taxpayer != null && (!string.IsNullOrEmpty(taxpayer.Tin))) { var ctc = taxpayer.CurrentCtc; lblCtcNo.Text = ctc.CtcNumber; lblCtcIssuedOn.Text = String.Format("{0:MMMM dd, yyyy}", ctc.DateIssued); lblCtcIssuedAt.Text = ctc.IssuedWhere; } //District && Address var customerClassif = Customer.GetById(partyRoleId); var district = customerClassif.CurrentClassification; lblDistrict.Text = district.ClassificationType.District; lblHomeAddress.Text = model.PrimaryHomeAddress; //Contact No. string cellphoneNumber = ""; string telephoneNumber = ""; if (model.CellphoneNumber != null && model.TelephoneNumber != null) { if (!string.IsNullOrWhiteSpace(model.CellphoneNumber)) cellphoneNumber = model.CountryCode + model.CellphoneAreaCode + model.CellphoneNumber; if (!string.IsNullOrWhiteSpace(model.TelephoneNumber)) telephoneNumber = "/" + model.TelephoneNumberAreaCode + "-" + model.TelephoneNumber; lblContactNo.Text = cellphoneNumber + telephoneNumber; } //CoBorrower if (form.AvailableCoBorrowers.Count() > 0) { foreach (var item in form.AvailableCoBorrowers) { lblCoBorrowerName.Text = StringConcatUtility.Build("/ ", lblCoBorrowerName.Text, item.Name); partyRoleCoborrower.Add(item.PartyRoleId); } lblContactNo1.Text = ""; FillCoBorrowerDetails(partyRoleCoborrower, loan); } else { lblCoBorrowerName.Text = "_____________________"; lblContactNo1.Text = "________________"; lblHomeAddress1.Text = "________________"; } }
public static Agreement Create(LoanApplication loanApplication, AgreementType loanAgreementType, DateTime today) { Agreement agreement = new Agreement(); agreement.AgreementType = loanAgreementType; agreement.Application = loanApplication.Application; agreement.AgreementDate = today; agreement.EffectiveDate = today; Context.Agreements.AddObject(agreement); //Context.SaveChanges(); return agreement; }
public static LoanDisbursementVcr CreateForAdditionalLoan(LoanApplication loanApplication, Agreement agreement, decimal additionalAmount, DateTime today) { LoanDisbursementVcr disbursement = new LoanDisbursementVcr(); disbursement.Agreement = agreement; disbursement.Date = today; disbursement.Amount = loanApplication.LoanAmount; disbursement.Balance = additionalAmount; Context.LoanDisbursementVcrs.AddObject(disbursement); return disbursement; }
public static FormDetail Create(int formTypeId, LoanApplication loanApp, string RoleString, string Person, string Signature) { FormDetail form = new FormDetail(); form.FormTypeId = formTypeId; form.LoanApplication = loanApp; form.RoleString = RoleString; if (string.IsNullOrWhiteSpace(Person) == false) form.PersonString = Person; if (string.IsNullOrWhiteSpace(Signature) == false) form.Signature = Signature; return form; }
public static LoanApplicationStatu CreateOrUpdateCurrent(LoanApplication loanApplication, LoanApplicationStatusType statusType, DateTime today) { LoanApplicationStatu loanAppStatus = GetActive(loanApplication); if (loanAppStatus != null && loanAppStatus.LoanApplicationStatusType.Id != statusType.Id) loanAppStatus.IsActive = false; if (loanAppStatus == null || loanAppStatus.LoanApplicationStatusType.Id != statusType.Id) { LoanApplicationStatu loanStatus = new LoanApplicationStatu(); loanStatus.LoanApplication = loanApplication; loanStatus.LoanApplicationStatusType = statusType; loanStatus.Remarks = null; loanStatus.TransitionDateTime = today; loanStatus.IsActive = true; Context.LoanApplicationStatus.AddObject(loanStatus); Context.SaveChanges(); return loanStatus; } return loanAppStatus; }
public static ProductFeatureApplicability RetrieveFeature(ProductFeatureCategory featureCategory, LoanApplication loanApplication) { var app = Context.ApplicationItems.SingleOrDefault(entity => entity.ProductFeatureApplicability.ProductFeature.ProductFeatureCategory.Id == featureCategory.Id && entity.ApplicationId == loanApplication.ApplicationId && entity.EndDate == null); return app.ProductFeatureApplicability; }
public static PartyRole CreateLoanApplicationRole(LoanApplication loanApplication, RoleType roletype, Party party, DateTime today) { PartyRole partyRole = new PartyRole(); partyRole.Party = party; partyRole.RoleTypeId = roletype.Id; partyRole.EffectiveDate = today; partyRole.EndDate = null; LoanApplicationRole loanApplicationRole = new LoanApplicationRole(); loanApplicationRole.LoanApplication = loanApplication; loanApplicationRole.PartyRole = partyRole; Context.LoanApplicationRoles.AddObject(loanApplicationRole); return partyRole; }
public static PartyRole GetPartyRoleFromLoanApplication(LoanApplication loanApplication, RoleType roletype) { var loanApplicationRole = loanApplication.LoanApplicationRoles.FirstOrDefault(entity => entity.PartyRole.RoleTypeId == roletype.Id && entity.PartyRole.EndDate == null); if (loanApplicationRole != null) return loanApplicationRole.PartyRole; else return null; }
public static IQueryable<PartyRole> GetAllRoleTypeFromLoanApplication(LoanApplication loanApplication, RoleType roletype) { return from lar in Context.LoanApplicationRoles.Where(entity => entity.PartyRole.RoleTypeId == roletype.Id && entity.PartyRole.EndDate == null && entity.ApplicationId == loanApplication.ApplicationId) select lar.PartyRole; }
public static LoanApplicationStatu GetStatus(LoanApplication loanApplication, LoanApplicationStatusType type) { return loanApplication.LoanApplicationStatus.FirstOrDefault(entity => entity.StatusTypeId == type.Id); }
private void EnableDisableControls(string mode, LoanApplication loanApplication) { switch (mode) { case "approve": btnPrint.Disabled = true; break; case "modify": if (loanApplication.CurrentStatus.LoanApplicationStatusType.Name != LoanApplicationStatusType.PendingApprovalType.Name) { btnPrint.Disabled = false; btnSaveSignatures.Hidden = true; } btnSaveSignatures.Disabled = true; flUpBorrower.Hide(); var formDetails = FormDetail.GetByLoanAppIdAndType(loanApplication.ApplicationId, FormType.PromissoryNoteType); foreach (var item in formDetails) { imgBorrower.ImageUrl = item.Signature; } break; default: break; } }
private void FillCoBorrowerDetails(List<int> partyRoleCoborrower, LoanApplication loan) { if (partyRoleCoborrower.Count > 0) { lblHomeAddress1.Text = ""; foreach (var item in partyRoleCoborrower) { RoleType coBorrowerRoleType = RoleType.CoBorrowerApplicationType; PartyRole coBorrowerPartyRole = PartyRole.GetPartyRoleFromLoanApplication(loan, coBorrowerRoleType); PartyRole customerPartyRole = PartyRole.GetByPartyIdAndRole(coBorrowerPartyRole.PartyId, RoleType.CustomerType); PartyRole employeePartyRole = PartyRole.GetByPartyIdAndRole(coBorrowerPartyRole.PartyId, RoleType.EmployeeType); PartyRole contactPartyRole = PartyRole.GetByPartyIdAndRole(coBorrowerPartyRole.PartyId, RoleType.ContactType); var model = new CustomerDetailsModel(); int coBorrowerPartyRoleId = 0; if (customerPartyRole != null) { coBorrowerPartyRoleId = customerPartyRole.Id; model = new CustomerDetailsModel(coBorrowerPartyRoleId); } else if (employeePartyRole != null) { coBorrowerPartyRoleId = employeePartyRole.Id; model.InitializeAddresses(employeePartyRole.Party); } else if (contactPartyRole != null) { model.InitializeAddresses(contactPartyRole.Party); coBorrowerPartyRoleId = contactPartyRole.Id; } else { return; } lblHomeAddress1.Text = StringConcatUtility.Build(" / ", lblHomeAddress1.Text, model.PrimaryHomeAddress); string cellphoneNumber = ""; string telephoneNumber = ""; if (model.CellphoneNumber != null && model.TelephoneNumber != null) { if (!string.IsNullOrWhiteSpace(model.CellphoneNumber)) cellphoneNumber = model.CountryCode + model.CellphoneAreaCode + model.CellphoneNumber; if (!string.IsNullOrWhiteSpace(model.TelephoneNumber)) telephoneNumber = " / " + model.TelephoneNumberAreaCode + "-" + model.TelephoneNumber; lblContactNo1.Text = cellphoneNumber + telephoneNumber; } else { lblContactNo1.Text = "___________"; } var taxpayerCoBorrower = ObjectContext.Taxpayers.SingleOrDefault(x => x.PartyRoleId == coBorrowerPartyRoleId); if (taxpayerCoBorrower != null && (!string.IsNullOrWhiteSpace(taxpayerCoBorrower.Tin))) { var ctc = taxpayerCoBorrower.CurrentCtc; lblCtcNo1.Text = StringConcatUtility.Build("/ ", lblCtcNo1.Text, ctc.CtcNumber); var date = String.Format("{0:MMMM dd, yyyy}", ctc.DateIssued); lblCtcIssuedOn1.Text = StringConcatUtility.Build("/ ", lblCtcIssuedOn1.Text, date); lblCtcIssuedAt1.Text = StringConcatUtility.Build("/ ", lblCtcIssuedAt1.Text, ctc.IssuedWhere); } //District && Address var customerClassif = Customer.GetById(coBorrowerPartyRoleId); if (customerClassif != null) { var district = customerClassif.CurrentClassification; lblDistrict1.Text = district.ClassificationType.District; } } } }
private void EnableDisableControls(string mode, LoanApplication loanApplication) { if (mode == "approve") { txtWitness.Show(); txtWitness2.Show(); txtWitness3.Show(); txtWitness4.Show(); txtLender.Show(); imgWitness.Show(); imgWitness2.Show(); imgWitness3.Show(); imgWitness4.Show(); imgLender.Show(); imgBorrower.Show(); flUpWitness.Show(); flUpWitness2.Show(); flUpWitness3.Show(); flUpWitness4.Show(); flUpLender.Show(); flUpBorrower.Show(); btnPrint.Disabled = true; } else if (mode == "modify") { txtWitness.Hide(); txtWitness2.Hide(); txtWitness3.Hide(); txtWitness4.Hide(); txtLender.Hide(); imgWitness.Show(); imgWitness2.Show(); imgWitness3.Show(); imgWitness4.Show(); imgLender.Show(); imgBorrower.Show(); flUpWitness.Hide(); flUpWitness2.Hide(); flUpWitness3.Hide(); flUpWitness4.Hide(); flUpLender.Hide(); flUpBorrower.Hide(); btnSaveSignatures.Disabled = true; } }
public void FillSignatures(LoanApplication loanApplication) { btnPrint.Disabled = false; var formDetails = FormDetail.GetByLoanAppIdAndType(loanApplication.ApplicationId, FormType.SPAType); if (formDetails.Count() == 0 && loanApplication.CurrentStatus.LoanApplicationStatusType.Name != LoanApplicationStatusType.PendingApprovalType.Name) { imgWitness.Hide(); imgWitness2.Hide(); imgWitness3.Hide(); imgWitness4.Hide(); imgLender.Hide(); imgBorrower.Hide(); } foreach (var item in formDetails) { switch (item.RoleString) { case "Lender": lblLender.Text = item.PersonString; imgLender.ImageUrl = item.Signature; break; case "Borrower": imgBorrower.ImageUrl = item.Signature; break; case "Witness1": lblWitness.Text = item.PersonString; imgWitness.ImageUrl = item.Signature; break; case "Witness2": lblWitness2.Text = item.PersonString; imgWitness2.ImageUrl = item.Signature; break; case "Witness3": lblWitness3.Text = item.PersonString; imgWitness3.ImageUrl = item.Signature; break; case "Witness4": lblWitness4.Text = item.PersonString; imgWitness4.ImageUrl = item.Signature; break; default: break; } } }
public void FillDetails(LoanApplication loanApplication) { lblLoanAmount.Text = loanApplication.LoanAmount.ToString("N"); var agreement = Agreement.GetByApplicationId(loanApplication.ApplicationId); var amort = ObjectContext.AmortizationSchedules.SingleOrDefault(x => x.AgreementId == agreement.Id); lblReleaseDate.Text = String.Format("{0:MMMM dd, yyyy}", amort.LoanReleaseDate); if (amort.AmortizationScheduleItems.Count() == 0) { lblMaturityDate.Text = "________________"; } else { var date = amort.AmortizationScheduleItems.OrderByDescending(x=>x.ScheduledPaymentDate).First().ScheduledPaymentDate; lblMaturityDate.Text = String.Format("{0:MMMM dd, yyyy}", date); } lblPrincipalLoan.Text = ConvertNumbers.EnglishFromNumber((double)loanApplication.LoanAmount); lblPrincipal.Text = loanApplication.LoanAmount.ToString("N"); lblPercentInWords.Text = ConvertNumbers.EnglishFromNumber((double)loanApplication.InterestRate); lblInterestRate.Text = loanApplication.InterestRate.ToString(); var today = DateTime.Today; var numSuffix = NumberFacade.DaySuffix(today); //SPA lblDayToday.Text = today.Day.ToString() + numSuffix; lblMonthToday.Text = today.ToString("MMMM"); lblYearToday.Text = today.ToString("yyyy"); //Memorandum of Agreement lblDayToday1.Text = today.Day.ToString() + numSuffix; lblMonthToday1.Text = today.ToString("MMMM"); lblYearToday1.Text = today.ToString("yyyy"); lblDayToday2.Text = today.Day.ToString() + numSuffix; lblMonthToday2.Text = today.ToString("MMMM"); lblYearToday2.Text = today.ToString("yyyy"); }
public LoansGrantedModel(LoanApplication loanApplication, Party party, LoanAccount loanAccount) { this.LoanApplicationId = loanApplication.ApplicationId; this.LoanAmount = loanApplication.LoanAmount; this.InterestRate = loanApplication.InterestRate; this.LoanTerm = loanApplication.LoanTermLength; var aiCollateralRequirement = ApplicationItem.GetFirstActive(loanApplication.Application, ProductFeatureCategory.CollateralRequirementType); this.LoanProduct = aiCollateralRequirement.ProductFeatureApplicability.FinancialProduct.Name; this.LoanAccountStatus = loanAccount.CurrentStatus.LoanAccountStatusType.Name; var collateral = aiCollateralRequirement.ProductFeatureApplicability.ProductFeature.Name; if (!string.IsNullOrWhiteSpace(collateral)) this.CollateralRequirement = collateral; else this.CollateralRequirement = "N/A"; this.PaymentMode = UnitOfMeasure.GetByID(loanApplication.PaymentModeUomId).Name; this.LoanBalance = loanAccount.LoanBalance; if (party.PartyTypeId == PartyType.PersonType.Id) { Person personAsCustomer = party.Person; this.BorrowersName = StringConcatUtility.Build(" ", personAsCustomer.LastNameString + "," , personAsCustomer.FirstNameString, personAsCustomer.MiddleInitialString, personAsCustomer.NameSuffixString); } }
private void FillNoteParts(LoanApplication loanApplication) { LoanApplicationForm form = this.CreateOrRetrieve<LoanApplicationForm>(); form.Retrieve(loanApplication.ApplicationId); this.lblLoanAmountWords.Text = ConvertNumbers.EnglishFromNumber((double)form.LoanAmount) + " Pesos Only"; this.lblLoanAmount.Text = "(P " + String.Format("{0:#,##0.00;(#,##0.00);Zero}", form.LoanAmount) + " )"; var agreement = ObjectContext.Agreements.SingleOrDefault(entity => entity.ApplicationId == form.LoanApplicationId); var schedule = ObjectContext.AmortizationSchedules.SingleOrDefault(entity => entity.AgreementId == agreement.Id); this.lblmonthTerm.Text = String.Format("{0:MMMM}", schedule.PaymentStartDate); this.lblRate.Text = form.InterestRate.ToString() + " % "; CustomerDetailsModel model = new CustomerDetailsModel(form.PartyRoleId); foreach (var item in form.AvailableCoBorrowers) { this.lblCoborrower.Text = StringConcatUtility.Build(", ", lblCoborrower.Text, item.Name); } foreach (var item in form.AvailableGuarantors) { this.lblGuarantor.Text = StringConcatUtility.Build(", ", lblGuarantor.Text, item.Name); } this.lblName.Text = model.Name.ToUpper(); this.lblDistrict.Text = model.District; this.lblAddress.Text = model.PrimaryHomeAddress; string cellphoneNumber = ""; string telephoneNumber = ""; if (!string.IsNullOrWhiteSpace(model.CellphoneNumber)) cellphoneNumber = model.CountryCode + model.CellphoneAreaCode + model.CellphoneNumber; if (!string.IsNullOrWhiteSpace(model.TelephoneNumber)) telephoneNumber = "/" + model.TelephoneNumberAreaCode + "-" + model.TelephoneNumber; this.lblContact.Text = cellphoneNumber + telephoneNumber; this.lblDate.Text = String.Format("{0:MM/dd/yy}", DateTime.Now); }
private void FillControlNumber(LoanApplication loanApplication) { //var controlNumber = ObjectContext.ControlNumbers.SingleOrDefault(entity => // entity.FormType == FormType.PromissoryNoteType); var controlNumber = ControlNumberFacade.GetByLoanAppId(loanApplication.ApplicationId); this.lblControlNum.Text = string.Format("{0:00000}", controlNumber.LastControlNumber); }
public static LoanApplicationStatu GetActive(LoanApplication loanApplication) { return loanApplication.LoanApplicationStatus.FirstOrDefault(entity => entity.IsActive); }
public static void Delete(LoanApplication loanApplication, DateTime today) { List<ApplicationItem> applicationItems = loanApplication.Application.ApplicationItems.ToList(); List<LoanApplicationStatu> loanApplicationStatuses = loanApplication.LoanApplicationStatus.ToList(); List<LoanReAvailment> loanReAvailments = loanApplication.LoanReAvailments.ToList(); List<LoanApplicationFee> loanApplicationFees = loanApplication.LoanApplicationFees.ToList(); var chequesAssoc = Context.ChequeApplicationAssocs.Where(entity => entity.ApplicationId == loanApplication.ApplicationId); List<Payment> loanApplicationChequePayment = new List<Payment>(); foreach (var item in chequesAssoc) { var cheques = Context.Cheques.SingleOrDefault(entity => entity.Id == item.ChequeId); var payment = Context.Payments.SingleOrDefault(entity => entity.Id == cheques.PaymentId); loanApplicationChequePayment.Add(payment); } foreach (var item in chequesAssoc.ToList()) { Context.DeleteObject(item); } foreach (var item in applicationItems) { Context.ApplicationItems.DeleteObject(item); } foreach (var item in loanApplicationStatuses) { Context.LoanApplicationStatus.DeleteObject(item); } foreach (var item in loanReAvailments) { Context.LoanReAvailments.DeleteObject(item); } foreach (var item in loanApplicationFees) { Context.LoanApplicationFees.DeleteObject(item); } //-------------------------------------------------// List<SubmittedDocument> submittedDocuments = loanApplication.SubmittedDocuments.ToList(); foreach (var item in submittedDocuments) { List<DocumentPage> documentPage = item.DocumentPages.ToList(); foreach (var doc in documentPage) { Context.DocumentPages.DeleteObject(doc); } List<SubmittedDocumentStatu> status = item.SubmittedDocumentStatus.ToList(); foreach (var stat in status) { Context.SubmittedDocumentStatus.DeleteObject(stat); } Context.SubmittedDocuments.DeleteObject(item); } //-------------------------------------------------// foreach (var loanApplicationRole in loanApplication.LoanApplicationRoles.ToList()) { loanApplicationRole.PartyRole.EndDate = today; Context.LoanApplicationRoles.DeleteObject(loanApplicationRole); } foreach (var asset in loanApplication.Assets.ToList()) { if (asset.AssetType == AssetType.LandType) { foreach (var address in asset.Addresses.ToList()) { Context.PostalAddresses.DeleteObject(address.PostalAddress); Context.Addresses.DeleteObject(address); } Context.Lands.DeleteObject(asset.Land); } else if (asset.AssetType == AssetType.BankAccountType) { Context.BankAccounts.DeleteObject(asset.BankAccount); } foreach (var assetRole in asset.AssetRoles.ToList()) { assetRole.PartyRole.EndDate = today; Context.AssetRoles.DeleteObject(assetRole); } Context.Assets.DeleteObject(asset); } //-------------------------------------------------// foreach (var pay in loanApplicationChequePayment) { //TODO:: Changed to new payment var rpAssoc = Context.ReceiptPaymentAssocs.SingleOrDefault(entity => entity.PaymentId == pay.Id); var cheque = Context.Cheques.SingleOrDefault(entity => entity.PaymentId == pay.Id); Context.Cheques.DeleteObject(cheque); Context.Receipts.DeleteObject(rpAssoc.Receipt); Context.Payments.DeleteObject(rpAssoc.Payment); Context.ReceiptPaymentAssocs.DeleteObject(rpAssoc); } var agreement = Context.Agreements.SingleOrDefault(entity => entity.ApplicationId == loanApplication.ApplicationId); var loanAgreement = Context.LoanAgreements.SingleOrDefault(entity => entity.AgreementId == agreement.Id); var schedule = Context.AmortizationSchedules.SingleOrDefault(entity => entity.AgreementId == agreement.Id); Context.AmortizationSchedules.DeleteObject(schedule); Context.LoanAgreements.DeleteObject(loanAgreement); Context.Agreements.DeleteObject(agreement); Application application = loanApplication.Application; Context.LoanApplications.DeleteObject(loanApplication); Context.Applications.DeleteObject(application); }
private void EnableValidActivity(LoanApplication loanApplication) { btnApprove.Disabled = true; btnCancel.Disabled = true; btnReject.Disabled = true; btnPrintPromissory.Disabled = true; btnPrintTempSched.Disabled = true; btnPrintSPA.Disabled = true; //btnClose.Disabled = true; var status = loanApplication.CurrentStatus; if (status == null) return; if (status.StatusTypeId != LoanApplicationStatusType.PendingApprovalType.Id) { if (btnSaveSeparator.Hidden == false) btnSaveSeparator.Hidden = true; if (btnSave.Hidden == false) btnSave.Hidden = true; if (btnOpen.Hidden == false) btnOpen.Hidden = true; if (btnOpenSeparator.Hidden == false) btnOpenSeparator.Hidden = true; if (btnApprove.Hidden == false) btnApprove.Hidden = true; btnPrintPromissory.Disabled = false; btnPrintTempSched.Disabled = false; btnPrintSPA.Disabled = false; } if (LoanApplicationStatu.CanChangeStatusTo(status.LoanApplicationStatusType, LoanApplicationStatusType.CancelledType)) btnCancel.Disabled = false; if (LoanApplicationStatu.CanChangeStatusTo(status.LoanApplicationStatusType, LoanApplicationStatusType.PendingInFundingType)) btnApprove.Disabled = false; if (LoanApplicationStatu.CanChangeStatusTo(status.LoanApplicationStatusType, LoanApplicationStatusType.RejectedType)) btnReject.Disabled = false; //if (LoanApplicationStatu.CanChangeStatusTo(status.LoanApplicationStatusType, LoanApplicationStatusType.ClosedType)) // btnClose.Disabled = false; this.txtLoanApplicationStatus.Text = status.LoanApplicationStatusType.Name; if (loanApplication.LoanTermLength <= 0) btnPrintTempSched.Disabled = true; else btnPrintTempSched.Disabled = false; }