Exemple #1
0
 private void DeleteWineSortButton_Click(object sender, EventArgs e)
 {
     var selectedRows = WineSortTable.SelectedRows;
     foreach (DataGridViewRow row in selectedRows)
     {
         int id = Convert.ToInt32(row.Cells[0].Value);
         WineSortManager.DeleteData(id);
         WineSortCategory local = SortCategoryList.Find(x => x.Id == id);
         SortCategoryList.Remove(local);
     }
     UpdateWineSortTable();
 }
Exemple #2
0
 private void AddWineSortButton_Click(object sender, EventArgs e)
 {
     try
     {
         WineSortCategory local = new WineSortCategory(Convert.ToInt32(IdTextBox.Text),
                                                       WineSortTextBox.Text);
         MainForm main = Application.OpenForms["MainForm"] as MainForm;
         main.WineSortManager.LoadData(local);
         main.SortCategoryList.Add(local);
         main.UpdateWineSortTable();
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK);
     }
 }