private void butadd_Click(object sender, EventArgs e) { supplier supp = new supplier(); if (state == "Add") { if (text_Sup_ID.Text == string.Empty || textsupName.Text == string.Empty || textSupphone.Text == string.Empty || Cmb_company.Text == string.Empty || textSupaddress.Text == string.Empty) { MessageBox.Show("Rewrite all data !", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } clsssup.AddSupplier(textsupName.Text, textSupphone.Text, textSupemail.Text, Cmb_company.Text, textSupaddress.Text, DateSupplier.Value, text_user_add.Text); MessageBox.Show("Add Supplier Done Successfuly", "SMMS", MessageBoxButtons.OK, MessageBoxIcon.Information); butadd.Enabled = false; butnew.Enabled = true; clear(); textsupName.Enabled = false; textSupphone.Enabled = false; textSupemail.Enabled = false; textSupaddress.Enabled = false; } else { if (text_Sup_ID.Text == string.Empty || textsupName.Text == string.Empty || textSupphone.Text == string.Empty || Cmb_company.Text == string.Empty || textSupaddress.Text == string.Empty) { MessageBox.Show("Rewrite all data !", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } clsssup.UpdateSupplier(Convert.ToInt32(text_Sup_ID.Text), textsupName.Text, textSupphone.Text, textSupemail.Text, Cmb_company.Text, textSupaddress.Text, DateSupplier.Value, text_user_add.Text); MessageBox.Show("Edit Supplier Done Successfuly", "SMMS", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); this.Close(); } supplier_management.getmainform.dataGridView1.DataSource = clsssup.GET_ALL_Supplier(); }
private void button2_Click(object sender, EventArgs e) { supplier Sup = new supplier(); Sup.butadd.Enabled = true; Sup.butnew.Visible = false; Sup.textsupName.Enabled = true; Sup.textSupphone.Enabled = true; Sup.textSupemail.Enabled = true; Sup.textSupaddress.Enabled = true; Sup.text_Sup_ID.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString(); Sup.textsupName.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString(); Sup.textSupphone.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString(); Sup.textSupemail.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString(); Sup.textSupaddress.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString(); Sup.text_user_add.Text = this.dataGridView1.CurrentRow.Cells[7].Value.ToString(); Sup.Text = "Supplier Update:" + this.dataGridView1.CurrentRow.Cells[1].Value.ToString(); Sup.butadd.Text = "Update"; Sup.state = "update"; Sup.ShowDialog(); Sup.Close(); }
private static supplier frmsup; // ......................[1] static void frm_formclosed(object sender, FormClosedEventArgs e) // ................[2] { frmsup = null; }
private void button1_Click(object sender, EventArgs e) { supplier suplier = new supplier(); suplier.ShowDialog(); }
private void addNewSuppliersToolStripMenuItem_Click(object sender, EventArgs e) { supplier frm = new supplier(); frm.ShowDialog(); }