示例#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();

            }
        }
        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),
                };

                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,
                        UnitPrice = Convert.ToDecimal(txtPrice.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");
            }
        }
示例#3
0
        void conclusion()
        {
            // End the transaction
            concludeTransaction = true;
            toggleEncoding(false);

            Inventory inventory = null;
            foreach (ProductInvoice item in carts){
                dbController.insertProductInvoice(item);
                inventory = new Inventory(){
                    Barcode = item.product.Barcode,
                    QtyReceived = 0,
                    QtyOnHand = -item.QuantitySold,
                };
                dbController.pullInventory(inventory);
                dbController.checkProductCriticalLevel(item.product);
            }

            // audit
            string message = string.Format("completed a transaction: {0}", lblTransactionno.Text);
            dbController.insertAuditTrail(message);
            masterController.clientClock();
        }
        void insertProduct()
        {
            inventory = new Inventory(){
                Barcode = txtBarcode.Text,
                StockinDateTime = DateTime.Now,
                QtyReceived = Convert.ToInt32(txtQuantity.Text),
                QtyOnHand = Convert.ToInt32(txtQuantity.Text),
            };

            if (checkIfProductAlreadyExists(txtBarcode.Text)){
                dbController.insertInventory(inventory);
            }
            else{
                product = new Product(){
                    Barcode = txtBarcode.Text,
                    Description = txtDescription.Text,
                    UnitPrice = Convert.ToDecimal(txtPrice.Text),
                    //Company = txtCompany.Text
                };
                dbController.insertProductInsideInventory(inventory, product);
            }
            
            toggle();
            clear();
        }
 public bool insertInventory(Inventory inventory)
 {
     if (inventoryMapper.insertInventory(inventory)){
         OnInsertEntity(new EntityArgs(inventory));
         return true;
     }
     return false;
 }
 public bool insertProductInsideInventory(Inventory inventory, Product product){
     string insertInventory = inventoryMapper.createInventory(inventory);
     string insertProduct = productMapper.createProduct(product);
     if(createTransaction(insertProduct, insertInventory)){
         OnInsertEntity(new EntityArgs(inventory));
         OnInsertEntity(new EntityArgs(product));
         return true;
     }
     return false;
 }
 public bool pullInventory(Inventory inventory)
 {
     return inventoryMapper.pullInventory(inventory);
 }
示例#8
0
 public bool insertInventory(Inventory inventory)
 {
     return create(createInventory(inventory));
 }
示例#9
0
 public bool pullInventory(Inventory inventory)
 {
     return create(
         insertValues(inventory.Barcode, "null", "null",
         inventory.QtyOnHand));
 }
示例#10
0
 public string createInventory(Inventory inventory)
 {
     return insertValues(
         inventory.Barcode, "NOW()", inventory.QtyReceived,
         inventory.QtyOnHand, inventory.Supplier);
 }
 public ProductInventoryDomain(Product product, Inventory inventory)
 {
     this.product = product;
     this.inventory = inventory;
 }