private void PutOnResource_Load(object sender, EventArgs e)
 {
     try
     {
         List <IngridientViewModel> listC = serviceC.GetList();
         if (listC != null)
         {
             comboBoxIngridient.DisplayMember = "IngridientName";
             comboBoxIngridient.ValueMember   = "Id";
             comboBoxIngridient.DataSource    = listC;
             comboBoxIngridient.SelectedItem  = null;
         }
         List <ResourceViewModel> listS = serviceS.GetList();
         if (listS != null)
         {
             comboBoxResource.DisplayMember = "ResourceName";
             comboBoxResource.ValueMember   = "Id";
             comboBoxResource.DataSource    = listS;
             comboBoxResource.SelectedItem  = null;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void LoadData()
 {
     try
     {
         List <IngridientViewModel> 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);
     }
 }
Ejemplo n.º 3
0
 private void ArticleIngridientForm_Load(object sender, EventArgs e)
 {
     try
     {
         List <IngridientViewModel> list = service.GetList();
         if (list != null)
         {
             comboBoxIngridient.DisplayMember = "IngridientName";
             comboBoxIngridient.ValueMember   = "Id";
             comboBoxIngridient.DataSource    = list;
             comboBoxIngridient.SelectedItem  = null;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     if (model != null)
     {
         comboBoxIngridient.Enabled       = false;
         comboBoxIngridient.SelectedValue = model.IngridientId;
         textBoxCount.Text = model.Count.ToString();
     }
 }