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