public void ResetAll() { //CompanyTypecomboBox.Items.Clear(); CompanyTypecomboBox.SelectedIndex = -1; VendorNametextBox.Clear(); PhonetextBox.Clear(); EmailAddresstextBox.Clear(); WebServiceUrltextBox.Clear(); ResetResidentialAddress(); }
public void Reset1() { SupplierTypecomboBox.SelectedIndex = -1; SupplierNametextBox.Clear(); PhonetextBox.Clear(); FaxtextBox.Clear(); EmailAddresstextBox.Clear(); WebSiteUrltextBox.Clear(); CustomerCodetextBox.Clear(); ResetCorporateAddress(); }
private void EmailAddresstextBox_Validating(object sender, CancelEventArgs e) { if (!string.IsNullOrEmpty(EmailAddresstextBox.Text)) { string emailId = EmailAddresstextBox.Text.Trim(); Regex mRegxExpression; mRegxExpression = new Regex(@"^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$"); if (!mRegxExpression.IsMatch(emailId)) { MessageBox.Show("Please type your valid email Address.", "MojoCRM", MessageBoxButtons.OK, MessageBoxIcon.Error); EmailAddresstextBox.Clear(); EmailAddresstextBox.Focus(); } } }
private bool ValidateVendor() { List <Vendor> vendors = new List <Vendor>(); con = new SqlConnection(cs.DBConn); con.Open(); string ct3 = "SELECT V_Name, Phone, Email, WebUrl FROM tblVendor where tblVendor.V_Name='" + VendorNametextBox.Text + "'"; cmd = new SqlCommand(ct3, con); rdr = cmd.ExecuteReader(); while (rdr.Read()) { if (rdr.HasRows) { Vendor x = new Vendor(); x.Name = rdr.GetString(0); if (!DBNull.Value.Equals(rdr["Phone"])) { x.Phone = rdr.GetString(1); } else { x.Phone = null; } if (!DBNull.Value.Equals(rdr["Email"])) { x.Email = rdr.GetString(2); } else { x.Email = null; } if (!DBNull.Value.Equals(rdr["WebUrl"])) { x.Weburl = rdr.GetString(3); } else { x.Weburl = null; } vendors.Add(x); } } foreach (Vendor p in vendors) { if (p.Name == VendorNametextBox.Text && p.Phone == PhonetextBox.Text) { MessageBox.Show(@"This Person Exists,Please Input another one" + "\n" + @"Or Use another Phone", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); VendorNametextBox.Clear(); PhonetextBox.Clear(); WebServiceUrltextBox.Clear(); EmailAddresstextBox.Clear(); //VendorNametextBox.Focus(); con.Close(); return(true); } if (p.Name == VendorNametextBox.Text && p.Email == EmailAddresstextBox.Text) { MessageBox.Show(@"This Person Exists,Please Input another one" + "\n" + @"Or Use another Email", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); VendorNametextBox.Clear(); PhonetextBox.Clear(); WebServiceUrltextBox.Clear(); EmailAddresstextBox.Clear(); con.Close(); return(true); } if (p.Name == VendorNametextBox.Text && p.Weburl == WebServiceUrltextBox.Text) { MessageBox.Show( @"This Person Exists,Please Input another one" + "\n" + @"Or Use another Web Service URL", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); VendorNametextBox.Clear(); PhonetextBox.Clear(); WebServiceUrltextBox.Clear(); EmailAddresstextBox.Clear(); con.Close(); return(true); } } return(false); }
private bool ValidateSupplier() { List <Supplier> suppliers = new List <Supplier>(); con = new SqlConnection(cs.DBConn); con.Open(); string ct3 = "SELECT SupplierName, Phone, Fax, Email, WebSiteUrl, Code FROM Supplier where Supplier.SupplierName='" + SupplierNametextBox.Text + "'"; cmd = new SqlCommand(ct3, con); rdr = cmd.ExecuteReader(); while (rdr.Read()) { if (rdr.HasRows) { Supplier x = new Supplier(); x.Name = rdr.GetString(0); if (!DBNull.Value.Equals(rdr["Phone"])) { x.Phone = rdr.GetString(1); } else { x.Phone = null; } if (!DBNull.Value.Equals(rdr["Fax"])) { x.Fax = rdr.GetString(2); } else { x.Fax = null; } if (!DBNull.Value.Equals(rdr["Email"])) { x.Email = rdr.GetString(3); } else { x.Email = null; } if (!DBNull.Value.Equals(rdr["WebSiteUrl"])) { x.WebSiteUrl = rdr.GetString(4); } else { x.WebSiteUrl = null; } if (!DBNull.Value.Equals(rdr["Code"])) { x.Code = rdr.GetString(5); } else { x.Code = null; } suppliers.Add(x); } } foreach (Supplier p in suppliers) { if (p.Name == SupplierNametextBox.Text && p.Phone == PhonetextBox.Text) { MessageBox.Show(@"This Person Exists,Please Input another one" + "\n" + @"Or Use another Phone", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SupplierNametextBox.Clear(); PhonetextBox.Clear(); //WebServiceUrltextBox.Clear(); //EmailAddresstextBox.Clear(); //VendorNametextBox.Focus(); con.Close(); return(true); } if (p.Name == SupplierNametextBox.Text && p.Fax == FaxtextBox.Text) { MessageBox.Show(@"This Person Exists,Please Input another one" + "\n" + @"Or Use another Fax", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SupplierNametextBox.Clear(); FaxtextBox.Clear(); //WebServiceUrltextBox.Clear(); //EmailAddresstextBox.Clear(); //VendorNametextBox.Focus(); con.Close(); return(true); } if (p.Name == SupplierNametextBox.Text && p.Email == EmailAddresstextBox.Text) { MessageBox.Show(@"This Person Exists,Please Input another one" + "\n" + @"Or Use another Email", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SupplierNametextBox.Clear(); //PhonetextBox.Clear(); //WebServiceUrltextBox.Clear(); EmailAddresstextBox.Clear(); con.Close(); return(true); } if (p.Name == SupplierNametextBox.Text && p.WebSiteUrl == WebSiteUrltextBox.Text) { MessageBox.Show( @"This Person Exists,Please Input another one" + "\n" + @"Or Use another Web Service URL", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SupplierNametextBox.Clear(); //PhonetextBox.Clear(); WebSiteUrltextBox.Clear(); //EmailAddresstextBox.Clear(); con.Close(); return(true); } if (p.Name == SupplierNametextBox.Text && p.Code == CustomerCodetextBox.Text) { MessageBox.Show( @"This Person Exists,Please Input another one" + "\n" + @"Or Use another Customer Code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SupplierNametextBox.Clear(); //PhonetextBox.Clear(); CustomerCodetextBox.Clear(); //EmailAddresstextBox.Clear(); con.Close(); return(true); } } return(false); }