Example #1
0
        /// <summary>
        /// 修改限时活动管理
        /// </summary>
        /// <param name="countDownInfo"></param>
        /// <returns></returns>
        public bool UpdateCountDownDownCategories(CountDownCategoriesInfo countDownInfo)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(@"update  Ecshop_CountDownCategories
                                          set 
	                                          Title=@Title,
	                                          StartTime=@StartTime,
	                                          EndTime=@EndTime,
	                                          AdImageUrl=@AdImageUrl,
	                                          AdImageLinkUrl=@AdImageLinkUrl,
	                   
	                                          UpdatedBy=@UpdatedBy,
	                                          UpdatedOn=@UpdatedOn
                                          where CountDownCategoryId=@CountDownCategoryId");

            this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, countDownInfo.Title);
            this.database.AddInParameter(sqlStringCommand, "StartTime", DbType.Time, countDownInfo.StartTime.ToLongTimeString());
            this.database.AddInParameter(sqlStringCommand, "EndTime", DbType.Time, countDownInfo.EndTime.ToLongTimeString());
            this.database.AddInParameter(sqlStringCommand, "AdImageUrl", DbType.String, countDownInfo.AdImageUrl);
            this.database.AddInParameter(sqlStringCommand, "AdImageLinkUrl", DbType.String, countDownInfo.AdImageLinkUrl);

            this.database.AddInParameter(sqlStringCommand, "UpdatedBy", DbType.Int32, countDownInfo.UpdatedBy);
            this.database.AddInParameter(sqlStringCommand, "UpdatedOn", DbType.DateTime, DateTime.Now);
            this.database.AddInParameter(sqlStringCommand, "CountDownCategoryId", DbType.Int32, countDownInfo.CountDownCategoryId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
        private void btnUpdateGroupBuy_Click(object sender, System.EventArgs e)
        {
            CountDownCategoriesInfo countDownInfo = new CountDownCategoriesInfo();
            string text = string.Empty;

            countDownInfo.StartTime = Convert.ToDateTime("2015-1-1 " + this.drophours.SelectedValue.Value + ":00:00.0000000");
            countDownInfo.EndTime   = Convert.ToDateTime("2015-1-1 " + this.HourDropDownList1.SelectedValue.Value + ":00:00.0000000");


            if (System.DateTime.Compare(countDownInfo.StartTime, countDownInfo.EndTime) >= 0 && this.HourDropDownList1.SelectedValue.Value != 0)
            {
                this.ShowMsg("开始日期必须要早于结束日期", false);
                return;
            }
            countDownInfo.Title          = this.txtTitle.Text.Trim();
            countDownInfo.AdImageUrl     = CatalogHelper.UploadActiveCategorieImage(this.fileUpload.PostedFile);
            countDownInfo.AdImageUrl     = string.IsNullOrEmpty(countDownInfo.AdImageUrl) ? this.hidd_ImgSrc.Value.Trim() : countDownInfo.AdImageUrl;
            countDownInfo.AdImageLinkUrl = this.txtActiveImgUrl.Text.Trim();

            countDownInfo.CountDownCategoryId = CountDownCategoryId;

            if (PromoteHelper.UpdateCountDownDownCategories(countDownInfo))
            {
                this.ShowMsg("修改限时抢购活动成功", true);
                return;
            }
            this.ShowMsg("编辑限时抢购活动失败", true);
        }
        private void LoadCountDown(CountDownCategoriesInfo countDownInfo)
        {
            this.txtTitle.Text = countDownInfo.Title;

            this.calendarEndDate.SelectedDate = new System.DateTime?(countDownInfo.EndTime.Date);
            this.drophours.SelectedValue      = new int?(countDownInfo.StartTime.Hour);

            this.calendarStartDate.SelectedDate  = new System.DateTime?(countDownInfo.StartTime.Date);
            this.HourDropDownList1.SelectedValue = new int?(countDownInfo.EndTime.Hour);
            this.txtActiveImgUrl.Text            = countDownInfo.AdImageLinkUrl;
            this.hidd_ImgSrc.Value = countDownInfo.AdImageUrl;
        }
Example #4
0
        /// <summary>
        /// 获取限时活动管理对象
        /// </summary>
        /// <param name="CountDownCategoryId"></param>
        /// <returns></returns>
        public CountDownCategoriesInfo GetCountDownnCategoriesInfo(int CountDownCategoryId)
        {
            CountDownCategoriesInfo result = null;
            DbCommand sqlStringCommand     = this.database.GetSqlStringCommand("SELECT * FROM Ecshop_CountDownCategories WHERE CountDownCategoryId=@CountDownCategoryId");

            this.database.AddInParameter(sqlStringCommand, "CountDownCategoryId", DbType.Int32, CountDownCategoryId);
            using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    result = DataMapper.PopulateCountDownCategories(dataReader);
                }
            }
            return(result);
        }
Example #5
0
        /// <summary>
        /// 保存限时活动
        /// </summary>
        /// <param name="countDownInfo"></param>
        /// <returns></returns>
        public bool AddCountDownCategories(CountDownCategoriesInfo countDownInfo)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(@"DECLARE @DisplaySequence AS INT SELECT @DisplaySequence = (CASE WHEN MAX(DisplaySequence) IS NULL THEN 1 ELSE MAX(DisplaySequence) + 1 END) FROM Ecshop_CountDownCategories;
            INSERT INTO Ecshop_CountDownCategories(Title,StartTime,EndTime,AdImageUrl,AdImageLinkUrl,DisplaySequence,CreatedBy,CreatedOn ) 
                                        VALUES(@Title,@StartTime,@EndTime,@AdImageUrl,@AdImageLinkUrl,@DisplaySequence,@CreatedBy,@CreatedOn);");

            this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, countDownInfo.Title);
            this.database.AddInParameter(sqlStringCommand, "StartTime", DbType.Time, countDownInfo.StartTime.ToLongTimeString());
            this.database.AddInParameter(sqlStringCommand, "EndTime", DbType.Time, countDownInfo.EndTime.ToLongTimeString());
            this.database.AddInParameter(sqlStringCommand, "AdImageUrl", DbType.String, countDownInfo.AdImageUrl);
            this.database.AddInParameter(sqlStringCommand, "AdImageLinkUrl", DbType.String, countDownInfo.AdImageLinkUrl);
            this.database.AddInParameter(sqlStringCommand, "CreatedBy", DbType.Int32, countDownInfo.CreatedBy);
            this.database.AddInParameter(sqlStringCommand, "CreatedOn", DbType.DateTime, DateTime.Now);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!int.TryParse(base.Request.QueryString["CountDownCategoryId"], out this.CountDownCategoryId))
     {
         base.GotoResourceNotFound();
         return;
     }
     this.btnUpdateCountDown.Click += new System.EventHandler(this.btnUpdateGroupBuy_Click);
     if (!base.IsPostBack)
     {
         this.HourDropDownList1.DataBind();
         this.drophours.DataBind();
         CountDownCategoriesInfo countDownInfo = PromoteHelper.GetCountDownnCategoriesInfo(this.CountDownCategoryId);
         if (countDownInfo == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         this.LoadCountDown(countDownInfo);
     }
 }
        private void btnbtnAddCountDown_Click(object sender, System.EventArgs e)
        {
            CountDownCategoriesInfo countDownInfo = new CountDownCategoriesInfo();

            countDownInfo.StartTime = Convert.ToDateTime("2015-1-1 " + this.drophours.SelectedValue.Value + ":00:00.0000000");
            countDownInfo.EndTime   = Convert.ToDateTime("2015-1-1 " + this.HourDropDownList1.SelectedValue.Value + ":00:00.0000000");

            if (System.DateTime.Compare(countDownInfo.StartTime, countDownInfo.EndTime) >= 0 && this.HourDropDownList1.SelectedValue.Value != 0)
            {
                this.ShowMsg("开始日期必须要早于结束日期", false);
                return;
            }
            countDownInfo.Title          = this.txtTitle.Text.Trim();
            countDownInfo.AdImageUrl     = CatalogHelper.UploadActiveCategorieImage(this.fileUpload.PostedFile);
            countDownInfo.AdImageLinkUrl = this.txtActiveImgUrl.Text.Trim();

            if (PromoteHelper.AddCountDownCategories(countDownInfo))
            {
                this.ShowMsg("添加限时管理成功", true);
                return;
            }
            this.ShowMsg("添加限时管理失败", true);
        }
Example #8
0
 /// <summary>
 /// 修改限时活动管理
 /// </summary>
 /// <param name="countDownInfo"></param>
 /// <returns></returns>
 public static bool UpdateCountDownDownCategories(CountDownCategoriesInfo countDownInfo)
 {
     return(new CountDownDao().UpdateCountDownDownCategories(countDownInfo));
 }