Beispiel #1
0
        public static void SaveAddressMap(int varEmployeeID, int[] itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM EmployeeAddress WHERE EmployeeID=@EmployeeID", Employee.Schema.Provider.Name);

            cmdDel.AddParameter("@EmployeeID", varEmployeeID);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (int item in itemList)
            {
                EmployeeAddress varEmployeeAddress = new EmployeeAddress();
                varEmployeeAddress.SetColumnValue("EmployeeID", varEmployeeID);
                varEmployeeAddress.SetColumnValue("AddressID", item);
                varEmployeeAddress.Save();
            }
        }
Beispiel #2
0
        public static void SaveEmployeeMap(int varAddressID, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM EmployeeAddress WHERE AddressID=@AddressID", Address.Schema.Provider.Name);

            cmdDel.AddParameter("@AddressID", varAddressID);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (System.Web.UI.WebControls.ListItem l in itemList)
            {
                if (l.Selected)
                {
                    EmployeeAddress varEmployeeAddress = new EmployeeAddress();
                    varEmployeeAddress.SetColumnValue("AddressID", varAddressID);
                    varEmployeeAddress.SetColumnValue("EmployeeID", l.Value);
                    varEmployeeAddress.Save();
                }
            }
        }