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); }
public static Northwind.CustomerDemographicCollection GetCustomerDemographicCollection(string varCustomerID) { SubSonic.QueryCommand cmd = new SubSonic.QueryCommand("SELECT * FROM [dbo].[CustomerDemographics] INNER JOIN [CustomerCustomerDemo] ON [CustomerDemographics].[CustomerTypeID] = [CustomerCustomerDemo].[CustomerTypeID] WHERE [CustomerCustomerDemo].[CustomerID] = @CustomerID", Customer.Schema.Provider.Name); cmd.AddParameter("@CustomerID", varCustomerID, DbType.String); IDataReader rdr = SubSonic.DataService.GetReader(cmd); CustomerDemographicCollection coll = new CustomerDemographicCollection(); coll.LoadAndCloseReader(rdr); return(coll); }
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] = @CustomerID", Customer.Schema.Provider.Name); cmdDel.AddParameter("@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); }