Beispiel #1
0
 /// <summary>
 /// Loads the given TaxRuleShipZone object from the given database data reader.
 /// </summary>
 /// <param name="taxRuleShipZone">The TaxRuleShipZone object to load.</param>
 /// <param name="dr">The database data reader to read data from.</param>
 public static void LoadDataReader(TaxRuleShipZone taxRuleShipZone, IDataReader dr)
 {
     //SET FIELDS FROM ROW DATA
     taxRuleShipZone.TaxRuleId  = dr.GetInt32(0);
     taxRuleShipZone.ShipZoneId = dr.GetInt32(1);
     taxRuleShipZone.IsDirty    = false;
 }
        public static TaxRuleShipZoneCollection LoadForShipZone(Int32 shipZoneId)
        {
            TaxRuleShipZoneCollection TaxRuleShipZones = new TaxRuleShipZoneCollection();
            //CREATE THE DYNAMIC SQL TO LOAD OBJECT
            StringBuilder selectQuery = new StringBuilder();

            selectQuery.Append("SELECT TaxRuleId");
            selectQuery.Append(" FROM ac_TaxRuleShipZones");
            selectQuery.Append(" WHERE ShipZoneId = @shipZoneId");
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());

            database.AddInParameter(selectCommand, "@shipZoneId", System.Data.DbType.Int32, shipZoneId);
            //EXECUTE THE COMMAND
            using (IDataReader dr = database.ExecuteReader(selectCommand))
            {
                while (dr.Read())
                {
                    TaxRuleShipZone taxRuleShipZone = new TaxRuleShipZone();
                    taxRuleShipZone.ShipZoneId = shipZoneId;
                    taxRuleShipZone.TaxRuleId  = dr.GetInt32(0);
                    TaxRuleShipZones.Add(taxRuleShipZone);
                }
                dr.Close();
            }
            return(TaxRuleShipZones);
        }
        public static TaxRuleShipZone Load(Int32 taxRuleId, Int32 shipZoneId)
        {
            TaxRuleShipZone taxRuleShipZone = new TaxRuleShipZone();

            taxRuleShipZone.TaxRuleId  = taxRuleId;
            taxRuleShipZone.ShipZoneId = shipZoneId;
            taxRuleShipZone.IsDirty    = false;
            return(taxRuleShipZone);
        }
        public static bool Delete(Int32 taxRuleId, Int32 shipZoneId)
        {
            TaxRuleShipZone taxRuleShipZone = new TaxRuleShipZone();

            if (taxRuleShipZone.Load(taxRuleId, shipZoneId))
            {
                return(taxRuleShipZone.Delete());
            }
            return(false);
        }
 public static SaveResult Insert(TaxRuleShipZone taxRuleShipZone)
 {
     return(taxRuleShipZone.Save());
 }
 public static bool Delete(TaxRuleShipZone taxRuleShipZone)
 {
     return(taxRuleShipZone.Delete());
 }
 public static SaveResult Update(TaxRuleShipZone taxRuleShipZone)
 {
     return(taxRuleShipZone.Save());
 }