private void button1_Click_1(object sender, EventArgs e) { DbSupplier db = new DbSupplier(); try { WindowsFormsApplication1.Supplier w = new WindowsFormsApplication1.Supplier(); w.SupplierId = textBox1.Text; if (comboBox1.SelectedIndex == 0) { dataGridView1.DataSource = db.SearchSupplierById(w.SupplierId).Tables[0]; } else if (comboBox1.SelectedIndex == 1) { dataGridView1.DataSource = db.SearchSuppliersByName(w.Name).Tables[0]; } else { dataGridView1.DataSource = db.SearchSuppliersByCompany(w.Company).Tables[0]; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }
private void button1_Click(object sender, EventArgs e) { DbSupplier db = new DbSupplier(); WindowsFormsApplication1.Supplier w = new WindowsFormsApplication1.Supplier(); try { w.SupplierId = textBox1.Text; if (db.SupplierExist(w.SupplierId) == true) { DialogResult dialogResult = MessageBox.Show("Are You Sure To Delete Supplier?", "Delete", MessageBoxButtons.YesNoCancel); if (dialogResult == DialogResult.Yes) { db.DeleteSupplier(w); MessageBox.Show("Call was deleted Successfully"); } } else { MessageBox.Show("Supplier with similar ID was not found , try again", "Error"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }
private void button1_Click(object sender, EventArgs e) { DbSupplier db = new DbSupplier(); WindowsFormsApplication1.Supplier w = new WindowsFormsApplication1.Supplier(); w.SupplierId = textBox1.Text; w.Name = textBox3.Text; w.Company = textBox2.Text; w.Address = textBox4.Text; w.Phone = textBox5.Text; w.Fax = textBox6.Text; }
private void button1_Click(object sender, EventArgs e) { WindowsFormsApplication1.Supplier w = new WindowsFormsApplication1.Supplier(); DbSupplier db = new DbSupplier(); w.SupplierId = textBox1.Text; w.SupplierId = textBox3.Text; w.Name = textBox2.Text; w.Company = textBox4.Text; w.Address = textBox5.Text; w.Phone = textBox6.Text; db.UpdateSupplier(w); MessageBox.Show("Successfully updated Supplier"); }
public void InsertGetUpdate() { var target = new DbSupplier(); var report = new Supplier() { Id = -1, Name = "Supplier", }; target.InsertSupplier(report); var insertedTask = target.GetSupplier(report.Id); Assert.AreEqual(insertedTask.Id, report.Id); report.Name = "Supplier2"; target.UpdateSupplier(report); Assert.AreEqual(report.Name, "Supplier2"); }
/// <summary> /// This method will instantiate a new supplier controller. /// </summary> public SupplierController() { _dbSupplier = new DbSupplier(); }
private void button1_Click(object sender, EventArgs e) { DbSupplier db = new DbSupplier(); dataGridView1.DataSource = db.GetAllSuppliers().Tables[0]; }
private void button3_Click(object sender, EventArgs e) { WindowsFormsApplication1.Supplier w = new WindowsFormsApplication1.Supplier(); DbSupplier db = new DbSupplier(); DataSet ds = new DataSet(); }
public List <Supplier> GetSuppliers() { DbSupplier db = new DbSupplier(); return(db.GetSuppliers()); }