Пример #1
0
 private void FormPutInKitchen_Load(object sender, EventArgs e)
 {
     try
     {
         List <DishViewModel> listC = serviceC.GetList();
         if (listC != null)
         {
             comboBoxDish.DisplayMember = "DishName";
             comboBoxDish.ValueMember   = "Id";
             comboBoxDish.DataSource    = listC;
             comboBoxDish.SelectedItem  = null;
         }
         List <KitchenViewModel> listS = serviceS.GetList();
         if (listS != null)
         {
             comboBoxKitchen.DisplayMember = "KitchenName";
             comboBoxKitchen.ValueMember   = "Id";
             comboBoxKitchen.DataSource    = listS;
             comboBoxKitchen.SelectedItem  = null;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
 private void LoadData()
 {
     try
     {
         List <KitchenViewModel> list = service.GetList();
         if (list != null)
         {
             dataGridView.DataSource              = list;
             dataGridView.Columns[0].Visible      = false;
             dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }