/// <summary> /// Loads the given ShipZoneCountry object from the given database data reader. /// </summary> /// <param name="shipZoneCountry">The ShipZoneCountry object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(ShipZoneCountry shipZoneCountry, IDataReader dr) { //SET FIELDS FROM ROW DATA shipZoneCountry.ShipZoneId = dr.GetInt32(0); shipZoneCountry.CountryCode = dr.GetString(1); shipZoneCountry.IsDirty = false; }
public static ShipZoneCountryCollection LoadForCountry(String countryCode) { ShipZoneCountryCollection ShipZoneCountries = new ShipZoneCountryCollection(); //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT ShipZoneId"); selectQuery.Append(" FROM ac_ShipZoneCountries"); selectQuery.Append(" WHERE CountryCode = @countryCode"); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@countryCode", System.Data.DbType.String, countryCode); //EXECUTE THE COMMAND using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read()) { ShipZoneCountry shipZoneCountry = new ShipZoneCountry(); shipZoneCountry.CountryCode = countryCode; shipZoneCountry.ShipZoneId = dr.GetInt32(0); ShipZoneCountries.Add(shipZoneCountry); } dr.Close(); } return(ShipZoneCountries); }
public static ShipZoneCountry Load(Int32 shipZoneId, String countryCode) { ShipZoneCountry shipZoneCountry = new ShipZoneCountry(); shipZoneCountry.ShipZoneId = shipZoneId; shipZoneCountry.CountryCode = countryCode; shipZoneCountry.IsDirty = false; return(shipZoneCountry); }
public static bool Delete(Int32 shipZoneId, String countryCode) { ShipZoneCountry shipZoneCountry = new ShipZoneCountry(); if (shipZoneCountry.Load(shipZoneId, countryCode)) { return(shipZoneCountry.Delete()); } return(false); }
public static SaveResult Insert(ShipZoneCountry shipZoneCountry) { return(shipZoneCountry.Save()); }
public static bool Delete(ShipZoneCountry shipZoneCountry) { return(shipZoneCountry.Delete()); }
public static SaveResult Update(ShipZoneCountry shipZoneCountry) { return(shipZoneCountry.Save()); }