Exemplo n.º 1
0
        public void ProductEkle()
        {
            string   productId    = Guid.NewGuid().ToString();
            string   productName  = tbxProductName.Text;
            string   barkodNo     = tbxBarkodNo.Text;
            decimal  unitPrice    = Convert.ToDecimal(tbxUnitPrice.Text);
            int      quantity     = Convert.ToInt32(tbxQuantity.Text);
            DateTime additionDate = DateTime.Now;

            CRUDHelper.AddProduct(new Product
            {
                ProductId    = productId,
                ProductName  = productName,
                BarkodNo     = barkodNo,
                Quantity     = quantity,
                UnitPrice    = unitPrice,
                AdditionDate = additionDate
            });

            foreach (var item in lbCategory.SelectedItems)
            {
                CRUDHelper.AddProductCategory(new ProductsCategories
                {
                    ProductID  = productId,
                    CategoryID = (item as Categories).CategoryId,
                });
            }

            MessageBox.Show("tamam");
        }