private void VendorNametextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { PhonetextBox.Focus(); e.Handled = true; } }
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 Resetbutton_Click(object sender, EventArgs e) { PhonetextBox.Clear(); Nametexbox.Clear(); NotextBox.Clear(); ApartmentBox.Clear(); VillageBox.Clear(); Soibox.Clear(); StreetBox.Clear(); SubdistBox.Clear(); DistBox.Clear(); ProvinceBox.Clear(); DetailBox.Clear(); }
private void PhonetextBox_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(PhonetextBox.Text)) { string PhnNo = PhonetextBox.Text.Trim(); int Minlen = 8; if (!(PhonetextBox.Text.Length >= Minlen)) { MessageBox.Show("Please type your valid Phone No.", "MojoCRM", MessageBoxButtons.OK, MessageBoxIcon.Error); PhonetextBox.Clear(); PhonetextBox.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); }