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

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

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

            return(coll);
        }