Methods

GetSecurityToken(LoginInfo loginInfo)

Description: this method is used to get the security token that is used in every other method

Parameters: LoginInfo object

Return: string representation of the SecurityToken.

private string GetSecurityToken()
{
LoginInfo loginInfo = new LoginInfo();
loginInfo.ApplicationKey = "Your Application Key";
loginInfo.CustomerKey = "Customer Key";
loginInfo.UserName = "Username";
loginInfo.Password = "Password";
string SecurityToken = string.Empty;
var serializer = new DataContractJsonSerializer(typeof(LoginInfo));
var ms = new MemoryStream();
serializer.WriteObject(ms, loginInfo);
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
SecurityToken = client.GetSecurityToken(Encoding.UTF8.GetString(ms.ToArray()));
client.Close();
return SecurityToken;
}

AddUOM(UOM UomToAdd)

Description: this method is used to Add a Unit of measure into the system.

Parameters: UOM object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string AddUOM()
{
   // Create an instance of a UOM
   UOM uomToadd = new UOM();

   // fill in the UOM Parameter values.
   uomToadd.SecurityToken = “SecurityToken”;
   uomToadd.UnitCode = “UnitCode”;
   uomToadd.Multiplier = multiplier;
		etc…
   
    string returnedMessage;
    // Convert the Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(UOM));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, uomToadd);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the AddUOM Method.
    returnedMessage = client.AddUOM(Encoding.UTF8.GetString(ms.ToArray()));
         
    client.Close();
    return returnedMessage;
}

GetUOM(RequestObject GPObject)

Description: this method is used to get a specific UOM from the System.

Paramaters: RequestObject object

Return: the requested UOM if it exists in the System.

Sample C# Code:

private UOM GetUOM()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.ObjectIdentifier= "UOMCode to fetch";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetUOM Method.
       UOM foundUOM = client.GetUOM(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundUOM;
}

UpdateUOM(UOM uomToUpdate)

Description: this method is used to update a UOM that already exists in the system.

Paramaters: UOM object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string UpdateUOM()
{
   //Create a RequestObject
   RequestObject Robject = new RequestObject();

   //fill in the Parameter values
   Robject.SecurityToken = "Your SecurityToken";
   Robject.ObjectIdentifier= "UOMCode to edit";

   // Convert the RequestObject Object to JSON
   var serializer = new DataContractJsonSerializer(typeof(RequestObject));
   var ms = new MemoryStream();
   serializer.WriteObject(ms, Robject);

   // create an instance of the web service
   ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
   UOM foundObject = client.GetUOM(Encoding.UTF8.GetString(ms.ToArray()));

   //Close the client connection
   client.Close();

   //now that we have the UOM that we want to modify, let’s set up the properties
   // that need modifications.  Note: only the changed properties will be modified.
   foundObject.UnitName = "New UOM Name";
	etc….
               
          
   // Convert the RequestObject Object to JSON
   var Updateserializer = new DataContractJsonSerializer(typeof(UOM));
   var Updatems = new MemoryStream();
   Updateserializer.WriteObject(Updatems, foundObject);

   // create an instance of the web service
   ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();

   string Message= UpdateClient.UpdateUOM(Encoding.UTF8.GetString(Updatems.ToArray()));

   //Close the client connection
   UpdateClient.Close();

   return Message;
}

GetUOMs(RequestObject GPObject)

Description: this method is used to get All UOMs from the System.

Paramaters: RequestObject object

Return: All UOMs in the System.

Sample C# Code:

private UOM[] GetUOMs()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetUOMs Method.
       UOM[] foundObjects = client.GetUOMs(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundObjects;
}

AddAsset(Asset AssetToAdd)

Description: this method is used to Add an Asset into the system.

Parameters: Asset object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string AddAsset()
{
// Create an instance of an Asset
Asset assetToadd = new Asset();
// fill in the Paramater values.
assetToadd.SecurityToken = “SecurityToken”;
assetToadd.AssetNumber = “AssetNumber”;
assetToadd.CurrentLocation = “CurrentLocation”;
etc…
string returnedMessage;
// Convert the Asset Object to JSON
var serializer = new DataContractJsonSerializer(typeof(Asset));
var ms = new MemoryStream();
serializer.WriteObject(ms, assetToadd);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the AddAsset Method.
returnedMessage = client.AddAsset(Encoding.UTF8.GetString(ms.ToArray()));
client.Close();
return returnedMessage;
}

GetAsset(RequestObject GPObject)

Description: this method is used to get a specific Asset from the System.

Parameters: RequestObject object

Return: the requested Assets if it exists in the System.

private Asset GetAsset()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = "SecurityToken";
Robject.ObjectIdentifier= "AssetNumber to fetch";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the GetAsset Method.
Asset foundAsset = client.GetAsset(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundAsset;
}

GetAssets(RequestObject GPObject)

Description: this method is used to get all Assets from the System.

Parameters: RequestObject object

Return: an Array of Assets.

private Asset[] GetAssets()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Security Token Parameter values
Robject.SecurityToken = "Your SecurityToken";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the GetAssets Method.
Asset[] foundAssets = client.GetAssets(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundAssets;
}

UpdateAsset(Asset AssetToUpdate)

Description: this method is used to update an Asset that already exists in the system.

Parameters: Asset object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string UpdateAsset()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = "Your SecurityToken";
Robject.ObjectIdentifier= "AssetNumber to retreive";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the GetAsset Method.
Asset foundAsset = client.GetAsset(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
//now that we have the asset that we want to modify, lets set up the properties
// that need modifications.  Note: only the changed properites will be modified.
foundAsset.BIOS = "New Bios values";
foundAsset.Color = "New Color";
etc….
// Convert the RequestObject Object to JSON
var Updateserializer = new DataContractJsonSerializer(typeof(Asset));
var Updatems = new MemoryStream();
Updateserializer.WriteObject(Updatems, foundAsset);
// create an instance of the web service
ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();
string Message= UpdateClient.UpdateAsset(Encoding.UTF8.GetString(Updatems.ToArray()));
//Close the client connection
UpdateClient.Close();
return returnedUpdateMessage
}

DeleteAsset(RequestObject rqstObject)

Description: this method is used to delete an Asset that already exists in the system.

Parameters: RequestObject object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string DeleteAsset()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier= "AssetNumber of Asset to delete";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the DeleteAsset Method.
string message = client.DeleteAsset(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return message;
}

AddAssetModel(AssetModel AssetModelToAdd)

Description: this method is used to Add an AssetModel into the system.

Parameters: AssetModel object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string AddAssetModel()
{
string returnedMessage = string.Empty;
// Create an instance of an Asset
AssetModel assetModelToadd = new AssetModel();
// fill in the Paramater values.
assetModelToadd.SecurityToken = _SecurityToken;
assetModelToadd.ModelNumber = "MyTestModel";
assetModelToadd.AssetModelType = "Computer";
etc….
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(AssetModel));
var ms = new MemoryStream();
serializer.WriteObject(ms, assetModelToadd);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.AddAssetModel(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

GetAssetModel(RequestObject GPObject)

Description: this method is used to get a specific AssetModel from the System.

Parameters: RequestObject object

Return: the requested AssetModel if it exists in the System.

private AssetModel GetAssetModel()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = "SecurityToken";
Robject.ObjectIdentifier= "ModelNumber to fetch";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
AssetModel foundObject = client.GetAssetModel(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObject;
}

GetAssetModels(RequestObject GPObject)

Description: this method is used to get all AssetModels from the System.

Parameters: RequestObject object

Return: an Array of AssetModels.

private AssetModel[] GetAssetModels()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Security Token Parameter values
Robject.SecurityToken = "Your SecurityToken";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
AssetModel[] foundObjects =
client.GetAssetModels(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObjects;
}

UpdateAssetModel(AssetModel AssetModelToUpdate)

Description: this method is used to update an Asset that already exists in the system.

Parameters: Asset object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string UpdateAssetModel()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = "Your SecurityToken";
Robject.ObjectIdentifier = "ModelNumber to retreive";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
AssetModel foundObject = client.GetAssetModel(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
//now that we have the Object that we want to modify, lets set up the properties
// that need modifications.  Note: only the changed properites will be modified.
foundObject.Manufacturer = "MyManufacturer";
etc….
// Convert the RequestObject Object to JSON
var Updateserializer = new DataContractJsonSerializer(typeof(AssetModel));
var Updatems = new MemoryStream();
Updateserializer.WriteObject(Updatems, foundObject);
// create an instance of the web service
ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();
string Message= UpdateClient.UpdateAssetModel(Encoding.UTF8.GetString(Updatems.ToArray()));
//Close the client connection
UpdateClient.Close();

return Message;
}

DeleteAssetModel(RequestObject rqstObject)

Description: this method is used to Delete an AssetModel that already exists in the system.

Parameters: RequestObject object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string DeleteAssetModel()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "ModelNumber of AssetModel to delete";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Delete Method.
string message = client.DeleteAssetModel(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return message;
}

AddCustomer(Customer CustomerToAdd)

Description: this method is used to Add a Customer into the system.

Parameters: Customer object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string AddCustomer()
{
// Create an instance of a Customer
Customer customerToadd = new Customer();
// fill in the Paramater values.
customerToadd.SecurityToken = _SecurityToken;
customerToadd.Code = "MyCustomer";
customerToadd.Name = "MyCustomer Name";
etc…
string returnedMessage = string.Empty;
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(Customer));
var ms = new MemoryStream();
serializer.WriteObject(ms, customerToadd);
// create and instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.AddCustomer(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

GetCustomer(RequestObject GPObject)

Description: this method is used to get a specific Customer from the System.

Paramaters: RequestObject object

Return: the requested Customer if it exists in the System.

private Customer GetCustomer()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MyCustomer";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Customer foundObject = client.GetCustomer(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObject;
}

GetCustomers(RequestObject GPObject)

Description: this method is used to get all Customers from the System.

Paramaters: RequestObject object

Return: an Array of Customers.

private Customer[] GetCustomers()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Security Token Parameter values
Robject.SecurityToken = _SecurityToken;
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create and instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the GetCustomers Method.
Customer[] foundObjects =
client.GetCustomers(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObjects;
}

UpdateCustomer(Customer CustomerToUpdate)

Description: this method is used to update a customer that already exists in the system.

Paramaters: Customer object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string UpdateCustomer()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MyCustomer";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Customer foundObject = client.GetCustomer(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
//now that we have the Object that we want to modify, lets set up the properties
// that need modifications.  Note: only the changed properites will be modified.
foundObject.Address1 = "MyAddress1";
// Convert the RequestObject Object to JSON
var Updateserializer = new DataContractJsonSerializer(typeof(Customer));
var Updatems = new MemoryStream();
Updateserializer.WriteObject(Updatems, foundObject);
// create an instance of the web service
ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();
string Message = UpdateClient.UpdateCustomer(Encoding.UTF8.GetString(Updatems.ToArray()));
//Close the client connection
UpdateClient.Close();
return Message;
}

DeleteCustomer(RequestObject rqstObject)

Description: this method is used to Delete a Customer that already exists in the system.

Paramaters: RequestObject object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string DeleteCustomer()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "Code of Customer to delete";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Delete Method.
string message = client.DeleteCustomer(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return message;
}

AddLocation(Location LocationToAdd)

Description: this method is used to Add a Location into the system.

Paramaters: Location object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string AddLocation()
{
string returnedMessage = string.Empty;
// Create an instance of a Location
Location locationToadd = new Location();
// fill in the Paramater values.
locationToadd.SecurityToken = _SecurityToken;
locationToadd.Code = "MyLocation";
locationToadd.Name = "MyLocation Name";
etc…
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(Location));
var ms = new MemoryStream();
serializer.WriteObject(ms, locationToadd);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.AddLocation(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

GetLocation(RequestObject GPObject)

Description: this method is used to get a specific Location from the System.

Paramaters: RequestObject object

Return: the requested Location if it exists in the System.

private Location GetLocation()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MyLocation";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Location foundObject = client.GetLocation(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObject;
}

GetLocations(RequestObject GPObject)

Description: this method is used to get all Locations from the System.

Paramaters: RequestObject object

Return: an Array of Locations.

private Location[] GetLocations()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Security Token Parameter values
Robject.SecurityToken = _SecurityToken;
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the GetLocations Method.
Location[] foundObjects =
client.GetLocations(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObjects;
}

UpdateLocation(Location LocationToUpdate)

Description: this method is used to update a location that already exists in the system.

Paramaters: Location object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string UpdateLocation()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MyLocation";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Location foundObject = client.GetLocation(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
//now that we have the Object that we want to modify, lets set up the properties
// that need modifications.  Note: only the changed properites will be modified.
foundObject.PaletNumber = "123a";
// Convert the RequestObject Object to JSON
var Updateserializer = new DataContractJsonSerializer(typeof(Location));
var Updatems = new MemoryStream();
Updateserializer.WriteObject(Updatems, foundObject);
// create an instance of the web service
ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();
string Message =
UpdateClient.UpdateLocation(Encoding.UTF8.GetString(Updatems.ToArray()));
//Close the client connection
UpdateClient.Close();
return Message;
}

DeleteLocation(RequestObject rqstObject)

Description: this method is used to delete a Location that already exists in the system.

Paramaters: RequestObject object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string DeleteLocation()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "Code of Location to delete";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Delete Method.
string message = client.DeleteLocation(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return message;
}

AddPerson(Person PersonToAdd)

Description: this method is used to Add a Person into the system.

Paramaters: Person object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string AddPerson()
{
string returnedMessage = string.Empty;
// Create an instance of a Location
Person PersonToadd = new Person();
// fill in the Paramater values.
PersonToadd.SecurityToken = _SecurityToken;
PersonToadd.Code = "MyPerson";
PersonToadd.FirstName = "Me";
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(Person));
var ms = new MemoryStream();
serializer.WriteObject(ms, PersonToadd);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.AddPerson(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

GetPerson(RequestObject GPObject)

Description: this method is used to get a specific Person from the System.

Paramaters: RequestObject object

Return: the requested Person if it exists in the System.

private Person GetPerson()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MyPerson";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Person foundObject = client.GetPerson(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObject;
}

GetPersons(RequestObject GPObject)

Description: this method is used to get all Persons from the System.

Paramaters: RequestObject object

Return: an Array of Persons.

private Person[] GetPersons()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Security Token Parameter values
Robject.SecurityToken = _SecurityToken;
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the GetAssets Method.
Person[] foundObjects = client.GetPersons(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObjects;
}

UpdatePerson(Person PersonToUpdate)

Description: this method is used to update a Person that already exists in the system.

Paramaters: Person object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string UpdatePerson()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MyPerson";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Person foundObject = client.GetPerson(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
//now that we have the Object that we want to modify, lets set up the properties
// that need modifications.  Note: only the changed properites will be modified.
foundObject.FirstName = "John Doe";
// Convert the RequestObject Object to JSON
var Updateserializer = new DataContractJsonSerializer(typeof(Person));
var Updatems = new MemoryStream();
Updateserializer.WriteObject(Updatems, foundObject);
// create an instance of the web service
ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();
string Message =
UpdateClient.UpdatePerson(Encoding.UTF8.GetString(Updatems.ToArray()));
//Close the client connection
UpdateClient.Close();
return Message;
}

DeletePerson(RequestObject rqstObject)

Description: this method is used to delete a Person that already exists in the system.

Paramaters: RequestObject object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string DeletePerson()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MyPerson";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Delete Method.
string message = client.DeletePerson(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return message;
}

AddSupplier(Supplier SupplierToAdd)

Description: this method is used to Add a Supplier into the system.

Paramaters: Supplierobject

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string AddSupplier()
{
string returnedMessage = string.Empty;
// Create an instance of a Location
Supplier SupplierToadd = new Supplier();
// fill in the Paramater values.
SupplierToadd.SecurityToken = _SecurityToken;
SupplierToadd.Code = "MySupplier";
SupplierToadd.Contact = "John Doe";
Etc…
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(Supplier));
var ms = new MemoryStream();
serializer.WriteObject(ms, SupplierToadd);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.AddSupplier(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

GetSupplier(RequestObject GPObject)

Description: this method is used to get a specific Supplier from the System.

Paramaters: RequestObject object

Return: the requested Supplier if it exists in the System.

private Supplier GetSupplier()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MySupplier";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Supplier foundObject = client.GetSupplier(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObject;
}

GetSuppliers(RequestObject GPObject)

Description: this method is used to get all Suppliers from the System.

Paramaters: RequestObject object

Return: an Array of Suppliers.

private Supplier[] GetSuppliers()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Security Token Parameter values
Robject.SecurityToken = _SecurityToken;
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the GetAssets Method.
Supplier[] foundObjects = client.GetSuppliers(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return foundObjects;
}

UpdateSupplier(Supplier SupplierToUpdate)

Description: this method is used to update a Supplier that already exists in the system.

Paramaters: Supplier object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string UpdateSupplier()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MySupplier";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Get Method.
Supplier foundObject = client.GetSupplier(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
//now that we have the Object that we want to modify, let’s set up the properties
// that need modifications.  Note: only the changed properites will be modified.
foundObject.Contact = "John Smith";
etc…
// Convert the RequestObject Object to JSON
var Updateserializer = new DataContractJsonSerializer(typeof(Supplier));
var Updatems = new MemoryStream();
Updateserializer.WriteObject(Updatems, foundObject);
// create an instance of the web service
ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();
string Message =
UpdateClient.UpdateSupplier(Encoding.UTF8.GetString(Updatems.ToArray()));
//Close the client connection
UpdateClient.Close();
return Message;
}

DeleteSupplier(RequestObject rqstObject)

Description: this method is used to delete a Supplier that already exists in the system.

Paramaters: RequestObject object

Return: any errors in a string representation.  An empty return value means operation completed successfully.

private string DeleteSupplier()
{
//Create a RequestObject
RequestObject Robject = new RequestObject();
//fill in the Parameter values
Robject.SecurityToken = _SecurityToken;
Robject.ObjectIdentifier = "MySupplier";
// Convert the RequestObject Object to JSON
var serializer = new DataContractJsonSerializer(typeof(RequestObject));
var ms = new MemoryStream();
serializer.WriteObject(ms, Robject);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Delete Method.
string message = client.DeleteSupplier(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return message;
}

ReceiveAsset(AssetReceiveTransaction receiveTransaction)

Description: this method is used to receive an Asset into the system.

Paramaters: AssetReceiveTransaction object

Return: any errors in a string representation. An empty return value means operation completed successfully.

private string Receive()
{
string returnedMessage = string.Empty;
AssetReceiveTransaction assetReceiveTransaction = new AssetReceiveTransaction();
assetReceiveTransaction.SecurityToken = _SecurityToken;
assetReceiveTransaction.SiteName = "Main";
assetReceiveTransaction.LocationTo = "Receiving";
// now we will add the line items
AssetReceiveTransactionLineItem lineItem1 = new AssetReceiveTransactionLineItem();
lineItem1.AssetModelNumber = "iPad";
lineItem1.AssetNumber = "iPad000123-1";
lineItem1.AssetName = "My iPad";
lineItem1.Cost = 600;
          etc…
assetReceiveTransaction.LineItems.Add(lineItem1);
// Add another line items
AssetReceiveTransactionLineItem lineItem2 = new AssetReceiveTransactionLineItem();
lineItem2.AssetModelNumber = "iPad";
lineItem2.AssetNumber = "iPad000123-2";
lineItem2.AssetName = "My iPad-2";
lineItem2.Cost = 600;
          etc…
assetReceiveTransaction.LineItems.Add(lineItem2);
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(AssetReceiveTransaction));
var ms = new MemoryStream();
serializer.WriteObject(ms, assetReceiveTransaction);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.ReceiveAsset(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

MoveAsset(AssetMoveTransaction moveTransaction)

Description: this method is used to move an existing Asset.

Paramaters: AssetMoveTransaction object

Return: any errors in a string representation. An empty return value means operation completed successfully.

private string Move()
{
string returnedMessage = string.Empty;
AssetMoveTransaction assetMoveTransaction = new AssetMoveTransaction();
assetMoveTransaction.SecurityToken = _SecurityToken;
// now we will add the lineitems
AssetMoveTransactionLineItem lineItem1 = new AssetMoveTransactionLineItem();
lineItem1.AssetNumber = "iPad000123-3";
lineItem1.LocationTo = "Lab";
	etc…
assetMoveTransaction.LineItems.Add(lineItem1);
// Add another line item
AssetMoveTransactionLineItem lineItem2 = new AssetMoveTransactionLineItem();
lineItem2.AssetNumber = "iPad000123-2";
lineItem2.LocationTo = "Lab";
	etc…
assetMoveTransaction.LineItems.Add(lineItem2);
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(AssetMoveTransaction));
var ms = new MemoryStream();
serializer.WriteObject(ms, assetMoveTransaction);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.MoveAsset(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

DisposeAsset(DisposeMoveTransaction moveTransaction)

Description: this method is used to dispose an existing Asset.

Paramaters: DisposeMoveTransaction object

Return: any errors in a string representation. An empty return value means operation completed successfully.

private string Dispose()
{
string returnedMessage = string.Empty;
AssetDisposeTransaction assetDisposeTransaction = new AssetDisposeTransaction();
assetDisposeTransaction.SecurityToken = _SecurityToken;
// now we will add the lineitems
AssetDisposeTransactionLineItem lineItem1 = new AssetDisposeTransactionLineItem();
lineItem1.AssetNumber = "iPad000123-3";
lineItem1.DisposeTo = "Recylce";
assetDisposeTransaction.LineItems.Add(lineItem1);
// Add another line item
AssetDisposeTransactionLineItem lineItem2 = new AssetDisposeTransactionLineItem();
lineItem2.AssetNumber = "iPad000123-2";
lineItem2.DisposeTo = "Recylce";
assetDisposeTransaction.LineItems.Add(lineItem2);
// Convert the Object to JSON
var serializer = new DataContractJsonSerializer(typeof(AssetDisposeTransaction));
var ms = new MemoryStream();
serializer.WriteObject(ms, assetDisposeTransaction);
// create an instance of the web service
ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();
// Call the Add Method.
returnedMessage = client.DisposeAsset(Encoding.UTF8.GetString(ms.ToArray()));
//Close the client connection
client.Close();
return returnedMessage;
}

GetAllInventory(RequestObject GPObject)

Description: this method is used to get all the Stock Inventory from the System.

Paramaters: RequestObject object

Return: an Array of StockInventory objects.

Sample C# Code:

private StockInventory[] GetAllInventory()
{
    //Create a RequestObject
    RequestObject Robject = new RequestObject();

    //fill in the Security Token Parameter values
    Robject.SecurityToken = _SecurityToken;

    // Convert the RequestObject Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(RequestObject));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, Robject);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the GetAllInventory Method.
    StockInventory[] foundObjects = 
		client.GetAllInventory(Encoding.UTF8.GetString(ms.ToArray()));


    //Close the client connection
    client.Close();
    return foundObjects;
}

GetInventoryByStockNumber(RequestObject GPObject)

Description: this method is used to get all the Stock Inventory from the System per stockNumber.

Paramaters: RequestObject object

Return: an Array of StockInventory objects.

Sample C# Code:

private StockInventory[] GetInventoryByStockNumber()
{
    //Create a RequestObject
    RequestObject Robject = new RequestObject();

    //fill in the Security Token Parameter values
    Robject.SecurityToken = _SecurityToken;
    Robject.ObjectIdentifier = "StockNumberToFilterBy";


    // Convert the RequestObject Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(RequestObject));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, Robject);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the GetInventoryByStockNumber Method.
    StockInventory[] foundObjects = 
		client.GetInventoryByStockNumber(Encoding.UTF8.GetString(ms.ToArray()));


    //Close the client connection
    client.Close();
    return foundObjects;
}

GetInventoryByLocation(RequestObject GPObject)

Description: this method is used to get all the Stock Inventory from the System per Location.

Paramaters: RequestObject object

Return: an Array of StockInventory objects.

Sample C# Code:

private StockInventory[] GetInventoryByLocation()
{
    //Create a RequestObject
    RequestObject Robject = new RequestObject();

    //fill in the Security Token Parameter values
    Robject.SecurityToken = _SecurityToken;
    Robject.ObjectIdentifier = "LocationToFilterBy";


    // Convert the RequestObject Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(RequestObject));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, Robject);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the GetInventoryByLocation Method.
    StockInventory[] foundObjects = 
		client.GetInventoryByLocation(Encoding.UTF8.GetString(ms.ToArray()));


    //Close the client connection
    client.Close();
    return foundObjects;
}

GetInventoryBySiteName(RequestObject GPObject)

Description: this method is used to get all the Stock Inventory from the System per Site.

Paramaters: RequestObject object

Return: an Array of StockInventory objects.

Sample C# Code:

private StockInventory[] GetInventoryBySiteName()
{
    //Create a RequestObject
    RequestObject Robject = new RequestObject();

    //fill in the Security Token Parameter values
    Robject.SecurityToken = _SecurityToken;
    Robject.ObjectIdentifier = "SiteToFilterBy";


    // Convert the RequestObject Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(RequestObject));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, Robject);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the GetInventoryByLocation Method.
    StockInventory[] foundObjects = 
		client.GetInventoryBySiteName(Encoding.UTF8.GetString(ms.ToArray()));

    //Close the client connection
    client.Close();
    return foundObjects;
}

CheckoutAsset(AssetCheckoutTransaction checkoutTransaction)

Description: this method is used to Checkout an existing Asset, please note that all assets associated with this asset will also be checked out.

Paramaters: AssetCheckoutTransaction object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string CheckoutAsset()
{
     string returnedMessage = string.Empty;
     AssetCheckoutTransaction assetCheckoutTransaction = new AssetCheckoutTransaction();
     assetCheckoutTransaction.SecurityToken = _SecurityToken;

     // now we will add the line items

     AssetCheckoutTransactionLineItem lineItem1 = new AssetCheckoutTransactionLineItem();
     lineItem1.AssetNumber = "AssetToCheckout";
     lineItem1.CheckoutToLocation = "LocationToCheckoutTo";
     lineItem1.DueDays = 10;
     lineItem1.DueDate = DateTime.Now.AddDays(10);
	etc…
     assetCheckoutTransaction.LineItems.Add(lineItem1);

     AssetCheckoutTransactionLineItem lineItem2 = new AssetCheckoutTransactionLineItem();
     lineItem2.AssetNumber = "AssetToCheckout_2";
     lineItem2.CheckoutToLocation = "LocationToCheckoutTo";
     lineItem2.DueDays = 10;
     lineItem2.DueDate = DateTime.Now.AddDays(10);
	etc…
     assetCheckoutTransaction.LineItems.Add(lineItem2);
				
		etc…
		
            
     // Convert the Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(AssetCheckoutTransaction));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, assetCheckoutTransaction);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Checkout Method.
     returnedMessage = client.CheckoutAsset(Encoding.UTF8.GetString(ms.ToArray()));
     //Close the client connection
     client.Close();

      return returnedMessage;
 }

CheckinAsset(AssetCheckinTransaction checkinTransaction)

Description: this method is used to Checkin an existing Asset, please note that all assets associated with this asset will also be checked in.

Paramaters: AssetCheckinTransaction object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string CheckinAsset()
{
     string returnedMessage = string.Empty;
     AssetCheckinTransaction assetCheckoutTransaction = new AssetCheckinTransaction();
     assetCheckinTransaction.SecurityToken = _SecurityToken;

     // now we will add the line items

     AssetCheckinTransactionLineItem lineItem1 = new AssetCheckinTransactionLineItem();
     lineItem1.AssetNumber = "AssetToCheckin";
     lineItem1.CheckinToLocation = "LocationToCheckInto";
	etc…
     assetCheckinTransaction.LineItems.Add(lineItem1);

     AssetCheckinTransactionLineItem lineItem2 = new AssetCheckinTransactionLineItem();
     lineItem2.AssetNumber = "AssetToCheckin2";
     lineItem2.CheckoutToLocation = "LocationToCheckInto";
     	etc…
     assetCheckinTransaction.LineItems.Add(lineItem2);
				
		etc…
		
            
     // Convert the Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(AssetCheckinTransaction));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, assetCheckinTransaction);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Checkin Method.
     returnedMessage = client.CheckinAsset(Encoding.UTF8.GetString(ms.ToArray()));
     //Close the client connection
     client.Close();

      return returnedMessage;
 }

AddAssetPurchaseOrder(AssetPurchaseOrder AssetPOToAdd)

Description: this method is used to Add an Asset Purchase Order into the system.

Paramaters: AssetPurchaseOrder object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string AddAssetPurchaseOrder()
{
   // Create an instance of an Asset
   AssetPurchaseOrder assetPOToadd = new AssetPurchaseOrder();

   // fill in the Purchase Order Parameter values.
   assetPOToadd.SecurityToken = "SecurityToken";
   assetPOToadd.PONumber = "AssetPONumber";
   assetPOToadd.OrderDate = "CurrentDate";
		etc…
   // fill in the Purchase Order Line Items Parameter values.
   AssetPurchaseOrderLineItem LI1 = new AssetPurchaseOrderLineItem();
   LI1.AssetModel = "AssetModel";
   LI1.LineNumber = 1;
   	etc…   
   assetPOToadd.LineItems.Add(LI1);

   AssetPurchaseOrderLineItem LI2 = new AssetPurchaseOrderLineItem();
   LI2.AssetModel = "AssetModel2";
   LI2.LineNumber = 2;
   	etc…   
   assetPOToadd.LineItems.Add(LI2);

		etc….


    string returnedMessage;
    // Convert the Asset Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(AssetPurchaseOrder));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, assetPOToadd);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the AddAssetPurchaseOrder Method.
    returnedMessage = client.AddAssetPurchaseOrder(Encoding.UTF8.GetString(ms.ToArray()));
         
    client.Close();
    return returnedMessage;
}

GetAssetPurchaseOrder(RequestObject GPObject)

Description: this method is used to get a specific Asset Purchase Order from the System.

Paramaters: RequestObject object

Return: the requested Asset Purchase Order if it exists in the System.

Sample C# Code:

private AssetPurchaseOrder GetAssetPurchaseOrder()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.ObjectIdentifier= "AssetPONumber to fetch";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetAssetPurchaseOrder Method.
       AssetPurchaseOrder foundPO = 
			  client.GetAssetPurchaseOrder(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundPO;
}

GetAssetPurchaseOrders(SqlFilter GPObject)

Description: this method is used to get all Asset Purchase Orders from the System.

Paramaters: SqlFilter object

Return: the requested Asset Purchase Orders that fit the filter, if filter is passed as an empty string, all Asset purchase orders will be returned.

Sample C# Code:

 private AssetPurchaseOrder[] GetAssetPurchaseOrders()
{
//Create a RequestObject
       SqlFilter Robject = new SqlFilter();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.Filter = "Deleted = 0 and OrderStatus = 'closed' ";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(SqlFilter));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetAssetPurchaseOrder Method.
       AssetPurchaseOrder[] foundObject = client.GetAssetPurchaseOrders(Encoding.UTF8.GetString(ms.ToArray()));
       //Close the client connection
       client.Close();
       return foundObject;
}

UpdateAssetPurchaseOrder(AssetPurchaseOrder AssetPOToUpdate)

Description: this method is used to update an Asset Purchase Order header information that already exists in the system.

Paramaters: AssetPurchaseOrder object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string UpdateAssetPurchaseOrder()
{

   //Create a RequestObject
   RequestObject Robject = new RequestObject();

   //fill in the Parameter values
   Robject.SecurityToken = "Your SecurityToken";
   Robject.ObjectIdentifier= "AssetPONumber to edit";

   // Convert the RequestObject Object to JSON
   var serializer = new DataContractJsonSerializer(typeof(RequestObject));
   var ms = new MemoryStream();
   serializer.WriteObject(ms, Robject);

   // create an instance of the web service
   ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
   AssetPurchaseOrder foundObject =  
		client.GetAssetPurchaseOrder(Encoding.UTF8.GetString(ms.ToArray()));

   //Close the client connection
   client.Close();

   //now that we have the asset PO that we want to modify, lets set up the properties
   // that need modifications.  Note: only the changed properties will be modified.
   foundObject.Supplier = "New supplier";
	etc….
                        
   // Convert the RequestObject Object to JSON
   var Updateserializer = new DataContractJsonSerializer(typeof(AssetPurchaseOrder));
   var Updatems = new MemoryStream();
   Updateserializer.WriteObject(Updatems, foundObject);

   // create an instance of the web service
   ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();

   string Message= UpdateClient.UpdateAssetPurchaseOrder(Encoding.UTF8.GetString(Updatems.ToArray()));

   //Close the client connection
   UpdateClient.Close();

   return returnedUpdateMessage
}

AddBarCloudUser(BarCloudUser UserToAdd)

Description: this method is used to Add a BarCloud User into the system.

Paramaters: BarCloudUser object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string AddBarCloudUser()
{
    string returnedMessage = string.Empty;

    // Create an instance of a BarCloudUser
    BarCloudUser oUser = new BarCloudUser();

    // fill in the Paramater values.
    oUser.SecurityToken = "Your SecurityToken";
    oUser.Username = "Username";
    oUser.Password = "Password";
    oUser.Person = "Person associated with this user";
    oUser.Offset = TimeZone.CurrentTimeZone.ToString();
    oUser.SecurityLevel = "SecurityLevel";
    oUser.Email = "Email";
                       
    // Convert the Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(BarCloudUser));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, oUser);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the Add Method.
    returnedMessage = client.AddBarCloudUser(Encoding.UTF8.GetString(ms.ToArray()));
    //Close the client connection
    client.Close();
    return returnedMessage;
}

GetBarCloudUsers(RequestObject GPObject)

Description: this method is used to get all BarCloudUsers from the System.

Paramaters: RequestObject object

Return: an Array of BarCloudUsers.

Sample C# Code:

private BarCloudUsers[] GetBarCloudUsers()
{

//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Security Token Parameter values
       Robject.SecurityToken = "Your SecurityToken";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the Get Method.
       BarCloudUser[] foundUsers =
			 client.GetBarCloudUsers(Encoding.UTF8.GetString(ms.ToArray()));
      
//Close the client connection
       client.Close();
       return foundUsers;
}

GetBarCloudUserByUsername(RequestObject GPObject)

Description: this method is used to get a specific User from the System.

Paramaters: RequestObject object

Return: the requested User if it exists in the System.

Sample C# Code:

private BarCloudUser GetBarCloudUserByUsername()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.ObjectIdentifier= "Username to fetch";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetBarCloudUserByUsername Method.
       BarCloudUser foundUser = 
		client.GetBarCloudUserByUsername(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundUser;
}

ResetBarCloudUserPassword(BarCloudUser oUser)

Description: this method is used to reset the Password of a specific User.

Paramaters: BarCloudUser object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string ResetPassword()
{
    //Create a RequestObject
    RequestObject Robject = new RequestObject();

    //fill in the Parameter values
    Robject.SecurityToken = "SecurityToken";
    Robject.ObjectIdentifier= "Username to fetch";

    // Convert the RequestObject Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(RequestObject));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, Robject);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the Get Method.
    BarCloudUser foundObject = client.GetBarCloudUserByUsername(Encoding.UTF8.GetString(ms.ToArray()));

    //Close the client connection
    client.Close();

            
    // Convert the RequestObject Object to JSON
    var Updateserializer = new DataContractJsonSerializer(typeof(BarCloudUser));
    var Updatems = new MemoryStream();
    Updateserializer.WriteObject(Updatems, foundObject);

    // create an instance of the web service
    ServiceReference2.ServiceClient oClient = new ServiceReference2.ServiceClient();

    string Message = oClient.ResetPassword(Encoding.UTF8.GetString(Updatems.ToArray()));

    //Close the client connection
    oClient.Close();

    return Message;
}

GetBarCloudLoggedInUsers(RequestObject GPObject)

Description: this method is used to get all BarCloudUsers that are currently logged in.

Paramaters: RequestObject object

Return: an Array of BarCloudUsers.

Sample C# Code:


private BarCloudUsers[] GetLoggedInUsers()
{
	//Create a RequestObject
	RequestObject Robject = new RequestObject();

      //fill in the Parameter values
	Robject.SecurityToken = "SecurityToken";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the Get Method.
       BarCloudUser[] LoggedInUsers = 
		client.GetBarCloudLoggedInUsers(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return LoggedInUsers;
}

LogBarCloudUserOut(BarCloudUser oUser)

Description: this method is used to Log out a BarCloudUsers that is currently logged in.

Paramaters: BarCloudUser object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:


private string LogUserOut()
{
	//Create a RequestObject
    RequestObject Robject = new RequestObject();

    //fill in the Parameter values
    Robject.SecurityToken = "SecurityToken";
    Robject.ObjectIdentifier = "Username of User to Log out";

    // Convert the RequestObject Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(RequestObject));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, Robject);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the Get Method.
    BarCloudUser foundObject = 
		client.GetBarCloudUserByUsername(Encoding.UTF8.GetString(ms.ToArray()));

    //Close the client connection
    client.Close();

    // Convert the RequestObject Object to JSON
    var Updateserializer = new DataContractJsonSerializer(typeof(BarCloudUser));
    var Updatems = new MemoryStream();
    Updateserializer.WriteObject(Updatems, foundObject);

    // create an instance of the web service
    ServiceReference2.ServiceClient oClient = new ServiceReference2.ServiceClient();
    
    string Message = oClient.LogUserOut(Encoding.UTF8.GetString(Updatems.ToArray()));

    //Close the client connection
    oClient.Close();

    return Message;
}

AddAssetMaintenanceScheduleOneTime(AssetMaintenanceSheduleOneTime oParam)

Description: this method is used to Add a onetime Asset Maintenance into the system.

Paramaters: AssetMaintenanceSheduleOneTime object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:


private string ScheduleOneTimeAssetMaintenance()
{
   string returnedMessage = string.Empty;

    // Create an instance of the object
    AssetMaintenanceScheduleOneTime oParam = new AssetMaintenanceScheduleOneTime();

    // fill in the Paramater values.
    oParam.SecurityToken = "SecurityToken";
    oParam.MaintenanceCode = "AssetMaintenanceCode";
    oParam.AssetNumber = "AssetNumber";
    oParam.ScheduledFor = "Date Scheduled For";
		etc…
            
    // Convert the Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(AssetMaintenanceScheduleOneTime));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, oParam);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the Add Method.
    returnedMessage =   
     client.AddAssetMaintenanceScheduleOneTime(Encoding.UTF8.GetString(ms.ToArray()));
    //Close the client connection
    client.Close();
    return returnedMessage;
}

AddAssetMaintenanceScheduleRecurring(AssetMaintenanceSheduleRecurring oParam)

Description: this method is used to Add a recurring Asset Maintenance into the system.

Paramaters: AssetMaintenanceSheduleRecurring object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:


private string ScheduleRecurringAssetMaintenance()
{
   string returnedMessage = string.Empty;

    // Create an instance of the object
    AssetMaintenanceScheduleRecurring oParam = new AssetMaintenanceScheduleRecurring();

    // fill in the Paramater values.
    oParam.SecurityToken = "SecurityToken";
    oParam.MaintenanceCode = "AssetMaintenanceCode";
    oParam.AssetNumber = "AssetNumber";
    oParam.Frequency = 5;
		etc…
    // Convert the Object to JSON
    var serializer = 
		new DataContractJsonSerializer(typeof(AssetMaintenanceScheduleRecurring));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, oParam);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the Add Method.
    returnedMessage =   
     client.AddAssetMaintenanceScheduleRecurring(Encoding.UTF8.GetString(ms.ToArray()));
    //Close the client connection
    client.Close();
    return returnedMessage;
}

PerformAssetMaintenance(AssetMaintenancePerform oParam)

Description: this method is used to Peform an Asset Maintenance.

Paramaters: AssetMaintenancePerform object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:


private string PerformAssetMaintenance()
{
       string returnedMessage = string.Empty;

    // Create an instance of a Purchase Order
    AssetMaintenancePerform oParam = new AssetMaintenancePerform();

    // fill in the Paramater values.
    oParam.SecurityToken = "SecurityToken";
    oParam.PerformMaintenanceCode = "PerformMaintenanceCode";
    oParam.PerformDate = DateTime.Now;
    oParam.Person = "PersonPerformedBy";
		etc…



    // Convert the Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(AssetMaintenancePerform));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, oParam);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the Perform Method.
    returnedMessage = client.PerformAssetMaintenance(Encoding.UTF8.GetString(ms.ToArray()));
    //Close the client connection
    client.Close();
    return returnedMessage;
}

IssueStock(StockIssueTransaction issueTransaction)

Description: this method is used to issue out Stocks.

Paramaters: StockIssueTransaction object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

 private string IssueStock()
{
     string returnedMessage = string.Empty;
     StockIssueTransaction issueTransaction = new StockIssueTransaction ();
     issueTransaction.SecurityToken = "Your Security token";
     issueTransaction.CustomerCode = "Customer Code";
     issueTransaction.SalesOrderNumber = "Sales Order # if any";
     issueTransaction.Notes = "Transaction Notes";


     // now we will add the line items

     StockIssueTransactionLineItem lineItem1 = new StockIssueTransactionLineItem();
     lineItem1.InventoryNumber = "InventoryNumber to issue out";
     lineItem1.LocationFrom = "From Location";
     lineItem1.Price = 6;
     lineItem1.QuantityToIssue = 1;
     lineItem1.SalesOrderLineNumber = 2;
     issueTransaction.LineItems.Add(lineItem1);

     StockIssueTransactionLineItem lineItem2 = new StockIssueTransactionLineItem();
     lineItem2.InventoryNumber = "InventoryNumber to issue out";
     lineItem2.LocationFrom = "From Location";
     lineItem2.Price = 6;
     lineItem2.QuantityToIssue = 1;
     lineItem2.SalesOrderLineNumber = 2;
     issueTransaction.LineItems.Add(lineItem1);
				
		etc…
		
     // Convert the Object to JSON

     var serializer = new DataContractJsonSerializer(typeof(StockIssueTransaction));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, issueTransaction);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Checkout Method.
     returnedMessage = client.IssueStock(Encoding.UTF8.GetString(ms.ToArray()));
     //Close the client connection
     client.Close();

      return returnedMessage;
 }

GetAssetAllHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset All History.

Paramaters: HistoryRequestObject object

Return: Array of AssetAllHistory Objects.

Sample C# Code:


public AssetAllHistory[] GetAssetAllHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench' AND InvHistoryType = 
								'Move'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetAllHistory[] foundObject = 
			client.GetAssetAllHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

GetAssetReceiveHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Receive History.

Paramaters: HistoryRequestObject object

Return: Array of AssetReceiveHistory Objects.

Sample C# Code:

public AssetReceiveHistory[] GetAssetReceiveHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetReceiveHistory [] foundObject = 
			client.GetAssetReceiveHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

GetAssetMoveHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Move History.

Paramaters: HistoryRequestObject object

Return: Array of AssetMoveHistory Objects.

Sample C# Code:


public AssetMoveHistory[] GetAssetMoveHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetMoveHistory [] foundObject = 
			client.GetAssetMoveHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

GetAssetDisposeHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Dispose History.

Paramaters: HistoryRequestObject object

Return: Array of AssetDisposeHistory Objects.

Sample C# Code:


public AssetDisposeHistory[] GetAssetDisposeHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetDisposeHistory [] foundObject = 
			client.GetAssetDisposeHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

GetAssetCheckoutHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Checkout History.

Paramaters: HistoryRequestObject object

Return: Array of AssetCheckoutHistory Objects.

Sample C# Code:


public AssetCheckoutHistory[] GetAssetCheckoutHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetCheckoutHistory [] foundObject = 
			client.GetAssetCheckoutHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

GetAssetCheckinHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Checkin History.

Paramaters: HistoryRequestObject object

Return: Array of AssetCheckinHistory Objects.

Sample C# Code:


public AssetCheckinHistory[] GetAssetCheckinHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetCheckinHistory [] foundObject = 
			client.GetAssetCheckinHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

AddStockPurchaseOrder(StockPurchaseOrder StockPOToAdd)

Description: this method is used to Add a Stock Purchase Order into the system.

Paramaters: StockPurchaseOrder object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string AddStockPurchaseOrder()
{
   // Create an instance of a Stock Purchase Order
   StockPurchaseOrder stockPOToadd = new StockPurchaseOrder();

   // fill in the Purchase Order Parameter values.
   stockPOToadd.SecurityToken = "SecurityToken";
   stockPOToadd.PONumber = "StockPONumber";
   stockPOToadd.OrderDate = "CurrentDate";
		etc…
   // fill in the Purchase Order Line Items Parameter values.
   StockPurchaseOrderLineItem LI1 = new StockPurchaseOrderLineItem();
   LI1.StockNumber = "StockNumber1";
   LI1.LineNumber = 1;
   	etc…   
   stockPOToadd.LineItems.Add(LI1);

   StockPurchaseOrderLineItem LI2 = new StockPurchaseOrderLineItem();
   LI2.StockNumber = "StockNumber2";
   LI2.LineNumber = 2;
   	etc…   
   stockPOToadd.LineItems.Add(LI2);

		etc….


    string returnedMessage;
    // Convert the Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(StockPurchaseOrder));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, stockPOToadd);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the AddPurchaseOrder Method.
    returnedMessage = client.AddStockPurchaseOrder(Encoding.UTF8.GetString(ms.ToArray()));
         
    client.Close();
    return returnedMessage;
}


GetStockPurchaseOrder(RequestObject GPObject)

Description: this method is used to get a specific Stock Purchase Order from the System.

Paramaters: RequestObject object

Return: the requested Stock Purchase Order if it exists in the System.

Sample C# Code:

private StockPurchaseOrder GetStockPurchaseOrder()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.ObjectIdentifier= "StockPONumber to fetch";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetStockPurchaseOrder Method.
       StockPurchaseOrder foundPO = 
			  client.GetStockPurchaseOrder(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundPO;
}



GetStockPurchaseOrders(SqlFilter GPObject)

Description: this method is used to get all Stock Purchase Orders from the System.

Paramaters: SqlFilter object

Return: the requested Stock Purchase Orders that fit the filter, if filter is passed as an empty string, all Stock purchase orders will be returned.

Sample C# Code:

 private StockPurchaseOrder[] GetStockPurchaseOrders()
{
//Create a RequestObject
       SqlFilter Robject = new SqlFilter();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.Filter = "Deleted = 0 and OrderStatus = 'closed' ";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(SqlFilter));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetAssetPurchaseOrder Method.
       AssetPurchaseOrder[] foundObject = client.GetStockPurchaseOrders(Encoding.UTF8.GetString(ms.ToArray()));
       //Close the client connection
       client.Close();
       return foundObject;
}

UpdateStockPurchaseOrder(StockPurchaseOrder StockPOToUpdate)

Description: this method is used to update a stock Purchase that already exists in the system.

Paramaters: StockPurchaseOrder object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string UpdateStockPurchaseOrder()
{

   //Create a RequestObject
   RequestObject Robject = new RequestObject();

   //fill in the Parameter values
   Robject.SecurityToken = "Your SecurityToken";
   Robject.ObjectIdentifier= "StockPONumber to edit";

   // Convert the RequestObject Object to JSON
   var serializer = new DataContractJsonSerializer(typeof(RequestObject));
   var ms = new MemoryStream();
   serializer.WriteObject(ms, Robject);

   // create an instance of the web service
   ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
   StockPurchaseOrder foundObject =  
		client.GetStockPurchaseOrder(Encoding.UTF8.GetString(ms.ToArray()));

   //Close the client connection
   client.Close();

   //now that we have the PO that we want to modify, lets set up the properties
   // that need modifications.  Note: only the changed properties will be modified.
   foundObject.Supplier = "New supplier";
	etc….
               
   // now let's increase line item one quantity by one
   foreach (StockPurchaseOrderLineItem li in foundObject.LineItems)
   {
       if (li.LineNumber == 1)
       {
          li.UnitsOrdered = li.UnitsOrdered+1;
       }
   }

   // now let's Add a new line Item
   StockPurchaseOrderLineItem NewLine = new StockPurchaseOrderLineItem();
   NewLine.StockNumber = "StockNumber3";
   NewLine.LineNumber = 3;
   	etc…   
   foundObject.LineItems.Add(NewLine);


         
   // Convert the RequestObject Object to JSON
   var Updateserializer = new DataContractJsonSerializer(typeof(StockPurchaseOrder));
   var Updatems = new MemoryStream();
   Updateserializer.WriteObject(Updatems, foundObject);

   // create an instance of the web service
   ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();

   string Message= UpdateClient.UpdateStockPurchaseOrder(Encoding.UTF8.GetString(Updatems.ToArray()));

   //Close the client connection
   UpdateClient.Close();

   return Message;
}

AddStockSalesOrder(StockSalesOrder StockSOToAdd)

Description: this method is used to Add a Stock Sales Order into the system.

Paramaters: StockSalesOrder object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string AddStockSalesOrder()
{
   // Create an instance of a Stock Sales Order
   StockSalesOrder stockSOToadd = new StockSalesOrder();

   // fill in the Purchase Order Parameter values.
   stockSOToadd.SecurityToken = "SecurityToken";
   stockSOToadd.SONumber = "StockSONumber";
   stockSOToadd.OrderDate = "CurrentDate";
		etc…
   // fill in the Sales Order Line Items Parameter values.
   StockSalesOrderLineItem LI1 = new StockSalesOrderLineItem();
   LI1.StockNumber = "StockNumber1";
   LI1.LineNumber = 1;
   	etc…   
   stockSOToadd.LineItems.Add(LI1);

   StockSalesOrderLineItem LI2 = new StockSalesOrderLineItem();
   LI2.StockNumber = "StockNumber2";
   LI2.LineNumber = 2;
   	etc…   
   stockSOToadd.LineItems.Add(LI2);

		etc….


    string returnedMessage;
    // Convert the Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(StockSalesOrder));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, stockPOToadd);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the AddSalesOrder Method.
    returnedMessage = client.AddStockSalesOrder(Encoding.UTF8.GetString(ms.ToArray()));
         
    client.Close();
    return returnedMessage;
}



GetStockSalesOrder(RequestObject GPObject)

Description: this method is used to get a specific Stock Sales Order from the System.

Paramaters: RequestObject object

Return: the requested Stock Sales Order if it exists in the System.

Sample C# Code:

private StockSalesOrder GetStockSalesOrder()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.ObjectIdentifier= "StockSONumber to fetch";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetStockSalesOrder Method.
       StockSalesOrder foundPO = 
			  client.GetStockSalesOrder(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundPO;
}


UpdateStockSalesOrder(StockSalesOrder StockSOToUpdate)

Description: this method is used to update a stock Sales that already exists in the system.

Paramaters: StockSalesOrder object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string UpdateStockSalesOrder()
{

   //Create a RequestObject
   RequestObject Robject = new RequestObject();

   //fill in the Parameter values
   Robject.SecurityToken = "Your SecurityToken";
   Robject.ObjectIdentifier= "StockSONumber to edit";

   // Convert the RequestObject Object to JSON
   var serializer = new DataContractJsonSerializer(typeof(RequestObject));
   var ms = new MemoryStream();
   serializer.WriteObject(ms, Robject);

   // create an instance of the web service
   ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
   StockSalesOrder foundObject =  
		client.GetStockSalesOrder(Encoding.UTF8.GetString(ms.ToArray()));

   //Close the client connection
   client.Close();

   //now that we have the PO that we want to modify, lets set up the properties
   // that need modifications.  Note: only the changed properties will be modified.
   foundObject.Customer = "New Customer";
	etc….
               
   // now let's increase line item one quantity by one
   foreach (StockPurchaseOrderLineItem li in foundObject.LineItems)
   {
       if (li.LineNumber == 1)
       {
          li.Quantity = li.Quantity+1;
       }
   }

   // now let's Add a new line Item
   StockSalesOrderLineItem NewLine = new StockSalesOrderLineItem();
   NewLine.StockNumber = "StockNumber3";
   NewLine.LineNumber = 3;
   	etc…   
   foundObject.LineItems.Add(NewLine);


         
   // Convert the RequestObject Object to JSON
   var Updateserializer = new DataContractJsonSerializer(typeof(StockPurchaseOrder));
   var Updatems = new MemoryStream();
   Updateserializer.WriteObject(Updatems, foundObject);

   // create an instance of the web service
   ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();

   string Message= UpdateClient.UpdateStockSalesOrder(Encoding.UTF8.GetString(Updatems.ToArray()));

   //Close the client connection
   UpdateClient.Close();

   return Message;
}



ReturnStock(StockReturnTransaction returnTransaction)

Description: this method is used to return issued out Stocks.

Paramaters: StockReturnTransaction object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string ReturnStock()
{
     string returnedMessage = string.Empty;
     StockReturnTransaction returnTransaction = new StockReturnTransaction ();
     returnTransaction.SecurityToken = "Your Security token";
     returnTransaction.CustomerCode = "Customer Code";
     returnTransaction.SalesOrderNumber = "Sales Order # if any";
     returnTransaction.Notes = "Transaction Notes";


     // now we will add the line items

     StockReturnTransactionLineItem lineItem1 = new StockReturnTransactionLineItem();
     lineItem1.InventoryNumber = "InventoryNumber to Return";
     lineItem1.LocationFrom = "To Location";
     lineItem1.Price = 6;
     lineItem1.QuantityToReturn = 1;
     lineItem1.SalesOrderLineNumber = 2;
     returnTransaction.LineItems.Add(lineItem1);

     StockReturnTransactionLineItem lineItem2 = new StockReturnTransactionLineItem ();
     lineItem2.InventoryNumber = " InventoryNumber to Return ";
     lineItem2.LocationFrom = " To Location ";
     lineItem2.Price = 6;
     lineItem2.QuantityToReturn = 1;
     lineItem2.SalesOrderLineNumber = 2;
     returnTransaction.LineItems.Add(lineItem2);
				
		etc…
		
     // Convert the Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(StockReturnTransaction));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, returnTransaction);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Checkout Method.
     returnedMessage = client.ReturnStock(Encoding.UTF8.GetString(ms.ToArray()));
     //Close the client connection
     client.Close();

      return returnedMessage;
 }

GetAssetAllHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset All History.

Paramaters: HistoryRequestObject object

Return: Array of AssetAllHistory Objects with Most recent transactions first.

Sample C# Code:

public AssetAllHistory[] GetAssetAllHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench' AND InvHistoryType = 
								'Move'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));

     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetAllHistory[] foundObject = 
			client.GetAssetAllHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetAssetReceiveHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Receive History.

Paramaters: HistoryRequestObject object

Return: Array of AssetReceiveHistory Objects with most recent transactions first.

Sample C# Code:

public AssetReceiveHistory[] GetAssetReceiveHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetReceiveHistory [] foundObject = 
client.GetAssetReceiveHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

GetAssetMoveHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Move History.

Paramaters: HistoryRequestObject object

Return: Array of AssetMoveHistory Objects with Most recent transactions first.

Sample C# Code:

public AssetMoveHistory[] GetAssetMoveHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetMoveHistory [] foundObject = 
	client.GetAssetMoveHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetAssetDisposeHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Dispose History.

Paramaters: HistoryRequestObject object

Return: Array of AssetDisposeHistory Objects with Most recent transactions first.

Sample C# Code:

public AssetDisposeHistory[] GetAssetDisposeHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetDisposeHistory [] foundObject = 
	client.GetAssetDisposeHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetAssetCheckoutHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Checkout History.

Paramaters: HistoryRequestObject object

Return: Array of AssetCheckoutHistory Objects with Most recent transactions first.

Sample C# Code:

public AssetCheckoutHistory[] GetAssetCheckoutHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetCheckoutHistory [] foundObject =       client.GetAssetCheckoutHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetAssetCheckinHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Asset Checkin History.

Paramaters: HistoryRequestObject object

Return: Array of AssetCheckinHistory Objects.

Sample C# Code:

public AssetCheckinHistory[] GetAssetCheckinHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e AssetNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     AssetCheckinHistory [] foundObject = 
	client.GetAssetCheckinHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetStockReceiveHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Stock Receive History.

Paramaters: HistoryRequestObject object

Return: Array of StockReceiveHistory Objects.

Sample C# Code:

public StockReceiveHistory[] GetStockReceiveHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockReceiveHistory [] foundObject = 
client.GetStockReceiveHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }



GetStockMoveHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockMove History.

Paramaters: HistoryRequestObject object

Return: Array of StockMoveHistory Objects.

Sample C# Code:

public StockMoveHistory[] GetStockMoveHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockMoveHistory [] foundObject = 
	client.GetStockMoveHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetStockDisposeHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockDispose History.

Paramaters: HistoryRequestObject object

Return: Array of StockDisposeHistory Objects.

Sample C# Code:

public StockDisposeHistory[] GetStockDisposeHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockDisposeHistory [] foundObject = 
	client.GetStockDisposeHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetStockIssueHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockIssue History.

Paramaters: HistoryRequestObject object

Return: Array of StockIssueHistory Objects.

Sample C# Code:

public StockIssueHistory[] GetStockIssueHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockIssueHistory [] foundObject = 
	client.GetStockIssueHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }



GetStockReturnHistory(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockReturn History.

Paramaters: HistoryRequestObject object

Return: Array of StockReturnHistory Objects.

Sample C# Code:

public StockReturnHistory[] GetStockReturnHistory()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockReturnHistory [] foundObject = 
	client.GetStockReturnHistory(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }


GetStockReceiveHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve Stock Receive History.

Paramaters: HistoryRequestObject object

Return: Array of StockReceiveHistory Objects with most recent transactions first.

Sample C# Code:

public StockReceiveHistory[] GetStockReceiveHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockReceiveHistory [] foundObject = 
client.GetStockReceiveHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }



GetStockMoveHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockMove History.

Paramaters: HistoryRequestObject object

Return: Array of StockMoveHistory Objects with Most recent transactions first.

Sample C# Code:

public StockMoveHistory[] GetStockMoveHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockMoveHistory [] foundObject = 
	client.GetStockMoveHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }



GetStockDisposeHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockDispose History.

Paramaters: HistoryRequestObject object

Return: Array of StockDisposeHistory Objects with Most recent transactions first.

Sample C# Code:

public StockDisposeHistory[] GetStockDisposeHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockDisposeHistory [] foundObject = 
	client.GetStockDisposeHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }



GetStockIssueHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockIssue History.

Paramaters: HistoryRequestObject object

Return: Array of StockIssueHistory Objects with Most recent transactions first.

Sample C# Code:

public StockIssueHistory[] GetStockIssueHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockIssueHistory [] foundObject = 
	client.GetStockIssueHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }



GetStockReturnHistoryOrderByMostRecent(HistoryRequestObject paramHistoryRequest)

Description: this method is used to retrieve StockReturn History.

Paramaters: HistoryRequestObject object

Return: Array of StockReturnHistory Objects with Most recent transactions first.

Sample C# Code:

public StockReturnHistory[] GetStockReturnHistoryOrderByMostRecent()
{
     //Create a RequestObject
     HistoryRequestObject Robject = new HistoryRequestObject();

     //fill in the Parameter values
     Robject.SecurityToken = "Your Security token";
     Robject.SqlFilter = " Your filter if any i.e StockNumber = 'Wrench'";

     // Convert the RequestObject Object to JSON
     var serializer = new DataContractJsonSerializer(typeof(HistoryRequestObject));
     var ms = new MemoryStream();
     serializer.WriteObject(ms, Robject);

     // create an instance of the web service
     ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
     StockReturnHistory [] foundObject = 
	client.GetStockReturnHistoryOrderByMostRecent(Encoding.UTF8.GetString(ms.ToArray()));

     //Close the client connection
     client.Close();
     return foundObject;
 }

AddStockItem(Stock stockToAdd)

Description: this method is used to Add a stock item into the system.

Paramaters: Stock object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string AddStock()
{
   // Create an instance of a Stock
   Stock sTockToadd = new Stock();

   // fill in the Stock Parameter values.
   sTockToadd.SecurityToken = “SecurityToken”;
   sTockToadd.STOCKNUMBER= “SKU #”;
		etc…
   
    // Convert the Object to JSON
    var serializer = new DataContractJsonSerializer(typeof(Stock));
    var ms = new MemoryStream();
    serializer.WriteObject(ms, uomToadd);

    // create an instance of the web service
    ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

    // Call the AddStock Method.
    string  returnedMessage = client.AddStock(Encoding.UTF8.GetString(ms.ToArray()));
         
    client.Close();
    return returnedMessage;
}

GetStockItem(RequestObject GPObject)

Description: this method is used to get a specific Stock Item from the System.

Paramaters: RequestObject object

Return: the requested Stock Item if it exists in the System.

Sample C# Code:

private Stock GetStockItem()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";
       Robject.ObjectIdentifier= "StockItem # to fetch";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetStock Method.
       Stock foundStock = client.GetStock(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundStock;
}

UpdateStockItem(Stock stockToUpdate)

Description: this method is used to update a Stock Item that already exists in the system.

Paramaters: Stock object

Return: any errors in a string representation. An empty return value means operation completed successfully.

Sample C# Code:

private string UpdateStockItem()
{
   //Create a RequestObject
   RequestObject Robject = new RequestObject();

   //fill in the Parameter values
   Robject.SecurityToken = "Your SecurityToken";
   Robject.ObjectIdentifier= "StockItem # to edit";

   // Convert the RequestObject Object to JSON
   var serializer = new DataContractJsonSerializer(typeof(RequestObject));
   var ms = new MemoryStream();
   serializer.WriteObject(ms, Robject);

   // create an instance of the web service
   ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

     // Call the Get Method.
   Stock foundObject = client.GetStock(Encoding.UTF8.GetString(ms.ToArray()));

   //Close the client connection
   client.Close();

   //now that we have the stock item that we want to modify, let’s set up the properties
   // that need modifications.  Note: only the changed properties will be modified.
   foundObject.DESCRIPTION = "New description";
	etc….
               
          
   // Convert the RequestObject Object to JSON
   var Updateserializer = new DataContractJsonSerializer(typeof(Stock));
   var Updatems = new MemoryStream();
   Updateserializer.WriteObject(Updatems, foundObject);

   // create an instance of the web service
   ServiceReference2.ServiceClient UpdateClient = new ServiceReference2.ServiceClient();

   string Message= UpdateClient.UpdateStock(Encoding.UTF8.GetString(Updatems.ToArray()));

   //Close the client connection
   UpdateClient.Close();

   return Message;
}

GetStocks(RequestObject GPObject)

Description: this method is used to get All StockItems from the System.

Paramaters: RequestObject object

Return: All Stock items in the system.

Sample C# Code:

private Stock[] GetStockItems()
{
//Create a RequestObject
       RequestObject Robject = new RequestObject();

       //fill in the Parameter values
       Robject.SecurityToken = "SecurityToken";

       // Convert the RequestObject Object to JSON
       var serializer = new DataContractJsonSerializer(typeof(RequestObject));
       var ms = new MemoryStream();
       serializer.WriteObject(ms, Robject);

       // create an instance of the web service
       ServiceReference2.ServiceClient client = new ServiceReference2.ServiceClient();

       // Call the GetStocks Method.
       Stock[] foundObjects = client.GetStocks(Encoding.UTF8.GetString(ms.ToArray()));

       //Close the client connection
       client.Close();
       return foundObjects;
}