private void SaveAddres() { try { string Address = string.Empty; string PostCode = string.Empty; string Error = string.Empty; bool IsInvalidChar = false; bool PostCodeSpace = false; IsInvalidChar = txtAddress.Text.Contains(","); if (IsInvalidChar == true) { ENUtils.ShowMessage("Address contains ',' Invalid Character"); return; } IsInvalidChar = txtAddress.Text.Contains("="); if (IsInvalidChar == true) { ENUtils.ShowMessage("Address contains '=' Invalid Character"); return; } IsInvalidChar = txtAddress.Text.Contains(":"); if (IsInvalidChar == true) { ENUtils.ShowMessage("Address contains ':' Invalid Character"); return; } Address = txtAddress.Text.Trim().ToUpper(); PostCode = General.GetPostCodeMatch(txtAddress.Text.Trim().ToUpper()); PostCodeSpace = PostCode.Contains(" "); if (string.IsNullOrEmpty(Address)) { Error = "Required : Address"; } if (string.IsNullOrEmpty(PostCode)) { Error += Environment.NewLine + "Required : PostCode"; } if (PostCodeSpace == false) { if (string.IsNullOrEmpty(Error)) { Error = "Please Enter Correct PostCode"; } else { Error += Environment.NewLine + "Please Enter Correct PostCode"; } } if (!string.IsNullOrEmpty(Error)) { ENUtils.ShowMessage(Error); return; } int?zoneId = ddlZone.SelectedValue.ToIntorNull(); long Entity = 0; if (AppVars.objPolicyConfiguration.EnablePOI.ToBool()) { using (TaxiDataContext db = new TaxiDataContext()) { Address = Address.Replace(PostCode, ""); // db.stp_SaveRoadLevelAddress(EntityID,PostCode,Address,""); } } else { using (TaxiDataContext db = new TaxiDataContext()) { Entity = db.stp_SaveGeneralAddress(EntityID, Address, PostCode, zoneId.ToStr()).FirstOrDefault().Entity.ToLong(); } AppVars.listOfAddress.Insert(0, new stp_GetFullAddressesResult { AddressLine1 = Address.ToUpper(), PostalCode = PostCode.ToUpper(), ZoneId = zoneId }); if (Entity == 0) { ENUtils.ShowMessage("Address already exist"); return; } } this.Close(); if (!string.IsNullOrEmpty(OldAddress) && OldAddress != Address) { ((frmAddNewAddress)Application.OpenForms.OfType <Form>().FirstOrDefault(c => c.Name == "frmAddNewAddress")).RefreshData(); } } catch (OverflowException ex) { ENUtils.ShowMessage(ex.Message); } }