Example #1
0
 /// <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;
 }
Example #2
0
        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);
        }
Example #3
0
        public static ShipZoneCountry Load(Int32 shipZoneId, String countryCode)
        {
            ShipZoneCountry shipZoneCountry = new ShipZoneCountry();

            shipZoneCountry.ShipZoneId  = shipZoneId;
            shipZoneCountry.CountryCode = countryCode;
            shipZoneCountry.IsDirty     = false;
            return(shipZoneCountry);
        }
Example #4
0
        public static bool Delete(Int32 shipZoneId, String countryCode)
        {
            ShipZoneCountry shipZoneCountry = new ShipZoneCountry();

            if (shipZoneCountry.Load(shipZoneId, countryCode))
            {
                return(shipZoneCountry.Delete());
            }
            return(false);
        }
Example #5
0
 public static SaveResult Insert(ShipZoneCountry shipZoneCountry)
 {
     return(shipZoneCountry.Save());
 }
Example #6
0
 public static bool Delete(ShipZoneCountry shipZoneCountry)
 {
     return(shipZoneCountry.Delete());
 }
Example #7
0
 public static SaveResult Update(ShipZoneCountry shipZoneCountry)
 {
     return(shipZoneCountry.Save());
 }