Exemple #1
0
      private void btn_save_Click(object sender, EventArgs e)
      {
          try
          {
              if (edit_or_add == "add")
              {
                  if (string.IsNullOrWhiteSpace(txt_ID.Text) || string.IsNullOrWhiteSpace(txt_Name.Text))
                  {
                      MessageBox.Show("you must enter  ID and First name at least");
                  }
                  else
                  {
                      Most_Insert();
                      phone();
                      MessageBox.Show("Added");
                      this.Close();
                      frm_Find_Supplier f = new frm_Find_Supplier();
                      f.Show();
                  }
              }
          }
          catch (Exception exp)
          {
              MessageBox.Show(exp.Message);
          }

          //DELETE FROM [dbo].[Supplier_Phone] WHERE [Sup_ID]=@Sup_ID


          if (edit_or_add == "edit")
          {
              try
              {
                  most_edit();
                  Delete_All_Phones();
                  phone();
                  MessageBox.Show("Edited");
                  this.Close();
                  frm_Find_Supplier f = new frm_Find_Supplier();
                  f.Show();
              }
              catch (Exception exp)
              {
                  MessageBox.Show(exp.Message);
              }
          }
      }
        private void deleteToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            frm_Find_Supplier form_Search_Supplier = new frm_Find_Supplier();

            form_Search_Supplier.ShowDialog();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            frm_Find_Supplier form_Search_Supplier = new frm_Find_Supplier();

            form_Search_Supplier.ShowDialog();
        }