示例#1
0
        public SalesPersonCollection FetchByQuery(Query qry)
        {
            SalesPersonCollection coll = new SalesPersonCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
示例#2
0
        public SalesPersonCollection FetchAll()
        {
            SalesPersonCollection coll = new SalesPersonCollection();
            Query qry = new Query(SalesPerson.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
示例#3
0
        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);
        }
示例#4
0
        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();
            }
        }
示例#5
0
        public SalesPersonCollection FetchByID(object SalesPersonID)
        {
            SalesPersonCollection coll = new SalesPersonCollection().Where("SalesPersonID", SalesPersonID).Load();

            return(coll);
        }