///
/// Deletes a record from the table.
///
/// The table to delete from.
/// Nothing, or a filter that restricts which records get deleted.
/// Nothing, or the specific sort order in which the records get deleted.
/// The zero-based index of the first record to delete.
/// The exact number of records to delete.
/// The total number of matching records (ignoring page boundaries).
public override void DeleteRecords(
BaseClasses.Data.TableDefinition table,
BaseClasses.Data.BaseFilter filter,
BaseClasses.Data.OrderBy sortOrder,
int startIndex,
int count,
ref int totalCount)
{
// If we are deleting using a primary key, then
// just call the web service that deletes one record.
if ((filter != null) && (filter is BaseClasses.Data.PrimaryKeyValueFilter))
{
int ${Primary Key} = Get${Primary Key}FromFilter(filter);
// Instantiate the object that will communicate with a web service.
// Replace "MyWebServiceForTableAccess" with the external web service name
localhost.MyWebServiceForTableAccess webService;
webService = new localhost.MyWebServiceForTableAccess();
webService.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Call the web service's "DeleteRecord" function.
webService.Delete${${Table Name}RecordClassName}(${Primary Key});
totalCount = 1;
return;
}
// Else use the normal path to delete records, e.g. using stored procedures, or inline SQL.
// You can customize this to call your web service instead.
base.DeleteRecords(table, filter, sortOrder, startIndex, count, ref totalCount);
}
|