private void Post() { DateTime DeliveryDate = Convert.ToDateTime(txtPostDate.Text); ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); clsERPConfig.CommitAndDispose(); if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate) { long CreditMemoID = Convert.ToInt64(lblCreditMemoID.Text); string CustomerDocNo = txtCustomerDocNo.Text; CreditMemos clsCreditMemos = new CreditMemos(); clsCreditMemos.Post(CreditMemoID, CustomerDocNo, DeliveryDate); clsCreditMemos.CommitAndDispose(); Common Common = new Common(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&retid=" + Common.Encrypt(CreditMemoID.ToString(), Session.SessionID); Response.Redirect("Default.aspx" + stParam); } else { string stScript = "<Script>"; stScript += "window.alert('Sorry you cannot post using the delivery date: " + txtPostDate.Text + ". Please enter an allowable posting date.')"; stScript += "</Script>"; Response.Write(stScript); } }
private void IssueGRN() { DateTime DeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text); ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); clsERPConfig.CommitAndDispose(); if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate) { long BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text); string ReceivedBy = txtReceivedBy.Text; BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.IssueGRN(BranchTransferID, ReceivedBy, DeliveryDate); clsBranchTransfer.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&BranchTransferID=" + Common.Encrypt(BranchTransferID.ToString(), Session.SessionID); Response.Redirect("Default.aspx" + stParam); } else { string stScript = "<Script>"; stScript += "window.alert('Sorry you cannot post using the delivery date: " + txtDeliveryDate.Text + ". Please enter an allowable posting date.')"; stScript += "</Script>"; Response.Write(stScript); } }
private void LoadRecord() { ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsDetails = clsERPConfig.Details(); clsERPConfig.CommitAndDispose(); txtDateFrom.Text = clsDetails.PostingDateFrom.ToString("yyyy-MM-dd"); txtDateTo.Text = clsDetails.PostingDateTo.ToString("yyyy-MM-dd"); }
private void SaveRecord() { ERPConfigDetails clsDetails = new ERPConfigDetails(); clsDetails.PostingDateFrom = Convert.ToDateTime(txtDateFrom.Text); clsDetails.PostingDateTo = Convert.ToDateTime(txtDateTo.Text); ERPConfig clsERPConfig = new ERPConfig(); clsERPConfig.UpdatePostingDate(clsDetails.PostingDateFrom, clsDetails.PostingDateTo); clsERPConfig.CommitAndDispose(); }
private void LoadRecord() { ERPConfig clsERPConfig = new ERPConfig(); APLinkConfigDetails clsDetails = clsERPConfig.APLinkDetails(); clsERPConfig.CommitAndDispose(); cboChartOfAccountAPTracking.SelectedIndex = cboChartOfAccountAPTracking.Items.IndexOf(cboChartOfAccountAPTracking.Items.FindByValue(clsDetails.ChartOfAccountIDAPTracking.ToString())); cboChartOfAccountAPBills.SelectedIndex = cboChartOfAccountAPBills.Items.IndexOf(cboChartOfAccountAPBills.Items.FindByValue(clsDetails.ChartOfAccountIDAPBills.ToString())); cboChartOfAccountAPFreight.SelectedIndex = cboChartOfAccountAPFreight.Items.IndexOf(cboChartOfAccountAPFreight.Items.FindByValue(clsDetails.ChartOfAccountIDAPFreight.ToString())); cboChartOfAccountAPVDeposit.SelectedIndex = cboChartOfAccountAPVDeposit.Items.IndexOf(cboChartOfAccountAPVDeposit.Items.FindByValue(clsDetails.ChartOfAccountIDAPVDeposit.ToString())); cboChartOfAccountAPContra.SelectedIndex = cboChartOfAccountAPContra.Items.IndexOf(cboChartOfAccountAPContra.Items.FindByValue(clsDetails.ChartOfAccountIDAPContra.ToString())); cboChartOfAccountAPLatePayment.SelectedIndex = cboChartOfAccountAPLatePayment.Items.IndexOf(cboChartOfAccountAPLatePayment.Items.FindByValue(clsDetails.ChartOfAccountIDAPLatePayment.ToString())); }
public ActionResult Edit(ERPConfig model) { Context.ERPConfig dbitem = RepoERPConfig.FindByFrist(); if (dbitem == null) { dbitem = new Context.ERPConfig(); } dbitem.IdKawalan = model.IdKawalan; dbitem.IdTimbangan = model.IdTimbangan; dbitem.IdKarantina = model.IdKaarantina; dbitem.IdSPSI = model.IdSPSI; dbitem.IdMultidrop = model.IdMultidrop; //dbitem.IdSolar = model.IdSolar; //dbitem.IdKapal = model.IdKapal; dbitem.IdTambahanRuteMuat = model.IdRutemuat; dbitem.IdTambahanRuteLain = model.IdRuteLain; dbitem.IdAUJCredit = model.IdCreditAuj; dbitem.IdKasirCash = model.IdOprCash; dbitem.IdCashCredit = model.IdCreditCash; dbitem.IdKasirTf = model.IdOprTf; dbitem.IdTfCredit = model.IdCreditTf; dbitem.IdKasbonAuj = model.IdKasbonAuj; dbitem.IdPotonganLainAuj = model.IdPotonganLainAuj; dbitem.IdKlaimAuj = model.IdKlaimAuj; dbitem.IdBoronganDasar = model.IdBoronganDasar; dbitem.IdVoucherSolar = model.IdVoucherSolar; dbitem.IdVoucherKapal = model.IdVoucherKapal; dbitem.IdKasbonDriver = model.IdKasbonDriver; dbitem.IdBiayaPerjalanan = model.IdBiayaPerjalanan; dbitem.IdBiayaInap = model.IdBiayaInap; dbitem.IdBiayaKlaim = model.IdBiayaKlaim; dbitem.IdKreditKlaim = model.IdKreditKlaim; dbitem.IdPiutangCustomer = model.IdPiutangCustomer; dbitem.IdDP = model.IdDP; dbitem.IdPiutangDagang = model.IdPiutangBlmInv; dbitem.IdPendapatanUsahaBlmInv = model.IdPenjualanBlmInv; dbitem.IdPiutangDailySupir = model.IdPiutangDailySupir; dbitem.IdKlaimSupir = model.IdKlaimSupir; dbitem.IdPiutangDriverBatalJalan = model.IdPiutangDriverBatalJalan; dbitem.IdPiutangDriverPribadi = model.IdPiutangDriverPribadi; dbitem.IdPendapatanPengembalianPiutangDriver = model.IdPendapatanPengembalianPiutangDriver; dbitem.IdTabunganDriver = model.IdTabunganDriver; dbitem.IdBiayaBatalJalan = model.IdBiayaBatalJalan; dbitem.IdPiutangDriverBatalJalanSementaraSolar = model.IdPiutangDriverBatalJalanSementaraSolar; RepoERPConfig.save(dbitem); return(RedirectToAction("Edit")); }
private void SaveRecord() { APLinkConfigDetails clsDetails = new APLinkConfigDetails(); clsDetails.ChartOfAccountIDAPTracking = Convert.ToInt32(cboChartOfAccountAPTracking.SelectedItem.Value); clsDetails.ChartOfAccountIDAPBills = Convert.ToInt32(cboChartOfAccountAPBills.SelectedItem.Value); clsDetails.ChartOfAccountIDAPFreight = Convert.ToInt32(cboChartOfAccountAPFreight.SelectedItem.Value); clsDetails.ChartOfAccountIDAPVDeposit = Convert.ToInt32(cboChartOfAccountAPVDeposit.SelectedItem.Value); clsDetails.ChartOfAccountIDAPContra = Convert.ToInt32(cboChartOfAccountAPContra.SelectedItem.Value); clsDetails.ChartOfAccountIDAPLatePayment = Convert.ToInt32(cboChartOfAccountAPLatePayment.SelectedItem.Value); ERPConfig clsERPConfig = new ERPConfig(); clsERPConfig.UpdateAPLinkConfig(clsDetails); clsERPConfig.CommitAndDispose(); }
private string CloseInventory() { string strRetValue = ""; try { DateTime DeliveryDate = Convert.ToDateTime(txtClosingDate.Text); ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate) { string strReferenceNo = Constants.CLOSE_INVENTORY_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsERPConfig.get_LastClosingNo(); AccessUserDetails clsAccessUserDetails = (AccessUserDetails)Session["AccessUserDetails"]; ProductInventories clsProductInventories = new ProductInventories(clsERPConfig.Connection, clsERPConfig.Transaction); clsProductInventories.CloseInventoryBySupplier(int.Parse(cboBranch.SelectedItem.Value), clsAccessUserDetails.UID, DateTime.Parse(txtClosingDate.Text), strReferenceNo, long.Parse(cboContact.SelectedItem.Value), cboContact.SelectedItem.Text); Products clsProducts = new Products(clsERPConfig.Connection, clsERPConfig.Transaction); clsProducts.LockUnlockForSellingBySupplier(int.Parse(cboBranch.SelectedItem.Value), long.Parse(cboContact.SelectedItem.Value), false); clsERPConfig.CommitAndDispose(); strRetValue = strReferenceNo; } else { clsERPConfig.CommitAndDispose(); string stScript = "<Script>"; stScript += "window.alert('Sorry you cannot close using the closing date: " + txtClosingDate.Text + ". Please enter an allowable posting date.')"; stScript += "</Script>"; Response.Write(stScript); } } catch (Exception ex) { string stScript = "<Script>"; stScript += "window.alert('An error has occured while closing the inventory. Details:' " + ex.Message + ")"; stScript += "</Script>"; Response.Write(stScript); } return(strRetValue); }
public void save(ERPConfig dbitem) { if (dbitem.Id == 0) //create { context.ERPConfig.Add(dbitem); var auditrail = new Auditrail { Actionnya = "Add", EventDate = DateTime.Now, Modulenya = "Area", QueryDetail = "Edit Account", RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1 }; context.Auditrail.Add(auditrail); } else //edit { context.ERPConfig.Attach(dbitem); var auditrail = new Auditrail { Actionnya = "Edit", EventDate = DateTime.Now, Modulenya = "Area", QueryDetail = "Edit Account", RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1 }; context.Auditrail.Add(auditrail); var entry = context.Entry(dbitem); entry.State = EntityState.Modified; } context.SaveChanges(); }
public ActionResult Edit() { ERPConfig model = new ERPConfig(); Context.ERPConfig dbitem = RepoERPConfig.FindByFrist(); if (dbitem != null) { if (dbitem.IdDP.HasValue) { ac_mstr ac_mstr_DP = Repoac_mstr.FindByPk(dbitem.IdDP); model.IdDP = ac_mstr_DP.id; model.CodeDP = ac_mstr_DP.ac_code; model.NamaDP = ac_mstr_DP.ac_name; } if (dbitem.IdBiayaPerjalanan.HasValue) { ac_mstr ac_mstr_BiayaPerjalanan = Repoac_mstr.FindByPk(dbitem.IdBiayaPerjalanan); model.IdBiayaPerjalanan = ac_mstr_BiayaPerjalanan.id; model.CodeBiayaPerjalanan = ac_mstr_BiayaPerjalanan.ac_code; model.NamaBiayaPerjalanan = ac_mstr_BiayaPerjalanan.ac_name; } if (dbitem.IdBiayaInap.HasValue) { ac_mstr ac_mstr_BiayaInap = Repoac_mstr.FindByPk(dbitem.IdBiayaInap); model.IdBiayaInap = ac_mstr_BiayaInap.id; model.CodeBiayaInap = ac_mstr_BiayaInap.ac_code; model.NamaBiayaInap = ac_mstr_BiayaInap.ac_name; } if (dbitem.IdKasbonDriver.HasValue) { ac_mstr ac_mstr_KasbonDriver = Repoac_mstr.FindByPk(dbitem.IdKasbonDriver); model.IdKasbonDriver = ac_mstr_KasbonDriver.id; model.CodeKasbonDriver = ac_mstr_KasbonDriver.ac_code; model.NamaKasbonDriver = ac_mstr_KasbonDriver.ac_name; } if (dbitem.IdVoucherKapal.HasValue) { ac_mstr ac_mstr_VoucherKapal = Repoac_mstr.FindByPk(dbitem.IdVoucherKapal); model.IdVoucherKapal = ac_mstr_VoucherKapal.id; model.CodeVoucherKapal = ac_mstr_VoucherKapal.ac_code; model.NamaVoucherKapal = ac_mstr_VoucherKapal.ac_name; } if (dbitem.IdVoucherSolar.HasValue) { ac_mstr ac_mstr_VoucherSolar = Repoac_mstr.FindByPk(dbitem.IdVoucherSolar); model.IdVoucherSolar = ac_mstr_VoucherSolar.id; model.CodeVoucherSolar = ac_mstr_VoucherSolar.ac_code; model.NamaVoucherSolar = ac_mstr_VoucherSolar.ac_name; } if (dbitem.IdBoronganDasar.HasValue) { ac_mstr ac_mstr_BoronganDasar = Repoac_mstr.FindByPk(dbitem.IdBoronganDasar); model.IdBoronganDasar = ac_mstr_BoronganDasar.id; model.CodeBoronganDasar = ac_mstr_BoronganDasar.ac_code; model.NamaBoronganDasar = ac_mstr_BoronganDasar.ac_name; } if (dbitem.IdKawalan.HasValue) { ac_mstr ac_mstr_kawalan = Repoac_mstr.FindByPk(dbitem.IdKawalan); model.IdKawalan = ac_mstr_kawalan.id; model.CodeKawalan = ac_mstr_kawalan.ac_code; model.NamaKawalan = ac_mstr_kawalan.ac_name; } if (dbitem.IdTimbangan.HasValue) { ac_mstr ac_mstr_timbangan = Repoac_mstr.FindByPk(dbitem.IdTimbangan); model.IdTimbangan = ac_mstr_timbangan.id; model.CodeTimbangan = ac_mstr_timbangan.ac_code; model.NamaTimbangan = ac_mstr_timbangan.ac_name; } if (dbitem.IdKarantina.HasValue) { ac_mstr ac_mstr_karantina = Repoac_mstr.FindByPk(dbitem.IdKarantina); model.IdKaarantina = ac_mstr_karantina.id; model.CodeKaarantina = ac_mstr_karantina.ac_code; model.NamaKaarantina = ac_mstr_karantina.ac_name; } if (dbitem.IdSPSI.HasValue) { ac_mstr ac_mstr_spsi = Repoac_mstr.FindByPk(dbitem.IdSPSI); model.IdSPSI = ac_mstr_spsi.id; model.CodeSPSI = ac_mstr_spsi.ac_code; model.NamaSPSI = ac_mstr_spsi.ac_name; } if (dbitem.IdMultidrop.HasValue) { ac_mstr ac_mstr_multidrop = Repoac_mstr.FindByPk(dbitem.IdMultidrop); model.IdMultidrop = ac_mstr_multidrop.id; model.CodeMultidrop = ac_mstr_multidrop.ac_code; model.NamaMultidrop = ac_mstr_multidrop.ac_name; } if (dbitem.IdTambahanRuteMuat.HasValue) { ac_mstr ac_mstr_tambahan_rute_muat = Repoac_mstr.FindByPk(dbitem.IdTambahanRuteMuat); model.IdRutemuat = ac_mstr_tambahan_rute_muat.id; model.CodeRutemuat = ac_mstr_tambahan_rute_muat.ac_code; model.NamaRutemuat = ac_mstr_tambahan_rute_muat.ac_name; } if (dbitem.IdTambahanRuteLain.HasValue) { ac_mstr ac_mstr_tambahan_rute_lain = Repoac_mstr.FindByPk(dbitem.IdTambahanRuteLain); model.IdRuteLain = ac_mstr_tambahan_rute_lain.id; model.CodeRuteLain = ac_mstr_tambahan_rute_lain.ac_code; model.NamaRuteLain = ac_mstr_tambahan_rute_lain.ac_name; } if (dbitem.IdKasirCash.HasValue) { ac_mstr ac_mstr_kasir_cash = Repoac_mstr.FindByPk(dbitem.IdKasirCash); model.IdOprCash = ac_mstr_kasir_cash.id; model.CodeOprCash = ac_mstr_kasir_cash.ac_code; model.NamaOprCash = ac_mstr_kasir_cash.ac_name; } if (dbitem.IdKasirTf.HasValue) { ac_mstr ac_mstr_kasir_tf = Repoac_mstr.FindByPk(dbitem.IdKasirTf); model.IdOprTf = ac_mstr_kasir_tf.id; model.CodeOprTf = ac_mstr_kasir_tf.ac_code; model.NamaOprTf = ac_mstr_kasir_tf.ac_name; } //credit if (dbitem.IdAUJCredit.HasValue) { ac_mstr ac_credit_auj = Repoac_mstr.FindByPk(dbitem.IdAUJCredit); model.IdCreditAuj = ac_credit_auj.id; model.CodeCreditAuj = ac_credit_auj.ac_code; model.NamaCreditAuj = ac_credit_auj.ac_name; } if (dbitem.IdCashCredit.HasValue) { ac_mstr bk_credit_cash = Repoac_mstr.FindByPk(dbitem.IdCashCredit); model.IdCreditCash = bk_credit_cash.id; model.CodeCreditCash = bk_credit_cash.ac_code; model.NamaCreditCash = bk_credit_cash.ac_name; } if (dbitem.IdTfCredit.HasValue) { ac_mstr bk_credit_tf = Repoac_mstr.FindByPk(dbitem.IdTfCredit); model.IdCreditTf = bk_credit_tf.id; model.CodeCreditTf = bk_credit_tf.ac_code; model.NamaCreditTf = bk_credit_tf.ac_name; } if (dbitem.IdKasbonAuj.HasValue) { ac_mstr kasbon_auj = Repoac_mstr.FindByPk(dbitem.IdKasbonAuj); model.IdKasbonAuj = kasbon_auj.id; model.CodeKasbonAuj = kasbon_auj.ac_code; model.NamaKasbonAuj = kasbon_auj.ac_name; } if (dbitem.IdKlaimAuj.HasValue) { ac_mstr klaim_auj = Repoac_mstr.FindByPk(dbitem.IdKlaimAuj); model.IdKlaimAuj = klaim_auj.id; model.CodeKlaimAuj = klaim_auj.ac_code; model.NamaKlaimAuj = klaim_auj.ac_name; } if (dbitem.IdPotonganLainAuj.HasValue) { ac_mstr potongan_lain_auj = Repoac_mstr.FindByPk(dbitem.IdPotonganLainAuj); model.IdPotonganLainAuj = potongan_lain_auj.id; model.CodePotonganLainAuj = potongan_lain_auj.ac_code; model.NamaPotonganLainAuj = potongan_lain_auj.ac_name; } if (dbitem.IdPiutangCustomer.HasValue) { ac_mstr piutangCustomer = Repoac_mstr.FindByPk(dbitem.IdPiutangCustomer); model.IdPiutangCustomer = piutangCustomer.id; model.CodePiutangCustomer = piutangCustomer.ac_code; model.NamaPiutangCustomer = piutangCustomer.ac_name; } if (dbitem.IdBiayaKlaim.HasValue) { ac_mstr biayaKlaim = Repoac_mstr.FindByPk(dbitem.IdBiayaKlaim); model.IdBiayaKlaim = biayaKlaim.id; model.CodeBiayaKlaim = biayaKlaim.ac_code; model.NamaBiayaKlaim = biayaKlaim.ac_name; } if (dbitem.IdKreditKlaim.HasValue) { ac_mstr kreditKlaim = Repoac_mstr.FindByPk(dbitem.IdKreditKlaim); model.IdKreditKlaim = kreditKlaim.id; model.CodeKreditKlaim = kreditKlaim.ac_code; model.NamaKreditKlaim = kreditKlaim.ac_name; } if (dbitem.IdPiutangDagang.HasValue) { ac_mstr piutangBlmInv = Repoac_mstr.FindByPk(dbitem.IdPiutangDagang); model.IdPiutangBlmInv = piutangBlmInv.id; model.CodePiutangBlmInv = piutangBlmInv.ac_code; model.NamaPiutangBlmInv = piutangBlmInv.ac_name; } if (dbitem.IdPendapatanUsahaBlmInv.HasValue) { ac_mstr penjualanBlmInv = Repoac_mstr.FindByPk(dbitem.IdPendapatanUsahaBlmInv); model.IdPenjualanBlmInv = penjualanBlmInv.id; model.CodePenjualanBlmInv = penjualanBlmInv.ac_code; model.NamaPenjualanBlmInv = penjualanBlmInv.ac_name; } if (dbitem.IdPiutangDailySupir.HasValue) { ac_mstr piutangDailySupir = Repoac_mstr.FindByPk(dbitem.IdPiutangDailySupir); model.IdPiutangDailySupir = piutangDailySupir.id; model.CodePiutangDailySupir = piutangDailySupir.ac_code; model.NamaPiutangDailySupir = piutangDailySupir.ac_name; } if (dbitem.IdKlaimSupir.HasValue) { ac_mstr klaimSupir = Repoac_mstr.FindByPk(dbitem.IdKlaimSupir); model.IdKlaimSupir = klaimSupir.id; model.CodeKlaimSupir = klaimSupir.ac_code; model.NamaKlaimSupir = klaimSupir.ac_name; } } return(View("Form", model)); }
public ActionResult Dynamic(ERPConfig model) { return(RedirectToAction("Edit")); }
private Int64 SaveRecord() { ContactDetails clsDetails = new ContactDetails(); ERPConfig clsERPConfig = new ERPConfig(); BarcodeHelper ean13 = new BarcodeHelper(BarcodeHelper.CustomerCode_Country_Code, BarcodeHelper.CustomerCode_ManufacturerCode, clsERPConfig.get_LastCustomerCode()); clsDetails.ContactCode = ean13.CountryCode + ean13.ManufacturerCode + ean13.ProductCode + ean13.ChecksumDigit; clsERPConfig.CommitAndDispose(); clsDetails.ContactName = txtLastName.Text + ", " + txtFirstName.Text + " " + txtMiddleName.Text; clsDetails.ContactGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value); clsDetails.ModeOfTerms = ModeOfTerms.Months; clsDetails.Terms = 0; clsDetails.Address = txtAddress1.Text + " " + txtAddress2.Text + " " + txtCity.Text + " " + txtState.Text + " " + txtZipCode.Text; clsDetails.BusinessName = txtBusinessName.Text; clsDetails.TelephoneNo = txtBusinessPhoneNo.Text; clsDetails.Remarks = txtRemarks.Text; clsDetails.Debit = 0; clsDetails.Credit = 0; clsDetails.IsCreditAllowed = false; clsDetails.CreditLimit = 0; clsDetails.DepartmentID = Convert.ToInt16(cboDepartment.SelectedItem.Value); clsDetails.PositionID = Convert.ToInt16(cboPosition.SelectedItem.Value); DateTime dteBirthDate = Constants.C_DATE_MIN_VALUE; DateTime dteSpouseBirthDate = Constants.C_DATE_MIN_VALUE; DateTime dteAnniversaryDate = Constants.C_DATE_MIN_VALUE; dteBirthDate = DateTime.TryParse(txtBirthDate.Text, out dteBirthDate) ? dteBirthDate : Constants.C_DATE_MIN_VALUE; dteSpouseBirthDate = DateTime.TryParse(txtSpouseBirthDate.Text, out dteSpouseBirthDate) ? dteSpouseBirthDate : Constants.C_DATE_MIN_VALUE; dteAnniversaryDate = DateTime.TryParse(txtAnniversaryDate.Text, out dteAnniversaryDate) ? dteAnniversaryDate : Constants.C_DATE_MIN_VALUE; ContactAddOnDetails clsAddOnDetails = new ContactAddOnDetails(); clsAddOnDetails.ContactID = clsDetails.ContactID; clsAddOnDetails.Salutation = cboSalutation.SelectedItem.Value; clsAddOnDetails.FirstName = txtFirstName.Text; clsAddOnDetails.MiddleName = txtMiddleName.Text; clsAddOnDetails.LastName = txtLastName.Text; clsAddOnDetails.SpouseName = txtSpouseName.Text; clsAddOnDetails.BirthDate = dteBirthDate; clsAddOnDetails.SpouseBirthDate = dteSpouseBirthDate; clsAddOnDetails.AnniversaryDate = dteAnniversaryDate; clsAddOnDetails.Address1 = txtAddress1.Text; clsAddOnDetails.Address2 = txtAddress2.Text; clsAddOnDetails.City = txtCity.Text; clsAddOnDetails.State = txtState.Text; clsAddOnDetails.ZipCode = txtZipCode.Text; clsAddOnDetails.CountryID = int.Parse(cboCountry.SelectedItem.Value); clsAddOnDetails.CountryCode = cboCountry.SelectedItem.Text; clsAddOnDetails.BusinessPhoneNo = txtBusinessPhoneNo.Text; clsAddOnDetails.HomePhoneNo = txtHomePhoneNo.Text; clsAddOnDetails.MobileNo = txtMobileNo.Text; clsAddOnDetails.FaxNo = txtFaxNo.Text; clsAddOnDetails.EmailAddress = txtEmailAddress.Text; clsDetails.AdditionalDetails = clsAddOnDetails; Contacts clsContact = new Contacts(); Int64 id = clsContact.Insert(clsDetails); clsContact.CommitAndDispose(); return(id); }