protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest == false && this.IsPostBack == false)
            {
                int customerId = int.Parse(Request.QueryString["customerPartyRoleId"]);
                this.ParentResourceGuid = Request.QueryString["ResourceGuid"];
                LoanApplicationForm form = this.Retrieve<LoanApplicationForm>(ParentResourceGuid);
                CustomerDetailsModel model = new CustomerDetailsModel(form.PartyRoleId);
                this.lblCustomerName.Text = model.Name;
                this.lblDateGenerated.Text = String.Format("{0:MMMM dd, yyyy}", DateTime.Today);

                var loanApplication = LoanApplication.GetById(form.LoanApplicationId);
                //HEADER LENDER INFORMATION
                var partyRole = ObjectContext.PartyRoles.FirstOrDefault(x => x.RoleTypeId == RoleType.LendingInstitutionType.Id);
                var party = partyRole.Party;
                FillLenderInformation(party);

                if (form.AvailableSchedule.Count() != 0)
                {
                    storeAmortizationSchedule.DataSource = form.AmortizationSchedules;
                    storeAmortizationSchedule.DataBind();
                }
                else
                {
                    var agr = ObjectContext.Agreements.SingleOrDefault(entity => entity.ApplicationId == loanApplication.ApplicationId);
                    var schedule = ObjectContext.AmortizationSchedules.SingleOrDefault(entity => entity.AgreementId == agr.Id);
                    var items = ObjectContext.AmortizationScheduleItems.Where(entity => entity.AmortizationScheduleId == schedule.Id);
                    var scheduleItems = LoanApplication.CreateScheduleItems(loanApplication, schedule);

                    if (items.Count() == 0)
                    {
                        storeAmortizationSchedule.DataSource = scheduleItems;
                        storeAmortizationSchedule.DataBind();
                    }
                    else
                    {
                        var type = UnitOfMeasure.GetByID(loanApplication.PaymentModeUomId).Name;
                        int i = 0;
                        foreach (var amModel in items)
                        {
                            AmortizationScheduleModel newModel = new AmortizationScheduleModel();
                            newModel.Counter = GetItemType(type) + " " + (i + 1).ToString();
                            newModel.InterestPayment = amModel.InterestPayment;
                            newModel.IsBilledIndicator = amModel.IsBilledIndicator;
                            newModel.PrincipalBalance = amModel.PrincipalBalance;
                            newModel.PrincipalPayment = amModel.PrincipalPayment;
                            newModel.ScheduledPaymentDate = amModel.ScheduledPaymentDate;
                            newModel.TotalLoanBalance = amModel.TotalLoanBalance;
                            newModel.TotalPayment = amModel.PrincipalPayment + amModel.InterestPayment;
                            i++;

                            form.AddAmortizationModel(newModel);
                        }

                        storeAmortizationSchedule.DataSource = form.AmortizationSchedules;
                        storeAmortizationSchedule.DataBind();
                    }
                }
            }
        }
Пример #2
0
        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 void FillBorrowersBasicInformation(int partyRoleId)
        {
            LoanApplicationForm form = this.CreateOrRetrieve<LoanApplicationForm>();
            form.PartyRoleId = partyRoleId;
            CustomerDetailsModel model = new CustomerDetailsModel(partyRoleId);
            this.lblCustomerName.Text = model.Name;
            this.lblDistricts.Text = model.District;
            this.lblStation.Text = model.StationNumber;
            this.lblGender.Text = model.Gender;
            this.lblAge.Text = model.Age.ToString();
            this.lblCreditLimit.Text = String.Format("{0:#,##0.00;(#,##0.00);Zero}", model.CreditLimit);
            this.lblPrimaryHomeAddress.Text = model.PrimaryHomeAddress;
            this.lblCellphoneNumber.Text = model.CountryCode + model.CellphoneAreaCode + model.CellphoneNumber;
            this.lblTelephoneNumber.Text = model.TelephoneNumberAreaCode + model.TelephoneNumber;
            this.lblPrimaryEmailAddress.Text = model.PrimaryEmailAddress;

            var borrowerParty = PartyRole.GetById(form.PartyRoleId);
            if (borrowerParty.Party.Person.ImageFilename != null)
                imgPersonPicture.ImageUrl = borrowerParty.Party.Person.ImageFilename;
        }
        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);
        }
        public void SaveSignatures(int loanAppId)
        {
            LoanApplicationForm form = this.CreateOrRetrieve<LoanApplicationForm>();
            form.Retrieve(loanAppId);

            var loanApp = LoanApplication.GetById(loanAppId);
            CustomerDetailsModel model = new CustomerDetailsModel(form.PartyRoleId);

            var formDetail = FormDetail.Create(FormType.PromissoryNoteType.Id, loanApp, "Borrower", model.Name.ToUpper(), hdnBorrower.Text);

            ObjectContext.FormDetails.AddObject(formDetail);
            ObjectContext.SaveChanges();
        }
Пример #6
0
 public EmployeeDetailsModel(Party party)
 {
     //Postal Address
     CustomerDetailsModel model = new CustomerDetailsModel();
     model.InitializeAddresses(party);
 }
Пример #7
0
        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;
                    }

                }
            }
        }
        public void FillCustomerDetails(int partyRoleId)
        {
            storePayOutstandingLoan.RemoveAll();
            var imageFilename = "../../../Uploaded/Images/";
            LoanApplicationForm form = this.CreateOrRetrieve<LoanApplicationForm>();
            form.PartyRoleId = partyRoleId;
            CustomerDetailsModel model = new CustomerDetailsModel(partyRoleId);
            this.txtCustomerName.Text = model.Name;
            this.hiddenCustomerID.Value = partyRoleId;
            if (string.IsNullOrWhiteSpace(model.ImageUrl) == false)
                this.imgPersonPicture.ImageUrl = model.ImageUrl;
            else
                this.imgPersonPicture.ImageUrl = imageFilename + "../../../Resources/images/noimage.jpg";
            this.txtDistrict.Text = model.District;
            this.txtStationNumber.Text = model.StationNumber;
            this.txtCustomerStatus.Text = model.Status;
            this.txtCustomerType.Text = model.CustomerType;
            this.txtGender.Text = model.Gender;
            this.txtAge.Value = model.Age;
            if (model.CreditLimit != null)
                this.txtCreditLimit.Text = ((decimal)model.CreditLimit).ToString("N");
            this.txtPrimaryHomeAddress.Text = model.PrimaryHomeAddress;
            this.txtCellNumberCountryCode.Text = model.CountryCode;
            this.txtPrimaryTelCountryCode.Text = model.CountryCode;
            this.nfCellNumberAreaCode.Text = model.CellphoneAreaCode;
            this.nfCellNumberPhoneNumber.Text = model.CellphoneNumber;
            this.txtPrimaryTelAreaCode.Text = model.TelephoneNumberAreaCode;
            this.txtPrimaryTelPhoneNumber.Text = model.TelephoneNumber;
            this.txtPrimaryEmailAddress.Text = model.PrimaryEmailAddress;
            var list = form.RetrieveOutstandingLoans();
            if (list != null)
            {
                storePayOutstandingLoan.DataSource = list;
                storePayOutstandingLoan.DataBind();
                chkPayOutstandingLoan.Disabled = list.Count == 0;
            }
            else
            {
                chkPayOutstandingLoan.Checked = false;
                chkPayOutstandingLoan.Disabled = true;
            }

            SetAllInterestComputationModes();
        }