public CustomerDemographicCollection FetchByQuery(Query qry)
        {
            CustomerDemographicCollection coll = new CustomerDemographicCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
        public CustomerDemographicCollection FetchAll()
        {
            CustomerDemographicCollection coll = new CustomerDemographicCollection();
            Query qry = new Query(CustomerDemographic.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
示例#3
0
        public static NorthwindAccess.CustomerDemographicCollection GetCustomerDemographicCollection(string varCustomerID)
        {
            SubSonic.QueryCommand cmd = new SubSonic.QueryCommand("SELECT * FROM [CustomerDemographics] INNER JOIN [CustomerCustomerDemo] ON [CustomerDemographics].[CustomerTypeID] = [CustomerCustomerDemo].[CustomerTypeID] WHERE [CustomerCustomerDemo].[CustomerID] = PARM__CustomerID", Customer.Schema.Provider.Name);
            cmd.AddParameter("PARM__CustomerID", varCustomerID, DbType.String);
            IDataReader rdr = SubSonic.DataService.GetReader(cmd);
            CustomerDemographicCollection coll = new CustomerDemographicCollection();

            coll.LoadAndCloseReader(rdr);
            return(coll);
        }
示例#4
0
        public static void SaveCustomerDemographicMap(string varCustomerID, CustomerDemographicCollection items)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [CustomerCustomerDemo] WHERE [CustomerCustomerDemo].[CustomerID] = PARM__CustomerID", Customer.Schema.Provider.Name);

            cmdDel.AddParameter("PARM__CustomerID", varCustomerID, DbType.String);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (CustomerDemographic item in items)
            {
                CustomerCustomerDemo varCustomerCustomerDemo = new CustomerCustomerDemo();
                varCustomerCustomerDemo.SetColumnValue("CustomerID", varCustomerID);
                varCustomerCustomerDemo.SetColumnValue("CustomerTypeID", item.GetPrimaryKeyValue());
                varCustomerCustomerDemo.Save();
            }
        }
        public CustomerDemographicCollection FetchByID(object CustomerTypeID)
        {
            CustomerDemographicCollection coll = new CustomerDemographicCollection().Where("CustomerTypeID", CustomerTypeID).Load();

            return(coll);
        }