protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["ActiveId"])) { int.TryParse(base.Request.QueryString["ActiveId"], out activeId); } LoadParameters(); if (!Page.IsPostBack) { dropCategories.DataBind(); dropCategories.SelectedValue = categoryId; BindProducts(); PromotionInfo promotionInfoById = new PromotionInfo(); promotionInfoById = SubsitePromoteHelper.GetPromotionInfoById(activeId); lblPromtion.Text = promotionInfoById.Name; ProductIds = SubsitePromoteHelper.GetPromotionProducts(activeId); BindPromoteProducts(); } CheckBoxColumn.RegisterClientCheckEvents(Page, Page.Form.ClientID); }
public override PromotionActionStatus Create(PromotionInfo promote) { return provider.CreateFullDiscount(promote as FullDiscountInfo); }
public static PromotionInfo GetFrontOrNextPromoteInfo(PromotionInfo promote, string type) { return CommentProvider.Instance().GetFrontOrNextPromoteInfo(promote, type); }
public override PromotionActionStatus Create(PromotionInfo promote) { return this.provider.CreatePurchaseGift(promote as PurchaseGiftInfo); }
public override PromotionInfo GetFrontOrNextPromoteInfo(PromotionInfo promote, string type) { string query = string.Empty; if (type == "Next") { query = "SELECT TOP 1 * FROM Hishop_Promotions WHERE activityId<@activityId AND PromoteType=@PromoteType ORDER BY activityId DESC"; } else { query = "SELECT TOP 1 * FROM Hishop_Promotions WHERE activityId>@activityId AND PromoteType=@PromoteType ORDER BY activityId ASC"; } DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query); this.database.AddInParameter(sqlStringCommand, "activityId", DbType.Int32, promote.ActivityId); this.database.AddInParameter(sqlStringCommand, "PromoteType", DbType.Int32, Convert.ToInt32(promote.PromoteType)); PromotionInfo info = null; using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = DataMapper.PopulatePromote(reader); } reader.Close(); } return info; }
public abstract PromotionActionStatus Create(PromotionInfo promote);
public static PromotionActionStatus AddPromotion(PromotionInfo promotion) { Globals.EntityCoding(promotion, true); return PromotionFactory.Create(promotion.PromoteType).Create(promotion); }
public abstract PromotionInfo GetFrontOrNextPromoteInfo(PromotionInfo promote, string type);
public override WholesaleDiscountInfo GetWholesaleDiscountInfo(int activeId) { DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM distro_Promotions P INNER JOIN distro_WholesaleDiscounts F ON P.ActivityId=F.ActivityId WHERE P.ActivityId=@ActivityId AND P.DistributorUserId=@DistributorUserId"); database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, activeId); database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId); PromotionInfo info = new PromotionInfo(); WholesaleDiscountInfo info2 = new WholesaleDiscountInfo(); using (IDataReader reader = database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = DataMapper.PopulatePromote(reader); info2 = DataMapper.PopulateWholesaleDiscount(reader); } info2.Name = info.Name; info2.Description = info.Description; } return info2; }
public override PromotionActionStatus Create(PromotionInfo promote) { return this.provider.CreateWholesaleDiscount(promote as WholesaleDiscountInfo); }
public override PromotionInfo GetPromotionInfoById(int activeId) { DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM distro_Promotions WHERE ActivityId=@ActivityId AND DistributorUserId=@DistributorUserId"); database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, activeId); database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId); PromotionInfo entity = new PromotionInfo(); using (IDataReader reader = database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { entity = DataMapper.PopulatePromote(reader); } } Globals.EntityCoding(entity, false); return entity; }
PromotionActionStatus UpdatePromotion(PromotionInfo promotion, DbTransaction tran) { DbCommand storedProcCommand = database.GetStoredProcCommand("sub_Promotions_Update"); database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId); database.AddInParameter(storedProcCommand, "ActivityId", DbType.Int32, promotion.ActivityId); database.AddInParameter(storedProcCommand, "Name", DbType.String, promotion.Name); database.AddInParameter(storedProcCommand, "Description", DbType.String, promotion.Description); database.AddParameter(storedProcCommand, "ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, string.Empty, DataRowVersion.Default, null); database.ExecuteNonQuery(storedProcCommand, tran); return (PromotionActionStatus)Convert.ToInt32(database.GetParameterValue(storedProcCommand, "ReturnValue")); }
int CreatePromotion(PromotionInfo promotion, DbTransaction tran) { DbCommand storedProcCommand = database.GetStoredProcCommand("sub_Promotions_Add"); database.AddInParameter(storedProcCommand, "Name", DbType.String, promotion.Name); database.AddInParameter(storedProcCommand, "PromoteType", DbType.Int32, (int)promotion.PromoteType); database.AddInParameter(storedProcCommand, "Description", DbType.String, promotion.Description); database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId); return Convert.ToInt32(database.ExecuteScalar(storedProcCommand, tran)); }
public override PromotionActionStatus Create(PromotionInfo promote) { return provider.CreateFullFree(promote as FullFreeInfo); }
public override PurchaseGiftInfo GetPurchaseGiftInfo(int activeId) { DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM Hishop_Promotions P INNER JOIN Hishop_PurchaseGifts F ON P.ActivityId=F.ActivityId WHERE P.ActivityId=@ActivityId"); database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, activeId); PromotionInfo info = new PromotionInfo(); PurchaseGiftInfo info2 = new PurchaseGiftInfo(); using (IDataReader reader = database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = DataMapper.PopulatePromote(reader); info2 = DataMapper.PopulatePurchaseGift(reader); } info2.Name = info.Name; info2.Description = info.Description; } return info2; }