예제 #1
0
        public static void SaveContactTypeMap(int varVendorID, int[] itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM VendorContact WHERE VendorID=@VendorID", Vendor.Schema.Provider.Name);

            cmdDel.AddParameter("@VendorID", varVendorID);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (int item in itemList)
            {
                VendorContact varVendorContact = new VendorContact();
                varVendorContact.SetColumnValue("VendorID", varVendorID);
                varVendorContact.SetColumnValue("ContactTypeID", item);
                varVendorContact.Save();
            }
        }
예제 #2
0
        public static void SaveVendorMap(int varContactID, VendorCollection items)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM VendorContact WHERE ContactID=@ContactID", Contact.Schema.Provider.Name);

            cmdDel.AddParameter("@ContactID", varContactID);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (Vendor item in items)
            {
                VendorContact varVendorContact = new VendorContact();
                varVendorContact.SetColumnValue("ContactID", varContactID);
                varVendorContact.SetColumnValue("VendorID", item.GetPrimaryKeyValue());
                varVendorContact.Save();
            }
        }
예제 #3
0
        public static void SaveContactMap(int varVendorID, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM VendorContact WHERE VendorID=@VendorID", Vendor.Schema.Provider.Name);

            cmdDel.AddParameter("@VendorID", varVendorID);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (System.Web.UI.WebControls.ListItem l in itemList)
            {
                if (l.Selected)
                {
                    VendorContact varVendorContact = new VendorContact();
                    varVendorContact.SetColumnValue("VendorID", varVendorID);
                    varVendorContact.SetColumnValue("ContactID", l.Value);
                    varVendorContact.Save();
                }
            }
        }