private void UpdateRecord() { dbo_ProspectiveBuyerClass oclsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); oclsdbo_ProspectiveBuyer.ProspectiveBuyerKey = System.Convert.ToInt32(Session["ProspectiveBuyerKey"]); oclsdbo_ProspectiveBuyer = dbo_ProspectiveBuyerDataClass.Select_Record(oclsdbo_ProspectiveBuyer); if (VerifyData() == true) { SetData(clsdbo_ProspectiveBuyer); bool bSucess = false; bSucess = dbo_ProspectiveBuyerDataClass.Update(oclsdbo_ProspectiveBuyer, clsdbo_ProspectiveBuyer); if (bSucess == true) { pnlForm.Visible = false; pnlSave.Visible = false; pnlGrid.Visible = true; lblMode.InnerText = ""; Session.Remove("dvdbo_ProspectiveBuyer"); LoadGriddbo_ProspectiveBuyer(); } else { ec.ShowMessage(" Update failed. ", " Dbo. Prospective Buyer "); } } }
private void Edit() { try { dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); Label lblProspectiveBuyerKey = (Label)grddbo_ProspectiveBuyer.Rows[grddbo_ProspectiveBuyer.EditIndex].FindControl("lblProspectiveBuyerKey"); clsdbo_ProspectiveBuyer.ProspectiveBuyerKey = System.Convert.ToInt32(lblProspectiveBuyerKey.Text); clsdbo_ProspectiveBuyer = dbo_ProspectiveBuyerDataClass.Select_Record(clsdbo_ProspectiveBuyer); LoadGriddbo_ProspectiveBuyer(); } catch { } }
private void DeleteRecord() { dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); Label lblProspectiveBuyerKey = (Label)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("lblProspectiveBuyerKey"); clsdbo_ProspectiveBuyer.ProspectiveBuyerKey = System.Convert.ToInt32(lblProspectiveBuyerKey.Text); clsdbo_ProspectiveBuyer = dbo_ProspectiveBuyerDataClass.Select_Record(clsdbo_ProspectiveBuyer); bool bSucess = false; bSucess = dbo_ProspectiveBuyerDataClass.Delete(clsdbo_ProspectiveBuyer); if (bSucess == true) { Session.Remove("dvdbo_ProspectiveBuyer"); LoadGriddbo_ProspectiveBuyer(); } else { ec.ShowMessage(" Delete failed. ", " Dbo. Prospective Buyer "); } }
private void InsertRecord() { dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); if (VerifyData() == true) { SetData(clsdbo_ProspectiveBuyer); bool bSucess = false; bSucess = dbo_ProspectiveBuyerDataClass.Add(clsdbo_ProspectiveBuyer); if (bSucess == true) { pnlForm.Visible = false; pnlSave.Visible = false; pnlGrid.Visible = true; lblMode.InnerText = ""; Session.Remove("dvdbo_ProspectiveBuyer"); LoadGriddbo_ProspectiveBuyer(); } else { ec.ShowMessage(" Insert failed. ", " Dbo. Prospective Buyer "); } } }
private void SetData(dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer) { if (string.IsNullOrEmpty(txtProspectAlternateKey.Text)) { clsdbo_ProspectiveBuyer.ProspectAlternateKey = null; } else { clsdbo_ProspectiveBuyer.ProspectAlternateKey = txtProspectAlternateKey.Text; } if (string.IsNullOrEmpty(txtFirstName.Text)) { clsdbo_ProspectiveBuyer.FirstName = null; } else { clsdbo_ProspectiveBuyer.FirstName = txtFirstName.Text; } if (string.IsNullOrEmpty(txtMiddleName.Text)) { clsdbo_ProspectiveBuyer.MiddleName = null; } else { clsdbo_ProspectiveBuyer.MiddleName = txtMiddleName.Text; } if (string.IsNullOrEmpty(txtLastName.Text)) { clsdbo_ProspectiveBuyer.LastName = null; } else { clsdbo_ProspectiveBuyer.LastName = txtLastName.Text; } if (string.IsNullOrEmpty(txtBirthDate.Text)) { clsdbo_ProspectiveBuyer.BirthDate = null; } else { clsdbo_ProspectiveBuyer.BirthDate = System.Convert.ToDateTime(txtBirthDate.Text); } if (string.IsNullOrEmpty(txtMaritalStatus.Text)) { clsdbo_ProspectiveBuyer.MaritalStatus = null; } else { clsdbo_ProspectiveBuyer.MaritalStatus = txtMaritalStatus.Text; } if (string.IsNullOrEmpty(txtGender.Text)) { clsdbo_ProspectiveBuyer.Gender = null; } else { clsdbo_ProspectiveBuyer.Gender = txtGender.Text; } if (string.IsNullOrEmpty(txtEmailAddress.Text)) { clsdbo_ProspectiveBuyer.EmailAddress = null; } else { clsdbo_ProspectiveBuyer.EmailAddress = txtEmailAddress.Text; } if (string.IsNullOrEmpty(txtYearlyIncome.Text)) { clsdbo_ProspectiveBuyer.YearlyIncome = null; } else { clsdbo_ProspectiveBuyer.YearlyIncome = System.Convert.ToDecimal(txtYearlyIncome.Text); } if (string.IsNullOrEmpty(txtTotalChildren.Text)) { clsdbo_ProspectiveBuyer.TotalChildren = null; } else { clsdbo_ProspectiveBuyer.TotalChildren = System.Convert.ToByte(txtTotalChildren.Text); } if (string.IsNullOrEmpty(txtNumberChildrenAtHome.Text)) { clsdbo_ProspectiveBuyer.NumberChildrenAtHome = null; } else { clsdbo_ProspectiveBuyer.NumberChildrenAtHome = System.Convert.ToByte(txtNumberChildrenAtHome.Text); } if (string.IsNullOrEmpty(txtEducation.Text)) { clsdbo_ProspectiveBuyer.Education = null; } else { clsdbo_ProspectiveBuyer.Education = txtEducation.Text; } if (string.IsNullOrEmpty(txtOccupation.Text)) { clsdbo_ProspectiveBuyer.Occupation = null; } else { clsdbo_ProspectiveBuyer.Occupation = txtOccupation.Text; } if (string.IsNullOrEmpty(txtHouseOwnerFlag.Text)) { clsdbo_ProspectiveBuyer.HouseOwnerFlag = null; } else { clsdbo_ProspectiveBuyer.HouseOwnerFlag = txtHouseOwnerFlag.Text; } if (string.IsNullOrEmpty(txtNumberCarsOwned.Text)) { clsdbo_ProspectiveBuyer.NumberCarsOwned = null; } else { clsdbo_ProspectiveBuyer.NumberCarsOwned = System.Convert.ToByte(txtNumberCarsOwned.Text); } if (string.IsNullOrEmpty(txtAddressLine1.Text)) { clsdbo_ProspectiveBuyer.AddressLine1 = null; } else { clsdbo_ProspectiveBuyer.AddressLine1 = txtAddressLine1.Text; } if (string.IsNullOrEmpty(txtAddressLine2.Text)) { clsdbo_ProspectiveBuyer.AddressLine2 = null; } else { clsdbo_ProspectiveBuyer.AddressLine2 = txtAddressLine2.Text; } if (string.IsNullOrEmpty(txtCity.Text)) { clsdbo_ProspectiveBuyer.City = null; } else { clsdbo_ProspectiveBuyer.City = txtCity.Text; } if (string.IsNullOrEmpty(txtStateProvinceCode.Text)) { clsdbo_ProspectiveBuyer.StateProvinceCode = null; } else { clsdbo_ProspectiveBuyer.StateProvinceCode = txtStateProvinceCode.Text; } if (string.IsNullOrEmpty(txtPostalCode.Text)) { clsdbo_ProspectiveBuyer.PostalCode = null; } else { clsdbo_ProspectiveBuyer.PostalCode = txtPostalCode.Text; } if (string.IsNullOrEmpty(txtPhone.Text)) { clsdbo_ProspectiveBuyer.Phone = null; } else { clsdbo_ProspectiveBuyer.Phone = txtPhone.Text; } if (string.IsNullOrEmpty(txtSalutation.Text)) { clsdbo_ProspectiveBuyer.Salutation = null; } else { clsdbo_ProspectiveBuyer.Salutation = txtSalutation.Text; } if (string.IsNullOrEmpty(txtUnknown.Text)) { clsdbo_ProspectiveBuyer.Unknown = null; } else { clsdbo_ProspectiveBuyer.Unknown = System.Convert.ToInt32(txtUnknown.Text); } }
private void GetData() { ClearRecord(); dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); clsdbo_ProspectiveBuyer.ProspectiveBuyerKey = System.Convert.ToInt32(Session["ProspectiveBuyerKey"]); clsdbo_ProspectiveBuyer = dbo_ProspectiveBuyerDataClass.Select_Record(clsdbo_ProspectiveBuyer); if ((clsdbo_ProspectiveBuyer != null)) { try { txtProspectiveBuyerKey.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.ProspectiveBuyerKey); if (clsdbo_ProspectiveBuyer.ProspectAlternateKey == null) { txtProspectAlternateKey.Text = default(string); } else { txtProspectAlternateKey.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.ProspectAlternateKey); } if (clsdbo_ProspectiveBuyer.FirstName == null) { txtFirstName.Text = default(string); } else { txtFirstName.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.FirstName); } if (clsdbo_ProspectiveBuyer.MiddleName == null) { txtMiddleName.Text = default(string); } else { txtMiddleName.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.MiddleName); } if (clsdbo_ProspectiveBuyer.LastName == null) { txtLastName.Text = default(string); } else { txtLastName.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.LastName); } if (clsdbo_ProspectiveBuyer.BirthDate == null) { txtBirthDate.Text = DateTime.Now.ToString(); } else { txtBirthDate.Text = System.Convert.ToDateTime(clsdbo_ProspectiveBuyer.BirthDate).ToShortDateString(); } if (clsdbo_ProspectiveBuyer.MaritalStatus == null) { txtMaritalStatus.Text = default(string); } else { txtMaritalStatus.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.MaritalStatus); } if (clsdbo_ProspectiveBuyer.Gender == null) { txtGender.Text = default(string); } else { txtGender.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.Gender); } if (clsdbo_ProspectiveBuyer.EmailAddress == null) { txtEmailAddress.Text = default(string); } else { txtEmailAddress.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.EmailAddress); } if (clsdbo_ProspectiveBuyer.YearlyIncome == null) { txtYearlyIncome.Text = default(string); } else { txtYearlyIncome.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.YearlyIncome); } if (clsdbo_ProspectiveBuyer.TotalChildren == null) { txtTotalChildren.Text = default(string); } else { txtTotalChildren.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.TotalChildren); } if (clsdbo_ProspectiveBuyer.NumberChildrenAtHome == null) { txtNumberChildrenAtHome.Text = default(string); } else { txtNumberChildrenAtHome.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.NumberChildrenAtHome); } if (clsdbo_ProspectiveBuyer.Education == null) { txtEducation.Text = default(string); } else { txtEducation.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.Education); } if (clsdbo_ProspectiveBuyer.Occupation == null) { txtOccupation.Text = default(string); } else { txtOccupation.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.Occupation); } if (clsdbo_ProspectiveBuyer.HouseOwnerFlag == null) { txtHouseOwnerFlag.Text = default(string); } else { txtHouseOwnerFlag.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.HouseOwnerFlag); } if (clsdbo_ProspectiveBuyer.NumberCarsOwned == null) { txtNumberCarsOwned.Text = default(string); } else { txtNumberCarsOwned.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.NumberCarsOwned); } if (clsdbo_ProspectiveBuyer.AddressLine1 == null) { txtAddressLine1.Text = default(string); } else { txtAddressLine1.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.AddressLine1); } if (clsdbo_ProspectiveBuyer.AddressLine2 == null) { txtAddressLine2.Text = default(string); } else { txtAddressLine2.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.AddressLine2); } if (clsdbo_ProspectiveBuyer.City == null) { txtCity.Text = default(string); } else { txtCity.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.City); } if (clsdbo_ProspectiveBuyer.StateProvinceCode == null) { txtStateProvinceCode.Text = default(string); } else { txtStateProvinceCode.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.StateProvinceCode); } if (clsdbo_ProspectiveBuyer.PostalCode == null) { txtPostalCode.Text = default(string); } else { txtPostalCode.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.PostalCode); } if (clsdbo_ProspectiveBuyer.Phone == null) { txtPhone.Text = default(string); } else { txtPhone.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.Phone); } if (clsdbo_ProspectiveBuyer.Salutation == null) { txtSalutation.Text = default(string); } else { txtSalutation.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.Salutation); } if (clsdbo_ProspectiveBuyer.Unknown == null) { txtUnknown.Text = default(string); } else { txtUnknown.Text = System.Convert.ToString(clsdbo_ProspectiveBuyer.Unknown); } } catch (Exception ex) { ec.ShowMessage(ex.Message, " Dbo. Prospective Buyer "); } } }
private void UpdateRecord() { try { TextBox txtProspectiveBuyerKey = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtProspectiveBuyerKey"); TextBox txtProspectAlternateKey = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtProspectAlternateKey"); TextBox txtFirstName = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtFirstName"); TextBox txtMiddleName = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtMiddleName"); TextBox txtLastName = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtLastName"); TextBox txtBirthDate = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtBirthDate"); TextBox txtMaritalStatus = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtMaritalStatus"); TextBox txtGender = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtGender"); TextBox txtEmailAddress = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtEmailAddress"); TextBox txtYearlyIncome = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtYearlyIncome"); TextBox txtTotalChildren = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtTotalChildren"); TextBox txtNumberChildrenAtHome = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtNumberChildrenAtHome"); TextBox txtEducation = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtEducation"); TextBox txtOccupation = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtOccupation"); TextBox txtHouseOwnerFlag = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtHouseOwnerFlag"); TextBox txtNumberCarsOwned = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtNumberCarsOwned"); TextBox txtAddressLine1 = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtAddressLine1"); TextBox txtAddressLine2 = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtAddressLine2"); TextBox txtCity = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtCity"); TextBox txtStateProvinceCode = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtStateProvinceCode"); TextBox txtPostalCode = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtPostalCode"); TextBox txtPhone = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtPhone"); TextBox txtSalutation = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtSalutation"); TextBox txtUnknown = (TextBox)grddbo_ProspectiveBuyer.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtUnknown"); dbo_ProspectiveBuyerClass oclsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); oclsdbo_ProspectiveBuyer.ProspectiveBuyerKey = System.Convert.ToInt32(txtProspectiveBuyerKey.Text); oclsdbo_ProspectiveBuyer = dbo_ProspectiveBuyerDataClass.Select_Record(oclsdbo_ProspectiveBuyer); if (VerifyData() == true) { if (string.IsNullOrEmpty(txtProspectAlternateKey.Text)) { clsdbo_ProspectiveBuyer.ProspectAlternateKey = null; } else { clsdbo_ProspectiveBuyer.ProspectAlternateKey = txtProspectAlternateKey.Text; } if (string.IsNullOrEmpty(txtFirstName.Text)) { clsdbo_ProspectiveBuyer.FirstName = null; } else { clsdbo_ProspectiveBuyer.FirstName = txtFirstName.Text; } if (string.IsNullOrEmpty(txtMiddleName.Text)) { clsdbo_ProspectiveBuyer.MiddleName = null; } else { clsdbo_ProspectiveBuyer.MiddleName = txtMiddleName.Text; } if (string.IsNullOrEmpty(txtLastName.Text)) { clsdbo_ProspectiveBuyer.LastName = null; } else { clsdbo_ProspectiveBuyer.LastName = txtLastName.Text; } if (string.IsNullOrEmpty(txtBirthDate.Text)) { clsdbo_ProspectiveBuyer.BirthDate = null; } else { clsdbo_ProspectiveBuyer.BirthDate = System.Convert.ToDateTime(txtBirthDate.Text); } if (string.IsNullOrEmpty(txtMaritalStatus.Text)) { clsdbo_ProspectiveBuyer.MaritalStatus = null; } else { clsdbo_ProspectiveBuyer.MaritalStatus = txtMaritalStatus.Text; } if (string.IsNullOrEmpty(txtGender.Text)) { clsdbo_ProspectiveBuyer.Gender = null; } else { clsdbo_ProspectiveBuyer.Gender = txtGender.Text; } if (string.IsNullOrEmpty(txtEmailAddress.Text)) { clsdbo_ProspectiveBuyer.EmailAddress = null; } else { clsdbo_ProspectiveBuyer.EmailAddress = txtEmailAddress.Text; } if (string.IsNullOrEmpty(txtYearlyIncome.Text)) { clsdbo_ProspectiveBuyer.YearlyIncome = null; } else { clsdbo_ProspectiveBuyer.YearlyIncome = System.Convert.ToDecimal(txtYearlyIncome.Text); } if (string.IsNullOrEmpty(txtTotalChildren.Text)) { clsdbo_ProspectiveBuyer.TotalChildren = null; } else { clsdbo_ProspectiveBuyer.TotalChildren = System.Convert.ToByte(txtTotalChildren.Text); } if (string.IsNullOrEmpty(txtNumberChildrenAtHome.Text)) { clsdbo_ProspectiveBuyer.NumberChildrenAtHome = null; } else { clsdbo_ProspectiveBuyer.NumberChildrenAtHome = System.Convert.ToByte(txtNumberChildrenAtHome.Text); } if (string.IsNullOrEmpty(txtEducation.Text)) { clsdbo_ProspectiveBuyer.Education = null; } else { clsdbo_ProspectiveBuyer.Education = txtEducation.Text; } if (string.IsNullOrEmpty(txtOccupation.Text)) { clsdbo_ProspectiveBuyer.Occupation = null; } else { clsdbo_ProspectiveBuyer.Occupation = txtOccupation.Text; } if (string.IsNullOrEmpty(txtHouseOwnerFlag.Text)) { clsdbo_ProspectiveBuyer.HouseOwnerFlag = null; } else { clsdbo_ProspectiveBuyer.HouseOwnerFlag = txtHouseOwnerFlag.Text; } if (string.IsNullOrEmpty(txtNumberCarsOwned.Text)) { clsdbo_ProspectiveBuyer.NumberCarsOwned = null; } else { clsdbo_ProspectiveBuyer.NumberCarsOwned = System.Convert.ToByte(txtNumberCarsOwned.Text); } if (string.IsNullOrEmpty(txtAddressLine1.Text)) { clsdbo_ProspectiveBuyer.AddressLine1 = null; } else { clsdbo_ProspectiveBuyer.AddressLine1 = txtAddressLine1.Text; } if (string.IsNullOrEmpty(txtAddressLine2.Text)) { clsdbo_ProspectiveBuyer.AddressLine2 = null; } else { clsdbo_ProspectiveBuyer.AddressLine2 = txtAddressLine2.Text; } if (string.IsNullOrEmpty(txtCity.Text)) { clsdbo_ProspectiveBuyer.City = null; } else { clsdbo_ProspectiveBuyer.City = txtCity.Text; } if (string.IsNullOrEmpty(txtStateProvinceCode.Text)) { clsdbo_ProspectiveBuyer.StateProvinceCode = null; } else { clsdbo_ProspectiveBuyer.StateProvinceCode = txtStateProvinceCode.Text; } if (string.IsNullOrEmpty(txtPostalCode.Text)) { clsdbo_ProspectiveBuyer.PostalCode = null; } else { clsdbo_ProspectiveBuyer.PostalCode = txtPostalCode.Text; } if (string.IsNullOrEmpty(txtPhone.Text)) { clsdbo_ProspectiveBuyer.Phone = null; } else { clsdbo_ProspectiveBuyer.Phone = txtPhone.Text; } if (string.IsNullOrEmpty(txtSalutation.Text)) { clsdbo_ProspectiveBuyer.Salutation = null; } else { clsdbo_ProspectiveBuyer.Salutation = txtSalutation.Text; } if (string.IsNullOrEmpty(txtUnknown.Text)) { clsdbo_ProspectiveBuyer.Unknown = null; } else { clsdbo_ProspectiveBuyer.Unknown = System.Convert.ToInt32(txtUnknown.Text); } bool bSucess = false; bSucess = dbo_ProspectiveBuyerDataClass.Update(oclsdbo_ProspectiveBuyer, clsdbo_ProspectiveBuyer); if (bSucess == true) { Session.Remove("dvdbo_ProspectiveBuyer"); grddbo_ProspectiveBuyer.EditIndex = -1; LoadGriddbo_ProspectiveBuyer(); } else { ec.ShowMessage(" Update failed. ", " Dbo. Prospective Buyer "); } } } catch { } }
private void InsertRecord() { try { TextBox txtNewProspectAlternateKey = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewProspectAlternateKey"); TextBox txtNewFirstName = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewFirstName"); TextBox txtNewMiddleName = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewMiddleName"); TextBox txtNewLastName = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewLastName"); TextBox txtNewBirthDate = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewBirthDate"); TextBox txtNewMaritalStatus = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewMaritalStatus"); TextBox txtNewGender = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewGender"); TextBox txtNewEmailAddress = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewEmailAddress"); TextBox txtNewYearlyIncome = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewYearlyIncome"); TextBox txtNewTotalChildren = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewTotalChildren"); TextBox txtNewNumberChildrenAtHome = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewNumberChildrenAtHome"); TextBox txtNewEducation = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewEducation"); TextBox txtNewOccupation = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewOccupation"); TextBox txtNewHouseOwnerFlag = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewHouseOwnerFlag"); TextBox txtNewNumberCarsOwned = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewNumberCarsOwned"); TextBox txtNewAddressLine1 = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewAddressLine1"); TextBox txtNewAddressLine2 = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewAddressLine2"); TextBox txtNewCity = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewCity"); TextBox txtNewStateProvinceCode = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewStateProvinceCode"); TextBox txtNewPostalCode = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewPostalCode"); TextBox txtNewPhone = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewPhone"); TextBox txtNewSalutation = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewSalutation"); TextBox txtNewUnknown = (TextBox)grddbo_ProspectiveBuyer.FooterRow.FindControl("txtNewUnknown"); dbo_ProspectiveBuyerClass clsdbo_ProspectiveBuyer = new dbo_ProspectiveBuyerClass(); if (VerifyDataNew() == true) { if (string.IsNullOrEmpty(txtNewProspectAlternateKey.Text)) { clsdbo_ProspectiveBuyer.ProspectAlternateKey = null; } else { clsdbo_ProspectiveBuyer.ProspectAlternateKey = txtNewProspectAlternateKey.Text; } if (string.IsNullOrEmpty(txtNewFirstName.Text)) { clsdbo_ProspectiveBuyer.FirstName = null; } else { clsdbo_ProspectiveBuyer.FirstName = txtNewFirstName.Text; } if (string.IsNullOrEmpty(txtNewMiddleName.Text)) { clsdbo_ProspectiveBuyer.MiddleName = null; } else { clsdbo_ProspectiveBuyer.MiddleName = txtNewMiddleName.Text; } if (string.IsNullOrEmpty(txtNewLastName.Text)) { clsdbo_ProspectiveBuyer.LastName = null; } else { clsdbo_ProspectiveBuyer.LastName = txtNewLastName.Text; } if (string.IsNullOrEmpty(txtNewBirthDate.Text)) { clsdbo_ProspectiveBuyer.BirthDate = null; } else { clsdbo_ProspectiveBuyer.BirthDate = System.Convert.ToDateTime(txtNewBirthDate.Text); } if (string.IsNullOrEmpty(txtNewMaritalStatus.Text)) { clsdbo_ProspectiveBuyer.MaritalStatus = null; } else { clsdbo_ProspectiveBuyer.MaritalStatus = txtNewMaritalStatus.Text; } if (string.IsNullOrEmpty(txtNewGender.Text)) { clsdbo_ProspectiveBuyer.Gender = null; } else { clsdbo_ProspectiveBuyer.Gender = txtNewGender.Text; } if (string.IsNullOrEmpty(txtNewEmailAddress.Text)) { clsdbo_ProspectiveBuyer.EmailAddress = null; } else { clsdbo_ProspectiveBuyer.EmailAddress = txtNewEmailAddress.Text; } if (string.IsNullOrEmpty(txtNewYearlyIncome.Text)) { clsdbo_ProspectiveBuyer.YearlyIncome = null; } else { clsdbo_ProspectiveBuyer.YearlyIncome = System.Convert.ToDecimal(txtNewYearlyIncome.Text); } if (string.IsNullOrEmpty(txtNewTotalChildren.Text)) { clsdbo_ProspectiveBuyer.TotalChildren = null; } else { clsdbo_ProspectiveBuyer.TotalChildren = System.Convert.ToByte(txtNewTotalChildren.Text); } if (string.IsNullOrEmpty(txtNewNumberChildrenAtHome.Text)) { clsdbo_ProspectiveBuyer.NumberChildrenAtHome = null; } else { clsdbo_ProspectiveBuyer.NumberChildrenAtHome = System.Convert.ToByte(txtNewNumberChildrenAtHome.Text); } if (string.IsNullOrEmpty(txtNewEducation.Text)) { clsdbo_ProspectiveBuyer.Education = null; } else { clsdbo_ProspectiveBuyer.Education = txtNewEducation.Text; } if (string.IsNullOrEmpty(txtNewOccupation.Text)) { clsdbo_ProspectiveBuyer.Occupation = null; } else { clsdbo_ProspectiveBuyer.Occupation = txtNewOccupation.Text; } if (string.IsNullOrEmpty(txtNewHouseOwnerFlag.Text)) { clsdbo_ProspectiveBuyer.HouseOwnerFlag = null; } else { clsdbo_ProspectiveBuyer.HouseOwnerFlag = txtNewHouseOwnerFlag.Text; } if (string.IsNullOrEmpty(txtNewNumberCarsOwned.Text)) { clsdbo_ProspectiveBuyer.NumberCarsOwned = null; } else { clsdbo_ProspectiveBuyer.NumberCarsOwned = System.Convert.ToByte(txtNewNumberCarsOwned.Text); } if (string.IsNullOrEmpty(txtNewAddressLine1.Text)) { clsdbo_ProspectiveBuyer.AddressLine1 = null; } else { clsdbo_ProspectiveBuyer.AddressLine1 = txtNewAddressLine1.Text; } if (string.IsNullOrEmpty(txtNewAddressLine2.Text)) { clsdbo_ProspectiveBuyer.AddressLine2 = null; } else { clsdbo_ProspectiveBuyer.AddressLine2 = txtNewAddressLine2.Text; } if (string.IsNullOrEmpty(txtNewCity.Text)) { clsdbo_ProspectiveBuyer.City = null; } else { clsdbo_ProspectiveBuyer.City = txtNewCity.Text; } if (string.IsNullOrEmpty(txtNewStateProvinceCode.Text)) { clsdbo_ProspectiveBuyer.StateProvinceCode = null; } else { clsdbo_ProspectiveBuyer.StateProvinceCode = txtNewStateProvinceCode.Text; } if (string.IsNullOrEmpty(txtNewPostalCode.Text)) { clsdbo_ProspectiveBuyer.PostalCode = null; } else { clsdbo_ProspectiveBuyer.PostalCode = txtNewPostalCode.Text; } if (string.IsNullOrEmpty(txtNewPhone.Text)) { clsdbo_ProspectiveBuyer.Phone = null; } else { clsdbo_ProspectiveBuyer.Phone = txtNewPhone.Text; } if (string.IsNullOrEmpty(txtNewSalutation.Text)) { clsdbo_ProspectiveBuyer.Salutation = null; } else { clsdbo_ProspectiveBuyer.Salutation = txtNewSalutation.Text; } if (string.IsNullOrEmpty(txtNewUnknown.Text)) { clsdbo_ProspectiveBuyer.Unknown = null; } else { clsdbo_ProspectiveBuyer.Unknown = System.Convert.ToInt32(txtNewUnknown.Text); } bool bSucess = false; bSucess = dbo_ProspectiveBuyerDataClass.Add(clsdbo_ProspectiveBuyer); if (bSucess == true) { Session.Remove("dvdbo_ProspectiveBuyer"); LoadGriddbo_ProspectiveBuyer(); } else { ec.ShowMessage(" Insert failed. ", " Dbo. Prospective Buyer "); } } } catch { } }