Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 public override PromotionActionStatus Create(PromotionInfo promote)
 {
     return provider.CreateFullDiscount(promote as FullDiscountInfo);
 }
Esempio n. 3
0
 public static PromotionInfo GetFrontOrNextPromoteInfo(PromotionInfo promote, string type)
 {
     return CommentProvider.Instance().GetFrontOrNextPromoteInfo(promote, type);
 }
Esempio n. 4
0
 public override PromotionActionStatus Create(PromotionInfo promote)
 {
     return this.provider.CreatePurchaseGift(promote as PurchaseGiftInfo);
 }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
 public abstract PromotionActionStatus Create(PromotionInfo promote);
Esempio n. 7
0
 public static PromotionActionStatus AddPromotion(PromotionInfo promotion)
 {
     Globals.EntityCoding(promotion, true);
     return PromotionFactory.Create(promotion.PromoteType).Create(promotion);
 }
Esempio n. 8
0
 public abstract PromotionInfo GetFrontOrNextPromoteInfo(PromotionInfo promote, string type);
Esempio n. 9
0
 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;
 }
Esempio n. 10
0
 public override PromotionActionStatus Create(PromotionInfo promote)
 {
     return this.provider.CreateWholesaleDiscount(promote as WholesaleDiscountInfo);
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
 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"));
 }
Esempio n. 13
0
 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));
 }
Esempio n. 14
0
 public override PromotionActionStatus Create(PromotionInfo promote)
 {
     return provider.CreateFullFree(promote as FullFreeInfo);
 }
Esempio n. 15
0
 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;
 }