protected void btnSave_Click(object sender, EventArgs e) { base.ChangeAllFieldBackColor(Color.Empty); var taxUserId = CommonFunctions.TaxUserId; var taxPayerId = CommonFunctions.TaxPayerId; var formId = DirectiveFormId; var contactPerson = new ReportEntityContactPersonDetails { FirstNames = txtContactPersonFirstName.Text, Surname = txtContactPersonSurname.Text, BusTelNo1 = txtContactPersonBusinessTel1.Text, BusTelNo2 = txtContactPersonBusinessTel2.Text, CellNo = txtContactPersonEmailAddress.Text, EmailAddress = txtContactPersonEmailAddress.Text, ID = 0 }; var entityAddress = new EntityAddress { AddressTypeCode = ctrEntityAddress.AddressType.SelectedValue, PostalServiceID = ctrEntityAddress.AddressOption.SelectedValue, PostOffice = ctrEntityAddress.PostOffice.Text, OtherPOSpecialService = ctrEntityAddress.OtherSpecify.Text, Number = ctrEntityAddress.AddressNumber.Text, PAPostalCode = ctrEntityAddress.PostOfficePostCode.Text, RESPostalCode = ctrEntityAddress.ResPostalCode.Text, PACountryCode = ctrEntityAddress.PostOfficeCountryCode.SelectedValue, RESCountryCode = ctrEntityAddress.ResAddressCountryCode.SelectedValue, UnitNo = ctrEntityAddress.UnitNumber.Text, Complex = ctrEntityAddress.ComplexName.Text, StreetNo = ctrEntityAddress.StreetNo.Text, StreetName = ctrEntityAddress.StreetOrFarmName.Text, Suburb = ctrEntityAddress.SuburbOrDistrict.Text, City = ctrEntityAddress.CityOrTownName.Text, ID = 0 // PostalServiceID = ctrEntityAddress.AddressOption.SelectedValue }; SaveReportEntity(); }
public void SaveReportEntity() { decimal contactPersonDetailsId = SessionStorage.contactPersonDetailsId == null ? 0 : decimal.Parse(SessionStorage.contactPersonDetailsId); decimal entityAddressId = SessionStorage.entityAddressId == null ? 0 : decimal.Parse(SessionStorage.entityAddressId); decimal reportEntityId = SessionStorage.reportEntityId == null ? 0 : decimal.Parse(SessionStorage.reportEntityId); base.ChangeAllFieldBackColor(Color.Empty); var taxUserId = CommonFunctions.TaxUserId; var taxPayerId = CommonFunctions.TaxPayerId; var formId = DirectiveFormId; var contactPerson = new ReportEntityContactPersonDetails { FirstNames = txtContactPersonFirstName.Text, Surname = txtContactPersonSurname.Text, BusTelNo1 = txtContactPersonBusinessTel1.Text, BusTelNo2 = txtContactPersonBusinessTel2.Text, CellNo = txtContactPersonEmailAddress.Text, EmailAddress = txtContactPersonEmailAddress.Text, ID = contactPersonDetailsId }; var entityAddress = new EntityAddress { AddressTypeCode = ctrEntityAddress.AddressType.SelectedValue, PostalServiceID = ctrEntityAddress.AddressOption.SelectedValue, PostOffice = ctrEntityAddress.PostOffice.Text, OtherPOSpecialService = ctrEntityAddress.OtherSpecify.Text, Number = ctrEntityAddress.AddressNumber.Text, PAPostalCode = ctrEntityAddress.PostOfficePostCode.Text, RESPostalCode = ctrEntityAddress.ResPostalCode.Text, PACountryCode = ctrEntityAddress.PostOfficeCountryCode.SelectedValue, RESCountryCode = ctrEntityAddress.ResAddressCountryCode.SelectedValue, UnitNo = ctrEntityAddress.UnitNumber.Text, Complex = ctrEntityAddress.ComplexName.Text, StreetNo = ctrEntityAddress.StreetNo.Text, StreetName = ctrEntityAddress.StreetOrFarmName.Text, Suburb = ctrEntityAddress.SuburbOrDistrict.Text, City = ctrEntityAddress.CityOrTownName.Text, ID = entityAddressId }; contactPersonDetailsId = db.SaveReportEntityContactPersonDetails(contactPerson); if (contactPersonDetailsId > 0) { SessionStorage.contactPersonDetailsId = contactPersonDetailsId.ToString(); } entityAddressId = db.SaveReportEntityAddress(entityAddress); if (entityAddressId > 0) { SessionStorage.entityAddressId = entityAddressId.ToString(); } string dt = Request.Form[txtReportingPeriod.UniqueID]; contactPersonDetailsId = SessionStorage.contactPersonDetailsId == null ? 0 : decimal.Parse(SessionStorage.contactPersonDetailsId); entityAddressId = SessionStorage.entityAddressId == null ? 0 : decimal.Parse(SessionStorage.entityAddressId); var repEntity = new ReportEntity() { ID = reportEntityId, ReportingPeriod = dt, CompanyRegNo = txtREgisteredName.Text, RegisteredName = txtREgisteredName.Text, CompanyRegNoIssuedByCountry = ddlCompanyRegIssuedByCountry.SelectedValue, TaxRefNo = txtTexRefNo.Text, TaxRefNoIssuedByCountry = ddlTexRefNoIssuedByCountry.SelectedValue, GIINNo = txtGIINNo.Text, GIINNoIndicator = rbtnGIINNoAvailable.SelectedValue, GIINNoIssuedByCountry = ddlGIINNoIssuedByCountry.SelectedValue, UniqueNo = txtUniqueNo.Text, ReportingRoleId = ddlRole.SelectedValue, ResidentCountryCode = ddlResCountry.SelectedValue, ReportEntityAddressId = entityAddressId, ReportEntityContactPersonDetailsId = contactPersonDetailsId, RecordStatusId = GetRecordStatus(), TaxUserID = taxUserId }; reportEntityId = db.SaveReportEntity(repEntity); if (reportEntityId > 0) { SessionStorage.reportEntityId = reportEntityId.ToString(); } SaveCBCReport(); }