Esempio n. 1
0
        public List <WCF_StockCard> GetStockCard(string itemId, string token)
        {
            //Check if user is authorizated to use this method. If is not authorized, it will return a json with -1 in the primary key
            if (!IsAuthanticateUser(token))
            {
                List <WCF_StockCard> wcf_UnAuthObj = new List <WCF_StockCard>();
                WCF_StockCard        wcfUnAuth     = new WCF_StockCard();
                wcfUnAuth.ID = -1;
                wcf_UnAuthObj.Add(wcfUnAuth);
                return(wcf_UnAuthObj);
            }
            InventoryLogic       inventoryLogic = new InventoryLogic();
            List <StockCard>     stockCard      = InventoryLogic.GetStockcardByItemId(itemId);
            List <WCF_StockCard> wcfList        = new List <WCF_StockCard>();

            foreach (StockCard i in stockCard)
            {
                WCF_InventoryCatalogue c = SearchInventoryList(i.ItemID, internalSecertKey).First();
                WCF_StockCard          w = WCF_StockCard.Create(i.ID, i.ItemID,
                                                                ((DateTime)i.Date).ToString("d"), i.Description, i.Type,
                                                                (int)i.Quantity, i.UOM, (int)i.Balance, c);
                wcfList.Add(w);
            }
            return(wcfList);
        }
Esempio n. 2
0
        public List <WCF_InventoryCatalogue> SearchInventoryList(string query, string token)
        {
            //Check if user is authorizated to use this method. If is not authorized, it will return a json with -1 in the primary key
            if (!IsAuthanticateUser(token))
            {
                List <WCF_InventoryCatalogue> wcf_UnAuthObj = new List <WCF_InventoryCatalogue>();
                WCF_InventoryCatalogue        wcfUnAuth     = new WCF_InventoryCatalogue();
                wcfUnAuth.ItemID = "-1";
                wcf_UnAuthObj.Add(wcfUnAuth);
                return(wcf_UnAuthObj);
            }
            InventoryLogic                inventoryLogic = new InventoryLogic();
            List <InventoryCatalogue>     catalogueList  = inventoryLogic.SearchBy(query);
            List <WCF_InventoryCatalogue> wcfList        = new List <WCF_InventoryCatalogue>();

            foreach (InventoryCatalogue i in catalogueList)
            {
                WCF_InventoryCatalogue w = WCF_InventoryCatalogue.Create(i.ItemID, i.BIN, i.Shelf, (int)i.Level,
                                                                         i.CategoryID, i.Description, (int)i.ReorderLevel, i.UnitsInStock,
                                                                         (int)i.ReorderQty, i.UOM, i.Discontinued, (int)i.UnitsOnOrder,
                                                                         (int)i.BufferStockLevel);
                wcfList.Add(w);
            }
            return(wcfList);
        }