Example #1
0
        protected override void AttachChildControls()
        {
            int num = default(int);

            int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num);
            MemberInfo user = HiContext.Current.User;

            if (user.UserId == 0)
            {
                HttpContext.Current.Response.Redirect("login.aspx?ReturnUrl=/Vshop/Activity.aspx?id=" + num);
            }
            else
            {
                VActivityInfo activity = VshopBrowser.GetActivity(num);
                if (activity == null)
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                }
                else if (activity.MaxValue <= VshopBrowser.GetUserPrizeCount(num))
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){alert_h(\"报名人数已达到限制人数!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                }
                else
                {
                    this.img                 = (HiImage)this.FindControl("img");
                    this.litDescription      = (Literal)this.FindControl("litDescription");
                    this.img.ImageUrl        = activity.PicUrl;
                    this.litDescription.Text = activity.Description;
                    PageTitle.AddSiteNameTitle("微报名");
                }
            }
        }
Example #2
0
        public int SaveActivity(VActivityInfo activity)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("INSERT INTO vshop_Activity(").Append("Name,Description,StartDate,EndDate,CloseRemark,Keys").Append(",MaxValue,PicUrl,Item1,Item2,Item3,Item4,Item5)")
            .Append(" VALUES (")
            .Append("@Name,@Description,@StartDate,@EndDate,@CloseRemark,@Keys")
            .Append(",@MaxValue,@PicUrl,@Item1,@Item2,@Item3,@Item4,@Item5)")
            .Append(";select @@IDENTITY");
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            base.database.AddInParameter(sqlStringCommand, "Name", DbType.String, activity.Name);
            base.database.AddInParameter(sqlStringCommand, "Description", DbType.String, activity.Description);
            base.database.AddInParameter(sqlStringCommand, "StartDate", DbType.DateTime, activity.StartDate);
            base.database.AddInParameter(sqlStringCommand, "EndDate", DbType.DateTime, activity.EndDate);
            base.database.AddInParameter(sqlStringCommand, "CloseRemark", DbType.String, activity.CloseRemark);
            base.database.AddInParameter(sqlStringCommand, "Keys", DbType.String, activity.Keys);
            base.database.AddInParameter(sqlStringCommand, "MaxValue", DbType.Int32, activity.MaxValue);
            base.database.AddInParameter(sqlStringCommand, "PicUrl", DbType.String, activity.PicUrl);
            base.database.AddInParameter(sqlStringCommand, "Item1", DbType.String, activity.Item1);
            base.database.AddInParameter(sqlStringCommand, "Item2", DbType.String, activity.Item2);
            base.database.AddInParameter(sqlStringCommand, "Item3", DbType.String, activity.Item3);
            base.database.AddInParameter(sqlStringCommand, "Item4", DbType.String, activity.Item4);
            base.database.AddInParameter(sqlStringCommand, "Item5", DbType.String, activity.Item5);
            object obj    = base.database.ExecuteScalar(sqlStringCommand);
            int    result = default(int);

            int.TryParse(obj.ToString(), out result);
            return(result);
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.btnEditActivity.Click += this.btnEditActivity_Click;
     if (!this.Page.IsPostBack)
     {
         int           urlIntParam = base.GetUrlIntParam("id");
         VActivityInfo activity    = VShopHelper.GetActivity(urlIntParam);
         this.txtCloseRemark.Text     = activity.CloseRemark;
         this.txtDescription.Text     = activity.Description;
         this.txtEndDate.SelectedDate = activity.EndDate;
         this.txtKeys.Text            = activity.Keys;
         if (activity.MaxValue != 0)
         {
             this.txtMaxValue.Text = activity.MaxValue.ToString();
         }
         this.txtName.Text = activity.Name;
         this.txtStartDate.SelectedDate = activity.StartDate;
         this.hidOldImages.Value        = activity.PicUrl;
         this.txtItem1.Text             = activity.Item1;
         this.txtItem2.Text             = activity.Item2;
         this.txtItem3.Text             = activity.Item3;
         this.txtItem4.Text             = activity.Item4;
         this.txtItem5.Text             = activity.Item5;
     }
 }
Example #4
0
        protected override void Render(HtmlTextWriter writer)
        {
            int num = default(int);

            int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num);
            VActivityInfo activity = VshopBrowser.GetActivity(num);

            if (activity != null)
            {
                string        format        = "<div class=\"qb_mb10 qb_flex\"><input type=\"text\" class=\"mod_input flex_box\" style=\"height:35px;\" placeholder=\"您的{0}\" id=\"{1}\"></div>";
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendFormat("<input type=\"hidden\" id=\"id\" value=\"{0}\">", num);
                if (!string.IsNullOrEmpty(activity.Item1))
                {
                    stringBuilder.AppendFormat(format, activity.Item1, "item1");
                }
                if (!string.IsNullOrEmpty(activity.Item2))
                {
                    stringBuilder.AppendFormat(format, activity.Item2, "item2");
                }
                if (!string.IsNullOrEmpty(activity.Item3))
                {
                    stringBuilder.AppendFormat(format, activity.Item3, "item3");
                }
                if (!string.IsNullOrEmpty(activity.Item4))
                {
                    stringBuilder.AppendFormat(format, activity.Item4, "item4");
                }
                if (!string.IsNullOrEmpty(activity.Item5))
                {
                    stringBuilder.AppendFormat(format, activity.Item5, "item5");
                }
                writer.Write(stringBuilder.ToString());
            }
        }
Example #5
0
 private void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else
     {
         int maxValue = 0;
         if (!this.txtStartDate.SelectedDate.HasValue)
         {
             this.ShowMsg("请选择开始日期!", false);
         }
         else if (!this.txtEndDate.SelectedDate.HasValue)
         {
             this.ShowMsg("请选择结束日期!", false);
         }
         else
         {
             DateTime dateTime = this.txtStartDate.SelectedDate.Value;
             if (dateTime.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0)
             {
                 this.ShowMsg("开始日期不能晚于结束日期!", false);
             }
             else if (this.txtMaxValue.Text != "" && !int.TryParse(this.txtMaxValue.Text, out maxValue))
             {
                 this.ShowMsg("人数上限格式错误!", false);
             }
             else
             {
                 VActivityInfo vActivityInfo = new VActivityInfo();
                 vActivityInfo.CloseRemark = this.txtCloseRemark.Text.Trim();
                 vActivityInfo.Description = this.txtDescription.Text.Trim();
                 VActivityInfo vActivityInfo2 = vActivityInfo;
                 dateTime = this.txtEndDate.SelectedDate.Value;
                 dateTime = dateTime.AddMinutes(59.0);
                 vActivityInfo2.EndDate  = dateTime.AddSeconds(59.0);
                 vActivityInfo.Item1     = this.txtItem1.Text.Trim();
                 vActivityInfo.Item2     = this.txtItem2.Text.Trim();
                 vActivityInfo.Item3     = this.txtItem3.Text.Trim();
                 vActivityInfo.Item4     = this.txtItem4.Text.Trim();
                 vActivityInfo.Item5     = this.txtItem5.Text.Trim();
                 vActivityInfo.Keys      = this.txtKeys.Text.Trim();
                 vActivityInfo.MaxValue  = maxValue;
                 vActivityInfo.Name      = this.txtName.Text.Trim();
                 vActivityInfo.PicUrl    = this.UploadImage();
                 vActivityInfo.StartDate = this.txtStartDate.SelectedDate.Value;
                 if (VShopHelper.SaveActivity(vActivityInfo))
                 {
                     base.Response.Redirect("ManageActivity.aspx");
                 }
                 else
                 {
                     this.ShowMsg("添加失败", false);
                 }
             }
         }
     }
 }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         int           urlIntParam = base.GetUrlIntParam("id");
         VActivityInfo activity    = VShopHelper.GetActivity(urlIntParam);
         if (activity != null)
         {
             this._act = activity;
             IList <ActivitySignUpInfo> activitySignUpById = VShopHelper.GetActivitySignUpById(urlIntParam);
             this.rpt.DataSource = activitySignUpById;
             this.rpt.DataBind();
             this.nodata = (this.rpt.Items.Count == 0);
         }
     }
 }
Example #7
0
        public bool UpdateActivity(VActivityInfo activity)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("UPDATE vshop_Activity SET ").Append("Name=@Name,").Append("Description=@Description,")
            .Append("StartDate=@StartDate,")
            .Append("EndDate=@EndDate,")
            .Append("CloseRemark=@CloseRemark,")
            .Append("Keys=@Keys,")
            .Append("MaxValue=@MaxValue,")
            .Append("PicUrl=@PicUrl,")
            .Append("Item1=@Item1,")
            .Append("Item2=@Item2,")
            .Append("Item3=@Item3,")
            .Append("Item4=@Item4,")
            .Append("Item5=@Item5")
            .Append(" WHERE ActivityId=@ActivityId")
            .Append(";UPDATE vshop_Reply SET Keys = @Keys WHERE ActivityId = @ActivityId AND [ReplyType] = @ReplyType");
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            base.database.AddInParameter(sqlStringCommand, "Name", DbType.String, activity.Name);
            base.database.AddInParameter(sqlStringCommand, "Description", DbType.String, activity.Description);
            base.database.AddInParameter(sqlStringCommand, "StartDate", DbType.DateTime, activity.StartDate);
            base.database.AddInParameter(sqlStringCommand, "EndDate", DbType.DateTime, activity.EndDate);
            base.database.AddInParameter(sqlStringCommand, "CloseRemark", DbType.String, activity.CloseRemark);
            base.database.AddInParameter(sqlStringCommand, "Keys", DbType.String, activity.Keys);
            base.database.AddInParameter(sqlStringCommand, "MaxValue", DbType.Int32, activity.MaxValue);
            base.database.AddInParameter(sqlStringCommand, "PicUrl", DbType.String, activity.PicUrl);
            base.database.AddInParameter(sqlStringCommand, "Item1", DbType.String, activity.Item1);
            base.database.AddInParameter(sqlStringCommand, "Item2", DbType.String, activity.Item2);
            base.database.AddInParameter(sqlStringCommand, "Item3", DbType.String, activity.Item3);
            base.database.AddInParameter(sqlStringCommand, "Item4", DbType.String, activity.Item4);
            base.database.AddInParameter(sqlStringCommand, "Item5", DbType.String, activity.Item5);
            base.database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, activity.ActivityId);
            base.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, 256);
            return(base.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Example #8
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Vote);

            if (replies != null && replies.Count > 0)
            {
                foreach (ReplyInfo item in replies)
                {
                    if (item.Keys == key)
                    {
                        VoteInfo voteById = StoreHelper.GetVoteById(item.ActivityId);
                        if (voteById != null && voteById.IsBackup)
                        {
                            NewsResponse newsResponse = new NewsResponse();
                            newsResponse.CreateTime   = DateTime.Now;
                            newsResponse.FromUserName = request.ToUserName;
                            newsResponse.ToUserName   = request.FromUserName;
                            newsResponse.Articles     = new List <Article>();
                            newsResponse.Articles.Add(new Article
                            {
                                Description = voteById.VoteName,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{voteById.ImageUrl}",
                                Title       = voteById.VoteName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/Vote.aspx?voteId={voteById.VoteId}"
                            });
                            return(newsResponse);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies2 = ReplyHelper.GetReplies(ReplyType.Wheel);

            if (replies2 != null && replies2.Count > 0)
            {
                foreach (ReplyInfo item2 in replies2)
                {
                    if (item2.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo = VShopHelper.GetLotteryActivityInfo(item2.ActivityId);
                        if (lotteryActivityInfo != null)
                        {
                            NewsResponse newsResponse2 = new NewsResponse();
                            newsResponse2.CreateTime   = DateTime.Now;
                            newsResponse2.FromUserName = request.ToUserName;
                            newsResponse2.ToUserName   = request.FromUserName;
                            newsResponse2.Articles     = new List <Article>();
                            newsResponse2.Articles.Add(new Article
                            {
                                Description = lotteryActivityInfo.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryActivityInfo.ActivityPic}",
                                Title       = lotteryActivityInfo.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/BigWheel.aspx?activityId={lotteryActivityInfo.ActivityId}"
                            });
                            return(newsResponse2);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies3 = ReplyHelper.GetReplies(ReplyType.Scratch);

            if (replies3 != null && replies3.Count > 0)
            {
                foreach (ReplyInfo item3 in replies3)
                {
                    if (item3.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo2 = VShopHelper.GetLotteryActivityInfo(item3.ActivityId);
                        if (lotteryActivityInfo2 != null)
                        {
                            NewsResponse newsResponse3 = new NewsResponse();
                            newsResponse3.CreateTime   = DateTime.Now;
                            newsResponse3.FromUserName = request.ToUserName;
                            newsResponse3.ToUserName   = request.FromUserName;
                            newsResponse3.Articles     = new List <Article>();
                            newsResponse3.Articles.Add(new Article
                            {
                                Description = lotteryActivityInfo2.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryActivityInfo2.ActivityPic}",
                                Title       = lotteryActivityInfo2.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/Scratch.aspx?activityId={lotteryActivityInfo2.ActivityId}"
                            });
                            return(newsResponse3);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies4 = ReplyHelper.GetReplies(ReplyType.SmashEgg);

            if (replies4 != null && replies4.Count > 0)
            {
                foreach (ReplyInfo item4 in replies4)
                {
                    if (item4.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo3 = VShopHelper.GetLotteryActivityInfo(item4.ActivityId);
                        if (lotteryActivityInfo3 != null)
                        {
                            NewsResponse newsResponse4 = new NewsResponse();
                            newsResponse4.CreateTime   = DateTime.Now;
                            newsResponse4.FromUserName = request.ToUserName;
                            newsResponse4.ToUserName   = request.FromUserName;
                            newsResponse4.Articles     = new List <Article>();
                            newsResponse4.Articles.Add(new Article
                            {
                                Description = lotteryActivityInfo3.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryActivityInfo3.ActivityPic}",
                                Title       = lotteryActivityInfo3.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/SmashEgg.aspx?activityId={lotteryActivityInfo3.ActivityId}"
                            });
                            return(newsResponse4);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies5 = ReplyHelper.GetReplies(ReplyType.SignUp);

            if (replies5 != null && replies5.Count > 0)
            {
                foreach (ReplyInfo item5 in replies5)
                {
                    if (item5.Keys == key)
                    {
                        VActivityInfo activity = VShopHelper.GetActivity(item5.ActivityId);
                        if (activity != null)
                        {
                            NewsResponse newsResponse5 = new NewsResponse();
                            newsResponse5.CreateTime   = DateTime.Now;
                            newsResponse5.FromUserName = request.ToUserName;
                            newsResponse5.ToUserName   = request.FromUserName;
                            newsResponse5.Articles     = new List <Article>();
                            newsResponse5.Articles.Add(new Article
                            {
                                Description = activity.Description,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{activity.PicUrl}",
                                Title       = activity.Name,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/Activity.aspx?id={activity.ActivityId}"
                            });
                            return(newsResponse5);
                        }
                    }
                }
            }
            IList <ReplyInfo> replies6 = ReplyHelper.GetReplies(ReplyType.Ticket);

            if (replies6 != null && replies6.Count > 0)
            {
                foreach (ReplyInfo item6 in replies6)
                {
                    if (item6.Keys == key)
                    {
                        LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(item6.ActivityId);
                        if (lotteryTicket != null)
                        {
                            NewsResponse newsResponse6 = new NewsResponse();
                            newsResponse6.CreateTime   = DateTime.Now;
                            newsResponse6.FromUserName = request.ToUserName;
                            newsResponse6.ToUserName   = request.FromUserName;
                            newsResponse6.Articles     = new List <Article>();
                            newsResponse6.Articles.Add(new Article
                            {
                                Description = lotteryTicket.ActivityDesc,
                                PicUrl      = $"http://{HttpContext.Current.Request.Url.Host}{lotteryTicket.ActivityPic}",
                                Title       = lotteryTicket.ActivityName,
                                Url         = $"http://{HttpContext.Current.Request.Url.Host}/vshop/SignUp.aspx?id={lotteryTicket.ActivityId}"
                            });
                            return(newsResponse6);
                        }
                    }
                }
            }
            return(null);
        }
Example #9
0
        private void btnEditActivity_Click(object sender, EventArgs e)
        {
            int maxValue = 0;

            if (!this.txtStartDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择开始日期!", false);
            }
            else if (!this.txtEndDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择结束日期!", false);
            }
            else
            {
                DateTime dateTime = this.txtStartDate.SelectedDate.Value;
                if (dateTime.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0)
                {
                    this.ShowMsg("开始日期不能晚于结束日期!", false);
                }
                else if (this.txtMaxValue.Text != "" && !int.TryParse(this.txtMaxValue.Text, out maxValue))
                {
                    this.ShowMsg("人数上限格式错误!", false);
                }
                else
                {
                    int           urlIntParam = base.GetUrlIntParam("id");
                    VActivityInfo activity    = VShopHelper.GetActivity(urlIntParam);
                    if (activity.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
                    {
                        this.ShowMsg("关键字重复!", false);
                    }
                    else
                    {
                        activity.CloseRemark = this.txtCloseRemark.Text.Trim();
                        activity.Description = this.txtDescription.Text.Trim();
                        VActivityInfo vActivityInfo = activity;
                        dateTime = this.txtEndDate.SelectedDate.Value;
                        dateTime = dateTime.AddMinutes(59.0);
                        vActivityInfo.EndDate = dateTime.AddSeconds(59.0);
                        activity.Item1        = this.txtItem1.Text.Trim();
                        activity.Item2        = this.txtItem2.Text.Trim();
                        activity.Item3        = this.txtItem3.Text.Trim();
                        activity.Item4        = this.txtItem4.Text.Trim();
                        activity.Item5        = this.txtItem5.Text.Trim();
                        activity.Keys         = this.txtKeys.Text.Trim();
                        activity.MaxValue     = maxValue;
                        activity.Name         = this.txtName.Text.Trim();
                        activity.PicUrl       = this.UploadImage();
                        activity.StartDate    = this.txtStartDate.SelectedDate.Value;
                        if (VShopHelper.UpdateActivity(activity))
                        {
                            base.Response.Redirect("ManageActivity.aspx");
                        }
                        else
                        {
                            this.ShowMsg("更新失败", false);
                        }
                    }
                }
            }
        }