Example #1
0
        public EmployeeCollection FetchByQuery(Query qry)
        {
            EmployeeCollection coll = new EmployeeCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Example #2
0
        public EmployeeCollection FetchAll()
        {
            EmployeeCollection coll = new EmployeeCollection();
            Query qry = new Query(Employee.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Example #3
0
        public static NorthwindAccess.EmployeeCollection GetEmployeeCollection(string varTerritoryID)
        {
            SubSonic.QueryCommand cmd = new SubSonic.QueryCommand("SELECT * FROM [Employees] INNER JOIN [EmployeeTerritories] ON [Employees].[EmployeeID] = [EmployeeTerritories].[EmployeeID] WHERE [EmployeeTerritories].[TerritoryID] = PARM__TerritoryID", Territory.Schema.Provider.Name);
            cmd.AddParameter("PARM__TerritoryID", varTerritoryID, DbType.String);
            IDataReader        rdr  = SubSonic.DataService.GetReader(cmd);
            EmployeeCollection coll = new EmployeeCollection();

            coll.LoadAndCloseReader(rdr);
            return(coll);
        }
Example #4
0
        public static void SaveEmployeeMap(string varTerritoryID, EmployeeCollection items)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [EmployeeTerritories] WHERE [EmployeeTerritories].[TerritoryID] = PARM__TerritoryID", Territory.Schema.Provider.Name);

            cmdDel.AddParameter("PARM__TerritoryID", varTerritoryID, DbType.String);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (Employee item in items)
            {
                EmployeeTerritory varEmployeeTerritory = new EmployeeTerritory();
                varEmployeeTerritory.SetColumnValue("TerritoryID", varTerritoryID);
                varEmployeeTerritory.SetColumnValue("EmployeeID", item.GetPrimaryKeyValue());
                varEmployeeTerritory.Save();
            }
        }
Example #5
0
        public EmployeeCollection FetchByID(object EmployeeID)
        {
            EmployeeCollection coll = new EmployeeCollection().Where("EmployeeID", EmployeeID).Load();

            return(coll);
        }