Ejemplo n.º 1
0
        public static List <ItemInventoryRet> GetInventoryItemQuery(string QBCompanyFile, string itemNumber)
        {
            var modxml = ItemInventoryViewModel.BuildModifiedItemInventoryQuery(itemNumber);


            var modres = QBPosContext.ProcessXML(modxml.OuterXml, QBCompanyFile);

            //if(sessionBegun == true)

            var lst = new List <ItemInventoryRet>();

            lst.AddRange(GetQBInventoryItems(modres));

            return(lst.GroupBy(x => x.ListID).Select(grp => grp.First()).ToList());
        }
Ejemplo n.º 2
0
        public List <ItemInventoryRet> GetInventoryItemQuery(int days = 1)
        {
            if (sessionManager != null)
            {
                IMsgSetRequest ItemModifiedInventoryRequestMsgSet = sessionManager.CreateMsgSetRequest(3, 0);
                IMsgSetRequest ItemCreatedInventoryRequestMsgSet  = sessionManager.CreateMsgSetRequest(3, 0);
                ItemModifiedInventoryRequestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
                ItemCreatedInventoryRequestMsgSet.Attributes.OnError  = ENRqOnError.roeContinue;
                ItemInventoryViewModel inventoryVM = new ItemInventoryViewModel();
                inventoryVM.BuildModifiedItemInventoryQuery(ItemModifiedInventoryRequestMsgSet, days);
                inventoryVM.BuildCreatedItemInventoryQuery(ItemCreatedInventoryRequestMsgSet, days);
                //if(sessionBegun == false)
                //    BeginSession();
                ////Send the request and get the response from QuickBooks
                IMsgSetResponse ModifiedItemsLst = sessionManager.DoRequests(ItemModifiedInventoryRequestMsgSet);
                IMsgSetResponse CreatedItemsLst  = sessionManager.DoRequests(ItemCreatedInventoryRequestMsgSet);
                //if(sessionBegun == true)

                var lst  = new List <ItemInventoryRet>();
                var tlst = new TrackableCollection <ItemInventoryRet>(null);

                if (ModifiedItemsLst != null)
                {
                    tlst = inventoryVM.WalkItemInventoryQueryRs(ModifiedItemsLst);
                }

                if (tlst != null)
                {
                    lst.AddRange(tlst.ToList());
                }

                if (CreatedItemsLst != null)
                {
                    tlst = inventoryVM.WalkItemInventoryQueryRs(CreatedItemsLst);
                }

                if (tlst != null)
                {
                    lst.AddRange(tlst.ToList());
                }

                return(lst.GroupBy(x => x.ListID).Select(grp => grp.First()).ToList());
            }
            return(new List <ItemInventoryRet>());
        }