public SalesTerritoryCollection FetchByQuery(Query qry) { SalesTerritoryCollection coll = new SalesTerritoryCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public SalesTerritoryCollection FetchAll() { SalesTerritoryCollection coll = new SalesTerritoryCollection(); Query qry = new Query(SalesTerritory.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public static AVManager.DAL.SalesTerritoryCollection GetSalesTerritoryCollection(int varSalesPersonID) { SubSonic.QueryCommand cmd = new SubSonic.QueryCommand( "SELECT * FROM SalesTerritory INNER JOIN SalesTerritoryHistory ON " + "SalesTerritory.TerritoryID=SalesTerritoryHistory.TerritoryID WHERE SalesTerritoryHistory.SalesPersonID=@SalesPersonID", SalesPerson.Schema.Provider.Name); cmd.AddParameter("@SalesPersonID", varSalesPersonID, DbType.Int32); IDataReader rdr = SubSonic.DataService.GetReader(cmd); SalesTerritoryCollection coll = new SalesTerritoryCollection(); coll.LoadAndCloseReader(rdr); return(coll); }
public static void SaveSalesTerritoryMap(int varSalesPersonID, SalesTerritoryCollection items) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM SalesTerritoryHistory WHERE SalesPersonID=@SalesPersonID", SalesPerson.Schema.Provider.Name); cmdDel.AddParameter("@SalesPersonID", varSalesPersonID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (SalesTerritory item in items) { SalesTerritoryHistory varSalesTerritoryHistory = new SalesTerritoryHistory(); varSalesTerritoryHistory.SetColumnValue("SalesPersonID", varSalesPersonID); varSalesTerritoryHistory.SetColumnValue("TerritoryID", item.GetPrimaryKeyValue()); varSalesTerritoryHistory.Save(); } }
public SalesTerritoryCollection FetchByID(object TerritoryID) { SalesTerritoryCollection coll = new SalesTerritoryCollection().Where("TerritoryID", TerritoryID).Load(); return(coll); }