Archive
SWS CreateAuction Method
Creates a rental auction so that rental items can be placed in auction, including date, time, auctioneer and auction status.
Parameters
Name | DataType | Is Required |
---|---|---|
AuctionDateTime | dateTime | Required |
Description | The date and time the auction will take place. If no time is supplied, the default is 12:00am. | |
AuctioneerName | String | Required |
Description | The auctioneer’s name. Max string length of 100. | |
AuctionNotes | String | Optional |
Description | The free text note as to the rental item’s auction status. Max string length of 4000. | |
SiteID | Long | Required |
Description | The site’s ID number where the auction will take place. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
AuctionID | Long |
Description | Returns the auction’s ID number. This is a system generated number. |
Auction_Date | dateTime |
Description | Returns the date and time when the auction will occur. |
Auction_Time | dateTime |
Description | Returns just the time when the auction will occur. |
Created_By | Long |
Description | Returns the Store user’s ID number that created the auction. |
Notes | String |
Description | Returns the auctions notes. |
Site_ID | Long |
Description | Returns the sites ID number where the auction is scheduled. |
Status | Integer |
Description | Returns the auction’s status. Available values:
|
Updated_By | Long |
Description | Returns the Store user’s ID number that last updated the field. |
Examples
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project. At this point we need to our objects. We’ll need the standard service object, a CreateAuction request object and a CreateAuction response object. We can define and create those like this:
// Create request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.CreateAuction_Request request = new SWS.CreateAuction_Request();
SWS.CreateAuction_Response response;
Here’s my sample code of the Request object.
// new auction request
request.SiteID = 123456;
request.AuctionDateTime = DateTime.Now.AddDays(7);
request.AuctioneerName = "Joe Auctioneer";
request.AuctionNotes = "This will be the only auction this month.";
Finally we can call the method and pass across the login object and the request object to create our auction. It’s a good idea to do this in a Try Catch block.
// Call the method that will load the response object
try
{
response = service.CreateAuction(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.
For a full list of methods see SWS Methods.