private Int64 Insert(ContactAddOnDetails Details) { try { Save(Details); string SQL = "SELECT LAST_INSERT_ID();"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); Int64 iID = 0; while (myReader.Read()) { iID = myReader.GetInt64(0); } myReader.Close(); return iID; } catch (Exception ex) { throw base.ThrowException(ex); } }
private Int64 Insert(ContactAddOnDetails Details) { try { Save(Details); string SQL = "SELECT LAST_INSERT_ID();"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); Int64 iID = 0; while (myReader.Read()) { iID = myReader.GetInt64(0); } myReader.Close(); return(iID); } catch (Exception ex) { throw base.ThrowException(ex); } }
private void Update(ContactAddOnDetails Details) { try { Save(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
public ContactAddOnDetails Details(long ContactID) { try { System.Data.DataTable dt = ListAsDataTable(ContactID); ContactAddOnDetails clsContactAddOnDetails = setDetails(dt); return(clsContactAddOnDetails); } catch (Exception ex) { throw base.ThrowException(ex); } }
//public void Save(ContactAddOnDetails Details) //{ // if (isExist(Details.ContactID) && Details.ContactID != 0) // { // Update(Details); // } // else if (Details.ContactID != 0) // { // Insert(Details); // } //} public Int32 Save(ContactAddOnDetails Details) { try { string SQL = "CALL procSaveContactAddOn(@ContactDetailID, @ContactID, @Salutation, @FirstName, @MiddleName, @LastName," + "@SpouseName, @BirthDate, @SpouseBirthDate, @AnniversaryDate, @Address1, @Address2," + "@City, @State, @ZipCode, @CountryID, @BusinessphoneNo, @HomephoneNo, @MobileNo," + "@FaxNo, @EmailAddress, @Sex, @AttendingPhysician, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("ContactDetailID", Details.ContactDetailID); cmd.Parameters.AddWithValue("ContactID", Details.ContactID); cmd.Parameters.AddWithValue("Salutation", Details.Salutation); cmd.Parameters.AddWithValue("FirstName", Details.FirstName); cmd.Parameters.AddWithValue("MiddleName", Details.MiddleName); cmd.Parameters.AddWithValue("LastName", Details.LastName); cmd.Parameters.AddWithValue("SpouseName", Details.SpouseName); cmd.Parameters.AddWithValue("BirthDate", Details.BirthDate); cmd.Parameters.AddWithValue("SpouseBirthDate", Details.SpouseBirthDate); cmd.Parameters.AddWithValue("AnniversaryDate", Details.AnniversaryDate); cmd.Parameters.AddWithValue("Address1", Details.Address1); cmd.Parameters.AddWithValue("Address2", Details.Address2); cmd.Parameters.AddWithValue("City", Details.City); cmd.Parameters.AddWithValue("State", Details.State); cmd.Parameters.AddWithValue("ZipCode", Details.ZipCode); cmd.Parameters.AddWithValue("CountryID", Details.CountryID); cmd.Parameters.AddWithValue("BusinessPhoneNo", Details.BusinessPhoneNo); cmd.Parameters.AddWithValue("HomePhoneNo", Details.HomePhoneNo); cmd.Parameters.AddWithValue("MobileNo", Details.MobileNo); cmd.Parameters.AddWithValue("FaxNo", Details.FaxNo); cmd.Parameters.AddWithValue("EmailAddress", Details.EmailAddress); cmd.Parameters.AddWithValue("Sex", Details.Sex); cmd.Parameters.AddWithValue("AttendingPhysician", Details.AttendingPhysician); cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn); cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified); return(base.ExecuteNonQuery(cmd)); } catch (Exception ex) { throw base.ThrowException(ex); } }
private ContactAddOnDetails setDetails(System.Data.DataTable dt) { ContactAddOnDetails Details = new ContactAddOnDetails(); try { foreach (System.Data.DataRow dr in dt.Rows) { Details.ContactID = Int64.Parse(dr["ContactID"].ToString()); Details.Salutation = "" + dr["Salutation"].ToString(); Details.FirstName = "" + dr["FirstName"].ToString(); Details.MiddleName = "" + dr["MiddleName"].ToString(); Details.LastName = "" + dr["LastName"].ToString(); Details.SpouseName = "" + dr["SpouseName"].ToString(); Details.BirthDate = DateTime.Parse(dr["BirthDate"].ToString()); Details.SpouseBirthDate = DateTime.Parse(dr["SpouseBirthDate"].ToString()); Details.AnniversaryDate = DateTime.Parse(dr["AnniversaryDate"].ToString()); Details.Address1 = "" + dr["Address1"].ToString(); Details.Address2 = "" + dr["Address2"].ToString(); Details.City = "" + dr["City"].ToString(); Details.State = "" + dr["State"].ToString(); Details.ZipCode = "" + dr["ZipCode"].ToString(); Details.CountryID = Int32.Parse(dr["CountryID"].ToString()); Details.CountryCode = "" + dr["CountryName"].ToString(); Details.BusinessPhoneNo = "" + dr["BusinessPhoneNo"].ToString(); Details.HomePhoneNo = "" + dr["HomePhoneNo"].ToString(); Details.MobileNo = "" + dr["MobileNo"].ToString(); Details.FaxNo = "" + dr["FaxNo"].ToString(); Details.EmailAddress = "" + dr["EmailAddress"].ToString(); Details.Sex = (Sex)Enum.Parse(typeof(Sex), dr["Sex"].ToString()); Details.AttendingPhysician = "" + dr["AttendingPhysician"].ToString(); } } catch (Exception ex) { throw base.ThrowException(ex); } return(Details); }
private void SaveRecord() { Contacts clsContact = new Contacts(); ContactDetails clsDetails = new ContactDetails(); clsDetails.ContactID = Convert.ToInt32(lblContactID.Text); clsDetails.ContactCode = lblCustomerCode.Text; 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; clsContact.Update(clsDetails); clsContact.CommitAndDispose(); }
private void SaveRecord() { Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"]; Contacts clsContact = new Contacts(); ContactDetails clsDetails = new ContactDetails(); clsDetails.ContactID = Convert.ToInt32(lblContactID.Text); clsDetails.ContactCode = txtContactCode.Text; clsDetails.ContactName = txtLastName.Text + ", " + txtFirstName.Text + " " + txtMiddleName.Text; clsDetails.ContactGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value); clsDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), cboModeOfTerms.SelectedItem.Value); clsDetails.Terms = Convert.ToInt32(txtTerms.Text); clsDetails.Address = txtAddress.Text; clsDetails.BusinessName = txtBusinessName.Text; clsDetails.TelephoneNo = txtTelephoneNo.Text; clsDetails.Remarks = txtRemarks.Text; clsDetails.Debit = Convert.ToDecimal(txtDebit.Text); clsDetails.Credit = Convert.ToDecimal(txtCredit.Text); clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked; clsDetails.CreditLimit = Convert.ToDecimal(txtCreditLimit.Text); clsDetails.DepartmentID = Convert.ToInt16(cboDepartment.SelectedItem.Value); clsDetails.PositionID = Convert.ToInt16(cboPosition.SelectedItem.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 = ""; DateTime dteBirthDate = Constants.C_DATE_MIN_VALUE; dteBirthDate = DateTime.TryParse(txtBirthDate.Text, out dteBirthDate) ? dteBirthDate : Constants.C_DATE_MIN_VALUE; clsAddOnDetails.BirthDate = dteBirthDate; clsAddOnDetails.SpouseBirthDate = Constants.C_DATE_MIN_VALUE; clsAddOnDetails.AnniversaryDate = Constants.C_DATE_MIN_VALUE; clsAddOnDetails.Address1 = txtAddress.Text; clsAddOnDetails.Address2 = string.Empty; clsAddOnDetails.City = string.Empty; clsAddOnDetails.State = string.Empty; clsAddOnDetails.ZipCode = string.Empty; clsAddOnDetails.CountryID = Constants.C_DEF_COUNTRY_ID; clsAddOnDetails.CountryCode = Constants.C_DEF_COUNTRY_CODE; clsAddOnDetails.BusinessPhoneNo = txtTelephoneNo.Text; clsAddOnDetails.HomePhoneNo = string.Empty; clsAddOnDetails.MobileNo = txtMobileNo.Text; clsAddOnDetails.FaxNo = string.Empty; clsAddOnDetails.EmailAddress = string.Empty; clsDetails.AdditionalDetails = clsAddOnDetails; clsContact.Update(clsDetails); clsContact.CommitAndDispose(); }
private Int64 SaveRecord() { ContactDetails clsDetails = new ContactDetails(); clsDetails.ContactCode = txtContactCode.Text; clsDetails.ContactName = txtLastName.Text + ", " + txtFirstName.Text + " " + txtMiddleName.Text; clsDetails.ContactGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value); clsDetails.ModeOfTerms = ModeOfTerms.Days; clsDetails.Terms = Convert.ToInt32("0"); clsDetails.Address = txtAddress.Text; clsDetails.BusinessName = txtBusinessName.Text; clsDetails.TelephoneNo = txtTelephoneNo.Text; clsDetails.Remarks = txtRemarks.Text; clsDetails.Debit = Convert.ToDecimal("0"); clsDetails.Credit = Convert.ToDecimal("0"); clsDetails.IsCreditAllowed = true; clsDetails.CreditLimit = Convert.ToDecimal(0); clsDetails.DepartmentID = Convert.ToInt16(cboDepartment.SelectedItem.Value); clsDetails.PositionID = Convert.ToInt16(cboPosition.SelectedItem.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 = ""; DateTime dteBirthDate = Constants.C_DATE_MIN_VALUE; dteBirthDate = DateTime.TryParse(txtBirthDate.Text, out dteBirthDate) ? dteBirthDate : Constants.C_DATE_MIN_VALUE; clsAddOnDetails.BirthDate = dteBirthDate; clsAddOnDetails.SpouseBirthDate = Constants.C_DATE_MIN_VALUE; clsAddOnDetails.AnniversaryDate = Constants.C_DATE_MIN_VALUE; clsAddOnDetails.Address1 = txtAddress.Text; clsAddOnDetails.Address2 = string.Empty; clsAddOnDetails.City = string.Empty; clsAddOnDetails.State = string.Empty; clsAddOnDetails.ZipCode = string.Empty; clsAddOnDetails.CountryID = Constants.C_DEF_COUNTRY_ID; clsAddOnDetails.CountryCode = Constants.C_DEF_COUNTRY_CODE; clsAddOnDetails.BusinessPhoneNo = txtTelephoneNo.Text; clsAddOnDetails.HomePhoneNo = string.Empty; clsAddOnDetails.MobileNo = txtMobileNo.Text; clsAddOnDetails.FaxNo = string.Empty; clsAddOnDetails.EmailAddress = string.Empty; clsDetails.AdditionalDetails = clsAddOnDetails; Contacts clsContact = new Contacts(); Int64 id = clsContact.Insert(clsDetails); clsContact.CommitAndDispose(); return id; }
private ContactAddOnDetails setDetails(System.Data.DataTable dt) { ContactAddOnDetails Details = new ContactAddOnDetails(); try { foreach(System.Data.DataRow dr in dt.Rows) { Details.ContactID = Int64.Parse(dr["ContactID"].ToString()); Details.Salutation = "" + dr["Salutation"].ToString(); Details.FirstName = "" + dr["FirstName"].ToString(); Details.MiddleName = "" + dr["MiddleName"].ToString(); Details.LastName = "" + dr["LastName"].ToString(); Details.SpouseName = "" + dr["SpouseName"].ToString(); Details.BirthDate = DateTime.Parse(dr["BirthDate"].ToString()); Details.SpouseBirthDate = DateTime.Parse(dr["SpouseBirthDate"].ToString()); Details.AnniversaryDate = DateTime.Parse(dr["AnniversaryDate"].ToString()); Details.Address1 = "" + dr["Address1"].ToString(); Details.Address2 = "" + dr["Address2"].ToString(); Details.City = "" + dr["City"].ToString(); Details.State = "" + dr["State"].ToString(); Details.ZipCode = "" + dr["ZipCode"].ToString(); Details.CountryID = Int32.Parse(dr["CountryID"].ToString()); Details.CountryCode = "" + dr["CountryName"].ToString(); Details.BusinessPhoneNo = "" + dr["BusinessPhoneNo"].ToString(); Details.HomePhoneNo = "" + dr["HomePhoneNo"].ToString(); Details.MobileNo = "" + dr["MobileNo"].ToString(); Details.FaxNo = "" + dr["FaxNo"].ToString(); Details.EmailAddress = "" + dr["EmailAddress"].ToString(); Details.Sex = (Sex) Enum.Parse(typeof(Sex), dr["Sex"].ToString()); Details.AttendingPhysician = "" + dr["AttendingPhysician"].ToString(); } } catch (Exception ex) { throw base.ThrowException(ex); } return Details; }
//public void Save(ContactAddOnDetails Details) //{ // if (isExist(Details.ContactID) && Details.ContactID != 0) // { // Update(Details); // } // else if (Details.ContactID != 0) // { // Insert(Details); // } //} public Int32 Save(ContactAddOnDetails Details) { try { string SQL = "CALL procSaveContactAddOn(@ContactDetailID, @ContactID, @Salutation, @FirstName, @MiddleName, @LastName," + "@SpouseName, @BirthDate, @SpouseBirthDate, @AnniversaryDate, @Address1, @Address2," + "@City, @State, @ZipCode, @CountryID, @BusinessphoneNo, @HomephoneNo, @MobileNo," + "@FaxNo, @EmailAddress, @Sex, @AttendingPhysician, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("ContactDetailID", Details.ContactDetailID); cmd.Parameters.AddWithValue("ContactID", Details.ContactID); cmd.Parameters.AddWithValue("Salutation", Details.Salutation); cmd.Parameters.AddWithValue("FirstName", Details.FirstName); cmd.Parameters.AddWithValue("MiddleName", Details.MiddleName); cmd.Parameters.AddWithValue("LastName", Details.LastName); cmd.Parameters.AddWithValue("SpouseName", Details.SpouseName); cmd.Parameters.AddWithValue("BirthDate", Details.BirthDate); cmd.Parameters.AddWithValue("SpouseBirthDate", Details.SpouseBirthDate); cmd.Parameters.AddWithValue("AnniversaryDate", Details.AnniversaryDate); cmd.Parameters.AddWithValue("Address1", Details.Address1); cmd.Parameters.AddWithValue("Address2", Details.Address2); cmd.Parameters.AddWithValue("City", Details.City); cmd.Parameters.AddWithValue("State", Details.State); cmd.Parameters.AddWithValue("ZipCode", Details.ZipCode); cmd.Parameters.AddWithValue("CountryID", Details.CountryID); cmd.Parameters.AddWithValue("BusinessPhoneNo", Details.BusinessPhoneNo); cmd.Parameters.AddWithValue("HomePhoneNo", Details.HomePhoneNo); cmd.Parameters.AddWithValue("MobileNo", Details.MobileNo); cmd.Parameters.AddWithValue("FaxNo", Details.FaxNo); cmd.Parameters.AddWithValue("EmailAddress", Details.EmailAddress); cmd.Parameters.AddWithValue("Sex", Details.Sex); cmd.Parameters.AddWithValue("AttendingPhysician", Details.AttendingPhysician); cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn); cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified); return base.ExecuteNonQuery(cmd); } catch (Exception ex) { throw base.ThrowException(ex); } }
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; }