Example #1
0
 private void LoadData()
 {
     try
     {
         List <ChefViewModel> 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);
     }
 }
 private void FormTakeChoiceInWork_Load(object sender, EventArgs e)
 {
     try
     {
         if (!id.HasValue)
         {
             MessageBox.Show("Не указан заказ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Close();
         }
         List <ChefViewModel> listI = serviceI.GetList();
         if (listI != null)
         {
             comboBoxChef.DisplayMember = "ChefFIO";
             comboBoxChef.ValueMember   = "Id";
             comboBoxChef.DataSource    = listI;
             comboBoxChef.SelectedItem  = null;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }