Пример #1
0
 private void btnAddLabel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Добавить марку?", "Добавить", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
     {
         return;
     }
     else
     {
         var helper = new LabelManager();
         helper.AddLabel(cmbLabel.Text.ToString());
         cmbLabel.DataSource = helper.GetAllLabel();
         cmbLabelGrid.DataSource = helper.GetAllLabel();
         MessageBox.Show("Марка успешно добавлена!");
     }
 }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var products = new ProductManager();
            dtGridProducts.DataSource = products.GetAllProduct();
            dtGridProducts.Columns["Id"].Visible = false;
            dtGridProducts.Columns["LabelName"].HeaderText = "Марка";
            dtGridProducts.Columns["Name"].HeaderText = "Название";
            dtGridProducts.Columns["Name"].FillWeight = 250;
            dtGridProducts.Columns["Volume"].HeaderText = "Объем";
            dtGridProducts.Columns["Price"].HeaderText = "Цена";
            dtGridProducts.Columns["Count"].HeaderText = "Количество";

            txtCountProductGrid.Text = products.GetAllProductCount(products.GetAllProduct()).ToString();
            txtAllPriceGrid.Text = products.GetAllProductPrice(products.GetAllProduct()).ToString();

            var temp = new LabelManager();
            cmbLabel.DataSource = temp.GetAllLabel();
            cmbLabel.ValueMember = "Id";
            cmbLabel.DisplayMember = "NameLabel";
            cmbLabelGrid.DataSource = temp.GetAllLabel();
            cmbLabelGrid.ValueMember = "Id";
            cmbLabelGrid.DisplayMember = "NameLabel";
            txtDiscount.Text = "0";
        }
Пример #3
0
        private void bетDelLabel_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Изменить марку?", "Изменить", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            else
            {
                var helper = new LabelManager();

                helper.DelLabel(Convert.ToInt32(txtHiddenIdLabel.Text), cmbLabel.Text.ToString());
                cmbLabel.DataSource = helper.GetAllLabel();
                cmbLabelGrid.DataSource = helper.GetAllLabel();
                var prod = new ProductManager();
                dtGridProducts.DataSource = prod.GetAllProduct();
                MessageBox.Show("Марка успешно изменена!");
            }
        }