Skip to content

Commit ed1bdf4

Browse files
authored
Add files via upload
1 parent 27c7ae6 commit ed1bdf4

File tree

4 files changed

+228
-0
lines changed

4 files changed

+228
-0
lines changed

APIDemo.csproj

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
10+
<PackageReference Include="Sabre.Trams.AppServer.Client" Version="4.9.0.5" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<Reference Include="Sabre.Trams.AppServer.Client">
15+
<HintPath>..\Sabre.Trams.AppServer.Client\Sabre.Trams.AppServer.Client\bin\Debug\netstandard2.0\Sabre.Trams.AppServer.Client.dll</HintPath>
16+
</Reference>
17+
</ItemGroup>
18+
19+
</Project>

APIDemo.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29519.87
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIDemo", "APIDemo.csproj", "{C8EF230E-0A1F-4FBC-8A15-120AA37FE745}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{C8EF230E-0A1F-4FBC-8A15-120AA37FE745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C8EF230E-0A1F-4FBC-8A15-120AA37FE745}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C8EF230E-0A1F-4FBC-8A15-120AA37FE745}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C8EF230E-0A1F-4FBC-8A15-120AA37FE745}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {9B638364-4581-4B93-B26C-B0F1E125AA43}
24+
EndGlobalSection
25+
EndGlobal

Program.cs

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Newtonsoft.Json.Linq;
4+
using Sabre.Trams.AppServer.Client;
5+
class TramsAPIDemo
6+
{
7+
static async Task RunAsync()
8+
{
9+
10+
const string URL = "http://localhost:8085/";
11+
const string alias = "Automate_CBB_117_C";
12+
const string username = "SYSDBA";
13+
const string password = "masterkey";
14+
15+
//const string URL = "http://ltxw1359.sgdcelab.sabre.com/tramsappserverbeta/tramsappserverwebisapi.dll/";
16+
//const string alias = "automate_cbb_117";
17+
//const string username = "SYSDBA";
18+
//const string password = "masterkey";
19+
20+
const string TBO_Access_Key = "";
21+
22+
Console.WriteLine("Connecting to server...");
23+
Session session = new Session(new System.Uri(URL));
24+
25+
Console.WriteLine("Logging in...");
26+
WebResponse loginResponse = await session.Login(new System.Net.NetworkCredential(username, password, alias), 1, TBO_Access_Key).ConfigureAwait(false);
27+
loginResponse.Check();
28+
Console.WriteLine(FormattableString.Invariant($"Login Successful, Username = {username}, Alias = {alias}, Session ID = {session.SessionID}"));
29+
30+
Console.WriteLine("Running Invoice Search... ");
31+
InvoiceSearch invoiceSearch = new InvoiceSearch(session);
32+
await invoiceSearch.Search(
33+
new JObject
34+
{
35+
{ InvoiceSearch.Param_IssueDateFrom, new JValue(new DateTime(2000, 1, 1)) },
36+
{ InvoiceSearch.Param_IssueDateTo, new JValue(new DateTime(2003, 12, 31)) },
37+
{ InvoiceSearch.Param_InvoiceType,
38+
new JArray(
39+
Invoice.Literal_InvoiceType_Sale,
40+
Invoice.Literal_InvoiceType_Refund
41+
)
42+
},
43+
{
44+
BaseSearchDataset.Param_IncludeCols,
45+
new JArray(
46+
InvoiceSearch.Col_Invoice_InvoiceNo,
47+
InvoiceSearch.Col_Invoice_IssueDate,
48+
InvoiceSearch.Col_Invoice_InvoiceNumber,
49+
InvoiceSearch.Col_Invoice_Remarks
50+
)
51+
}
52+
}
53+
).ConfigureAwait(false);
54+
Console.WriteLine("Invoice Search Dataset Result Count: " + invoiceSearch.ResultTable.Rows.Count);
55+
56+
Invoice invoice = new Invoice(session);
57+
58+
for (int i = 0; i < invoiceSearch.ResultTable.Rows.Count; i++)
59+
{
60+
//await invoice.Load((long)invoiceSearch.ResultTable.Rows[i][InvoiceSearch.Col_Invoice_InvoiceNo]);
61+
Console.WriteLine((long)invoiceSearch.ResultTable.Rows[i][InvoiceSearch.Col_Invoice_InvoiceNo]);
62+
}
63+
64+
Console.WriteLine("Create New Profile... ");
65+
Profile profile = new Profile(session);
66+
67+
await profile.Prepare().ConfigureAwait(false);
68+
profile.ProfileRow[Profile.Field_Profile_ProfileType_LinkCode] = Profile.Literal_ProfileType_Leisure;
69+
profile.ProfileRow[Profile.Field_Profile_Name] = "Palley/Dan";
70+
profile.AddRow(profile.ProfileRow);
71+
72+
profile.PassengerRow[Profile.Field_Passenger_FirstName] = "Dan";
73+
profile.PassengerRow[Profile.Field_Passenger_LastName] = "Palley";
74+
profile.PassengerRow[Profile.Field_ProfilePassenger_IsPrimary] = "Y";
75+
profile.PassengerRow = profile.AddRow(profile.PassengerRow);
76+
77+
profile.PassengerRow[Profile.Field_Passenger_FirstName] = "Tyson";
78+
profile.PassengerRow[Profile.Field_Passenger_LastName] = "Palley";
79+
profile.AddRow(profile.PassengerRow);
80+
81+
Console.WriteLine("Saving Profile... ");
82+
await profile.Save().ConfigureAwait(false);
83+
84+
Console.WriteLine("Create New Invoice... ");
85+
//Invoice invoice = new Invoice(session);
86+
87+
await invoice.Prepare().ConfigureAwait(false);
88+
89+
// set the desired column values for the new invoice datarow
90+
invoice.InvoiceRow[Invoice.Field_Invoice_InvoiceNumber] = await invoice.GetNextInvoiceNumber(Invoice.Literal_InvoiceType_Sale, 0).ConfigureAwait(false);
91+
invoice.InvoiceRow[Invoice.Field_Invoice_InvoiceType_LinkCode] = Invoice.Literal_InvoiceType_Sale;
92+
invoice.InvoiceRow[Invoice.Field_Invoice_IssueDate] = DateTime.Today;
93+
invoice.InvoiceRow[Invoice.Field_Invoice_Client_LinkNo] = 4;
94+
invoice.InvoiceRow[Invoice.Field_Invoice_Branch_LinkNo] = 0;
95+
invoice.InvoiceRow[Invoice.Field_Invoice_RecordLocator] = "ABCDEF";
96+
97+
// add the new invoice datarow to the invoice table
98+
invoice.AddRow(invoice.InvoiceRow);
99+
100+
// set the desired column values for the new booking datarow
101+
invoice.BookingRow[Invoice.Field_Booking_SubmitTo_LinkCode] = Invoice.Literal_SubmitTo_Supplier;
102+
invoice.BookingRow[Invoice.Field_Booking_Vendor_LinkNo] = 2;
103+
invoice.BookingRow[Invoice.Field_Booking_ConfirmNo] = "ABC123";
104+
105+
// add the new booking datarow to the booking table and return a new row
106+
invoice.BookingRow = invoice.AddRow(invoice.BookingRow);
107+
108+
// set the desired column values for the new booking datarow
109+
invoice.BookingRow[Invoice.Field_Booking_SubmitTo_LinkCode] = Invoice.Literal_SubmitTo_Supplier;
110+
invoice.BookingRow[Invoice.Field_Booking_Vendor_LinkNo] = 3;
111+
invoice.BookingRow[Invoice.Field_Booking_ConfirmNo] = "DEF456";
112+
113+
// add the new booking datarow to the booking table
114+
invoice.AddRow(invoice.BookingRow);
115+
116+
// set the desired column values for the new segment datarow
117+
invoice.SegmentRow[Invoice.Field_Segment_IndexNo] = 1;
118+
119+
// add the new segment datarow to the segment table
120+
invoice.AddRow(invoice.SegmentRow);
121+
122+
Console.WriteLine("Saving invoice... ");
123+
await invoice.Save().ConfigureAwait(false);
124+
125+
Console.WriteLine("Create New ResCard... ");
126+
ResCard resCard = new ResCard(session);
127+
128+
await resCard.Prepare().ConfigureAwait(false);
129+
130+
resCard.ResCardRow[ResCard.Field_ResCard_CreateDate] = DateTime.Today;
131+
resCard.ResCardRow[ResCard.Field_ResCard_Profile_Linkno] = 4;
132+
resCard.AddRow(resCard.ResCardRow);
133+
134+
resCard.ReservationRow[ResCard.Field_Reservation_Vendor_LinkNo] = 66;
135+
resCard.ReservationRow[ResCard.Field_Reservation_TravelCategory_LinkNo] = 1;
136+
resCard.AddRow(resCard.ReservationRow);
137+
138+
Console.WriteLine("Saving ResCard... ");
139+
await resCard.Save().ConfigureAwait(false);
140+
141+
Console.WriteLine("Running Activity Search... ");
142+
ActivitySearch activitySearch = new ActivitySearch(session);
143+
await activitySearch.Search(
144+
new JObject
145+
{
146+
{
147+
BaseSearchDataset.Param_IncludeCols,
148+
new JArray(
149+
ActivitySearch.Col_ActivityNo
150+
)
151+
}
152+
}
153+
).ConfigureAwait(false);
154+
Console.WriteLine("Activity Search Dataset Result Count: " + activitySearch.ResultTable.Rows.Count);
155+
156+
Activity activity = new Activity(session);
157+
158+
for (int i = 0; i < activitySearch.ResultTable.Rows.Count; i++)
159+
{
160+
//await activity.Load((long)activitySearch.ResultTable.Rows[i][ActivitySearch.Col_ActivityNo]).ConfigureAwait(false);
161+
Console.WriteLine((long)activitySearch.ResultTable.Rows[i][ActivitySearch.Col_ActivityNo]);
162+
}
163+
164+
Console.WriteLine("Logging Out");
165+
await session.Logout().ConfigureAwait(false);
166+
}
167+
static void Main()
168+
{
169+
RunAsync().Wait();
170+
}
171+
}

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Introduction
2+
# Installation and configuration
3+
# Dependencies
4+
5+
- [Newtonsoft Json.NET](http://www.newtonsoft.com/json): used for serialization.
6+
- Sabre.Trams.AppServer.Client
7+
8+
# Support
9+
10+
- https://groups.google.com/forum/#!forum/tramsapi-beta
11+
12+
# Disclaimer of Warranty and Limitation of Liability
13+
This software and any compiled programs created using this software are furnished “as is” without warranty of any kind, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. No oral or written information or advice given by Sabre, its agents or employees shall create a warranty or in any way increase the scope of this warranty, and you may not rely on any such information or advice. Sabre does not warrant, guarantee, or make any representations regarding the use, or the results of the use, of this software, compiled programs created using this software, or written materials in terms of correctness, accuracy, reliability, currentness, or otherwise. The entire risk as to the results and performance of this software and any compiled applications created using this software is assumed by you. Neither Sabre nor anyone else who has been involved in the creation, production or delivery of this software shall be liable for any direct, indirect, consequential, or incidental damages (including damages for loss of business profits, business interruption, loss of business information, and the like) arising out of the use of or inability to use such product even if Sabre has been advised of the possibility of such damages.

0 commit comments

Comments
 (0)