private void FormOutputElement_Load(object sender, EventArgs e)
 {
     try
     {
         List <ElementViewModel> list = service.GetList();
         if (list != null)
         {
             comboBoxComponent.DisplayMember = "ElementName";
             comboBoxComponent.ValueMember   = "Id";
             comboBoxComponent.DataSource    = list;
             comboBoxComponent.SelectedItem  = null;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
     if (model != null)
     {
         comboBoxComponent.Enabled       = false;
         comboBoxComponent.SelectedValue = model.ElementId;
         textBoxCount.Text = model.Number.ToString();
     }
 }
        public ActionResult AddElement()
        {
            var ingredients = new SelectList(ingredientService.GetList(), "Id", "ElementName");

            ViewBag.Elements = ingredients;
            return(View());
        }
Exemple #3
0
 private void LoadData()
 {
     try
     {
         List <ElementViewModel> 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);
     }
 }
Exemple #4
0
 // GET: Elements
 public ActionResult Index()
 {
     return(View(service.GetList()));
 }