예제 #1
0
        public CustomerDemographicCollection FetchByQuery(Query qry)
        {
            CustomerDemographicCollection coll = new CustomerDemographicCollection();

            coll.Load(qry.ExecuteReader());
            return(coll);
        }
예제 #2
0
        public CustomerDemographicCollection FetchAll()
        {
            CustomerDemographicCollection coll = new CustomerDemographicCollection();
            Query qry = new Query(CustomerDemographic.Schema);

            coll.Load(qry.ExecuteReader());
            return(coll);
        }
예제 #3
0
        public static Chapter08.NorthwindDAL.CustomerDemographicCollection GetCustomerDemographicCollection(string varCustomerID)
        {
            SubSonic.QueryCommand cmd = new SubSonic.QueryCommand(
                "SELECT * FROM CustomerDemographics INNER JOIN CustomerCustomerDemo ON " +
                "CustomerDemographics.CustomerTypeID=CustomerCustomerDemo.CustomerTypeID WHERE CustomerCustomerDemo.CustomerID=@CustomerID", Customer.Schema.Provider.Name);

            cmd.AddParameter("@CustomerID", varCustomerID);

            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 CustomerID=@CustomerID", Customer.Schema.Provider.Name);

            cmdDel.AddParameter("@CustomerID", varCustomerID);
            //add this in
            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();
            }
        }
예제 #5
0
        public CustomerDemographicCollection FetchByID(object CustomerTypeID)
        {
            CustomerDemographicCollection coll = new CustomerDemographicCollection().Where("CustomerTypeID", CustomerTypeID).Load();

            return(coll);
        }