User Tools

Site Tools


taxengine:integration:code_samples:c_sample_code

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
taxengine:integration:code_samples:c_sample_code [2015/04/15 23:35] – external edit 127.0.0.1taxengine:integration:code_samples:c_sample_code [2015/08/06 19:56] – [Console App in C#] chuck
Line 37: Line 37:
             string password = "p@ssw0rd";             string password = "p@ssw0rd";
             string companyDatabase = "TWO";             string companyDatabase = "TWO";
 +            string systemDatabase = "DYNAMICS";
 +            string itemCategory = "FREIGHT";
             Int16 timeOutSeconds = 60;             Int16 timeOutSeconds = 60;
             bool displayProgessBar = true;             bool displayProgessBar = true;
Line 48: Line 50:
                 {                 {
                     /// The Portal.Login method makes the connection to SQL Server and                     /// The Portal.Login method makes the connection to SQL Server and
-                    /// prepares the tax engine for use. +                    /// prepares the TaxEngine for use. 
-                    loginMessage = txEngn.Login(server, userId, password, companyDatabase, timeOutSeconds, displayProgessBar);+                    loginMessage = txEngn.Login(server, userId, password, systemDatabase, companyDatabase, timeOutSeconds, displayProgessBar);
                 }                 }
                 catch (Exception e)                 catch (Exception e)
Line 68: Line 70:
                     /// and Document Type Setup windows.  In the SOP module, invoices are                      /// and Document Type Setup windows.  In the SOP module, invoices are 
                     /// docType 3.                     /// docType 3.
 +                    /// (The SOP module can be setup automatically using 
 +                    /// File > Create SOP in the TE Transaction Source Modules window.)
                     Int16 docType = 3;                     Int16 docType = 3;
                     string module = "SOP";                     string module = "SOP";
Line 97: Line 101:
                     int lineNumber = 1;                     int lineNumber = 1;
                     txEngn.LineAdd(lineNumber);                     txEngn.LineAdd(lineNumber);
- 
                     do                     do
                     {                     {
-                        /// We now provide the ZIP code.+                        Console.WriteLine("Enter an item category. Press enter for {0}", itemCategory); 
 +                        string ic = Console.ReadLine(); 
 +                        if (ic != ""
 +                            itemCategory = ic; 
 +                        if (itemCategory != ""
 +                        { 
 +                            try 
 +                            { 
 +                                txEngn.LineItemCategory = itemCategory; 
 +                                Console.WriteLine("Item category has been set to {0}", txEngn.LineItemCategory); 
 +                            } 
 +                            catch (Exception e) 
 +                            { 
 +                                Console.WriteLine(e.Message); 
 +                                if (txEngn.LineItemCategory == ""
 +                                    Console.WriteLine("Item category is blank"); 
 +                                else 
 +                                    Console.WriteLine("Item category is {0}", txEngn.LineItemCategory); 
 +                                Console.WriteLine(""); 
 +                            } 
 +                        } 
 +                        /// Select a ZIP code.
                         Console.WriteLine("Enter a ZIP code");                         Console.WriteLine("Enter a ZIP code");
                         zip = Console.ReadLine();                         zip = Console.ReadLine();
Line 115: Line 139:
                             continue;                             continue;
                         }                         }
 +                        // Fetch the default tax schedule for this zip.
 +                        txEngn.LineTaxScheduleSelect();
                         /*                         /*
                         * At this point, the Portal object will have identified and made                         * At this point, the Portal object will have identified and made
Line 152: Line 178:
                                     txEngn.LineState = state;                                     txEngn.LineState = state;
                             }                             }
 +                            // Fetch the default tax schedule for this state and zip. 
 +                            txEngn.LineTaxScheduleSelect();
                             cities = txEngn.LineCitiesInStateAndZip();                             cities = txEngn.LineCitiesInStateAndZip();
                             Console.WriteLine("Cities in {0} state and {1} ZIP:",                             Console.WriteLine("Cities in {0} state and {1} ZIP:",
Line 162: Line 189:
                             if (cities.Count > 1)                             if (cities.Count > 1)
                             {                             {
-                                bool cityNotChosen true+                                bool cityChosen false
-                                while (cityNotChosen)+                                while (!cityChosen)
                                 {                                 {
                                     Console.WriteLine("Enter a city. Press enter for {0}", txEngn.LineCity);                                     Console.WriteLine("Enter a city. Press enter for {0}", txEngn.LineCity);
Line 169: Line 196:
                                     if (city == "")                                     if (city == "")
                                     {                                     {
-                                        cityNotChosen false;+                                        cityChosen true//Accepting the current value
                                     }                                     }
                                     else                                     else
Line 176: Line 203:
                                         {                                         {
                                             txEngn.LineCity = city;                                             txEngn.LineCity = city;
-                                            cityNotChosen false;+                                            cityChosen true;
                                         }                                         }
                                         catch (Exception e)                                         catch (Exception e)
Line 185: Line 212:
                                 }                                 }
                             }                             }
- +                            // Fetch the default tax schedule for this city state and zip. 
-                            counties = txEngn.LineCountiesInCityStateAndZip(); +                            txEngn.LineTaxScheduleSelect(); 
-                            Console.WriteLine("Counties in {0}, {1} {2}:"+                            counties = txEngn.LineCountiesInState(); 
-                            txEngn.LineCity, txEngn.LineState, txEngn.LineZip);+                            Console.WriteLine("Counties in {0}:", txEngn.LineState);
                             foreach (string county in counties)                             foreach (string county in counties)
                             {                             {
Line 195: Line 222:
                             if (counties.Count > 1)                             if (counties.Count > 1)
                             {                             {
-                                bool countyNotChosen true+                                bool countyChosen false
-                                while (countyNotChosen)+                                while (!countyChosen)
                                 {                                 {
                                     Console.WriteLine("Enter a county. Press enter for {0}", txEngn.LineCounty);                                     Console.WriteLine("Enter a county. Press enter for {0}", txEngn.LineCounty);
Line 202: Line 229:
                                     if (county == "")                                     if (county == "")
                                     {                                     {
-                                        countyNotChosen false;+                                        countyChosen true//Accepting the current value
                                     }                                     }
                                     else                                     else
Line 209: Line 236:
                                         {                                         {
                                             txEngn.LineCounty = county;                                             txEngn.LineCounty = county;
-                                            countyNotChosen false;+                                            countyChosen true;
                                         }                                         }
                                         catch (Exception e)                                         catch (Exception e)
Line 661: Line 688:
 </code> </code>
  
 +----
 +[[taxengine:integration:code_samples:sample_code|Sample Code]] \\
 [[taxengine:integration:code_samples:dex_sample_code|Sample Code in Dexterity]] [[taxengine:integration:code_samples:dex_sample_code|Sample Code in Dexterity]]
  
taxengine/integration/code_samples/c_sample_code.txt · Last modified: 2015/08/06 20:00 by chuck

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki