Пример #1
0
 private void buttonDeleteProduct_Click(object sender, EventArgs e)
 {
     store = StoreModel.SelectAllProducts();
     if (store.Count != 0)
     {
         var          index  = dataGridViewBar.CurrentRow.Index;
         DialogResult result = MessageBox.Show("Удалить?", "Удаление", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             int  Id     = store[index].Id;
             bool delete = StoreModel.Delete(Id);
             if (delete)
             {
                 ShowBar();
             }
             else
             {
                 MessageBox.Show("Ошибка при удаления");
             }
         }
     }
     else
     {
         MessageBox.Show("Склад пустой");
     }
 }
Пример #2
0
 private void buttonUpdateProduct_Click(object sender, EventArgs e)
 {
     store = StoreModel.SelectAllProducts();
     if (store.Count != 0)
     {
         var index = dataGridViewBar.CurrentRow.Index;
         UpdateChangeForm update = new UpdateChangeForm();
         update.store = store[index];
         update.ShowDialog();
         ShowBar();
         Show();
     }
     else
     {
         MessageBox.Show("Склад пустой");
     }
 }
Пример #3
0
 private void buttonAddProduct_Click(object sender, EventArgs e)
 {
     store = StoreModel.SelectAllProducts();
     if (store.Count != 0)
     {
         var          index   = dataGridViewBar.CurrentRow.Index;
         AddGoodsForm addgood = new AddGoodsForm();
         addgood.radioButtonGoods.Checked = true;
         addgood.store = store[index];
         addgood.ShowDialog();
         ShowBar();
         Show();
     }
     else
     {
         MessageBox.Show("Склад пустой");
     }
 }
Пример #4
0
 public void ShowBar()
 {
     store = StoreModel.SelectAllProducts();
     dataGridViewBar.DataSource = store;
 }