public FormPackagingBouqet(IPackagingLogic logic, ExceptionHandling exceptionHandling) { InitializeComponent(); this.exceptionHandling = exceptionHandling; List <PackagingViewModel> list = logic.Read(null); if (list != null) { comboBoxComponent.DisplayMember = "PackagingName"; comboBoxComponent.ValueMember = "Id"; comboBoxComponent.DataSource = list; comboBoxComponent.SelectedItem = null; } }
private void LoadData() { try { var list = logic.Read(null); if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns[3].Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FormPackaging_Load(object sender, EventArgs e) { if (id.HasValue) { try { var view = logic.Read(new PackagingBindingModel { Id = id })?[0]; if (view != null) { textBoxName.Text = view.PackagingName; textBoxPrice.Text = view.Price.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public IActionResult Packings() { ViewBag.Packings = logic.Read(null); return(View()); }