Beispiel #1
0
        public void insertProduct()
        {
            if (MyExtension.Validation.isFilled(contentPanel))
            {
                inventory = new Inventory()
                {
                    Barcode         = txtBarcode.Text,
                    StockinDateTime = DateTime.Now,
                    QtyReceived     = Convert.ToInt32(txtQuantity.Text),
                    QtyOnHand       = Convert.ToInt32(txtQuantity.Text),
                    Supplier        = txtSupplier.Text,
                };

                if (checkIfProductAlreadyExists(txtBarcode.Text))
                {
                    dbController.insertInventory(inventory);
                }
                else
                {
                    product = new Product()
                    {
                        Barcode     = txtBarcode.Text,
                        Description = txtName.Text,
                        UnitPrice   = Convert.ToDecimal(txtPrice.Text),
                        Category    = txtCategory.Text,
                    };
                    dbController.insertProductInsideInventory(inventory, product);
                }

                toggle();
            }
        }
Beispiel #2
0
        public void insertProduct()
        {
            if (MyExtension.Validation.isFilled(contentPanel))
            {
                inventory = new Inventory()
                {
                    Barcode         = txtBarcode.Text,
                    StockinDateTime = DateTime.Now,
                    Supplier        = txtSupplier.Text,
                };

                if (checkIfProductAlreadyExists(txtBarcode.Text))
                {
                    dbController.insertInventory(inventory);
                }
                else
                {
                    int category_id = dbController.categoryMapper.getCategoryIndexFromName(cbCategory.Text);
                    product = new Product()
                    {
                        Barcode       = txtBarcode.Text,
                        Description   = txtName.Text,
                        Warranty      = txtWarranty.Text.ToString(),
                        Replacement   = txtReplacement.Text.ToString(),
                        Specification = txtSpecs.Text,
                        Category_id   = category_id,
                    };
                    dbController.insertProductInsideInventory(inventory, product);
                }
                toggle();
            }
            else
            {
                //   MessageBox.Show("Missing field required");
            }
        }