private int?GetCustomerId() { CustomerBO objCustomer = new CustomerBO(); int? rtnCustomerId = null; try { if (objMaster.PrimaryKeyValue == null) { objCustomer.New(); objCustomer.Current.Name = txtCustomerName.Text.Trim(); objCustomer.Current.MobileNo = txtMobileNo.Text.Trim(); objCustomer.Current.TelephoneNo = txtTelephoneNo.Text.Trim(); objCustomer.Current.Address1 = txtAddress1.Text.Trim(); objCustomer.Current.Email = txtEmail.Text.Trim(); objCustomer.Current.BlackList = false; objCustomer.Current.BlackListResion = string.Empty; objCustomer.Current.DoorNo = txtDoorNo.Text.Trim(); objCustomer.Current.TotalCalls = 0; objCustomer.Current.AddOn = DateTime.Now; objCustomer.CheckDataValidation = false; objCustomer.Save(); } else { objCustomer.GetByPrimaryKey(objMaster.Current.CustomerId); objCustomer.Edit(); objCustomer.Current.Name = txtCustomerName.Text.Trim(); objCustomer.Current.MobileNo = txtMobileNo.Text.Trim(); objCustomer.Current.TelephoneNo = txtTelephoneNo.Text.Trim(); objCustomer.Current.Address1 = txtAddress1.Text.Trim(); objCustomer.Current.Email = txtEmail.Text.Trim(); objCustomer.Current.BlackList = false; objCustomer.Current.BlackListResion = string.Empty; objCustomer.Current.DoorNo = txtDoorNo.Text.Trim(); objCustomer.Current.TotalCalls = 0; objCustomer.Current.AddOn = DateTime.Now; objCustomer.CheckDataValidation = false; objCustomer.Save(); } rtnCustomerId = objMaster.PrimaryKeyValue == null?objCustomer.PrimaryKeyValue.ToIntorNull() : objMaster.Current.CustomerId; } catch { } return(rtnCustomerId); }
public override void Save() { try { //if (chkBlackList.Checked == true && txtResion.Text == "") //{ // ENUtils.ShowMessage("Requried: Resion"); //} if (objMaster.PrimaryKeyValue == null) { objMaster.New(); } else { objMaster.Edit(); } objMaster.Current.Name = txtName.Text.Trim(); objMaster.Current.Email = txtEmail.Text.Trim(); objMaster.Current.TelephoneNo = txtTelephoneNo.Text.Trim(); objMaster.Current.MobileNo = txtMobileNo.Text.Trim(); objMaster.Current.Address1 = txtAddress1.Text.Trim(); objMaster.Current.Address2 = txtAddress2.Text.Trim(); objMaster.Current.DoorNo = txtDoorNo.Text.Trim(); objMaster.Current.AccountNo = chkDisableIVR.Checked ? "1" : "0"; objMaster.Current.BlackList = chkBlackList.Checked.ToBool(); objMaster.Current.BlackListResion = txtResion.Text.ToString(); objMaster.Current.TotalCalls = txtTotalCalls.Value.ToInt(); // objMaster.Current.CreditCardDetails = txtCreditCard.Text.Trim(); objMaster.Current.LikesAndDislikes = txtNotes.Text.Trim(); objMaster.Save(); // General.RefreshListWithoutSelected<frmCustomersList>("frmCustomersList1"); // General.RefreshListWithoutSelected<frmBlackCustomersList>("frmBlackCustomersList1"); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }