public static CouponGroupCollection LoadForCoupon(Int32 couponId) { CouponGroupCollection CouponGroups = new CouponGroupCollection(); //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT GroupId"); selectQuery.Append(" FROM ac_CouponGroups"); selectQuery.Append(" WHERE CouponId = @couponId"); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@couponId", System.Data.DbType.Int32, couponId); //EXECUTE THE COMMAND using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read()) { CouponGroup couponGroup = new CouponGroup(); couponGroup.CouponId = couponId; couponGroup.GroupId = dr.GetInt32(0); CouponGroups.Add(couponGroup); } dr.Close(); } return(CouponGroups); }
public static CouponGroup Load(Int32 couponId, Int32 groupId) { CouponGroup couponGroup = new CouponGroup(); couponGroup.CouponId = couponId; couponGroup.GroupId = groupId; couponGroup.IsDirty = false; return(couponGroup); }
public static bool Delete(Int32 couponId, Int32 groupId) { CouponGroup couponGroup = new CouponGroup(); if (couponGroup.Load(couponId, groupId)) { return(couponGroup.Delete()); } return(false); }
public static SaveResult Insert(CouponGroup couponGroup) { return(couponGroup.Save()); }
public static bool Delete(CouponGroup couponGroup) { return(couponGroup.Delete()); }
public static SaveResult Update(CouponGroup couponGroup) { return(couponGroup.Save()); }