Example #1
0
        public TransactionData NewTransactionData(InventoryProduct product)
        {
            TransactionData a = new TransactionData(product);

            if (a is null)
            {
                throw new ArgumentNullException();
            }
            return(a);
        }
        public void AddImageToProduct(InventoryProduct product, string imageURL = "")
        {
            //Task<AirtableRetrieveRecordResponse> task = _invAirtableBase.RetrieveRecord(ProductsTableName, product.Record.Id);
            //var response = task.Result;

            Fields mainField = new Fields();
            Fields imgField  = new Fields();

            imgField.AddField("url", imageURL);
            mainField.AddField("Image", imgField);


            var updateTask     = _invAirtableBase.UpdateRecord(ProductsTableName, mainField, product.Record.Id);
            var updateResponse = updateTask.Result;
        }
        //Transaction is a purchase of one or more of a single product, orders can contain one or more transactions
        public bool UpdateInventoryCountForTransaction(InventoryProduct product, int quantityOrdered, out List <InventoryComponent> components, string orderID = "")
        {
            components = new List <InventoryComponent>();
            if (product == null)
            {
                return(false);
            }
            components = product.getComponents(this);

            foreach (var component in components)
            {
                component.Quantity = component.Quantity - quantityOrdered;
                LogInventoryEntry(component.Name, component.Record.Id, -quantityOrdered, orderID);
                UpdateComponentRecord(component);
            }
            return(true);
        }
 public TransactionData(InventoryProduct product) : this(product.Record.Id)
 {
     this.Name = product.UniqueName;
 }
 public bool GetPotentialPrintersList(InventoryProduct product, out List <string> printerNames, out string preferredPrinter)
 {
     return(GetPotentialPrintersListCore(product.Record, out printerNames, out preferredPrinter));
 }
 public bool GetPreferredShipper(InventoryProduct product, out string preferredShipper)
 {
     return(GetPreferredShipperCore(product.Record, out preferredShipper));
 }
 public string GetPreferredPrinter(InventoryProduct product)
 {
     return(GetPreferredPrinterCore(product.Record));
 }