public CountryRegionCollection FetchAll() { CountryRegionCollection coll = new CountryRegionCollection(); Query qry = new Query(CountryRegion.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public static AVManager.DAL.CountryRegionCollection GetCountryRegionCollection(string varCurrencyCode) { SubSonic.QueryCommand cmd = new SubSonic.QueryCommand( "SELECT * FROM CountryRegion INNER JOIN CountryRegionCurrency ON " + "CountryRegion.CountryRegionCode=CountryRegionCurrency.CountryRegionCode WHERE CountryRegionCurrency.CurrencyCode=@CurrencyCode", Currency.Schema.Provider.Name); cmd.AddParameter("@CurrencyCode", varCurrencyCode, DbType.String); IDataReader rdr = SubSonic.DataService.GetReader(cmd); CountryRegionCollection coll = new CountryRegionCollection(); coll.LoadAndCloseReader(rdr); return(coll); }
public static void SaveCountryRegionMap(string varCurrencyCode, CountryRegionCollection items) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM CountryRegionCurrency WHERE CurrencyCode=@CurrencyCode", Currency.Schema.Provider.Name); cmdDel.AddParameter("@CurrencyCode", varCurrencyCode); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (CountryRegion item in items) { CountryRegionCurrency varCountryRegionCurrency = new CountryRegionCurrency(); varCountryRegionCurrency.SetColumnValue("CurrencyCode", varCurrencyCode); varCountryRegionCurrency.SetColumnValue("CountryRegionCode", item.GetPrimaryKeyValue()); varCountryRegionCurrency.Save(); } }
public CountryRegionCollection FetchByID(object CountryRegionCode) { CountryRegionCollection coll = new CountryRegionCollection().Where("CountryRegionCode", CountryRegionCode).Load(); return(coll); }