Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string productName = txtProduct.Text;
            string price       = txtPrice.Text;
            string Amount      = txtAmount.Text;
            string Category    = cmbCategory.Text;
            string Size        = cmbSize.Text;
            string Desc        = rcDescription.Text;

            string[] emp = { productName, price, Amount, Category, Size, };

            if (mainExtensions.IsEmpty(emp, string.Empty))
            {
                int CatId  = db.Categories.First(ct => ct.Name == Category).Id;
                int SizeId = db.ProductSizes.First(ct => ct.Size == Size).Id;

                db.Products.Add(new Product()
                {
                    ProductName = productName,
                    Price       = Convert.ToDouble(price),
                    Amount      = Convert.ToInt32(Amount),
                    CategoryId  = CatId,
                    SizeId      = SizeId,
                });
                db.SaveChanges();
                MessageBox.Show("Product create successfully", "success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
            }
            NewProduct np = new NewProduct();

            np.ShowDialog();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string productName = txtProduct.Text;
            string price       = txtPrice.Text;
            string Amount      = txtAmount.Text;

            NewProduct np = new NewProduct();

            np.
        }
Exemple #3
0
        private void productsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewProduct np = new NewProduct();

            np.ShowDialog();
        }