taxengine:integration:code_samples:c_sample_code
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
taxengine:integration:code_samples:c_sample_code [2015/04/15 23:35] – external edit 127.0.0.1 | taxengine:integration:code_samples:c_sample_code [2015/08/06 19:56] – [Console App in C#] chuck | ||
---|---|---|---|
Line 37: | Line 37: | ||
string password = " | string password = " | ||
string companyDatabase = " | string companyDatabase = " | ||
+ | string systemDatabase = " | ||
+ | string itemCategory = " | ||
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 | + | /// prepares the TaxEngine |
- | loginMessage = txEngn.Login(server, | + | loginMessage = txEngn.Login(server, |
} | } | ||
catch (Exception e) | catch (Exception e) | ||
Line 68: | Line 70: | ||
/// and Document Type Setup windows. | /// and Document Type Setup windows. | ||
/// 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 = " | string module = " | ||
Line 97: | Line 101: | ||
int lineNumber = 1; | int lineNumber = 1; | ||
txEngn.LineAdd(lineNumber); | txEngn.LineAdd(lineNumber); | ||
- | |||
do | do | ||
{ | { | ||
- | /// We now provide the ZIP code. | + | |
+ | string ic = Console.ReadLine(); | ||
+ | if (ic != "" | ||
+ | itemCategory = ic; | ||
+ | if (itemCategory != "" | ||
+ | { | ||
+ | try | ||
+ | { | ||
+ | txEngn.LineItemCategory = itemCategory; | ||
+ | Console.WriteLine(" | ||
+ | } | ||
+ | catch (Exception e) | ||
+ | { | ||
+ | Console.WriteLine(e.Message); | ||
+ | if (txEngn.LineItemCategory == "" | ||
+ | Console.WriteLine(" | ||
+ | else | ||
+ | Console.WriteLine(" | ||
+ | Console.WriteLine("" | ||
+ | } | ||
+ | } | ||
+ | | ||
Console.WriteLine(" | Console.WriteLine(" | ||
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(" | Console.WriteLine(" | ||
Line 162: | Line 189: | ||
if (cities.Count > 1) | if (cities.Count > 1) | ||
{ | { | ||
- | bool cityNotChosen | + | bool cityChosen |
- | while (cityNotChosen) | + | while (!cityChosen) |
{ | { | ||
Console.WriteLine(" | Console.WriteLine(" | ||
Line 169: | Line 196: | ||
if (city == "" | if (city == "" | ||
{ | { | ||
- | | + | |
} | } | ||
else | else | ||
Line 176: | Line 203: | ||
{ | { | ||
txEngn.LineCity = city; | txEngn.LineCity = city; | ||
- | | + | |
} | } | ||
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 = txEngn.LineCountiesInState(); |
- | txEngn.LineCity, txEngn.LineState, txEngn.LineZip); | + | Console.WriteLine(" |
foreach (string county in counties) | foreach (string county in counties) | ||
{ | { | ||
Line 195: | Line 222: | ||
if (counties.Count > 1) | if (counties.Count > 1) | ||
{ | { | ||
- | bool countyNotChosen | + | bool countyChosen |
- | while (countyNotChosen) | + | while (!countyChosen) |
{ | { | ||
Console.WriteLine(" | Console.WriteLine(" | ||
Line 202: | Line 229: | ||
if (county == "" | if (county == "" | ||
{ | { | ||
- | | + | |
} | } | ||
else | else | ||
Line 209: | Line 236: | ||
{ | { | ||
txEngn.LineCounty = county; | txEngn.LineCounty = county; | ||
- | | + | |
} | } | ||
catch (Exception e) | catch (Exception e) | ||
Line 661: | Line 688: | ||
</ | </ | ||
+ | ---- | ||
+ | [[taxengine: | ||
[[taxengine: | [[taxengine: | ||
taxengine/integration/code_samples/c_sample_code.txt · Last modified: 2015/08/06 20:00 by chuck