/// <summary> /// Adds the comment to a bill. /// </summary> /// <param name="bill_id">The bill_id is the identifier of the bill.</param> /// <param name="new_comment_info">The new_comment_info is the Comment object which is having the comment information.</param> /// <returns>System.String.<br></br>The success message is "Comments added." </returns> public string AddComment(string bill_id, Comment new_comment_info) { string url = baseAddress + "/" + bill_id + "/comments"; var json = JsonConvert.SerializeObject(new_comment_info); var jsonstring = new Dictionary<object, object>(); jsonstring.Add("JSONString", json); var responce = ZohoHttpClient.post(url, getQueryParameters(jsonstring)); return BillParser.getMessage(responce); }
/// <summary> /// Adds the comment. /// </summary> /// <param name="vendor_credit_id">The vendor_credit_id.</param> /// <param name="new_comment_description">The new_comment_description.</param> /// <returns>Comment.</returns> public Comment AddComment(string vendor_credit_id,Comment new_comment_description) { var url = baseAddress + "/" + vendor_credit_id + "/comments"; var json = JsonConvert.SerializeObject(new_comment_description); var parameters = new Dictionary<object, object>(); parameters.Add("JSONString", json); var response = ZohoHttpClient.post(url, getQueryParameters(parameters)); return VendorCreditParser.getComment(response); }
/// <summary> /// Adds a comment to an existing credit note. /// </summary> /// <param name="creditnote_id">The creditnote_id is the identifier of the crditnote.</param> /// <param name="new_comment">The new_comment is the Comment object which is having new comment information.</param> /// <returns>Comment object.</returns> public Comment AddComment(string creditnote_id, Comment new_comment) { string url = baseAddress + "/" + creditnote_id + "/comments"; var json = JsonConvert.SerializeObject(new_comment); var jsonstring = new Dictionary<object, object>(); jsonstring.Add("JSONString", json); var responce = ZohoHttpClient.post(url, getQueryParameters(jsonstring)); return CreditNoteParser.getComment(responce); }
/// <summary> /// Adds the comment. /// </summary> /// <param name="salesorder_id">The salesorder_id.</param> /// <param name="new_comment_info">The new_comment_info.</param> /// <returns>Comment.</returns> public Comment AddComment(string salesorder_id,Comment new_comment_info) { string url = baseAddress + "/" + salesorder_id + "/comments"; var json = JsonConvert.SerializeObject(new_comment_info); var jsonstring = new Dictionary<object, object>(); jsonstring.Add("JSONString", json); var response = ZohoHttpClient.post(url, getQueryParameters(jsonstring)); return SalesorderParser.getComment(response); }
/// <summary> /// Gets the comment. /// </summary> /// <param name="responce">The responce.</param> /// <returns>Comment.</returns> internal static Comment getComment(HttpResponseMessage responce) { var comment = new Comment(); var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("comment")) { comment = JsonConvert.DeserializeObject<Comment>(jsonObj["comment"].ToString()); } return comment; }
internal static CommentList getCommentsList(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); } } return commentList; }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organization id}"); var invoicesApi = service.GetInvoicesApi(); var parameters = new Dictionary<object, object>(); var invoicesList = invoicesApi.GetInvoices(parameters); var invoices = invoicesList; var invoiceId = invoices[1].invoice_id; var custId = invoices[0].customer_id; var contactId=invoices[0].contact_persons[1]; foreach (var invoice in invoices) Console.WriteLine("Id:{0},Name:{1},due date:{2},total:{3}",invoice.invoice_id,invoice.name,invoice.due_date,invoice.total); var parameters1 = new Dictionary<object, object>(); var invoice1 = invoicesApi.Get(invoiceId, parameters1); Console.WriteLine("Id:{0},Name:{1},status:{2},total:{3}", invoice1.invoice_id, invoice1.name, invoice1.status, invoice1.total); var newInvoiceInfo = new Invoice() { customer_id = custId, reference_number = "jwqjjkw", payment_terms = 15, payment_terms_label = "Net 15", allow_partial_payments = false, custom_fields = { }, exchange_rate = 1, template_id = "{template id}", is_discount_before_tax = true, discount = "", discount_type = "item_level", shipping_charge = 50, adjustment = -100, adjustment_description = " adjustment", salesperson_name = "John Michael" }; var parameters8 = new Dictionary<object, object>(); var newinvoice = invoicesApi.Create(newInvoiceInfo,parameters8); Console.WriteLine("Id:{0},Name:{1},status:{2},total:{3}", newinvoice.invoice_id, newinvoice.name, newinvoice.status, newinvoice.total); var updateinfo = new Invoice() { salesperson_name="ha", }; var updatedInvoice = invoicesApi.Update(invoiceId, updateinfo, parameters8); Console.WriteLine("Id:{0},Name:{1},status:{2},salesPerson:{3}", updatedInvoice.invoice_id, updatedInvoice.name, updatedInvoice.status, updatedInvoice.salesperson_name); var deletemsg = invoicesApi.Delete(invoices[3].invoice_id); Console.WriteLine(deletemsg); var statusMsg = invoicesApi.MarkAsSent(invoiceId); Console.WriteLine(statusMsg); var status = invoicesApi.MarkAsVoid(invoiceId); Console.WriteLine(status); var statusmsg = invoicesApi.MarkAsDraft(invoiceId); Console.WriteLine(statusmsg); var emaildata=new EmailNotification(){ to_mail_ids=new List<string>(){"*****@*****.**"}, subject="invoice mail", body="hi" }; var parameters9 = new Dictionary<object, object>(); var emailInvoice = invoicesApi.SendEmail(invoiceId, emaildata, new string[] { @"attachment path", @"attachment path" }, parameters9); Console.WriteLine(emailInvoice); var parameters2 = new Dictionary<object, object>(); parameters2.Add("invoice_ids", invoices[2].invoice_id+","+invoices[0].invoice_id); var contactsToSend=new Contacts(){ contacts=new List<Contact>(){ new Contact(){ contact_id=contactId, email="true", snail_mail=true }, } }; var emailInvoices=invoicesApi.EmailInvoices(contactsToSend,parameters2); Console.WriteLine(emailInvoices); var parameters3 = new Dictionary<object, object>(); parameters3.Add("invoice_ids", invoices[2].invoice_id + "," + invoices[0].invoice_id); var emailcontent = invoicesApi.GetEmailContent(invoiceId, parameters3); Console.WriteLine("{0},{1},{2}", emailcontent.body, emailcontent.file_name, emailcontent.gateways_configured); var notifydetails = new EmailNotification() { to_mail_ids = new List<string>() { "{mail id 1}", "{mail id 2}" }, subject="payment reminder", body="dear " }; var parameters4 = new Dictionary<object, object>(); var remindMsg = invoicesApi.RemindCustomer(invoiceId, notifydetails, parameters4); Console.WriteLine(remindMsg); var parameters5 = new Dictionary<object, object>(); parameters5.Add("invoice_ids", invoices[2].invoice_id + "," + invoices[0].invoice_id); var bulkReminderMsg = invoicesApi.BulkInvoiceReminder(parameters5); Console.WriteLine(bulkReminderMsg); var reminderContent = invoicesApi.GetPaymentReminder(invoiceId); Console.WriteLine("{0},{1},{2}", reminderContent.body, reminderContent.file_name, reminderContent.gateways_configured); var parameters6 = new Dictionary<object, object>(); parameters6.Add("invoice_ids", invoices[2].invoice_id + "," + invoices[0].invoice_id); var bulkExport = invoicesApi.BulkExport(parameters6); Console.WriteLine(bulkExport); var disableReminderMsg = invoicesApi.DisablePaymentReminder(invoiceId); Console.WriteLine(disableReminderMsg); var enableReminderMsg = invoicesApi.EnablePaymentReminder(invoiceId); Console.WriteLine(enableReminderMsg); var writeoff = invoicesApi.WriteoffInvoice(invoiceId); Console.WriteLine(writeoff); var cancleWriteoff = invoicesApi.CancelWriteoff(invoiceId); Console.WriteLine(cancleWriteoff); var updateInfo = new Address() { address = "addr", is_update_customer = false }; var billingdAddrUpdate = invoicesApi.UpdateBillingAddress(invoiceId, updateInfo); Console.WriteLine(billingdAddrUpdate); var updateInfo1 = new Address() { address = "addr", is_update_customer = false }; var shippingdAddrUpdate = invoicesApi.UpdateShippingAddress(invoiceId, updateInfo); Console.WriteLine(shippingdAddrUpdate); var invoicetemplatesList = invoicesApi.GetTemplates(); var invoicetemplates = invoicetemplatesList; foreach (var template in invoicetemplates) Console.WriteLine("Templates\n{0},{1},{2}", template.template_id, template.template_name, template.template_type); var updateTemplate = invoicesApi.UpdateTemplate(invoiceId, invoicetemplates[0].template_id); Console.WriteLine(updateTemplate); var invoicePaymentsList = invoicesApi.GetPayments(invoiceId); var invoicePayments = invoicePaymentsList; var paymentId=invoicePayments[1].payment_id; foreach (var payment in invoicePayments) Console.WriteLine("payment:{0},{1},{2}", payment.payment_id, payment.description, payment.invoice_id); var appliedCreditsList = invoicesApi.GetCreditsApplied(invoiceId); var appliedCredits = appliedCreditsList; var creditnoteId=appliedCredits[1].creditnote_id; foreach (var credit in appliedCredits) Console.WriteLine("credit note:{0},{1},{2}", credit.creditnote_id, credit.amount_applied, credit.creditnotes_number); var creditstoapplly = new UseCredits() { apply_creditnotes = new List<CreditNote>() { new CreditNote(){ creditnote_id=creditnoteId, amount_applied=40.00 } } }; var appliedCredits1 = invoicesApi.AddCredits(invoiceId, creditstoapplly); var creditnotes = appliedCredits1.apply_creditnotes; foreach(var credit in creditnotes) Console.WriteLine("credit note:{0},{1}", credit.creditnote_id, credit.amount_applied); var deletePaymentmsg = invoicesApi.DeletePayment(invoiceId,paymentId); Console.WriteLine(deletePaymentmsg); var deleteAppliedcredit = invoicesApi.DelteAppliedCredit(invoiceId, creditnoteId); Console.WriteLine(deleteAppliedcredit); var commentsList = invoicesApi.GetComments(invoiceId); var comments = commentsList; foreach (var comment in comments) Console.WriteLine("{0},{1},{2}", comment.comment_id, comment.description, comment.commented_by); var newCommentInfo = new Comment() { description = "new comment", show_comment_to_clients = true }; var newComment = invoicesApi.AddComment(invoiceId, newCommentInfo); Console.WriteLine(newComment); var updateInfo2 = new Comment() { description = "updated comment", show_comment_to_clients = true }; var updatedComment = invoicesApi.UpdateComment(invoiceId, comments[1].comment_id, updateInfo2); Console.WriteLine("{0},{1},{2}", updatedComment.comment_id, updatedComment.description, updatedComment.commented_by); var deleteMsg = invoicesApi.DeleteComment(invoiceId, comments[3].comment_id); Console.WriteLine(deleteMsg); var attachment = invoicesApi.GetAttachment(invoiceId); Console.WriteLine(attachment); var parameters7 = new Dictionary<object, object>(); parameters7.Add("can_send_in_mail",true); var attachPreference = invoicesApi.UpdateAttachment(invoiceId, parameters7); Console.WriteLine(attachPreference); var deleteAttach = invoicesApi.DeleteAttachment(invoiceId); Console.WriteLine(deleteAttach); var deleteExpenceRecipt = invoicesApi.DeleteExpenseReceipt(invoiceId); Console.WriteLine(deleteExpenceRecipt); } 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 projectsApi = service.GetProjectsApi(); var parameters = new Dictionary<object, object>(); parameters.Add("filter_by", "Status.Active"); var projectsList = projectsApi.GetProjects(null); var projects = projectsList; var projectId = projects[0].project_id; foreach (var project in projects) Console.WriteLine("{0},{1},{2}", project.project_name, project.billing_type, project.status); var project1 = projectsApi.Get(projectId); Console.WriteLine("{0},{1},{2}", project1.project_name, project1.tasks.Count, project1.users.Count); var newPrjctInfo = new Project() { project_name="project-test-1", customer_id = project1.customer_id, billing_type = "fixed_cost_for_project", rate=1000, }; var newProject = projectsApi.Create(newPrjctInfo); Console.WriteLine("{0},{1},{2}", newProject.project_name, newProject.billing_type, newProject.status); var updateInfo = new Project() { project_name="project-test-updated", }; var updatedprjct = projectsApi.Update(newProject.project_id, updateInfo); Console.WriteLine("{0},{1},{2}", updatedprjct.project_name, updatedprjct.billing_type, updatedprjct.status); var delprjct = projectsApi.Delete(updatedprjct.project_id); Console.WriteLine(delprjct); var inAct = projectsApi.Inactivate(projectId); Console.WriteLine(inAct); var act = projectsApi.Activate(projectId); Console.WriteLine(act); var clonePrjctInfo = new Project() { project_name="clone-test", description="cloned for test" }; var clonePrjct = projectsApi.Clone(projectId, clonePrjctInfo); Console.WriteLine("{0},{1},{2}", clonePrjct.project_name, clonePrjct.billing_type, clonePrjct.status); var parameters1 = new Dictionary<object, object>(); var taskslist = projectsApi.GetTasks(projectId, parameters1); var tasks = taskslist; var taskId = tasks[0].task_id; foreach (var task in tasks) Console.WriteLine("{0},{1}", task.task_name, task.billed_hours); var task1 = projectsApi.GetATask(projectId, taskId); Console.WriteLine("{0},{1}", task1.task_name, task1.rate); var newTaskInfo = new ProjectTask() { task_name = "task new for test", description = "new task to project", }; var newTask = projectsApi.AddATask(projectId, newTaskInfo); Console.WriteLine("{0},{1}", newTask.task_name, newTask.rate); var updateInfo1 = new ProjectTask() { task_name = "ta3", }; var updatedTask = projectsApi.UpdateTask(projectId, newTask.task_id, updateInfo1); Console.WriteLine("{0},{1}", updatedTask.task_name, updatedTask.task_id); var delTask = projectsApi.DeleteTask(projectId, updatedTask.task_id); Console.WriteLine(delTask); var usersList = projectsApi.GetUsers(projectId); var users = usersList; var userId = users[0].user_id; foreach (var user in users) Console.WriteLine("{0},{1},{2}", user.user_name, user.user_role, user.rate); var user1 = projectsApi.GetAUser(projectId, userId); Console.WriteLine("{0},{1},{2}", user1.user_name, user1.user_role, user1.rate); var userstoAssign = new UsersToAssign() { users = new List<User>() { new User() { user_id=userId } } }; var users1 = projectsApi.AssignUsers(projectId, userstoAssign); foreach (var user in users1) Console.WriteLine("{0},{1},{2}", user.user_name, user.user_role, user.rate); var userInfo = new User() { user_name="name-twst", email="*****@*****.**", user_role="staff" }; var user2 = projectsApi.InviteUser(projectId, userInfo); Console.WriteLine("{0},{1},{2}", user2.user_name, user2.user_role, user2.rate); var updateInfo2 = new User() { user_name="name", user_role = "admin" }; var UpdatedUser = projectsApi.UpdateUser(projectId, user2.user_id, updateInfo2); Console.WriteLine("{0},{1},{2}", UpdatedUser.user_name, UpdatedUser.user_role, UpdatedUser.rate); var deleteUser = projectsApi.DeleteUser(projectId, UpdatedUser.user_id); Console.WriteLine(deleteUser); var parameters2 = new Dictionary<object, object>(); var timeEntrieslist = projectsApi.GetTimeEnries(parameters2); var timeEntries = timeEntrieslist; var timeEnteryId = timeEntries[0].time_entry_id; foreach (var timeentry in timeEntries) Console.WriteLine("time entry of id {0} for the project {1} of user {2} of log time:{3}\n",timeentry.time_entry_id,timeentry.project_name,timeentry.user_name,timeentry.log_time); var timeentry1 = projectsApi.GetATimeEntry(timeEnteryId); Console.WriteLine("time entry of id {0} for the project {1} of user {2} of log time:{3}\n", timeentry1.time_entry_id, timeentry1.project_name, timeentry1.user_name, timeentry1.log_time); var newTimeentryInfo = new TimeEntry() { project_id =projectId, task_id = taskId, user_id = userId, log_date="2014-11-13", log_time="06:46" }; var newTimeentry = projectsApi.LogTimeEntry(newTimeentryInfo); Console.WriteLine("time entry of id {0} for the project {1} of user {2} of log time:{3}\n", newTimeentry.time_entry_id, newTimeentry.project_name, newTimeentry.user_name, newTimeentry.log_time); var updateInfo3 = new TimeEntry() { project_id = projectId, user_id = userId, log_time="02:00", }; var updatedTimeEntry = projectsApi.UpdateTimeEntry(newTimeentry.time_entry_id, updateInfo3); Console.WriteLine("time entry of id {0} for the project {1} of user {2} of log time:{3}\n", updatedTimeEntry.time_entry_id, updatedTimeEntry.project_name, updatedTimeEntry.user_name, updatedTimeEntry.log_time); var deleteMsg = projectsApi.DeleteTimeEntry(updatedTimeEntry.time_entry_id); Console.WriteLine(deleteMsg); var parameters3 = new Dictionary<object, object>(); parameters3.Add("time_entry_ids", timeEnteryId+","+updatedTimeEntry.time_entry_id); var deleteEntries = projectsApi.DeleteTimeEntries(parameters3); Console.WriteLine(deleteEntries); var timer = projectsApi.GetTimer(); Console.WriteLine("time entry of id {0} for the project {1} of user {2} of log time:{3}\n", timer.time_entry_id, timer.project_name, timer.user_name, timer.log_time); var timerStart = projectsApi.StartTimer(timeEnteryId); Console.WriteLine("time entry of id {0} for the project {1} of user {2} of log time:{3}\n", timerStart.time_entry_id, timerStart.project_name, timerStart.user_name, timerStart.log_time); var stopTimer = projectsApi.StopTimer(); Console.WriteLine("time entry of id {0} for the project {1} of user {2} of log time:{3}\n", stopTimer.time_entry_id, stopTimer.project_name, stopTimer.user_name, stopTimer.log_time); var commentsList = projectsApi.GetComments(projectId); var comments = commentsList; foreach (var comment in comments) Console.WriteLine("{0},{1},{2}", comment.comment_id, comment.description, comment.commented_by); var newCommentInfo = new Comment() { description = "manually added comment", }; var newComment = projectsApi.AddComment(projectId, newCommentInfo); Console.WriteLine("{0},{1},{2}", newComment.comment_id, newComment.description, newComment.commented_by); var deleteComment = projectsApi.DeleteComment(projectId, newComment.comment_id); Console.WriteLine(deleteComment); var parameters4 = new Dictionary<object, object>(); var invoicesList = projectsApi.GetInvoices(projectId, null); foreach (var invoice in invoicesList) Console.WriteLine("{0},{1},{2}", invoice.invoice_number, invoice.total, invoice.status); } catch(Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { BillsApi billsApi = new BillsApi("{authtoken}", "{organizationId}"); var parameters = new Dictionary<object, object>(); var getBillAttach = billsApi.GetAttachment("71917000000088001", parameters); Console.WriteLine(getBillAttach); var parameters1 = new Dictionary<object, object>(); var bills = billsApi.GetBills(parameters1); if (bills != null) { foreach (var bill in bills) { Console.WriteLine("{0},{1},{2}", bill.bill_id, bill.vendor_name, bill.status); } } var billbyId = billsApi.Get("71917000000216033"); if (billbyId != null) { Console.WriteLine("{0},{1},{2}", billbyId.bill_id, billbyId.vendor_name, billbyId.status); Console.WriteLine("line Items {0}", billbyId.line_items.Count); List<LineItem> lts = billbyId.line_items; if (lts != null) foreach (var lt in lts) { Console.WriteLine("{0},{1},{2}", lt.account_name, lt.rate, lt.line_item_id); } } var newBillInfo = new Bill() { vendor_id = "71917000000020021", bill_number = "130", line_items = new List<LineItem>() { new LineItem{ account_id="71917000000000451", rate=1.0 } } }; var newBill = billsApi.Create(newBillInfo, @"F:\Personal\hari-2197\Desktop\2.jpg"); if (newBill != null) Console.WriteLine("{0},{1},{2}", newBill.bill_id, newBill.vendor_name, newBill.status); var updateInfo = new Bill() { bill_number = "156" }; var updatedBill = billsApi.Update("71917000000088017", updateInfo, @"F:\error.png"); if (updatedBill != null) Console.WriteLine("{0},{1},{2}", updatedBill.bill_id, updatedBill.vendor_name, updatedBill.attachment_name); var delBill = billsApi.Delete("71917000000089001"); Console.WriteLine(delBill); var voidBill = billsApi.VoidABill("71917000000088017"); Console.WriteLine(voidBill); var openBill = billsApi.MarkBillAsOpen("71917000000088017"); Console.WriteLine(openBill); var newBillingaddr = new Address() { state = "A.P", zip = "523117" }; var updatedBillindaddr = billsApi.UpdateBillingAddress("71917000000088017", newBillingaddr); Console.WriteLine(updatedBillindaddr); var billpayments = billsApi.GetPayments("71917000000088001"); foreach (var billpayment in billpayments) { Console.WriteLine("{0},{1}", billpayment.payment_id, billpayment.bill_payment_id); } UseCredits creditsToApply = new UseCredits() { bill_payments = new List<Payment>(){ new Payment(){ payment_id="71917000000087297", amount_applied=5 }, } }; var applyCredits = billsApi.ApplyCredits("71917000000088001", creditsToApply); Console.WriteLine(applyCredits); var delbillpay = billsApi.DeletePayment("71917000000088001", "71917000000090031"); Console.WriteLine(delbillpay); var parameters2 = new Dictionary<object, object>(); parameters2.Add("preview", false); var getBillAttach1 = billsApi.GetAttachment("71917000000088017", parameters2); Console.WriteLine(getBillAttach1); var delAttach = billsApi.DeleteAttachment("71917000000088001"); Console.WriteLine(delAttach); var attachfile = billsApi.AddAttachment("71917000000088001", @"C:\Users\hari-pt117\Downloads\Download Excel Macro Sample.xls"); Console.WriteLine(attachfile); var comments = billsApi.GetComments("71917000000088017"); if (comments != null) foreach (var comment in comments) Console.WriteLine("{0},{1},{2}", comment.comment_id, comment.description, comment.commented_by); var newCommentinfo = new Comment() { description = "nothing2" }; var newComment = billsApi.AddComment("71917000000088017", newCommentinfo); Console.WriteLine(newComment); var delcomment = billsApi.DeleteComment("71917000000088001", "71917000000088005"); Console.WriteLine(delcomment); } catch(Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
/// <summary> /// Update an existing comment of an invoice. /// </summary> /// <param name="invoice_id">The invoice_id is the identifier of the invoice.</param> /// <param name="comment_id">The comment_id is the identifier of the comment of specified invoice.</param> /// <param name="update_info">The update_info is the Comment object which contains the updation information.</param> /// <returns>Comment object.</returns> public Comment UpdateComment(string invoice_id, string comment_id, Comment update_info) { string url = baseAddress + "/" + invoice_id + "/comments/"+comment_id; var json = JsonConvert.SerializeObject(update_info); var jsonstring = new Dictionary<object, object>(); jsonstring.Add("JSONString", json); var responce = ZohoHttpClient.put(url, getQueryParameters(jsonstring)); return CreditNoteParser.getComment(responce); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organization id}"); var salesOrdersApi = service.GetSalesordersApi(); Console.WriteLine("------------------ SalesOrders -------------"); var salesOrders = salesOrdersApi.GetSalesorders(null); foreach(var tempSalesOrder in salesOrders) Console.WriteLine("Id:{0},date:{1},customerName:{2},status:{3},Amount:{4}",tempSalesOrder.salesorder_id,tempSalesOrder.date,tempSalesOrder.customer_name,tempSalesOrder.status,tempSalesOrder.total); Console.WriteLine("--------------------Specified SalesOrder----------------------"); var salesOrder = salesOrdersApi.Get(salesOrders[0].salesorder_id,null); Console.WriteLine("Id:{0},date:{1},customerName:{2},status:{3},Amount:{4}", salesOrder.salesorder_id, salesOrder.date, salesOrder.customer_name, salesOrder.status, salesOrder.total); Console.WriteLine("Line Items"); var lineitems = salesOrder.line_items; foreach(var tempLineitem in lineitems) { Console.WriteLine("Id:{0},name:{1},rate:{2}", tempLineitem.line_item_id, tempLineitem.name, tempLineitem.rate); } Console.WriteLine("--------------------New SalesOrder----------------------"); var newSalesOrderInfo=new Salesorder() { customer_id=salesOrders[0].customer_id, line_items = new List<LineItem> { new LineItem{ item_id=lineitems[0].item_id, }, }, }; var newSalesOrder = salesOrdersApi.Create(newSalesOrderInfo, null); Console.WriteLine("Id:{0},date:{1},customerName:{2},status:{3},Amount:{4}", newSalesOrder.salesorder_id, newSalesOrder.date, salesOrder.customer_name, newSalesOrder.status, newSalesOrder.total); Console.WriteLine("Line Items"); var newLineitems = salesOrder.line_items; foreach (var tempLineitem in newLineitems) { Console.WriteLine("Id:{0},name:{1},rate:{2}", tempLineitem.line_item_id, tempLineitem.name, tempLineitem.rate); } Console.WriteLine("--------------------Updated SalesOrder----------------------"); var updateInfo = new Salesorder() { line_items = new List<LineItem> { new LineItem{ item_id=lineitems[0].item_id, rate=150, }, }, }; var updatedSalesOrder = salesOrdersApi.Update(newSalesOrder.salesorder_id,updateInfo,null); Console.WriteLine("Id:{0},date:{1},customerName:{2},status:{3},Amount:{4}", updatedSalesOrder.salesorder_id, updatedSalesOrder.date, updatedSalesOrder.customer_name, updatedSalesOrder.status, updatedSalesOrder.total); Console.WriteLine("Line Items"); var updatedLineitems = salesOrder.line_items; foreach (var tempLineitem in updatedLineitems) { Console.WriteLine("Id:{0},name:{1},rate:{2}", tempLineitem.line_item_id, tempLineitem.name, tempLineitem.rate); } Console.WriteLine("--------------------Delete SalesOrder----------------------"); var deleteMsg = salesOrdersApi.Delete(updatedSalesOrder.salesorder_id); Console.WriteLine(deleteMsg); Console.WriteLine("--------------------Mark SalesOrder as Open----------------------"); var markAsOpen = salesOrdersApi.MarkAsOpen(salesOrders[0].salesorder_id); Console.WriteLine(markAsOpen); Console.WriteLine("--------------------Mark SalesOrder as Void----------------------"); var markAsVoid = salesOrdersApi.MarkAsVoid(salesOrders[0].salesorder_id); Console.WriteLine(markAsVoid); Console.WriteLine("--------------------Email A SalesOrder----------------------"); var emailDetails = new EmailNotification() { to_mail_ids = new List<string>(){"*****@*****.**",}, subject="test sub", body="body-test" }; var emailOrder=salesOrdersApi.SendEmail(salesOrders[1].salesorder_id,emailDetails,null); Console.WriteLine(emailOrder); Console.WriteLine("--------------------Email Content of SalesOrder----------------------"); var emailData = salesOrdersApi.GetEmailContent(salesOrders[1].salesorder_id, null); Console.WriteLine("Body:{0}\nSub:{1}\nTemplate Id{2}",emailData.body,emailData.subject,emailData.emailtemplates[0].email_template_id); Console.WriteLine("--------------------Bulk Export----------------------------"); var salesorderIds = new List<string> { salesOrders[0].salesorder_id,}; var bulkExport = salesOrdersApi.BulkExportSalesorders(salesorderIds); Console.WriteLine(bulkExport); Console.WriteLine("--------------------Bulk Print----------------------------"); var bulkPrint = salesOrdersApi.BulkExportSalesorders(salesorderIds); Console.WriteLine(bulkPrint); var addr_info = new Address() { city="test-city", country="test-country" }; Console.WriteLine("--------------------Update BillingAddress----------------------------"); var updatedBillingAddr = salesOrdersApi.UpdateBillingAddress(salesOrders[0].salesorder_id, addr_info); Console.WriteLine("city:{0},state:{1}",updatedBillingAddr.city,updatedBillingAddr.country); Console.WriteLine("--------------------Update ShippingAddress----------------------------"); var updatedShippingAddr = salesOrdersApi.UpdateShippingAddress(salesOrders[0].salesorder_id, addr_info); Console.WriteLine("city:{0},state:{1}", updatedShippingAddr.city, updatedShippingAddr.country); Console.WriteLine("---------------------Templates-------------------"); var templates = salesOrdersApi.GetTemplates(); foreach (var template in templates) Console.WriteLine("id:{0},name:{1}", template.template_id, template.template_name); Console.WriteLine("-----------------------Update Template----------------"); var updatedTemplate = salesOrdersApi.UpdateTemplate(salesOrders[0].salesorder_id, templates[0].template_id); Console.WriteLine(updatedTemplate); Console.WriteLine("-------------------------Attachments-----------------"); var getAttachment = salesOrdersApi.GetAttachment(salesOrders[1].salesorder_id,null); Console.WriteLine(getAttachment); var addAttachment=salesOrdersApi.AddAttachment(salesOrders[0].salesorder_id,@"C:\Users\hari-2197\Desktop\h.jpg",null); Console.WriteLine(addAttachment); var attachPreference = new Dictionary<object, object>(); attachPreference.Add("can_send_in_mail", true); var updatedAttachPreference = salesOrdersApi.UpdateAttachmentPreference(salesOrders[0].salesorder_id, attachPreference); Console.WriteLine(updatedAttachPreference); var delAttachment = salesOrdersApi.DeleteAnAttachment(salesOrders[0].salesorder_id); Console.WriteLine(delAttachment); Console.WriteLine("-------------------------Comments-----------------"); var comments = salesOrdersApi.GetComments(salesOrders[0].salesorder_id); Console.WriteLine("All Comments"); foreach (var comment in comments) Console.WriteLine("id:{0},description:{1},commented by:{2}",comment.comment_id,comment.description,comment.commented_by); var newCommentInfo=new Comment() { description="new test comment", }; var newComment = salesOrdersApi.AddComment(salesOrders[0].salesorder_id, newCommentInfo); Console.WriteLine("id:{0},description:{1},commented by:{2}", newComment.comment_id, newComment.description, newComment.commented_by); var commentUpdateInfo=new Comment(){ description="updated-test" }; var updatedComment = salesOrdersApi.UpdateComment(salesOrders[0].salesorder_id, newComment.comment_id, commentUpdateInfo); Console.WriteLine("id:{0},description:{1},commented by:{2}", updatedComment.comment_id, updatedComment.description, updatedComment.commented_by); var deleteComment = salesOrdersApi.DeleteComment(salesOrders[0].salesorder_id, updatedComment.comment_id); Console.WriteLine(deleteComment); } 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 purchaseordersApi = service.GetPurchaseordersApi(); Console.WriteLine("------------------------All Orders-----------"); var purchaseorders = purchaseordersApi.GetPurchaseorders(null); foreach (var tempOrder in purchaseorders) Console.WriteLine("order id:{0},vendor name:{1},status:{2}",tempOrder.purchaseorder_id,tempOrder.vendor_name,tempOrder.status); Console.WriteLine("-------------Specified order-------------------"); var purchaseorder = purchaseordersApi.Get(purchaseorders[0].purchaseorder_id,null); Console.WriteLine("order id:{0},vendor name:{1},status:{2}", purchaseorder.purchaseorder_id, purchaseorder.vendor_name, purchaseorder.status); Console.WriteLine("line items"); var lineitems = purchaseorder.line_items; foreach (var tempitem in lineitems) Console.WriteLine("item id:{0},description:{1},rate:{2}",tempitem.item_id,tempitem.description,tempitem.rate); Console.WriteLine("-------------New Purchaseorder--------------------"); var newOrderInfo = new Purchaseorder() { vendor_id=purchaseorder.vendor_id, line_items=new List<LineItem>() { new LineItem(){ item_id=lineitems[0].item_id, rate=250, }, } }; var newPurchaseOrder = purchaseordersApi.Create(newOrderInfo, null, @"C:\Users\hari-2197\Desktop\h.jpg"); Console.WriteLine("order id:{0},vendor name:{1},status:{2},total:{3}", newPurchaseOrder.purchaseorder_id, newPurchaseOrder.vendor_name, newPurchaseOrder.status,newPurchaseOrder.total); Console.WriteLine("line items"); var newOredrlineitems = newPurchaseOrder.line_items; foreach (var tempitem in newOredrlineitems) Console.WriteLine("item id:{0},description:{1},rate:{2}", tempitem.item_id, tempitem.description, tempitem.rate); Console.WriteLine("--------------------update order--------------"); var updateInfo = new Purchaseorder() { line_items=new List<LineItem>() { new LineItem(){ item_id=lineitems[0].item_id, rate=300, }, } }; var updatedOrder = purchaseordersApi.Update(newPurchaseOrder.purchaseorder_id, updateInfo, null,null); Console.WriteLine("order id:{0},vendor name:{1},status:{2},total:{3}", updatedOrder.purchaseorder_id, updatedOrder.vendor_name, updatedOrder.status, updatedOrder.total); Console.WriteLine("---------------Delete Order------------------"); var deleteOrder = purchaseordersApi.Delete(updatedOrder.purchaseorder_id); Console.WriteLine(deleteOrder); Console.WriteLine("---------------Mark Order as open------------------"); var markAsOpen = purchaseordersApi.MarkAsOpen(purchaseorders[0].purchaseorder_id); Console.WriteLine(markAsOpen); Console.WriteLine("---------------Mark Order as billed------------------"); var markAsBilled = purchaseordersApi.MarkAsBilled(purchaseorders[0].purchaseorder_id); Console.WriteLine(markAsBilled); Console.WriteLine("---------------Cancel purchaseOrder ------------------"); var cancelOrder = purchaseordersApi.CancelPurchaseorder(purchaseorders[0].purchaseorder_id); Console.WriteLine(cancelOrder); Console.WriteLine("---------------Email Purchase Order------------------"); var emailDetails = new EmailNotification() { to_mail_ids = new List<string>() { "*****@*****.**"}, subject="test-sub", body="test-body" }; var emailOrder = purchaseordersApi.SendEmail(purchaseorders[1].purchaseorder_id, emailDetails, null); Console.WriteLine(emailOrder); Console.WriteLine("---------------Email content of Purchase Order------------------"); var emailContent = purchaseordersApi.GetEmailContent(purchaseorders[1].purchaseorder_id, null); Console.WriteLine("Subject:{0},\n Body:{1}", emailContent.subject, emailContent.body); Console.WriteLine("---------------Update Billing Address------------------"); var updateAddressInfo = new Address() { city="test-city", state="test-state", }; var updatedAddress = purchaseordersApi.UpdateBillingAddress(purchaseorders[1].purchaseorder_id, updateAddressInfo); Console.WriteLine("city:{0},state:{1}",updatedAddress.city,updatedAddress.state); Console.WriteLine("---------------List and update template------------------"); var templates = purchaseordersApi.GetTemplates(); foreach (var template in templates) Console.WriteLine("name:{0},type:{1}", template.template_name, template.template_type); var updateTemplate = purchaseordersApi.UpdateTemplate(purchaseorders[1].purchaseorder_id, templates[0].template_id); Console.WriteLine(updateTemplate); Console.WriteLine("-------------------Attachments----------------"); var getAttachment = purchaseordersApi.GetAttachment(purchaseorders[0].purchaseorder_id, null); Console.WriteLine(getAttachment); var addAttachment = purchaseordersApi.AddAttachment(purchaseorders[2].purchaseorder_id, @"C:\Users\hari-2197\Desktop\h.jpg"); Console.WriteLine(addAttachment); var attachPreferences=new Dictionary<object,object>(); attachPreferences.Add("can_send_in_mail",true); var updateAttachPreference=purchaseordersApi.UpdateAttachmentPreference(purchaseorders[2].purchaseorder_id,attachPreferences); Console.WriteLine(updateAttachPreference); var deleteAttachment = purchaseordersApi.DeleteAnAttachment(purchaseorders[2].purchaseorder_id); Console.WriteLine(deleteAttachment); Console.WriteLine("--------------------------Comments -----------------------"); var comments = purchaseordersApi.GetComments(purchaseorders[0].purchaseorder_id); foreach (var comment in comments) Console.WriteLine("comment id:{0},description:{1},commented by:{2}", comment.comment_id, comment.description, comment.commented_by); var newCommentInfo = new Comment() { description="test comment", }; var newComment = purchaseordersApi.AddComment(purchaseorders[0].purchaseorder_id, newCommentInfo); Console.WriteLine("comment id:{0},description:{1},commented by:{2}", newComment.comment_id, newComment.description, newComment.commented_by); var commentUpdateInfo = new Comment() { description="updated for test", }; var updatedComment = purchaseordersApi.UpdateComment(purchaseorders[0].purchaseorder_id, newComment.comment_id, commentUpdateInfo); Console.WriteLine("comment id:{0},description:{1},commented by:{2}", updatedComment.comment_id, updatedComment.description, updatedComment.commented_by); var deleteComment = purchaseordersApi.DeleteComment(purchaseorders[0].purchaseorder_id, updatedComment.comment_id); Console.WriteLine(deleteComment); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organization id}"); CreditNotesApi creditnoteApi = service.GetCreditNoteApi(); var parameters = new Dictionary<object, object>(); parameters.Add("creditnote_number_startswith", "CN"); parameters.Add("status", "open"); parameters.Add("total_less_than", "5000"); var creditnotesList = creditnoteApi.GetCreditnotes(parameters); var creditnotes = creditnotesList; var creditnoteId = creditnotes[0].creditnote_id; if (creditnotes != null) { foreach (var creditnote in creditnotes) Console.WriteLine("{0},{1},{2}", creditnote.creditnote_number, creditnote.total_credits_used, creditnote.total); } var parameters1 = new Dictionary<object, object>(); parameters1.Add("print", "false"); var creditnote1 = creditnoteApi.Get(creditnoteId, parameters1); if (creditnote1 != null) Console.WriteLine("{0},{1},{2}", creditnote1.creditnote_number, creditnote1.total_credits_used, creditnote1.total); var newCreditnote = new CreditNote() { customer_id = "{customer id}", creditnote_number = "CN-0008", line_items = new List<LineItem>(){ new LineItem(){ item_id="{item id}", name="Hard Drive", description="500GB, USB 2.0 interface 1400 rpm, protective hard case.", unit="", rate=120.00, quantity= 1.00, }, } }; var parameters2 = new Dictionary<object, object>(); parameters2.Add("ignore_auto_number_generation", "true"); var createdCreditnote = creditnoteApi.Create(newCreditnote, parameters2); if (createdCreditnote != null) Console.WriteLine("{0},{1},{2}", createdCreditnote.creditnote_number, createdCreditnote.total_credits_used, createdCreditnote.total); CreditNote updateInf = new CreditNote() { customer_id = "{customer id}", creditnote_number = "CN-00000", }; var parameters3 = new Dictionary<object, object>(); parameters3.Add("ignore_auto_number_generation", "true"); var updatedCreditnote = creditnoteApi.Update(creditnoteId, updateInf, parameters3); if (updatedCreditnote != null) Console.WriteLine("{0},{1},{2}", updatedCreditnote.creditnote_number, updatedCreditnote.total_credits_used, updatedCreditnote.total); var delstr = creditnoteApi.Delete(creditnotes[2].creditnote_id); Console.WriteLine(delstr); var convToOpen = creditnoteApi.ConvertToOpen(creditnoteId); Console.WriteLine(convToOpen); var voidstr = creditnoteApi.ConvertToVoid(creditnoteId); Console.WriteLine(voidstr); var parameters4 = new Dictionary<object, object>(); var emaildata = new EmailNotification() { send_from_org_email_id = false, to_mail_ids = new List<string>(){ "*****@*****.**" }, subject = "Credit Note from Zillium Inc ", body = "Dear Customer, <br><br><br><br>The credit note is attached with this email. <br><br><br><br>Credit Note Overview: \n" }; var emailstr = creditnoteApi.SendEmail(creditnoteId, emaildata, parameters4); Console.WriteLine(emailstr); var emailhstrs = creditnoteApi.GetEmailHistory(creditnoteId); if (emailhstrs != null) foreach (var emailhstr in emailhstrs) Console.WriteLine("{0},{1},{2}", emailhstr.from, emailhstr.mailhistory_id, emailhstr.to_mail_ids); var parameters5 = new Dictionary<object, object>(); var emailstmt = creditnoteApi.GetEmailContent(creditnoteId, parameters5); if (emailstmt != null) { Console.WriteLine("{0},{1},{2}", emailstmt.body, emailstmt.subject, emailstmt.file_name); } var addr = new Address() { city = "guntur", state = "AP" }; var upbilladdrstr = creditnoteApi.UpdateBillingAddress(creditnoteId, addr); Console.WriteLine(upbilladdrstr); var address = new Address() { city = "guntur", state = "AP" }; var upshipp = creditnoteApi.UpdateShippingAddress(creditnoteId, address); Console.WriteLine(upshipp); var templatesList = creditnoteApi.GetTemplates(); var templates = templatesList; if (templates != null) foreach (var template in templates) Console.WriteLine("{0},{1},{2}", template.template_id, template.template_name, template.template_type); var updtemplatestr = creditnoteApi.UpdateTemplate(creditnoteId, templates[0].template_id); Console.WriteLine(updtemplatestr); var invoicescreditedList = creditnoteApi.GetInvoicesCredited(creditnoteId); var invoicescredited = invoicescreditedList; if (invoicescredited != null) foreach (var invoicecredited in invoicescredited) Console.WriteLine("{0},{1},{2}", invoicecredited.creditnote_invoice_id, invoicecredited.credited_amount, invoicecredited.invoice_id); var applytoinvoice = new ApplyToInvoices() { invoices = new List<CreditedInvoice>(){ new CreditedInvoice(){ invoice_id="{invoice id}", amount_applied=55.00, }, } }; var creditedinvoicesInfoList = creditnoteApi.CreditToInvoices(creditnoteId, applytoinvoice); var creditedinvoicesInfo = creditedinvoicesInfoList; if (creditedinvoicesInfo != null) foreach (var creditedinvoiceInfo in creditedinvoicesInfo) Console.WriteLine("{0},{1}", creditedinvoiceInfo.invoice_id, creditedinvoiceInfo.amount_applied); var delcreditinvapplied = creditnoteApi.DeleteInvoiceCredited(creditnoteId, creditedinvoicesInfo[1].creditnote_id); Console.WriteLine(delcreditinvapplied); var parameters6 = new Dictionary<object, object>(); var creditrefunds = creditnoteApi.GetCreditnoteRefunds(parameters6); if (creditrefunds != null) foreach (var creditrefund in creditrefunds) Console.WriteLine("{0},{1},{2}", creditrefund.creditnote_refund_id, creditrefund.creditnote_number, creditrefund.amount_bcy); var creditrefundsofcrednote = creditnoteApi.GetRefundsOfCrreditnote(creditnoteId); foreach (var creditrefund in creditrefundsofcrednote) Console.WriteLine("{0},{1},{2}", creditrefund.creditnote_refund_id, creditrefund.creditnote_number, creditrefund.amount_bcy); var creditnoterefund = creditnoteApi.GetCreditnoteRefund(creditnoteId, creditrefundsofcrednote[0].creditnote_refund_id); if (creditnoterefund != null) Console.WriteLine("{0},{1},{2}", creditnoterefund.creditnote_refund_id, creditnoterefund.from_account_name, creditnoterefund.amount); var refunddetails = new CreditNote() { date = "2014-01-30", from_account_id = "{account id}", amount = 10, }; var refundedcredit = creditnoteApi.AddRefund(creditnoteId, refunddetails); if (refundedcredit != null) Console.WriteLine("{0},{1},{2}", refundedcredit.creditnote_refund_id, refundedcredit.from_account_name, refundedcredit.amount); var creditrefundupdateinfo = new CreditNote() { date = "2014-01-30", from_account_id = "{account id}", amount = 5, }; var updatedCreditrefund = creditnoteApi.UpdateRefund(creditnoteId, creditrefundsofcrednote[0].creditnote_refund_id, creditrefundupdateinfo); if (updatedCreditrefund != null) Console.WriteLine("{0},{1},{2}", updatedCreditrefund.creditnote_refund_id, updatedCreditrefund.from_account_name, updatedCreditrefund.amount); var delcrdrefstr = creditnoteApi.DeleteRefund(creditnoteId, creditrefundsofcrednote[1].creditnote_refund_id); Console.WriteLine(delcrdrefstr); var commentsList = creditnoteApi.GetcreditnoteComments(creditnoteId); var comments = commentsList; if (comments != null) foreach (var comment in comments) Console.WriteLine("{0},{1},{2}", comment.comment_id, comment.description, comment.commented_by); var newcommentinfo = new Comment() { description = "nothing" }; var newcomment = creditnoteApi.AddComment(creditnoteId, newcommentinfo); if (newcomment != null) Console.WriteLine("{0},{1},{2}", newcomment.comment_id, newcomment.description, newcomment.commented_by); var delcommentstr = creditnoteApi.DeleteComment(creditnoteId, comments[1].comment_id); Console.WriteLine(delcommentstr); } catch(Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
static void Main(string[] args) { try { var service = new ZohoBooks(); service.initialize("{authtoken}", "{organisation id}"); EstimatesApi estimateApi = service.GetEstimatesApi(); var parameters = new Dictionary<object, object>(); var estimatesList = estimateApi.GetEstimates(parameters); var estimates = estimatesList; var estimateId = estimates[0].estimate_id; var customerId = estimates[0].customer_id; var contactPersns = estimates[0].contact_persons; if (estimates != null) foreach (var estimate in estimates) Console.WriteLine("{0},{1},{2}", estimate.estimate_id, estimate.customer_name, estimate.estimate_number); var parameters1 = new Dictionary<object, object>(); parameters1.Add("send",true); var newEstmt = new Estimate() { customer_id = customerId, template_id = "{template id}", reference_number = "QRT-", date = "2014-03-10", expiry_date = "2014-03-24", exchange_rate = 1.0, discount = 0.0, is_discount_before_tax = true, discount_type = "item_level", salesperson_name = "John Michael", line_items = new List<LineItem>() { new LineItem(){ name="Premium Plan - Web hosting", description="10 GB Space, 300 GB Transfer 100 Email Accounts 10 MySQL Databases", rate=2500, item_order=0, quantity=1.0, discount="0.0", }, }, notes = "Looking forward for your business.", terms = "Terms and conditions apply.", shipping_charge = 0.0, adjustment = 0.0, adjustment_description = "Adjustment" }; var newEstimate = estimateApi.Create(newEstmt, parameters1); if(newEstimate!=null) { Console.WriteLine("The new Estimate is created with the api call for the amount {0} which is having the following properties\n",newEstimate.total); Console.WriteLine("Estimate Id:{0}\n,Estimate number:{1},\n status:{2},\n",newEstimate.estimate_id,newEstimate.estimate_number,newEstimate.status); var billto = newEstimate.billing_address; Console.WriteLine("To:{0},{1},{2},{3},{4}", newEstimate.customer_name, billto.address, billto.city, billto.country, billto.zip); var items = newEstimate.line_items; Console.WriteLine("\n Items details:\n"); foreach (var item in items) Console.WriteLine("\n name: {0},\nCost: {1},\n Quantity :{2}", item.name, item.rate, item.quantity); } var parameters2 = new Dictionary<object, object>(); var updateInfo = new Estimate() { reference_number="2197", }; var updatedEst =estimateApi.Update(estimateId, updateInfo,parameters2); if(updatedEst!=null) Console.WriteLine("{0},{1},{2}", updatedEst.estimate_number, updatedEst.reference_number, updatedEst.exchange_rate); var delmsg = estimateApi.Delete(estimates[2].estimate_id); Console.WriteLine(delmsg); var status = estimateApi.MarkAsSent(estimateId); Console.WriteLine(status); var status1 = estimateApi.MarkAsAccepted(estimateId); Console.WriteLine(status); var status2 = estimateApi.MarkAsDeclined(estimateId); Console.WriteLine(status); var emailDetails = new EmailNotification() { to_mail_ids = new List<string>(){ "*****@*****.**",}, subject = "estimate email", body = "est" }; var emailEst = estimateApi.SendEmail(estimateId, emailDetails, new string[] { @"F:\error.png", @"F:\error.png" }); Console.WriteLine(emailEst); var estIds = new Dictionary<object, object>(); estIds.Add("estimate_ids", estimates[1].estimate_id + "," + estimates[2]); var emailests = estimateApi.EmailEstimates(estIds); Console.WriteLine(emailests); var emailContent = estimateApi.GetEmailContent(estimateId, null); Console.WriteLine("{0},{1},{2}", emailContent.body, emailContent.file_name, emailContent.subject); var export = estimateApi.BulkExport(estIds); Console.WriteLine(export); var print = estimateApi.BulkPrint(estIds); Console.WriteLine(print); var updateinfo3 = new Address() { address = "31", city = "chennai" }; var update = estimateApi.UpdateBillingAddress(estimateId, updateinfo3); Console.WriteLine(update); var updateinfo2 = new Address() { state="TamilNadu" }; var shipaddrUpdate = estimateApi.UpdateShippingAddress(estimateId, updateinfo2); Console.WriteLine(shipaddrUpdate); var estTemplatesList = estimateApi.GetTemplates(); var templates = estTemplatesList; foreach (var estTemplate in templates) Console.WriteLine("{0},{1},{2}", estTemplate.template_id, estTemplate.template_name, estTemplate.template_type); var updateTemplate = estimateApi.UpdateTemplate(estimateId, templates[1].template_id); Console.WriteLine(updateTemplate); var commentsList = estimateApi.GetComments(estimateId); var comments = commentsList; foreach (var comment in comments) Console.WriteLine("{0},{1},{2}",comment.comment_id,comment.description,comment.commented_by); var newCommentInfo = new Comment() { description = "added manually" }; var newComment = estimateApi.AddComment(estimateId, newCommentInfo); Console.WriteLine(newComment); var updateInfo1 = new Comment() { description = "edited comment" }; var updated = estimateApi.UpdateComment(estimateId, comments[2].comment_id, updateInfo1); Console.WriteLine("{0},{1},{2}", updated.comment_id, updated.description, updated.commented_by); var deleteMsg = estimateApi.DeleteComment(estimateId, comments[4].comment_id); Console.WriteLine(deleteMsg); } catch(Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }