You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.2 KiB

//==================================================
//
// Copyright 2017 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
//
//==================================================
using System;
using Teamcenter.ClientX;
using User = Teamcenter.Soa.Client.Model.Strong.User;
namespace Teamcenter.Vendor
{
/**
* This sample client application demonstrates some of the basic features of the
* Teamcenter Services framework and a few of the services.
*
* An instance of the Connection object is created with implementations of the
* ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners
* intefaces. This client application performs the following functions:
* 1. Establishes a session with the Teamcenter server
* 2. Display the contents of the Home Folder
* 3. Performs a simple query of the database
* 4. Create, revise, and delete an Item
*
*/
public class Vendor
{
/**
* @param args -help or -h will print out a Usage statement
*/
public static void Main(string[] args)
{
String serverHost = "http://localhost:7001/tc";
if (args.Length > 0)
{
if (args[0].Equals("-help") || args[0].Equals("-h"))
{
System.Console.Out.WriteLine("usage: Hello [-host http://server:port/tc]");
return;
}
if (args[0].Equals("-host") && args.Length > 1)
{
// Get optional host information
serverHost = args[1];
}
}
String sname = "";
Session session = new Session(serverHost);
VendorManagement vm = new VendorManagement();
// Establish a session with the Teamcenter Server
User user = session.login();
while ( !(sname.Equals("7") ) )
{
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("Services Available for .NET SOA VendorManagement Testing are :");
Console.WriteLine("1.createVendors ");
Console.WriteLine("2.createBidPackages ");
Console.WriteLine("3.createLineItems ");
Console.WriteLine("4.deleteVendorRoles ");
Console.WriteLine("5.deleteVendors ");
Console.WriteLine("6.createParts ");
Console.WriteLine("7.Exit ");
Console.WriteLine("");
Console.WriteLine("Please enter service number from the above list :");
Console.WriteLine("");
sname = Console.ReadLine();
if (sname.Equals("1"))
vm.createVendors();
if (sname.Equals("2"))
vm.createBidPackages();
if (sname.Equals("3"))
vm.createLineItems();
if (sname.Equals("4"))
vm.deleteVendorRoles();
if (sname.Equals("5"))
vm.deleteVendors();
if (sname.Equals("6"))
vm.createParts();
}
Console.WriteLine("");
Console.WriteLine("You have chosen to Exit from services,logging out.....");
// Terminate the session with the Teamcenter server
session.logout();
}
}
}