Exemplo n.º 1
0
        private async Task <bool> CreateInvStockQty(int ProdId, int WhId, double Qty)
        {
            // Create Inv Stock Record for the product
            InvStockQty InvStockQty = new InvStockQty
            {
                ProdId = ProdId,
                WhId   = WhId,
                Qty    = Qty
            };

            _db.InvStockQty.Add(InvStockQty);
            await _db.SaveChangesAsync();

            return(true);
        }
Exemplo n.º 2
0
        //This funtion will update the stock qty of a product. By admin only
        public async Task <bool> UpdateProdStkQty(int StkId, double Qty)
        {
            try
            {
                InvStockQty InvStockQty = _db.InvStockQty.FirstOrDefault(stk => stk.Id == StkId);

                InvStockQty.Qty = Qty;

                // Save changes
                await _db.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
                return(false);
            }
        }
        // leave it for later
        private bool CheckQtyInWh(string ProdCode, double Qty)
        {
            InvStockQty = _db.InvStockQty.FirstOrDefaultAsync(inv => inv.ProdInfo.ProdCode == ProdCode & inv.Warehouse.WhType.Type == SD.ShowRoom).GetAwaiter().GetResult();

            if (InvStockQty == null)
            {
                return(false);
            }

            double StockQty = InvStockQty.Qty;

            if (StockQty >= Qty)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }