Esempio n. 1
0
 public static void InventoryQuery(string response)
 {
     var rep = new Repository();
     var doc = XDocument.Parse(response);
     var itemInventoryQueryRs = doc.Document.Root.Descendants("QBXMLMsgsRs").FirstOrDefault().Descendants("ItemInventoryQueryRs").FirstOrDefault();
     var msg = itemInventoryQueryRs.Attribute("statusMessage").Value;
     var requestID = Convert.ToInt32(itemInventoryQueryRs.Attribute("requestID").Value);
     if (msg == "A query request did not find a matching object in QuickBooks")
     {
         Error.ProcessFailedOrder(requestID,response);
     }
     else
     {
         var order = rep.GetQuickBooksOrderByRequestID(requestID);
         var quickbooksItem = new QuickbooksInventory(){
             ClientID = order.ClientID,
             FullName = itemInventoryQueryRs.Element("ItemInventoryRet").Element("FullName").Value,
             ListID = itemInventoryQueryRs.Element("ItemInventoryRet").Element("ListID").Value,
         };
         rep.Add(quickbooksItem);
         rep.Save();
         var shopInventory = rep.GetShopInventoryItems(order.ClientID).Where(i => i.Name == itemInventoryQueryRs.Element("ItemInventoryRet").Element("FullName").Value).SingleOrDefault();
         if (shopInventory == null)
         {
             rep.Add(new ShopInventory(){
                  ClientID = order.ClientID,
                  Name = itemInventoryQueryRs.Element("ItemInventoryRet").Element("FullName").Value,
                  QuickbooksInventoryID = quickbooksItem.QuickbooksInventoryID
             });
         }
         else
         {
             shopInventory.QuickbooksInventoryID = quickbooksItem.QuickbooksInventoryID;
         }
         order.Reported = false;
         rep.Save();
     }
 }
Esempio n. 2
0
 public void Add(QuickbooksInventory item)
 {
     QbDb.QuickbooksInventories.InsertOnSubmit(item);
 }
Esempio n. 3
0
 partial void UpdateQuickbooksInventory(QuickbooksInventory instance);
Esempio n. 4
0
 partial void DeleteQuickbooksInventory(QuickbooksInventory instance);
Esempio n. 5
0
 partial void InsertQuickbooksInventory(QuickbooksInventory instance);