public static Collateral HandleCreate(Asset asset, PartyRole customerPartyRole) { LandCollateral collateral = new LandCollateral(); Land land = asset.Land; collateral.LandUOM = land.UomId; collateral.LandType = land.LandTypeId; collateral.TCTNumber = land.OctTctNumber; collateral.LandArea = land.LandArea; //add property location var borrowerParty = Context.Parties.SingleOrDefault(entity => entity.Id == customerPartyRole.PartyId); var propertyLocation = PostalAddress.GetCurrentPostalAddress(borrowerParty, PostalAddressType.PropertyLocationType, asset); if (propertyLocation != null) { collateral.StreetAddress = propertyLocation.StreetAddress; collateral.Barangay = propertyLocation.Barangay; collateral.Municipality = propertyLocation.Municipality; collateral.CountryId = propertyLocation.CountryId ?? 0; collateral.City = propertyLocation.City; collateral.Province = propertyLocation.Province; collateral.PostalCode = propertyLocation.PostalCode; } return collateral; }
public void Fill(LandCollateral collateral) { this.txtCollateralDesc.Text = collateral.Description; this.chkMortgaged.Checked = collateral.IsPropertyMortgage; this.chkNotMortgaged.Checked = collateral.IsPropertyMortgage == false; this.btnPickMortgagee.Disabled = collateral.IsPropertyMortgage == false; this.hiddenMortgageeId.Value = collateral.MortgageeId; this.txtMortgageeName.Text = collateral.Mortgagee; this.txtMortgageeName.AllowBlank = !this.chkMortgaged.Checked; this.cmbLandType.SetValueAndFireSelect(collateral.LandType); this.nfLandArea.Number = (double)collateral.LandArea; this.cmbUnitOfMeasure.SetValueAndFireSelect(collateral.LandUOM); this.txtTCTNumber.Text = collateral.TCTNumber; cmbCountry.SetValueAndFireSelect(collateral.CountryId); txtStreetAddress.Text = collateral.StreetAddress; txtBarangay.Text = collateral.Barangay; txtProvince.Text = collateral.Province; //txtState.Text = collateral.State; txtPostalCode.Text = collateral.PostalCode; if (string.IsNullOrWhiteSpace(collateral.Municipality) == false) { radioMunicipality.Checked = true; txtCityOrMunicipality.Text = collateral.Municipality; } else { txtCityOrMunicipality.Text = collateral.City; radioCity.Checked = true; } txtPropertyLocation.Text = StringConcatUtility.Build(", ", txtStreetAddress.Text, txtBarangay.Text, txtCityOrMunicipality.Text, txtProvince.Text, //txtState.Text, cmbCountry.SelectedItem.Text, txtPostalCode.Text); StorePropertyOwner.DataSource = collateral.AvailablePropertyOwners; StorePropertyOwner.DataBind(); }