Exemplo n.º 1
0
 /// <summary>
 /// Email statement to the contact (If the Email object is not given, email will be sent with the default email content).
 /// </summary>
 /// <param name="contact_id">The contact_id the identifier of the contact.</param>
 /// <param name="emailNotify_details">The email notify_details is the EmailNotification object contains the email details with to_mail_ids,subject and body parameters as mandatory.</param>
 /// <param name="attachment_paths">The attachment_paths is the file details which is going to be attached to the mail.</param>
 /// <param name="parameters">The parameters is the dictionary object which is optionally had the following key value pairs.<br></br>
 /// <table>
 /// <tr><td>start_date</td><td>If start_date and end_date are not given, current month's statement will be sent to contact.</td></tr>
 /// <tr><td>end_date</td><td>End date for the statement.</td></tr>
 /// </table>
 /// </param>
 /// <returns>System.String.<br></br>The success message is "Statement has been sent to the customer." </returns>
 public string SendEmailStatement(string contact_id, EmailNotification emailNotify_details, string[] attachment_paths, Dictionary<object, object> parameters)
 {
     string url = baseAddress + "/" + contact_id + "/statements/email";
     var json = JsonConvert.SerializeObject(emailNotify_details);
     var jsonstring = new Dictionary<object, object>();
     jsonstring.Add("JSONString", json);
     var files = new KeyValuePair<string, string[]>("attachments", attachment_paths);
     var responce = ZohoHttpClient.post(url, getQueryParameters(),jsonstring,files);
     return ContactParser.getMessage(responce);
 }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Remind your customer about an unpaid invoice by email. Reminder will be sent, only for the invoices which are in open or overdue status.
 /// </summary>
 /// <param name="invoice_id">The invoice_id is the identifier of the invoice.</param>
 /// <param name="notify_details">The notify_details is the EmailNotification object with to_mail_ids as mandatory parameter.</param>
 /// <param name="parameters">The parameters is the dictionary object which contains the following optional parameter in the key,value pair format.<br></br>
 /// <table><tr><td>send_customer_statement</td><td>Send customer statement pdf a with payment reminder.</td></tr></table>
 /// </param>
 /// <returns>System.String<br></br> The success message is "Your payment reminder has been sent."</returns>
 public string RemindCustomer(string invoice_id, EmailNotification notify_details, Dictionary<object, object> parameters)
 {
     string url = baseAddress + "/" + invoice_id + "/paymentreminder";
     var json = JsonConvert.SerializeObject(notify_details);
     parameters.Add("JSONString", json);
     var responce = ZohoHttpClient.post(url, getQueryParameters(parameters));
     return InvoiceParser.getMessage(responce);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Email an invoice to the customer. Input json string is not mandatory. If input json string is empty, mail will be send with default mail content.
 /// </summary>
 /// <param name="invoice_id">The invoice_id is the identifier of the invoice.</param>
 /// <param name="email_details">The email_details is the EmailNotification object with to_mail_ids as mandatory attribute.</param>
 /// <param name="attachment_paths">The attachment_paths is the file paths which are going to be attached to the mail.</param>
 /// <param name="parameters">The parameters is the dictionary object which contains the following optional parameters in the key,value pair forms.<br></br>
 /// <table>
 /// <tr><td>send_customer_statement</td><td>Send customer statement pdf a with email.</td></tr>
 /// <tr><td>send_attachment</td><td>Send the invoice attachment a with the email.</td></tr>
 /// </table>
 /// </param>
 /// <returns>System.String<br></br> The success message is "Your invoice has been sent."</returns>
 public string SendEmail(string invoice_id, EmailNotification email_details, string[] attachment_paths, Dictionary<object, object> parameters)
 {
     string url = baseAddress + "/" + invoice_id + "/email";
     var json = JsonConvert.SerializeObject(email_details);
     var jsonString = new Dictionary<object, object>();
     jsonString.Add("JSONString", json);
     var files = new KeyValuePair<string, string[]>("attachments", attachment_paths);
     var responce = ZohoHttpClient.post(url, getQueryParameters(parameters),jsonString,files);
     string responceContent = responce.Content.ReadAsStringAsync().Result;
     return InvoiceParser.getMessage(responce);
 }
 /// <summary>
 /// Emails a credit note to the customer.
 /// </summary>
 /// <param name="creditnote_id">The creditnote_id is the identifier of the creditnote.</param>
 /// <param name="mail_content_info">The mail_content_info is the EmailNotification object with to_mail_ids,subject and body as mandatory parameters.</param>
 /// <param name="parameters">The parameters is the dictionary object which is having the option parameter of customer_id as a key,value pair.</param>
 /// <returns>System.String.<br></br>The success message is "Your credit note has been sent."</returns>
 public string SendEmail(string creditnote_id, EmailNotification mail_content_info, Dictionary<object, object> parameters)
 {
     string url = baseAddress+"/"+creditnote_id+"/email";
     var json = JsonConvert.SerializeObject(mail_content_info);
     parameters.Add("JSONString", json);
     var responce = ZohoHttpClient.post(url, getQueryParameters(parameters));
     return CreditNoteParser.getMessage(responce);
 }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
 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();
 }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            var service = new ZohoBooks();
            service.initialize("{authtoken}", "{organizationId}");
            ContactsApi contactsApi = service.GetContactsApi();
            var parameters = new Dictionary<object, object>();
            var contactsList = contactsApi.GetContacts(parameters);
            var contacts=contactsList;
            var contactId = contacts[0].contact_id;
            if(contacts!=null)
            {

                foreach (var cont in contacts)
                    Console.WriteLine("{0},{1},{2}", cont.contact_id, cont.contact_name, cont.contact_type);
            }
            var contact = contactsApi.Get(contacts[0].contact_id);
            Console.WriteLine("{0},{1},{2}", contact.contact_id, contact.contact_name, contact.contact_type);
            var contactpers = contact.contact_persons;
            foreach (var per in contactpers)
                Console.WriteLine("{0},{1},{2}", per.contact_person_id, per.email, per.is_primary_contact);
            var newContact = new Contact()
            {
                contact_name = "name",
                payment_terms = 15,
                payment_terms_label = "Net 15",
                currency_id = "{currency id}",
                billing_address = new Address()
                {
                    address = "4900 Hopyard Rd, Suite 310",
                    city = "Pleasanton",
                    state = "CA",
                    zip = "94588",
                    country = "USA",
                    fax = "+1-925-924-9600"
                },
                shipping_address = new Address()
                {
                    address = "Suite 125, McMillan Avenue",
                    city = "San Francisco",
                    state = "CA",
                    zip = "94134",
                    country = "USA",
                    fax = "+1-925-924-9600"
                },
                contact_persons = new List<ContactPerson>(){
             new ContactPerson(){

             salutation="Mr.",
             first_name="Will",
             last_name="Smith",
             email="*****@*****.**",
               },
               new ContactPerson(){

             salutation="Mr.",
             first_name="Peter",
             last_name="Parker",
             email="*****@*****.**",
               }
             },

                notes = "Payment option : Through check"
            };
            var contact1 = contactsApi.Create(newContact);
            Console.WriteLine("{0},{1},{2}", contact1.contact_id, contact1.contact_name, contact1.contact_type);
            var contactpersons = contact.contact_persons;
            foreach (var per in contactpersons)
                Console.WriteLine("{0},{1},{2}", per.contact_person_id, per.email, per.is_primary_contact);
            var updateInfo = new Contact()
            {

                payment_terms = 15,
                payment_terms_label = "Net 15",

                billing_address = new Address()
                {
                    address = "4900 Hopyard Rd, Suite 310",
                    city = "Pleasanton",
                    state = "CA",
                    zip = "94588",
                    country = "USA",
                    fax = "+1-925-924-9600"
                },
                shipping_address = new Address()
                {
                    address = "Suite 125, McMillan Avenue",
                    city = "San Francisco",
                    state = "CA",
                    zip = "94134",
                    country = "USA",
                    fax = "+1-925-924-9600"
                },
                contact_persons = new List<ContactPerson>(){
             new ContactPerson(){

             salutation="Mr.",
             first_name="Will",
             last_name="Smith",
             email="*****@*****.**",
             phone="+1-925-921-9201",
             mobile="+1-4054439562"
               },
               new ContactPerson(){

             salutation="Mr.",
             first_name="Peter",
             last_name="Parker",
             email="*****@*****.**",
             phone="+1-925-929-7211",
             mobile="+1-4054439760"
               }
             },

                notes = "Payment option : Through check"
            };
            var updatedcontact = contactsApi.Update(contactId, updateInfo);
            Console.WriteLine("{0},{1},{2}", updatedcontact.contact_id, updatedcontact.contact_name, updatedcontact.contact_type);
            var contctpersons = updatedcontact.contact_persons;
            foreach (var per in contctpersons)
                Console.WriteLine("{0},{1},{2}", per.contact_person_id, per.email, per.is_primary_contact);
            var deleteContact = contactsApi.Delete(contacts[1].contact_id);
            Console.WriteLine(deleteContact);
            var inactive = contactsApi.MarkAsInactive(contactId);
            Console.WriteLine(inactive);
            var active = contactsApi.MarkAsActive(contactId);
            Console.WriteLine(active);
            var EnableReminder = contactsApi.EnablePaymentReminder(contactId);
            Console.WriteLine(EnableReminder);
            var disableReminder = contactsApi.DisablePaymentReminder(contactId);
            Console.WriteLine(disableReminder);
            var emailnote = new EmailNotification()
            {
                to_mail_ids =new List<string>(){
                    "*****@*****.**",},
                subject = "email notify",
                body = "body of mail"
            };
            var emailstmt = contactsApi.SendEmailStatement(contactId, emailnote, null, null);
            Console.WriteLine(emailstmt);
            parameters.Add("start_date", "2014-03-15");
            parameters.Add("end_date", "2014-04-29");
            var emaildata = contactsApi.GetEmailStatementContent(contactId, parameters);
            Console.WriteLine(emaildata.body);
            var emailnotify = new EmailNotification()
            {
                to_mail_ids =new List<string>(){
                    "*****@*****.**",},
                subject = "email notify",
                body = "body of mail"
            };
            var emailcntct = contactsApi.SendEmailStatement(contactId, emailnotify,null,null);
            Console.WriteLine(emailcntct);
            var comments = contactsApi.GetComments(contactId);
            foreach (var comment in comments)
                Console.WriteLine("{0},{1}", comment.comment_id, comment.description);
            var refunds = contactsApi.GetRefunds(contactId);
            foreach (var refund in refunds)
                Console.WriteLine("{0},{1}", refund.refund_mode, refund.amount);
            var track = contactsApi.Track1099(contactId);
            Console.WriteLine(track);
            var untrack = contactsApi.UnTrack1099(contactId);
            Console.WriteLine(untrack);
            var cntctpersnsList = contactsApi.GetContactPersons(contacts[0].contact_id);
            var cntctPersons = cntctpersnsList;
            var contactPersonId = cntctPersons[0].contact_person_id;
            foreach (var cntctper in cntctPersons)
                Console.WriteLine("{0},{1},{2}", cntctper.contact_person_id, cntctper.last_name, cntctper.first_name);

            var contactperson = contactsApi.GetContactPerson(contacts[0].contact_id, contactPersonId);
             Console.WriteLine("{0},{1},{2}", contactperson.contact_person_id, contactperson.last_name, contactperson.first_name);
             var contactPerInfo = new ContactPerson()
             {
                 contact_id = "{contactId}",
                 first_name = "hk"
             };
             var newContactPer = contactsApi.CreateContactPerson(contactPerInfo);
             Console.WriteLine("{0},{1},{2}", newContactPer.contact_person_id, newContactPer.last_name, newContactPer.first_name);
             var updateInfo1 = new ContactPerson()
             {

                 first_name = "fname"
             };
             var updated = contactsApi.UpdateContactperson(contactPersonId, updateInfo1);
             Console.WriteLine("{0},{1},{2}", updated.contact_person_id, updated.last_name, updated.first_name);
             var deletedmsg = contactsApi.DeleteContactPerson(contactPersonId);
             Console.WriteLine(deletedmsg);

             var makeAsPrimary = contactsApi.MarkAsPrimaryContactPerson(contactPersonId);
             Console.WriteLine(makeAsPrimary);
            Console.ReadKey();
        }
 /// <summary>
 /// Sends the email.
 /// </summary>
 /// <param name="salesorder_id">The salesorder_id.</param>
 /// <param name="email_details">The email_datails.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>System.String.</returns>
 public string SendEmail(string salesorder_id,EmailNotification email_details,Dictionary<object,object> parameters)
 {
     string url = baseAddress + "/" + salesorder_id + "/email";
     var json=JsonConvert.SerializeObject(email_details);
     if(parameters==null)
         parameters=new Dictionary<object,object>();
     parameters.Add("JSONString",json);
     var responce = ZohoHttpClient.post(url, getQueryParameters(parameters));
     return SalesorderParser.getMessage(responce);
 }
Exemplo n.º 10
0
        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();
        }
Exemplo n.º 11
0
        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();
        }