public static CategoryVolumeDiscountCollection LoadForCategory(Int32 categoryId) { CategoryVolumeDiscountCollection CategoryVolumeDiscounts = new CategoryVolumeDiscountCollection(); //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT VolumeDiscountId"); selectQuery.Append(" FROM ac_CategoryVolumeDiscounts"); selectQuery.Append(" WHERE CategoryId = @categoryId"); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@categoryId", System.Data.DbType.Int32, categoryId); //EXECUTE THE COMMAND using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read()) { CategoryVolumeDiscount categoryVolumeDiscount = new CategoryVolumeDiscount(); categoryVolumeDiscount.CategoryId = categoryId; categoryVolumeDiscount.VolumeDiscountId = dr.GetInt32(0); CategoryVolumeDiscounts.Add(categoryVolumeDiscount); } dr.Close(); } return(CategoryVolumeDiscounts); }
public static CategoryVolumeDiscount Load(Int32 categoryId, Int32 volumeDiscountId) { CategoryVolumeDiscount categoryVolumeDiscount = new CategoryVolumeDiscount(); categoryVolumeDiscount.CategoryId = categoryId; categoryVolumeDiscount.VolumeDiscountId = volumeDiscountId; categoryVolumeDiscount.IsDirty = false; return(categoryVolumeDiscount); }
public static bool Delete(Int32 categoryId, Int32 volumeDiscountId) { CategoryVolumeDiscount categoryVolumeDiscount = new CategoryVolumeDiscount(); if (categoryVolumeDiscount.Load(categoryId, volumeDiscountId)) { return(categoryVolumeDiscount.Delete()); } return(false); }
public static SaveResult Insert(CategoryVolumeDiscount categoryVolumeDiscount) { return(categoryVolumeDiscount.Save()); }
public static bool Delete(CategoryVolumeDiscount categoryVolumeDiscount) { return(categoryVolumeDiscount.Delete()); }