Beispiel #1
0
        public static void SaveUserMap(int varId, int[] itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [ProjectAssignments] WHERE [ProjectAssignments].[ProjectID] = @ProjectID", Project.Schema.Provider.Name);

            cmdDel.AddParameter("@ProjectID", varId, DbType.Int32);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (int item in itemList)
            {
                ProjectAssignment varProjectAssignment = new ProjectAssignment();
                varProjectAssignment.SetColumnValue("ProjectID", varId);
                varProjectAssignment.SetColumnValue("UserID", item);
                varProjectAssignment.Save();
            }
        }
Beispiel #2
0
        public static void SaveProjectMap(int varId, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [ProjectAssignments] WHERE [ProjectAssignments].[UserID] = @UserID", User.Schema.Provider.Name);

            cmdDel.AddParameter("@UserID", varId, DbType.Int32);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (System.Web.UI.WebControls.ListItem l in itemList)
            {
                if (l.Selected)
                {
                    ProjectAssignment varProjectAssignment = new ProjectAssignment();
                    varProjectAssignment.SetColumnValue("UserID", varId);
                    varProjectAssignment.SetColumnValue("ProjectID", l.Value);
                    varProjectAssignment.Save();
                }
            }
        }