コード例 #1
0
        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;
            }
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 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);
         }
     }
 }
コード例 #4
0
 public IActionResult Packings()
 {
     ViewBag.Packings = logic.Read(null);
     return(View());
 }