static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organization id}"); var journalsApi = service.GetJournalsApi(); var parameters = new Dictionary <object, object>(); parameters.Add("filter_by", "JournalDate.All"); Console.WriteLine("---------------Journals List--------------------"); var journalsList = journalsApi.GetJournals(parameters); var journals = journalsList; foreach (var journal in journals) { Console.WriteLine("{0},{1},{2}", journal.journal_id, journal.notes, journal.total); } var journalId = journals[0].journal_id; var accountsApi = service.GetChartOfAccountsApi(); var accountId = accountsApi.GetChartOfAcounts(null)[0].account_id; Console.WriteLine("---------------Specified Journal--------------------"); var journal1 = journalsApi.Get(journalId); Console.WriteLine("{0},{1},{2}", journal1.journal_id, journal1.notes, journal1.total); var lineitems = journal1.line_items; foreach (var lineitem in lineitems) { Console.WriteLine("{0},{1},{2}", lineitem.account_id, lineitem.amount, lineitem.line_id); } var newJournalInfo = new Journal() { journal_date = "2014-02-10", line_items = new List <LineItem>() { new LineItem() { account_id = accountId, debit_or_credit = "credit", amount = 150 }, new LineItem() { account_id = accountId, debit_or_credit = "debit", amount = 150 } } }; Console.WriteLine("---------------New Journal--------------------"); var newJournal = journalsApi.Create(newJournalInfo); Console.WriteLine("{0},{1},{2}", newJournal.journal_id, newJournal.notes, newJournal.total); var lineitems1 = newJournal.line_items; foreach (var lineitem in lineitems1) { Console.WriteLine("{0},{1},{2}", lineitem.account_id, lineitem.amount, lineitem.line_id); } var updateInfo = new Journal() { journal_date = "2014-11-10", line_items = new List <LineItem>() { new LineItem() { account_id = accountId, debit_or_credit = "debit", amount = 130 }, new LineItem() { account_id = accountId, debit_or_credit = "credit", amount = 130 } }, notes = "hari" }; Console.WriteLine("---------------Updated Journal--------------------"); var updatedJournal = journalsApi.Update(newJournal.journal_id, updateInfo); Console.WriteLine("{0},{1},{2}", updatedJournal.journal_id, updatedJournal.notes, updatedJournal.total); Console.WriteLine("---------------Delete Journal--------------------"); var deljournal = journalsApi.Delete(updatedJournal.journal_id); Console.WriteLine(deljournal); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organization id}"); var journalsApi = service.GetJournalsApi(); var parameters = new Dictionary<object, object>(); parameters.Add("filter_by", "JournalDate.All"); Console.WriteLine("---------------Journals List--------------------"); var journalsList = journalsApi.GetJournals(parameters); var journals = journalsList; foreach(var journal in journals) { Console.WriteLine("{0},{1},{2}",journal.journal_id,journal.notes,journal.total); } var journalId = journals[0].journal_id; var accountsApi = service.GetChartOfAccountsApi(); var accountId = accountsApi.GetChartOfAcounts(null)[0].account_id; Console.WriteLine("---------------Specified Journal--------------------"); var journal1 = journalsApi.Get(journalId); Console.WriteLine("{0},{1},{2}", journal1.journal_id, journal1.notes, journal1.total); var lineitems = journal1.line_items; foreach(var lineitem in lineitems) { Console.WriteLine("{0},{1},{2}",lineitem.account_id,lineitem.amount,lineitem.line_id); } var newJournalInfo = new Journal() { journal_date="2014-02-10", line_items = new List<LineItem>() { new LineItem(){ account_id=accountId, debit_or_credit="credit", amount=150 }, new LineItem(){ account_id=accountId, debit_or_credit="debit", amount=150 } } }; Console.WriteLine("---------------New Journal--------------------"); var newJournal = journalsApi.Create(newJournalInfo); Console.WriteLine("{0},{1},{2}", newJournal.journal_id, newJournal.notes, newJournal.total); var lineitems1 = newJournal.line_items; foreach (var lineitem in lineitems1) { Console.WriteLine("{0},{1},{2}", lineitem.account_id, lineitem.amount, lineitem.line_id); } var updateInfo = new Journal() { journal_date = "2014-11-10", line_items = new List<LineItem>() { new LineItem(){ account_id=accountId, debit_or_credit="debit", amount=130 }, new LineItem(){ account_id=accountId, debit_or_credit="credit", amount=130 } }, notes="hari" }; Console.WriteLine("---------------Updated Journal--------------------"); var updatedJournal = journalsApi.Update(newJournal.journal_id, updateInfo); Console.WriteLine("{0},{1},{2}", updatedJournal.journal_id, updatedJournal.notes, updatedJournal.total); Console.WriteLine("---------------Delete Journal--------------------"); var deljournal = journalsApi.Delete(updatedJournal.journal_id); Console.WriteLine(deljournal); } catch(Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organizationId}"); var chartofAccountApi = service.GetChartOfAccountsApi(); var parameters = new Dictionary <object, object>(); parameters.Add("sort_column", "account_name"); Console.WriteLine("----------------------------List of Accounts-----------------"); var chartofaccountsList = chartofAccountApi.GetChartOfAcounts(parameters); var accounts = chartofaccountsList; foreach (var account in accounts) { Console.WriteLine("{0},{1},{2}", account.account_id, account.account_name, account.account_type); } Console.WriteLine("----------------------------Specified Chart of Account-----------------"); var account1 = chartofAccountApi.Get(accounts[0].account_id); Console.WriteLine("{0},{1},{2}", account1.account_id, account1.account_name, account1.account_type); var newAccountInfo = new ChartOfAccount() { account_name = "account name", account_type = "cost_of_goods_sold" }; Console.WriteLine("----------------------------New Account-----------------"); var newAccount = chartofAccountApi.Create(newAccountInfo); Console.WriteLine("{0},{1},{2}", newAccount.account_id, newAccount.account_name, newAccount.account_type); var updateInfo = new ChartOfAccount() { account_name = "hari-test", }; Console.WriteLine("----------------------------Updated Account-----------------"); var updatedAccount = chartofAccountApi.Update(newAccount.account_id, updateInfo); Console.WriteLine("{0},{1},{2}", updatedAccount.account_id, updatedAccount.account_name, updatedAccount.account_type); Console.WriteLine("----------------------------Delete Account-----------------"); var delInfo = chartofAccountApi.Delete(updatedAccount.account_id); Console.WriteLine(delInfo); Console.WriteLine("----------------------------Mark Account as active/inactive-----------------"); var markasinactive = chartofAccountApi.MarkAsInactive(accounts[16].account_id); Console.WriteLine(markasinactive); var markasactive = chartofAccountApi.MarkAsActive(accounts[16].account_id); Console.WriteLine(markasactive); var parameters1 = new Dictionary <object, object>(); parameters1.Add("account_id", accounts[0].account_id); parameters1.Add("date.start", "2014-02-06"); parameters1.Add("date.end", "2014-02-08"); parameters1.Add("amount.less_than", 100); Console.WriteLine("----------------------------Transactions of Account-----------------"); var transactionsList = chartofAccountApi.GetTransactions(parameters1); var trans = transactionsList; foreach (var tran in trans) { Console.WriteLine("{0},{1},{2}", tran.transaction_id, tran.payee, tran.payment_mode); } Console.WriteLine("----------------------------Delete Transaction of Account-----------------"); var deltran = chartofAccountApi.DeleteATransaction(trans[0].transaction_id); Console.WriteLine(deltran); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organizationId}"); var chartofAccountApi = service.GetChartOfAccountsApi(); var parameters = new Dictionary<object, object>(); parameters.Add("sort_column", "account_name"); Console.WriteLine("----------------------------List of Accounts-----------------"); var chartofaccountsList = chartofAccountApi.GetChartOfAcounts(parameters); var accounts = chartofaccountsList; foreach (var account in accounts) Console.WriteLine("{0},{1},{2}", account.account_id, account.account_name, account.account_type); Console.WriteLine("----------------------------Specified Chart of Account-----------------"); var account1 = chartofAccountApi.Get(accounts[0].account_id); Console.WriteLine("{0},{1},{2}", account1.account_id, account1.account_name, account1.account_type); var newAccountInfo = new ChartOfAccount() { account_name = "account name", account_type = "cost_of_goods_sold" }; Console.WriteLine("----------------------------New Account-----------------"); var newAccount = chartofAccountApi.Create(newAccountInfo); Console.WriteLine("{0},{1},{2}", newAccount.account_id, newAccount.account_name, newAccount.account_type); var updateInfo = new ChartOfAccount() { account_name = "hari-test", }; Console.WriteLine("----------------------------Updated Account-----------------"); var updatedAccount = chartofAccountApi.Update(newAccount.account_id, updateInfo); Console.WriteLine("{0},{1},{2}", updatedAccount.account_id, updatedAccount.account_name, updatedAccount.account_type); Console.WriteLine("----------------------------Delete Account-----------------"); var delInfo = chartofAccountApi.Delete(updatedAccount.account_id); Console.WriteLine(delInfo); Console.WriteLine("----------------------------Mark Account as active/inactive-----------------"); var markasinactive = chartofAccountApi.MarkAsInactive(accounts[16].account_id); Console.WriteLine(markasinactive); var markasactive = chartofAccountApi.MarkAsActive(accounts[16].account_id); Console.WriteLine(markasactive); var parameters1 = new Dictionary<object, object>(); parameters1.Add("account_id", accounts[0].account_id); parameters1.Add("date.start", "2014-02-06"); parameters1.Add("date.end", "2014-02-08"); parameters1.Add("amount.less_than", 100); Console.WriteLine("----------------------------Transactions of Account-----------------"); var transactionsList = chartofAccountApi.GetTransactions(parameters1); var trans = transactionsList; foreach (var tran in trans) Console.WriteLine("{0},{1},{2}", tran.transaction_id, tran.payee, tran.payment_mode); Console.WriteLine("----------------------------Delete Transaction of Account-----------------"); var deltran = chartofAccountApi.DeleteATransaction(trans[0].transaction_id); Console.WriteLine(deltran); } catch(Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organizationId}"); var rulesApi = service.GetBankRulesApi(); var parameters = new Dictionary<object, object>(); var accountsApi = service.GetBankAccountsApi(); var accounts = accountsApi.GetBankAccounts(null); var chartOfAccountsApi = service.GetChartOfAccountsApi(); var chartOfAccounts = chartOfAccountsApi.GetChartOfAcounts(null); parameters.Add("account_id", accounts[1].account_id); Console.WriteLine("--------------------------Rules List---------------"); var rules = rulesApi.GetRules(parameters); foreach (var tempRule in rules) { Console.WriteLine("{0},{1},{2}", tempRule.rule_id, tempRule.rule_name, tempRule.account_name); var tempCriterions = tempRule.criterion; Console.WriteLine("criterions"); foreach (var tempCriterion in tempCriterions) Console.WriteLine("{0},{1}", tempCriterion.criteria_id, tempCriterion.value); } Console.WriteLine("--------------------------------------Specified Rule ----------------------------"); var rule = rulesApi.Get(rules[0].rule_id); Console.WriteLine("{0},{1},{2}", rule.rule_id, rule.rule_name, rule.account_name); var ruleInfo = new Rule() { rule_name = "hari", target_account_id = accounts[0].account_id, apply_to = "withdrawals", criteria_type = "or", criterion = new List<Criterion>(){ new Criterion(){ field="payee", comparator="contains", value="9" } }, record_as = "expense", account_id = chartOfAccounts[41].account_id }; Console.WriteLine("----------------------------New Rule-----------------------"); var newRule = rulesApi.Create(ruleInfo); Console.WriteLine("{0},{1},{2}", newRule.rule_id, newRule.rule_name, newRule.account_name); var newcriterions = newRule.criterion; Console.WriteLine("criterions"); foreach (var criterion in newcriterions) Console.WriteLine("{0},{1}", criterion.criteria_id, criterion.value); var updateInfo = new Rule() { rule_name = "krishna", apply_to = "withdrawals", criteria_type = "or", criterion = new List<Criterion>(){ new Criterion(){ field="payee", comparator="contains", value="8" } }, record_as = "expense", }; Console.WriteLine("----------------------------Updated Rule----------------------"); var updatedRule = rulesApi.Update(newRule.rule_id, updateInfo); Console.WriteLine("{0},{1},{2}", updatedRule.rule_id, updatedRule.rule_name, updatedRule.account_name); var criterions1 = updatedRule.criterion; Console.WriteLine("criterions"); foreach (var criterion in criterions1) Console.WriteLine("{0},{1}", criterion.criteria_id, criterion.value); Console.WriteLine("-------------------------------Delete Rule--------------------------------------"); var delRule = rulesApi.Delete(updatedRule.rule_id); Console.WriteLine(delRule); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organizationId}"); var rulesApi = service.GetBankRulesApi(); var parameters = new Dictionary <object, object>(); var accountsApi = service.GetBankAccountsApi(); var accounts = accountsApi.GetBankAccounts(null); var chartOfAccountsApi = service.GetChartOfAccountsApi(); var chartOfAccounts = chartOfAccountsApi.GetChartOfAcounts(null); parameters.Add("account_id", accounts[1].account_id); Console.WriteLine("--------------------------Rules List---------------"); var rules = rulesApi.GetRules(parameters); foreach (var tempRule in rules) { Console.WriteLine("{0},{1},{2}", tempRule.rule_id, tempRule.rule_name, tempRule.account_name); var tempCriterions = tempRule.criterion; Console.WriteLine("criterions"); foreach (var tempCriterion in tempCriterions) { Console.WriteLine("{0},{1}", tempCriterion.criteria_id, tempCriterion.value); } } Console.WriteLine("--------------------------------------Specified Rule ----------------------------"); var rule = rulesApi.Get(rules[0].rule_id); Console.WriteLine("{0},{1},{2}", rule.rule_id, rule.rule_name, rule.account_name); var ruleInfo = new Rule() { rule_name = "hari", target_account_id = accounts[0].account_id, apply_to = "withdrawals", criteria_type = "or", criterion = new List <Criterion>() { new Criterion() { field = "payee", comparator = "contains", value = "9" } }, record_as = "expense", account_id = chartOfAccounts[41].account_id }; Console.WriteLine("----------------------------New Rule-----------------------"); var newRule = rulesApi.Create(ruleInfo); Console.WriteLine("{0},{1},{2}", newRule.rule_id, newRule.rule_name, newRule.account_name); var newcriterions = newRule.criterion; Console.WriteLine("criterions"); foreach (var criterion in newcriterions) { Console.WriteLine("{0},{1}", criterion.criteria_id, criterion.value); } var updateInfo = new Rule() { rule_name = "krishna", apply_to = "withdrawals", criteria_type = "or", criterion = new List <Criterion>() { new Criterion() { field = "payee", comparator = "contains", value = "8" } }, record_as = "expense", }; Console.WriteLine("----------------------------Updated Rule----------------------"); var updatedRule = rulesApi.Update(newRule.rule_id, updateInfo); Console.WriteLine("{0},{1},{2}", updatedRule.rule_id, updatedRule.rule_name, updatedRule.account_name); var criterions1 = updatedRule.criterion; Console.WriteLine("criterions"); foreach (var criterion in criterions1) { Console.WriteLine("{0},{1}", criterion.criteria_id, criterion.value); } Console.WriteLine("-------------------------------Delete Rule--------------------------------------"); var delRule = rulesApi.Delete(updatedRule.rule_id); Console.WriteLine(delRule); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }