internal static MatchingTransactions getMatchingTransactions(HttpResponseMessage responce)
 {
     var matchingTransactions = new MatchingTransactions();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("matching_transactions"))
     {
         var transArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["matching_transactions"].ToString());
         foreach(var transactionObj in transArray)
         {
             var transaction = new Transaction();
             transaction = JsonConvert.DeserializeObject<Transaction>(transactionObj.ToString());
             matchingTransactions.Add(transaction);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         matchingTransactions.page_context = pageContext;
     }
     if (jsonObj.ContainsKey("instrumentation"))
     {
         var instrumentation = new Instrumentation();
         instrumentation = JsonConvert.DeserializeObject<Instrumentation>(jsonObj["instrumentation"].ToString());
         matchingTransactions.instrumentation = instrumentation;
     }
     return matchingTransactions;
 }
 internal static UserList getUserList(HttpResponseMessage response)
 {
     var userList = new UserList();
     JObject jobject = JObject.Parse(response.Content.ReadAsStringAsync().Result);
     if(jobject["users"]!=null)
     {
         foreach(var userObj in jobject["users"])
         {
             var user = getUserProperties(userObj.ToString());
             userList.Add(user);
         }
     }
     if (jobject["page_context"]!=null)
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jobject["page_context"].ToString());
         userList.page_context = pageContext;
     }
     return userList;
 }
 internal static CurrencyList getCurrencyList(HttpResponseMessage response)
 {
     var currencylist = new CurrencyList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("currencies"))
     {
         var currencyArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["currencies"].ToString());
         foreach(var currencyObj in currencyArray)
         {
             var currency = new Currency();
             currency = JsonConvert.DeserializeObject<Currency>(currencyObj.ToString());
             currencylist.Add(currency);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         currencylist.page_context = pageContext;
     }
     return currencylist;
 }
 internal static ExchangeRateList getExchangeRateList(HttpResponseMessage response)
 {
     var rateList = new ExchangeRateList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("exchange_rates"))
     {
         var ratesArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["exchange_rates"].ToString());
         foreach(var rateObj in ratesArray)
         {
             var rate = new ExchangeRate();
             rate = JsonConvert.DeserializeObject<ExchangeRate>(rateObj.ToString());
             rateList.Add(rate);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         rateList.page_context = pageContext;
     }
     return rateList;
 }
 internal static BankAccountList getBankAccountList(HttpResponseMessage responce)
 {
     var bankAccountList = new BankAccountList();
     var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObject.ContainsKey("bankaccounts"))
     {
         var bankAccountsArray = JsonConvert.DeserializeObject<List<object>>(jsonObject["bankaccounts"].ToString());
         foreach (var bankAccountObj in bankAccountsArray)
         {
             var bankAccount = new BankAccount();
             bankAccount = JsonConvert.DeserializeObject<BankAccount>(bankAccountObj.ToString());
             bankAccountList.Add(bankAccount);
         }
     }
     if (jsonObject.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObject["page_context"].ToString());
         bankAccountList.page_context = pageContext;
     }
     return bankAccountList;
 }
 /// <summary>
 /// Gets the comment list.
 /// </summary>
 /// <param name="responce">The responce.</param>
 /// <returns>CommentList.</returns>
 internal static CommentList getCommentList(HttpResponseMessage responce)
 {
     var commentList = new CommentList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("comments"))
     {
         var commentsArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["comments"].ToString());
         foreach (var commentObj in commentsArray)
         {
             var comment = new Comment();
             comment = JsonConvert.DeserializeObject<Comment>(commentObj.ToString());
             commentList.Add(comment);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         commentList.page_context = pageContext;
     }
     return commentList;
 }
 internal static ExpenseList getExpenseHistory(HttpResponseMessage responce)
 {
     var expenseList = new ExpenseList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("expensehistory"))
     {
         var expenseArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["expensehistory"].ToString());
         foreach(var expObj in expenseArray)
         {
             var expense = new Expense();
             expense = JsonConvert.DeserializeObject<Expense>(expObj.ToString());
             expenseList.Add(expense);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         expenseList.page_context = pageContext;
     }
     return expenseList;
 }
 internal static TaskList gatTaskList(HttpResponseMessage responce)
 {
     var taskList = new TaskList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("task"))
     {
         var tasksArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["task"].ToString());
         foreach(var taskObj in tasksArray)
         {
             var task = new ProjectTask();
             task = JsonConvert.DeserializeObject<ProjectTask>(taskObj.ToString());
             taskList.Add(task);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         taskList.page_context = pageContext;
     }
     return taskList;
 }
 internal static RecurringExpenseList getRecurringExpenseList(HttpResponseMessage responce)
 {
     var recExpList = new RecurringExpenseList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("recurring_expenses"))
     {
         var recExpArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["recurring_expenses"].ToString());
         foreach(var recExpObj in recExpArray)
         {
             var recExp = new RecurringExpense();
             recExp = JsonConvert.DeserializeObject<RecurringExpense>(recExpObj.ToString());
             recExpList.Add(recExp);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         recExpList.page_context = pageContext;
     }
     return recExpList;
 }
 internal static InvoicesList getInvoiceList(HttpResponseMessage responce)
 {
     var invoiceList = new InvoicesList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("invoices"))
     {
         var invoicesArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["invoices"].ToString());
         foreach(var invoiceObj in invoicesArray)
         {
             var invoice = new Invoice();
             invoice = JsonConvert.DeserializeObject<Invoice>(invoiceObj.ToString());
             invoiceList.Add(invoice);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         invoiceList.page_context = pageContext;
     }
     return invoiceList;
 }
Esempio n. 11
0
 internal static ItemList getItemList(HttpResponseMessage response)
 {
     var itemList = new ItemList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("items"))
     {
         var itemsArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["items"].ToString());
         foreach(var itemObj in itemsArray)
         {
             var item = new LineItem();
             item = JsonConvert.DeserializeObject<LineItem>(itemObj.ToString());
             itemList.Add(item);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         itemList.page_context = pageContext;
     }
     return itemList;
 }
Esempio n. 12
0
 internal static BillList getBillList(HttpResponseMessage responce)
 {
     var billList = new BillList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("bills"))
     {
         var billsArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["bills"].ToString());
         foreach(var billObj in billsArray)
         {
             var bill = new Bill();
             bill = JsonConvert.DeserializeObject<Bill>(billObj.ToString());
             billList.Add(bill);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         billList.page_context = pageContext;
     }
     return billList;
 }
 internal static TransactionList getTransactionList(HttpResponseMessage responce)
 {
     var transactionList = new TransactionList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("transactions"))
     {
         var transactionArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["transactions"].ToString());
         foreach (var transactionObj in transactionArray)
         {
             var transaction = new Transaction();
             transaction = JsonConvert.DeserializeObject<Transaction>(transactionObj.ToString());
             transactionList.Add(transaction);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         transactionList.page_context = pageContext;
     }
     return transactionList;
 }
 /// <summary>
 /// Gets the vendor creditlist.
 /// </summary>
 /// <param name="response">The response.</param>
 /// <returns>VendorCreditList.</returns>
 internal static VendorCreditList getVendorCreditlist(HttpResponseMessage response)
 {
     var vendorCreditList = new VendorCreditList();
     var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result);
     if (jsonObject.ContainsKey("vendor_credits"))
     {
         var vendorCreditsArray = JsonConvert.DeserializeObject<List<object>>(jsonObject["vendor_credits"].ToString());
         foreach(var vendorCreditObj in vendorCreditsArray)
         {
             var vendorCredit = new VendorCredit();
             vendorCredit = JsonConvert.DeserializeObject<VendorCredit>(vendorCreditObj.ToString());
             vendorCreditList.Add(vendorCredit);
         }
     }
     if (jsonObject.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObject["page_context"].ToString());
         vendorCreditList.page_context = pageContext;
     }
     return vendorCreditList;
 }
 internal static CreditNoteRefundList getCreditnoteRefundList(HttpResponseMessage responce)
 {
     var creditnoterefundList = new CreditNoteRefundList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("creditnote_refunds"))
     {
         var refundsArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["creditnote_refunds"].ToString());
         foreach(var refundObj in refundsArray)
         {
             var creditnote = new CreditNote();
             creditnote = JsonConvert.DeserializeObject<CreditNote>(refundObj.ToString());
             creditnoterefundList.Add(creditnote);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         creditnoterefundList.page_context = pageContext;
     }
     return creditnoterefundList;
 }
 internal static TimeEntryList getTimeEntrieslist(HttpResponseMessage responce)
 {
     var timeEntryList = new TimeEntryList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("time_entries"))
     {
         var timeEntriesArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["time_entries"].ToString());
         foreach(var timeEntryObj in timeEntriesArray)
         {
             var timeEntry = new TimeEntry();
             timeEntry = JsonConvert.DeserializeObject<TimeEntry>(timeEntryObj.ToString());
             timeEntryList.Add(timeEntry);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         timeEntryList.page_context = pageContext;
     }
     return timeEntryList;
 }
 internal static UserList getUserList(HttpResponseMessage responce)
 {
     var userList = new UserList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("users"))
     {
         var usersArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["users"].ToString());
         foreach(var userObj in usersArray)
         {
             var user = new User();
             user = JsonConvert.DeserializeObject<User>(userObj.ToString());
             userList.Add(user);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         userList.page_context = pageContext;
     }
     return userList;
 }
 /// <summary>
 /// Gets the purchaseorder list.
 /// </summary>
 /// <param name="response">The response.</param>
 /// <returns>PurchaseorderList.</returns>
 internal static PurchaseorderList getPurchaseorderList(HttpResponseMessage response)
 {
     var purchaseorderList = new PurchaseorderList();
     var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result);
     if (jsonObject.ContainsKey("purchaseorders"))
     {
         var purchaseordersArray = JsonConvert.DeserializeObject<List<object>>(jsonObject["purchaseorders"].ToString());
         foreach (var purchaseorderObj in purchaseordersArray)
         {
             var purchaseorder = new Purchaseorder();
             purchaseorder = JsonConvert.DeserializeObject<Purchaseorder>(purchaseorderObj.ToString());
             purchaseorderList.Add(purchaseorder);
         }
     }
     if (jsonObject.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObject["page_context"].ToString());
         purchaseorderList.page_context = pageContext;
     }
     return purchaseorderList;
 }