コード例 #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();

            }
        }
コード例 #2
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),
                };

                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
ファイル: Orders.cs プロジェクト: shiroh10/X-O-Genesis
        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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
 public bool insertInventory(Inventory inventory)
 {
     if (inventoryMapper.insertInventory(inventory)){
         OnInsertEntity(new EntityArgs(inventory));
         return true;
     }
     return false;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 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);
 }
コード例 #11
0
 public ProductInventoryDomain(Product product, Inventory inventory)
 {
     this.product = product;
     this.inventory = inventory;
 }