Exemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         var service = new ZohoBooks();
         service.initialize("{authtoken}", "{organizationId}");
         var creditnoteSettingsApi = service.GetSettingsApi();
         var creditnoteSettings = creditnoteSettingsApi.GetCreditnoteSettings();
         Console.WriteLine("prefix:{0},\nreferencetxt:{1},\nnotes:{2}", creditnoteSettings.prefix_string, creditnoteSettings.reference_text, creditnoteSettings.notes);
         var updateInfo = new CreditNoteSettings()
         {
             prefix_string="cn",
             reference_text="hari"
         };
         var updatedSettings = creditnoteSettingsApi.UpdateCreditnoteSettings(updateInfo);
         Console.WriteLine("prefix:{0},\nreferencetxt:{1},\nnotes:{2}", updatedSettings.prefix_string, updatedSettings.reference_text, updatedSettings.notes);
         var notesAndTerms = creditnoteSettingsApi.GetCreditnoteNotesAndTerms();
         Console.WriteLine("notes:{0}\nterms:{1}", notesAndTerms.notes, notesAndTerms.terms);
         var updatedInfo = new NotesAndTerms()
         {
             notes = "Thanking for business",
             terms = "terms"
         };
         var updated = creditnoteSettingsApi.UpdateCreditnoteNotesAndTerms(updatedInfo);
         Console.WriteLine("notes:{0}\nterms:{1}", updated.notes, updated.terms);
     }
     catch(Exception e)
     {
         Console.WriteLine(e.Message);
     }
     Console.ReadKey();
 }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     try
     {
         var service = new ZohoBooks();
         service.initialize("{authtoken}", "{organization id}");
         var estimateSettingsApi = service.GetSettingsApi();
         var estimateSettings = estimateSettingsApi.GetEstimateSettings();
         Console.WriteLine("Auto Generarte:{0},\nIs salesperson Required:{1},\nNotes:{2}\n", estimateSettings.auto_generate, estimateSettings.is_sales_person_required, estimateSettings.notes);
         var updateInfo = new EstimateSettings()
         {
             auto_generate=false,
             discount_type = "no_discount",
             is_sales_person_required=false
         };
         var updatedSettings = estimateSettingsApi.UpdateEstimateSettings(updateInfo);
         Console.WriteLine("Auto Generarte:{0},\nIs salesperson Required:{1},\nDiscount:{2}\n", updatedSettings.auto_generate, updatedSettings.is_sales_person_required, updatedSettings.discount_type);
         var notesAndTerms = estimateSettingsApi.GetEstimateNotesAndTerms();
         Console.WriteLine("notes:{0}\nterms:{1}", notesAndTerms.notes, notesAndTerms.terms);
         var updatedInfo = new NotesAndTerms()
         {
             notes="Thanking for business",
             terms="terms"
         };
         var updated = estimateSettingsApi.UpdateEstimateNotesAndTerms(updatedInfo);
         Console.WriteLine("notes:{0}\nterms:{1}", updated.notes, updated.terms);
     }
     catch(Exception e)
     {
         Console.WriteLine(e.Message);
     }
     Console.ReadKey();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Updates the invoice notes and terms.
 /// </summary>
 /// <param name="update_info">The update_info is the NotesAndTerms object which contains the invoice notes and terms updation information.</param>
 /// <returns>NotesAndTerms object.</returns>
 public NotesAndTerms UpdateInvoiceNotesAndTerms(NotesAndTerms update_info)
 {
     string url = baseAddress + "/invoices/notesandterms";
     var json = JsonConvert.SerializeObject(update_info);
     var jsonstring = new Dictionary<object, object>();
     jsonstring.Add("JSONString", json);
     var response = ZohoHttpClient.put(url, getQueryParameters(jsonstring));
     return SettingsParser.getNotesAndTerms(response);
 }
 internal static NotesAndTerms getNotesAndTerms(HttpResponseMessage response)
 {
     var notesAndTerms = new NotesAndTerms();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("notes_and_terms"))
     {
         notesAndTerms = JsonConvert.DeserializeObject<NotesAndTerms>(jsonObj["notes_and_terms"].ToString());
     }
     return notesAndTerms;
 }