/// <summary> /// Loads the given ProductVolumeDiscount object from the given database data reader. /// </summary> /// <param name="productVolumeDiscount">The ProductVolumeDiscount object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(ProductVolumeDiscount productVolumeDiscount, IDataReader dr) { //SET FIELDS FROM ROW DATA productVolumeDiscount.ProductId = dr.GetInt32(0); productVolumeDiscount.VolumeDiscountId = dr.GetInt32(1); productVolumeDiscount.IsDirty = false; }
public static ProductVolumeDiscountCollection LoadForProduct(Int32 productId) { ProductVolumeDiscountCollection ProductVolumeDiscounts = new ProductVolumeDiscountCollection(); //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT VolumeDiscountId"); selectQuery.Append(" FROM ac_ProductVolumeDiscounts"); selectQuery.Append(" WHERE ProductId = @productId"); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@productId", System.Data.DbType.Int32, productId); //EXECUTE THE COMMAND using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read()) { ProductVolumeDiscount productVolumeDiscount = new ProductVolumeDiscount(); productVolumeDiscount.ProductId = productId; productVolumeDiscount.VolumeDiscountId = dr.GetInt32(0); ProductVolumeDiscounts.Add(productVolumeDiscount); } dr.Close(); } return(ProductVolumeDiscounts); }
public static ProductVolumeDiscount Load(Int32 productId, Int32 volumeDiscountId) { ProductVolumeDiscount productVolumeDiscount = new ProductVolumeDiscount(); productVolumeDiscount.ProductId = productId; productVolumeDiscount.VolumeDiscountId = volumeDiscountId; productVolumeDiscount.IsDirty = false; return(productVolumeDiscount); }
public static bool Delete(Int32 productId, Int32 volumeDiscountId) { ProductVolumeDiscount productVolumeDiscount = new ProductVolumeDiscount(); if (productVolumeDiscount.Load(productId, volumeDiscountId)) { return(productVolumeDiscount.Delete()); } return(false); }
public static SaveResult Insert(ProductVolumeDiscount productVolumeDiscount) { return(productVolumeDiscount.Save()); }
public static bool Delete(ProductVolumeDiscount productVolumeDiscount) { return(productVolumeDiscount.Delete()); }
public static SaveResult Update(ProductVolumeDiscount productVolumeDiscount) { return(productVolumeDiscount.Save()); }