コード例 #1
0
ファイル: PromotionData.cs プロジェクト: davinx/himedi
 public override bool AddCountDown(CountDownInfo countDownInfo)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("DECLARE @DisplaySequence AS INT SELECT @DisplaySequence = (CASE WHEN MAX(DisplaySequence) IS NULL THEN 1 ELSE MAX(DisplaySequence) + 1 END) FROM Hishop_CountDown;INSERT INTO Hishop_CountDown(ProductId,CountDownPrice,EndDate,Content,DisplaySequence) VALUES(@ProductId,@CountDownPrice,@EndDate,@Content,@DisplaySequence);");
     database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, countDownInfo.ProductId);
     database.AddInParameter(sqlStringCommand, "CountDownPrice", DbType.Currency, countDownInfo.CountDownPrice);
     database.AddInParameter(sqlStringCommand, "EndDate", DbType.DateTime, countDownInfo.EndDate);
     database.AddInParameter(sqlStringCommand, "Content", DbType.String, countDownInfo.Content);
     return (database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
コード例 #2
0
ファイル: EditMyCountDown.aspx.cs プロジェクト: davinx/himedi
        protected void btnUpdateGroupBuy_Click(object sender, EventArgs e)
        {
            CountDownInfo countDownInfo = new CountDownInfo();
            countDownInfo.CountDownId = countDownId;

            string str = string.Empty;

            if (dropGroupBuyProduct.SelectedValue > 0)
            {
                if ((SubsitePromoteHelper.GetCountDownInfo(countDownId).ProductId != dropGroupBuyProduct.SelectedValue.Value) && SubsitePromoteHelper.ProductCountDownExist(dropGroupBuyProduct.SelectedValue.Value))
                {
                    ShowMsg("已经存在此商品的限时抢购活动", false);
                    return;
                }
                countDownInfo.ProductId = dropGroupBuyProduct.SelectedValue.Value;
            }
            else
            {
                str = str + Formatter.FormatErrorMessage("请选择限时抢购商品");
            }
            if (!calendarEndDate.SelectedDate.HasValue)
            {
                str = str + Formatter.FormatErrorMessage("请选择结束日期");
            }
            else
            {
                countDownInfo.EndDate = calendarEndDate.SelectedDate.Value;
            }
            if (!string.IsNullOrEmpty(txtPrice.Text))
            {
                decimal num;
                if (decimal.TryParse(txtPrice.Text.Trim(), out num))
                {
                    countDownInfo.CountDownPrice = num;
                }
                else
                {
                    str = str + Formatter.FormatErrorMessage("价格填写格式不正确");
                }
            }
            if (!string.IsNullOrEmpty(str))
            {
                ShowMsg(str, false);
            }
            else
            {
                countDownInfo.Content = txtContent.Text;
                if (SubsitePromoteHelper.UpdateCountDown(countDownInfo))
                {
                    ShowMsg("编辑限时抢购活动成功", true);
                }
                else
                {
                    ShowMsg("编辑限时抢购活动失败", true);
                }
            }
        }
コード例 #3
0
ファイル: AddCountDown.aspx.cs プロジェクト: davinx/himedi
 private void btnbtnAddCountDown_Click(object sender, EventArgs e)
 {
     CountDownInfo countDownInfo = new CountDownInfo();
     string str = string.Empty;
     if (dropGroupBuyProduct.SelectedValue > 0)
     {
         if (PromoteHelper.ProductCountDownExist(dropGroupBuyProduct.SelectedValue.Value))
         {
             ShowMsg("已经存在此商品的限时抢购活动", false);
             return;
         }
         countDownInfo.ProductId = dropGroupBuyProduct.SelectedValue.Value;
     }
     else
     {
         str = str + Formatter.FormatErrorMessage("请选择限时抢购商品");
     }
     if (!calendarEndDate.SelectedDate.HasValue)
     {
         str = str + Formatter.FormatErrorMessage("请选择结束日期");
     }
     else
     {
         countDownInfo.EndDate = calendarEndDate.SelectedDate.Value;
     }
     if (!string.IsNullOrEmpty(txtPrice.Text))
     {
         decimal num;
         if (decimal.TryParse(txtPrice.Text.Trim(), out num))
         {
             countDownInfo.CountDownPrice = num;
         }
         else
         {
             str = str + Formatter.FormatErrorMessage("价格填写格式不正确");
         }
     }
     if (!string.IsNullOrEmpty(str))
     {
         ShowMsg(str, false);
     }
     else
     {
         countDownInfo.Content = Globals.HtmlEncode(txtContent.Text);
         if (PromoteHelper.AddCountDown(countDownInfo))
         {
             ShowMsg("添加限时抢购活动成功", true);
         }
         else
         {
             ShowMsg("添加限时抢购活动失败", true);
         }
     }
 }
コード例 #4
0
ファイル: EditMyCountDown.aspx.cs プロジェクト: davinx/himedi
 private void LoadCountDown(CountDownInfo countDownInfo)
 {
     txtPrice.Text = countDownInfo.CountDownPrice.ToString("f2");
     txtContent.Text = countDownInfo.Content;
     calendarEndDate.SelectedDate = new DateTime?(countDownInfo.EndDate);
     dropGroupBuyProduct.SelectedValue = new int?(countDownInfo.ProductId);
 }
コード例 #5
0
ファイル: DataMapper.cs プロジェクト: davinx/himedi
 public static CountDownInfo PopulateCountDown(IDataRecord reader)
 {
     if (null == reader)
     {
         return null;
     }
     CountDownInfo info = new CountDownInfo();
     info.CountDownId = (int) reader["CountDownId"];
     info.ProductId = (int) reader["ProductId"];
     if (DBNull.Value != reader["CountDownPrice"])
     {
         info.CountDownPrice = (decimal) reader["CountDownPrice"];
     }
     info.EndDate = (DateTime) reader["EndDate"];
     if (DBNull.Value != reader["Content"])
     {
         info.Content = (string) reader["Content"];
     }
     info.DisplaySequence = (int) reader["DisplaySequence"];
     return info;
 }
コード例 #6
0
ファイル: PromotionsProvider.cs プロジェクト: davinx/himedi
 public abstract bool AddCountDown(CountDownInfo countDownInfo);
コード例 #7
0
ファイル: PromotionsProvider.cs プロジェクト: davinx/himedi
 public abstract bool UpdateCountDown(CountDownInfo countDownInfo);
コード例 #8
0
ファイル: PromoteHelper.cs プロジェクト: davinx/himedi
 public static bool UpdateCountDown(CountDownInfo countDownInfo)
 {
     return PromotionsProvider.Instance().UpdateCountDown(countDownInfo);
 }
コード例 #9
0
 void LoadProductGroupBuyInfo(CountDownInfo countDownInfo)
 {
     this.lblCurrentSalePrice.Money = countDownInfo.CountDownPrice;
     this.litContent.Text = countDownInfo.Content;
     this.lblTotalPrice.Value = new decimal?(countDownInfo.CountDownPrice);
     this.lblEndTime.Time = countDownInfo.EndDate;
     this.litRemainTime.Text = "待实现";
 }
コード例 #10
0
ファイル: PromotionData.cs プロジェクト: davinx/himedi
 public override bool UpdateCountDown(CountDownInfo countDownInfo)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE distro_CountDown SET ProductId=@ProductId,CountDownPrice=@CountDownPrice,EndDate=@EndDate,Content=@Content WHERE CountDownId=@CountDownId AND DistributorUserId = @DistributorUserId");
     database.AddInParameter(sqlStringCommand, "CountDownId", DbType.Int32, countDownInfo.CountDownId);
     database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, countDownInfo.ProductId);
     database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId);
     database.AddInParameter(sqlStringCommand, "CountDownPrice", DbType.Currency, countDownInfo.CountDownPrice);
     database.AddInParameter(sqlStringCommand, "EndDate", DbType.DateTime, countDownInfo.EndDate);
     database.AddInParameter(sqlStringCommand, "Content", DbType.String, countDownInfo.Content);
     return (database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
コード例 #11
0
ファイル: SubsitePromoteHelper.cs プロジェクト: davinx/himedi
 public static bool AddCountDown(CountDownInfo countDownInfo)
 {
     return SubsitePromotionsProvider.Instance().AddCountDown(countDownInfo);
 }