Exemplo n.º 1
0
        public static void SaveTerritoryMap(int varEmployeeID, TerritoryCollection items)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [EmployeeTerritories] WHERE [EmployeeTerritories].[EmployeeID] = PARM__EmployeeID", Employee.Schema.Provider.Name);

            cmdDel.AddParameter("PARM__EmployeeID", varEmployeeID, DbType.Int32);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (Territory item in items)
            {
                EmployeeTerritory varEmployeeTerritory = new EmployeeTerritory();
                varEmployeeTerritory.SetColumnValue("EmployeeID", varEmployeeID);
                varEmployeeTerritory.SetColumnValue("TerritoryID", item.GetPrimaryKeyValue());
                varEmployeeTerritory.Save();
            }
        }
Exemplo n.º 2
0
        public TerritoryCollection FetchByID(object TerritoryID)
        {
            TerritoryCollection coll = new TerritoryCollection().Where("TerritoryID", TerritoryID).Load();

            return(coll);
        }