// File Name: Orders_Br_Base.cs

// Description: This file contains the generated code relating to 'Orders'.

// Last Generated: 6/8/2005 by Blue Ink - http://www.blueink.biz

// Attention: DO NOT MODIFY THIS FILE.  It is liable to be regenerated and your changes may be lost.

 

using System;

using System.Data;

using System.Data.SqlClient;

 

using AutomatedArchitecture.Northwind.Dao;

using AutomatedArchitecture.Northwind.Common.Entities;

using AutomatedArchitecture.Northwind.Common.Exceptions;

using AutomatedArchitecture.Northwind.Common.Classes;

using AutomatedArchitecture.Northwind.Br.Helpers;

 

namespace AutomatedArchitecture.Northwind.Br.Base {

      public class Orders_Br_Base : MarshalByRefObject, IDisposable {

            // these determine what fields to update from the update input dataset

            protected bool mblnUpdate_CustomerID = true;

            protected bool mblnUpdate_EmployeeID = true;

            protected bool mblnUpdate_Freight = true;

            protected bool mblnUpdate_OrderDate = true;

            protected bool mblnUpdate_RequiredDate = true;

            protected bool mblnUpdate_ShipAddress = true;

            protected bool mblnUpdate_ShipCity = true;

            protected bool mblnUpdate_ShipCountry = true;

            protected bool mblnUpdate_ShipName = true;

            protected bool mblnUpdate_ShippedDate = true;

            protected bool mblnUpdate_ShipPostalCode = true;

            protected bool mblnUpdate_ShipRegion = true;

            protected bool mblnUpdate_ShipVia = true;

 

            // these determine what fields to add from the insert input dataset

            protected bool mblnInsert_CustomerID = true;

            protected bool mblnInsert_EmployeeID = true;

            protected bool mblnInsert_Freight = true;

            protected bool mblnInsert_OrderDate = true;

            protected bool mblnInsert_RequiredDate = true;

            protected bool mblnInsert_ShipAddress = true;

            protected bool mblnInsert_ShipCity = true;

            protected bool mblnInsert_ShipCountry = true;

            protected bool mblnInsert_ShipName = true;

            protected bool mblnInsert_ShippedDate = true;

            protected bool mblnInsert_ShipPostalCode = true;

            protected bool mblnInsert_ShipRegion = true;

            protected bool mblnInsert_ShipVia = true;

 

            public Orders_LookupsDataSet GetLookups() {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return GetLookups(cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            public Orders_LookupsDataSet GetLookups(IDbConnection cn) {

                  Orders_LookupsDataSet tdsLookups = new Orders_LookupsDataSet();

                  new Shippers_Dao().GetAll(tdsLookups.Shippers, cn);

                  return tdsLookups;

            }

 

            public Orders_ViewMultipleDataSet Search(Orders_SearchInputDataSet.OrdersRow rowSearchInput) {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return Search(rowSearchInput, cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            public Orders_ViewMultipleDataSet Search(

                  Orders_SearchInputDataSet.OrdersRow rowSearchInput,

                  IDbConnection cn

                  ) {

 

                  Orders_ViewMultipleDataSet tdsSearchResults = new Orders_ViewMultipleDataSet();

 

                  rowSearchInput.CustomerID = BrHelper.AddWildcards(rowSearchInput, "CustomerID");

                  new Orders_Dao().Search(

                        tdsSearchResults.Orders,

                        rowSearchInput,

                        cn

 

                        );

                  return tdsSearchResults;

            }

 

            public virtual OperationResult UpdateSelectedFields(Orders_UpdateInputDataSet.OrdersRow rowUpdate) {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return UpdateSelectedFields(rowUpdate, cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            // updates fields as determined by the class level variables

            public virtual OperationResult UpdateSelectedFields(Orders_UpdateInputDataSet.OrdersRow rowUpdate, IDbConnection cn) {

                  // get the existing row

                  int intOrderID = rowUpdate.SelectByOrderID;

                  Orders_ViewSimpleDataSet.OrdersRow rowExistingRecord = this.GetByPk(intOrderID, cn);

                  // for each field that is not to be updated, reset the value in the update input row to the existing value

                  if (!this.mblnUpdate_CustomerID)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "CustomerID", "CustomerID");;

                  if (!this.mblnUpdate_EmployeeID)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "EmployeeID", "EmployeeID");;

                  if (!this.mblnUpdate_Freight)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "Freight", "Freight");;

                  if (!this.mblnUpdate_OrderDate)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "OrderDate", "OrderDate");;

                  if (!this.mblnUpdate_RequiredDate)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "RequiredDate", "RequiredDate");;

                  if (!this.mblnUpdate_ShipAddress)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShipAddress", "ShipAddress");;

                  if (!this.mblnUpdate_ShipCity)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShipCity", "ShipCity");;

                  if (!this.mblnUpdate_ShipCountry)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShipCountry", "ShipCountry");;

                  if (!this.mblnUpdate_ShipName)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShipName", "ShipName");;

                  if (!this.mblnUpdate_ShippedDate)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShippedDate", "ShippedDate");;

                  if (!this.mblnUpdate_ShipPostalCode)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShipPostalCode", "ShipPostalCode");;

                  if (!this.mblnUpdate_ShipRegion)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShipRegion", "ShipRegion");;

                  if (!this.mblnUpdate_ShipVia)

                        BrHelper.CopyDataRowValue(rowExistingRecord, rowUpdate, "ShipVia", "ShipVia");;

                  return this.UpdateAllFields(rowUpdate, null, cn);

            }

            public virtual OperationResult UpdateAllFields(Orders_ViewSimpleDataSet.OrdersRow rowViewSimple, IDbConnection cn) {

                  return UpdateAllFields(rowViewSimple, null, cn);            }

 

            public virtual OperationResult UpdateAllFields(Orders_UpdateInputDataSet.OrdersRow rowUpdate, IDbConnection cn) {

                  return UpdateAllFields(rowUpdate, null, cn);

            }

 

            /// <summary>This is a convenience function that converts a ViewSimple dataset to an UpdateInput

            ///   dataset before calling Update.  It assumes no changes will be made to primary keys.</summary>

            /// <param name="rowViewSimple">The ViewSimple dataset that will be converted to an UpdateInput dataset.</param>

            /// <returns>An OperationResult that provides success or failure of the operation and an optional error message.</returns>

            public virtual OperationResult UpdateAllFields(Orders_ViewSimpleDataSet.OrdersRow rowViewSimple, IDbTransaction tx, IDbConnection cn) {

                  Orders_UpdateInputDataSet tdsUpdateInput = new Orders_UpdateInputDataSet();

                  Orders_UpdateInputDataSet.OrdersRow rowUpdateInput = tdsUpdateInput.Orders.NewOrdersRow();

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "OrderID", "SelectByOrderID");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "CustomerID", "CustomerID");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "EmployeeID", "EmployeeID");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "Freight", "Freight");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "OrderDate", "OrderDate");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "RequiredDate", "RequiredDate");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShipAddress", "ShipAddress");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShipCity", "ShipCity");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShipCountry", "ShipCountry");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShipName", "ShipName");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShippedDate", "ShippedDate");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShipPostalCode", "ShipPostalCode");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShipRegion", "ShipRegion");

                  BrHelper.CopyDataRowValue(rowViewSimple, rowUpdateInput, "ShipVia", "ShipVia");

                  tdsUpdateInput.Orders.AddOrdersRow(rowUpdateInput);

                  return this.UpdateAllFields(rowUpdateInput, tx, cn);

            }

 

            /// <summary>Updates a single Order in the database given an UpdateInput dataset.</summary>

            /// <param name="rowUpdate">The UpdateInput dataset will provide which Order to update as well as all new values.</param>

            /// <returns>An OperationResult that provides success or failure of the operation and an optional error message.</returns>

            public virtual OperationResult UpdateAllFields(Orders_UpdateInputDataSet.OrdersRow rowUpdate, IDbTransaction tx, IDbConnection cn) {

                  try {

                        new Orders_Dao().Update(rowUpdate, tx, cn);

                        return new OperationResult(true);

                  } catch (SqlException ex) {

                        string strErrorMessage = ex.Message;

                        throw ex;

                  }

            }

 

            public virtual OperationResult Insert(Orders_InsertInputDataSet.OrdersRow rowInsert) {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return Insert(rowInsert, null, cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            public virtual OperationResult Insert(Orders_InsertInputDataSet.OrdersRow rowInsert, IDbConnection cn) {

                  return Insert(rowInsert, null, cn);

            }

 

            public virtual OperationResult Insert(Orders_InsertInputDataSet tdsInsert, IDbTransaction tx, IDbConnection cn) {

                  foreach (Orders_InsertInputDataSet.OrdersRow rowInsert in tdsInsert.Orders) {

                        OperationResult objResult = Insert(rowInsert, tx, cn);

                        if (!objResult.Success)

                              return objResult;

                  }

                  return new OperationResult(true);

            }

 

            public virtual OperationResult Insert(Orders_InsertInputDataSet.OrdersRow rowInsert, IDbTransaction tx, IDbConnection cn) {

                  try {

                        int intNewAutoIncrementValue = new Orders_Dao().Insert(rowInsert, tx, cn);

                        return new OperationResult(true, intNewAutoIncrementValue);

                  } catch (SqlException ex) {

                        string strErrorMessage = ex.Message;

                        // if the inserted row violates the 'PK_Orders' constraint then throw a friendly exception

                        if (strErrorMessage.IndexOf("PK_Orders") != -1) {

                              string strNewError = String.Format("A Order already exists where Order Id = '{0}'.", rowInsert.OrderID);

                              return new OperationResult(false, strNewError);

                        }

                        throw ex;

                  }

            }

 

            public virtual OperationResult DeleteByPk(int intOrderID, IDbConnection cn) {

                  return DeleteByPk(intOrderID, null, cn);

            }

 

            public virtual OperationResult DeleteByPk(int intOrderID, IDbTransaction tx, IDbConnection cn) {

                  try {

                        new Orders_Dao().DeleteByPk(intOrderID, tx, cn);

                        return new OperationResult(true);

                  } catch (SqlException ex) {

                        return new OperationResult(false, ex.Message);

                  }

            }

 

            public virtual Orders_ViewDetailDataSet GetViewDetail(int intOrderID) {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return GetViewDetail(intOrderID, cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            public virtual Orders_ViewDetailDataSet GetViewDetail(int intOrderID, IDbConnection cn) {

                  Orders_ViewDetailDataSet tdsViewDetail = new Orders_ViewDetailDataSet();

                  tdsViewDetail.EnforceConstraints = false;

 

                  // get the Order

                  new Orders_Dao().GetByPk(tdsViewDetail.Orders, intOrderID, cn);

 

                  // if a order was found then try to get related tables

                  if (tdsViewDetail.Orders.Count == 1) {

                        Orders_ViewDetailDataSet.OrdersRow rowOrders = tdsViewDetail.Orders[0];

 

                        // get data access objects for related tables

                        // 1-N

                        Customers_Dao objCustomersDao = new Customers_Dao();

                        Employees_Dao objEmployeesDao = new Employees_Dao();

                        Shippers_Dao objShippersDao = new Shippers_Dao();

                        // N-1

                        OrderDetails_Dao objOrderDetailsDao = new OrderDetails_Dao();

 

                        // get 1-N relationships

                        if (!rowOrders.IsNull("CustomerID"))

                              objCustomersDao.GetByPkJoined(tdsViewDetail.Customers, rowOrders.CustomerID, cn);

                        if (!rowOrders.IsNull("EmployeeID"))

                              objEmployeesDao.GetByPkJoined(tdsViewDetail.Employees, rowOrders.EmployeeID, cn);

                        if (!rowOrders.IsNull("ShipVia"))

                              objShippersDao.GetByPkJoined(tdsViewDetail.Shippers, rowOrders.ShipVia, cn);

 

                        // get N-1 relationships

                        objOrderDetailsDao.GetByOrderID(tdsViewDetail.OrderDetails, rowOrders.OrderID, cn);

                  }

 

                  // don't enforce constraints since self-referential tables and multiple relationships between tables

                  //   will mess up referential integrity in the typed dataset

 

                  return tdsViewDetail;

            }

 

            public virtual Orders_ViewFksDataSet GetViewFks(int intOrderID) {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return GetViewFks(intOrderID, cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            public virtual Orders_ViewFksDataSet GetViewFks(int intOrderID, IDbConnection cn) {

                  Orders_ViewFksDataSet tdsViewFks = new Orders_ViewFksDataSet();

                  tdsViewFks.EnforceConstraints = false;

                  new Orders_Dao().GetByPk(tdsViewFks.Orders, intOrderID, cn);

 

                  // if a order was found then try to get related tables

                  if (tdsViewFks.Orders.Count == 1) {

                        Orders_ViewFksDataSet.OrdersRow rowOrders = tdsViewFks.Orders[0];

 

                        Customers_Dao objCustomersDao = new Customers_Dao();

                        Employees_Dao objEmployeesDao = new Employees_Dao();

                        Shippers_Dao objShippersDao = new Shippers_Dao();

 

                        // get 1-N relationships

                        if (!rowOrders.IsNull("CustomerID"))

                              objCustomersDao.GetByPkJoined(tdsViewFks.Customers, rowOrders.CustomerID, cn);

                        if (!rowOrders.IsNull("EmployeeID"))

                              objEmployeesDao.GetByPkJoined(tdsViewFks.Employees, rowOrders.EmployeeID, cn);

                        objShippersDao.GetAll(tdsViewFks.Shippers, cn);

                  }

                  // don't enforce constraints since self-referential tables and multiple relationships between tables

                  //   will mess up referential integrity in the typed dataset

 

                  return tdsViewFks;

            }

 

            public virtual Orders_ViewFksDataSet GetViewFks(Orders_UpdateInputDataSet.OrdersRow rowUpdateInput) {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return GetViewFks(rowUpdateInput, cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            /// <summary>

            /// This version of GetViewFks is for an edit page that is using an update input dataset to maintain state between pages

            ///     This function will use the data from the update input dataset as a starting point.

            /// </summary>

            /// <param name="rowUpdateInput"></param>

            /// <returns></returns>

            public virtual Orders_ViewFksDataSet GetViewFks(Orders_UpdateInputDataSet.OrdersRow rowUpdateInput, IDbConnection cn) {

                  Orders_ViewFksDataSet tdsViewFks = new Orders_ViewFksDataSet();

                  tdsViewFks.EnforceConstraints = false;

                  new Orders_Dao().GetByPk(tdsViewFks.Orders, rowUpdateInput.SelectByOrderID, cn);

 

                  // if a order was found then try to get related tables

                  if (tdsViewFks.Orders.Count == 1) {

                        Orders_ViewFksDataSet.OrdersRow rowOrders = tdsViewFks.Orders[0];

 

                        // update the db data with rowUpdateInput's data

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "CustomerID", "CustomerID");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "EmployeeID", "EmployeeID");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "Freight", "Freight");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "OrderDate", "OrderDate");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "RequiredDate", "RequiredDate");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShipAddress", "ShipAddress");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShipCity", "ShipCity");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShipCountry", "ShipCountry");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShipName", "ShipName");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShippedDate", "ShippedDate");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShipPostalCode", "ShipPostalCode");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShipRegion", "ShipRegion");

                        BrHelper.CopyDataRowValue(rowUpdateInput, rowOrders, "ShipVia", "ShipVia");

 

                        Customers_Dao objCustomersDao = new Customers_Dao();

                        Employees_Dao objEmployeesDao = new Employees_Dao();

                        Shippers_Dao objShippersDao = new Shippers_Dao();

 

                        // get 1-N relationships

                        if (!rowOrders.IsNull("CustomerID"))

                              objCustomersDao.GetByPkJoined(tdsViewFks.Customers, rowOrders.CustomerID, cn);

                        if (!rowOrders.IsNull("EmployeeID"))

                              objEmployeesDao.GetByPkJoined(tdsViewFks.Employees, rowOrders.EmployeeID, cn);

                        objShippersDao.GetAll(tdsViewFks.Shippers, cn);

                  }

                  // don't enforce constraints since self-referential tables and multiple relationships between tables

                  //   will mess up referential integrity in the typed dataset

 

                  return tdsViewFks;

            }

 

            public virtual Orders_ViewFksDataSet GetViewFks(Orders_InsertInputDataSet.OrdersRow rowInsertInput) {

                  IDbConnection cn = Dao.Helpers.DaoHelper.GetGenericConnection();

                  cn.Open();

                  try {

                        return GetViewFks(rowInsertInput, cn);

                  } finally {

                        cn.Close();

                        cn.Dispose();

                  }

            }

 

            /// <summary>

            /// This version of GetViewFks is for an add page that is using an insert input dataset to maintain state between pages

            ///     This function will use the data from the insert input dataset as a starting point.

            /// </summary>

            /// <param name="rowInsertInput"></param>

            /// <returns></returns>

            public virtual Orders_ViewFksDataSet GetViewFks(Orders_InsertInputDataSet.OrdersRow rowInsertInput, IDbConnection cn) {

                  // create a new view fk dataset and add a new row to it

                  Orders_ViewFksDataSet tdsViewFks = new Orders_ViewFksDataSet();

                  // don't enforce constraints since self-referential tables and multiple relationships between tables

                  //   will mess up referential integrity in the typed dataset

                  tdsViewFks.EnforceConstraints = false;

                  Orders_ViewFksDataSet.OrdersRow rowOrders = tdsViewFks.Orders.NewOrdersRow();

                  tdsViewFks.Orders.AddOrdersRow(rowOrders);

 

                  // update the new row with data from rowUpdateInput

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "CustomerID", "CustomerID");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "EmployeeID", "EmployeeID");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "Freight", "Freight");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "OrderDate", "OrderDate");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "RequiredDate", "RequiredDate");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShipAddress", "ShipAddress");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShipCity", "ShipCity");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShipCountry", "ShipCountry");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShipName", "ShipName");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShippedDate", "ShippedDate");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShipPostalCode", "ShipPostalCode");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShipRegion", "ShipRegion");

                  BrHelper.CopyDataRowValue(rowInsertInput, rowOrders, "ShipVia", "ShipVia");

 

                  // get data access objects in order to retrieve data for 1-n lookups

                  Customers_Dao objCustomersDao = new Customers_Dao();

                  Employees_Dao objEmployeesDao = new Employees_Dao();

                  Shippers_Dao objShippersDao = new Shippers_Dao();

 

                  // get data for each 1-N relationship (either get all or get by pk depending on if it's a lookup)

                  if (!rowOrders.IsNull("CustomerID"))

                        objCustomersDao.GetByPkJoined(tdsViewFks.Customers, rowOrders.CustomerID, cn);

                  if (!rowOrders.IsNull("EmployeeID"))

                        objEmployeesDao.GetByPkJoined(tdsViewFks.Employees, rowOrders.EmployeeID, cn);

                  objShippersDao.GetAll(tdsViewFks.Shippers, cn);

 

                  return tdsViewFks;

            }

 

            public virtual Orders_ViewSimpleDataSet.OrdersRow GetByPk(int intOrderID, IDbConnection cn) {

                  Orders_ViewSimpleDataSet tdsSimpleDataset = new Orders_ViewSimpleDataSet();

                  new Orders_Dao().GetByPk(tdsSimpleDataset.Orders, intOrderID, cn);

                  if (tdsSimpleDataset.Orders.Count == 1)

                        return tdsSimpleDataset.Orders[0];

                  else

                        return null;

            }

 

            public virtual Orders_ViewSimpleDataSet GetByCustomerID(string strCustomerID, IDbConnection cn) {

                  Orders_ViewSimpleDataSet tdsSimpleDataset = new Orders_ViewSimpleDataSet();

                  new Orders_Dao().GetByCustomerID(tdsSimpleDataset.Orders, strCustomerID, cn);

                  return tdsSimpleDataset;

            }

 

            public virtual Orders_ViewSimpleDataSet GetByEmployeeID(int intEmployeeID, IDbConnection cn) {

                  Orders_ViewSimpleDataSet tdsSimpleDataset = new Orders_ViewSimpleDataSet();

                  new Orders_Dao().GetByEmployeeID(tdsSimpleDataset.Orders, intEmployeeID, cn);

                  return tdsSimpleDataset;

            }

 

            public virtual Orders_ViewSimpleDataSet GetByShipVia(int intShipVia, IDbConnection cn) {

                  Orders_ViewSimpleDataSet tdsSimpleDataset = new Orders_ViewSimpleDataSet();

                  new Orders_Dao().GetByShipVia(tdsSimpleDataset.Orders, intShipVia, cn);

                  return tdsSimpleDataset;

            }

 

            public virtual Orders_ViewSimpleDataSet GetByOrderDate(System.DateTime objOrderDate, IDbConnection cn) {

                  Orders_ViewSimpleDataSet tdsSimpleDataset = new Orders_ViewSimpleDataSet();

                  new Orders_Dao().GetByOrderDate(tdsSimpleDataset.Orders, objOrderDate, cn);

                  return tdsSimpleDataset;

            }

 

            public virtual Orders_ViewSimpleDataSet GetByShippedDate(System.DateTime objShippedDate, IDbConnection cn) {

                  Orders_ViewSimpleDataSet tdsSimpleDataset = new Orders_ViewSimpleDataSet();

                  new Orders_Dao().GetByShippedDate(tdsSimpleDataset.Orders, objShippedDate, cn);

                  return tdsSimpleDataset;

            }

 

            public virtual Orders_ViewSimpleDataSet GetByShipPostalCode(string strShipPostalCode, IDbConnection cn) {

                  Orders_ViewSimpleDataSet tdsSimpleDataset = new Orders_ViewSimpleDataSet();

                  new Orders_Dao().GetByShipPostalCode(tdsSimpleDataset.Orders, strShipPostalCode, cn);

                  return tdsSimpleDataset;

            }

 

            public void Dispose() {}

      }

}