private void simpleButton3_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you realy want to delete this Product ?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { c.Delete_Customer(Convert.ToInt32(this.dataGridView1.CurrentRow.Cells[0].Value)); MessageBox.Show("Delete successful", "Delete Product", MessageBoxButtons.OK, MessageBoxIcon.Information); if (label8.Text == "Manage Customer") { this.dataGridView1.DataSource = c.Get_All_Customer(); } else { this.dataGridView1.DataSource = c.Get_All_Company(); } } else { MessageBox.Show("Delete Cancled", "Delete Product", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (compbtn.Content == "Add") { if (txtid.Text == "" || txtname.Text == "" || txtphone.Text == "" || txtaddress.Text == "") { MessageBox.Show("You Cant do anything if the boxes are empty ", "Warning ", MessageBoxButton.OK, MessageBoxImage.Warning); } else { c.AddCustomer(Convert.ToInt32(txtid.Text), txtname.Text, txtphone.Text, txtaddress.Text, Convert.ToInt32("1")); MessageBox.Show("Add Seccess", "Add Product ", MessageBoxButton.OK, MessageBoxImage.Information); txtid.Text = c.maxcomp().Rows[0][0].ToString(); txtname.Clear(); txtphone.Clear(); txtaddress.Clear(); } } if (compbtn.Content == "Delete") { if (txtid.Text == "" || txtname.Text == "" || txtphone.Text == "" || txtaddress.Text == "") { MessageBox.Show("You Cant do anything if the boxes are empty ", "Warning ", MessageBoxButton.OK, MessageBoxImage.Warning); } else { if (MessageBox.Show("Do you realy want to delete this Product ?", "Delete Product", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes) { c.Delete_Customer(Convert.ToInt32(txtid.Text)); MessageBox.Show("Delete successful", "Delete Product", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Delete Cancled", "Delete Product", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } if (compbtn.Content == "Update") { if (txtid.Text == "" || txtname.Text == "" || txtphone.Text == "" || txtaddress.Text == "") { MessageBox.Show("You Cant do anything if the boxes are empty ", "Warning ", MessageBoxButton.OK, MessageBoxImage.Warning); } else { c.UpdateCustomer(Convert.ToInt32(txtid.Text), txtname.Text, txtphone.Text, txtaddress.Text, Convert.ToInt32("1")); MessageBox.Show("Update Seccess", "Update Product ", MessageBoxButton.OK, MessageBoxImage.Information); txtid.Text = c.maxcomp().Rows[0][0].ToString(); txtname.Clear(); txtphone.Clear(); txtaddress.Clear(); } } }