コード例 #1
0
        protected override void AttachChildControls()
        {
            int num = default(int);

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

            if (user.UserId == 0)
            {
                HttpContext.Current.Response.Redirect("/Vshop/login.aspx?ReturnUrl=/Vshop/Ticket.aspx?id=" + num);
            }
            else if (lotteryTicket == null)
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
            }
            else
            {
                if (lotteryTicket != null && !VshopBrowser.HasSignUp(num, HiContext.Current.UserId) && DateTime.Now >= lotteryTicket.StartTime)
                {
                    HttpContext.Current.Response.Redirect($"~/vshop/SignUp.aspx?id={num}");
                }
                if (lotteryTicket.StartTime > DateTime.Now || DateTime.Now > lotteryTicket.EndTime)
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                }
                if (lotteryTicket.OpenTime > DateTime.Now)
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"抽奖还未开始!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                }
                this.litActivityDesc = (Literal)this.FindControl("litActivityDesc");
                this.litPrizeNames   = (Common_PrizeNames)this.FindControl("litPrizeNames");
                this.litStartDate    = (Literal)this.FindControl("litStartDate");
                this.litEndDate      = (Literal)this.FindControl("litEndDate");
                this.hdTitle         = (HtmlInputHidden)this.FindControl("hdTitle");
                this.hdAppId         = (HtmlInputHidden)this.FindControl("hdAppId");
                this.hdDesc          = (HtmlInputHidden)this.FindControl("hdDesc");
                this.hdImgUrl        = (HtmlInputHidden)this.FindControl("hdImgUrl");
                this.hdLink          = (HtmlInputHidden)this.FindControl("hdLink");
                if (base.ClientType == ClientType.VShop)
                {
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                    string       local          = (!string.IsNullOrWhiteSpace(lotteryTicket.ActivityPic)) ? lotteryTicket.ActivityPic : Globals.FullPath(masterSettings.LogoUrl);
                    this.hdImgUrl.Value = Globals.FullPath(local);
                    this.hdTitle.Value  = lotteryTicket.ActivityName;
                    this.hdDesc.Value   = lotteryTicket.ActivityDesc;
                    this.hdLink.Value   = Globals.FullPath($"/vshop/Ticket?id={lotteryTicket.ActivityId}");
                    this.hdAppId.Value  = masterSettings.WeixinAppId;
                }
                this.litActivityDesc.Text   = lotteryTicket.ActivityDesc;
                this.litPrizeNames.Activity = lotteryTicket;
                Literal  literal  = this.litStartDate;
                DateTime dateTime = lotteryTicket.OpenTime;
                literal.Text = dateTime.ToString("yyyy年MM月dd日 HH:mm:ss");
                Literal literal2 = this.litEndDate;
                dateTime      = lotteryTicket.EndTime;
                literal2.Text = dateTime.ToString("yyyy年MM月dd日 HH:mm:ss");
                PageTitle.AddSiteNameTitle("微抽奖");
            }
        }
コード例 #2
0
ファイル: VShopHelper.cs プロジェクト: damoOnly/e-commerce
        public static int SaveLotteryTicket(LotteryTicketInfo info)
        {
            string prizeSetting = JsonConvert.SerializeObject(info.PrizeSettingList);

            info.PrizeSetting = prizeSetting;
            return(new LotteryActivityDao().SaveLotteryTicket(info));
        }
コード例 #3
0
 protected void rpMaterial_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         if (VShopHelper.DelteLotteryTicket(System.Convert.ToInt32(e.CommandArgument)))
         {
             this.ShowMsg("删除成功", true);
             this.BindMaterial();
         }
         else
         {
             this.ShowMsg("删除失败", false);
         }
     }
     else
     {
         if (e.CommandName == "start")
         {
             LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(System.Convert.ToInt32(e.CommandArgument));
             if (lotteryTicket.OpenTime > System.DateTime.Now)
             {
                 lotteryTicket.OpenTime = System.DateTime.Now;
                 VShopHelper.UpdateLotteryTicket(lotteryTicket);
                 base.Response.Write("<script>location.reload();</script>");
             }
         }
     }
 }
コード例 #4
0
 protected void rpMaterial_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         if (VShopHelper.DelteLotteryTicket(Convert.ToInt32(e.CommandArgument)))
         {
             this.ShowMsg("删除成功", true);
             this.BindMaterial();
         }
         else
         {
             this.ShowMsg("删除失败", false);
         }
     }
     else if (e.CommandName == "start")
     {
         LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(Convert.ToInt32(e.CommandArgument));
         if (lotteryTicket.OpenTime > DateTime.Now)
         {
             lotteryTicket.OpenTime = DateTime.Now;
             VShopHelper.UpdateLotteryTicket(lotteryTicket);
             this.BindMaterial();
         }
     }
 }
コード例 #5
0
        protected void rpMaterial_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            if (!(e.CommandName == "del"))
            {
                if (e.CommandName == "start")
                {
                    int activityid = System.Convert.ToInt32(e.CommandArgument);
                    LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(activityid);
                    if (lotteryTicket.OpenTime > System.DateTime.Now)
                    {
                        lotteryTicket.OpenTime = System.DateTime.Now;
                        VShopHelper.UpdateLotteryTicket(lotteryTicket);
                    }
                    this.ShowMsg("开启成功", true);
                    this.BindMaterial();
                }
                return;
            }
            int activityId = System.Convert.ToInt32(e.CommandArgument);

            if (VShopHelper.DelteLotteryTicket(activityId))
            {
                this.ShowMsg("删除成功", true);
                this.BindMaterial();
                return;
            }
            this.ShowMsg("删除失败", false);
        }
コード例 #6
0
ファイル: VTicket.cs プロジェクト: tyriankid/WFX
        protected override void AttachChildControls()
        {
            int num;

            int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num);
            if (VshopBrowser.GetUserPrizeRecord(num) == null)
            {
                this.Context.Response.Redirect(this.Context.Request.Url.ToString().ToLower().Replace("ticket.aspx", "SignUp.aspx"));
                this.Context.Response.End();
            }
            else
            {
                LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num);
                if (lotteryTicket == null)
                {
                    base.GotoResourceNotFound("");
                }
                this.hdID                   = (HiddenField)this.FindControl("hdID");
                this.hdID.Value             = num.ToString();
                this.litActivityDesc        = (Literal)this.FindControl("litActivityDesc");
                this.litPrizeNames          = (Common_PrizeNames)this.FindControl("litPrizeNames");
                this.litStartDate           = (Literal)this.FindControl("litStartDate");
                this.litEndDate             = (Literal)this.FindControl("litEndDate");
                this.litActivityDesc.Text   = lotteryTicket.ActivityDesc;
                this.litPrizeNames.Activity = lotteryTicket;
                this.litStartDate.Text      = lotteryTicket.OpenTime.ToString("yyyy年MM月dd日 HH:mm:ss");
                this.litEndDate.Text        = lotteryTicket.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss");
                PageTitle.AddSiteNameTitle("微抽奖(" + lotteryTicket.ActivityName + ")");
            }
        }
コード例 #7
0
ファイル: VShopHelper.cs プロジェクト: sriramsoftware/wxshop
        public static bool UpdateLotteryTicket(LotteryTicketInfo info)
        {
            string str = JsonConvert.SerializeObject(info.PrizeSettingList);

            info.PrizeSetting = str;
            return(new LotteryActivityDao().UpdateLotteryTicket(info));
        }
コード例 #8
0
        protected override void AttachChildControls()
        {
            int num;

            int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num);
            LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num);

            if (lotteryTicket == null)
            {
                base.GotoResourceNotFound("");
            }
            if ((lotteryTicket != null) && VshopBrowser.HasSignUp(num, Globals.GetCurrentMemberUserId()))
            {
                HttpContext.Current.Response.Redirect(string.Format("~/vshop/ticket.aspx?id={0}", num));
            }
            if ((lotteryTicket.StartTime > DateTime.Now) || (DateTime.Now > lotteryTicket.EndTime))
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
            }
            this.pnlInfo                = (Panel)this.FindControl("pnlInfo");
            this.litActivityDesc        = (Literal)this.FindControl("litActivityDesc");
            this.litPrizeNames          = (Common_PrizeNames)this.FindControl("litPrizeNames");
            this.litStartDate           = (Literal)this.FindControl("litStartDate");
            this.litEndDate             = (Literal)this.FindControl("litEndDate");
            this.pnlInfo.Visible        = !string.IsNullOrEmpty(lotteryTicket.InvitationCode);
            this.litActivityDesc.Text   = lotteryTicket.ActivityDesc;
            this.litPrizeNames.Activity = lotteryTicket;
            this.litStartDate.Text      = lotteryTicket.OpenTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            this.litEndDate.Text        = lotteryTicket.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            PageTitle.AddSiteNameTitle("抽奖报名");
        }
コード例 #9
0
        public int SaveLotteryTicket(LotteryTicketInfo info)
        {
            int           num;
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into Vshop_LotteryActivity(");
            builder.Append("ActivityName,ActivityType,StartTime,OpenTime,EndTime,ActivityDesc,ActivityPic,ActivityKey,PrizeSetting,GradeIds,MinValue,InvitationCode,IsOpened)");
            builder.Append(" values (");
            builder.Append("@ActivityName,@ActivityType,@StartTime,@OpenTime,@EndTime,@ActivityDesc,@ActivityPic,@ActivityKey,@PrizeSetting,@GradeIds,@MinValue,@InvitationCode,@IsOpened)");
            builder.Append(";select @@IDENTITY");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "ActivityName", DbType.String, info.ActivityName);
            this.database.AddInParameter(sqlStringCommand, "ActivityType", DbType.Int32, info.ActivityType);
            this.database.AddInParameter(sqlStringCommand, "StartTime", DbType.DateTime, info.StartTime);
            this.database.AddInParameter(sqlStringCommand, "OpenTime", DbType.DateTime, info.OpenTime);
            this.database.AddInParameter(sqlStringCommand, "EndTime", DbType.DateTime, info.EndTime);
            this.database.AddInParameter(sqlStringCommand, "ActivityDesc", DbType.String, info.ActivityDesc);
            this.database.AddInParameter(sqlStringCommand, "ActivityPic", DbType.String, info.ActivityPic);
            this.database.AddInParameter(sqlStringCommand, "ActivityKey", DbType.String, info.ActivityKey);
            this.database.AddInParameter(sqlStringCommand, "PrizeSetting", DbType.String, info.PrizeSetting);
            this.database.AddInParameter(sqlStringCommand, "GradeIds", DbType.String, info.GradeIds);
            this.database.AddInParameter(sqlStringCommand, "MinValue", DbType.Int32, info.MinValue);
            this.database.AddInParameter(sqlStringCommand, "InvitationCode", DbType.String, info.InvitationCode);
            this.database.AddInParameter(sqlStringCommand, "IsOpened", DbType.Boolean, info.IsOpened);
            if (!int.TryParse(this.database.ExecuteScalar(sqlStringCommand).ToString(), out num))
            {
                return(0);
            }
            return(num);
        }
コード例 #10
0
        protected override void AttachChildControls()
        {
            int num;

            int.TryParse(System.Web.HttpContext.Current.Request.QueryString.Get("id"), out num);
            LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num);

            if (lotteryTicket == null)
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                return;
            }
            if (!(HiContext.Current.User is Member))
            {
                System.Web.HttpContext.Current.Response.Redirect("/Vshop/login.aspx?ReturnUrl=/Vshop/Tocket.aspx?id=" + num);
                return;
            }
            this.litActivityDesc        = (System.Web.UI.WebControls.Literal) this.FindControl("litActivityDesc");
            this.litPrizeNames          = (Common_PrizeNames)this.FindControl("litPrizeNames");
            this.litStartDate           = (System.Web.UI.WebControls.Literal) this.FindControl("litStartDate");
            this.litEndDate             = (System.Web.UI.WebControls.Literal) this.FindControl("litEndDate");
            this.litActivityDesc.Text   = lotteryTicket.ActivityDesc;
            this.litPrizeNames.Activity = lotteryTicket;
            this.litStartDate.Text      = lotteryTicket.OpenTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            this.litEndDate.Text        = lotteryTicket.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            PageTitle.AddSiteNameTitle("微抽奖");
        }
コード例 #11
0
        public void RestoreLottery()
        {
            LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(this.activityid);

            if (lotteryTicket != null)
            {
                TextBox textBox = this.txtMinValue;
                int     num     = lotteryTicket.MinValue;
                textBox.Text                        = num.ToString();
                this.txtCode.Text                   = lotteryTicket.InvitationCode;
                this.txtActiveName.Text             = lotteryTicket.ActivityName;
                this.txtKeyword.Text                = lotteryTicket.ActivityKey;
                this.txtdesc.Text                   = lotteryTicket.ActivityDesc;
                this.hidOldImages.Value             = lotteryTicket.ActivityPic;
                this.calendarStartDate.SelectedDate = lotteryTicket.StartTime;
                this.calendarOpenDate.SelectedDate  = lotteryTicket.OpenTime;
                this.calendarEndDate.SelectedDate   = lotteryTicket.EndTime;
                this.txtPrize1.Text                 = lotteryTicket.PrizeSettingList[0].PrizeName;
                TextBox textBox2 = this.txtPrize1Num;
                num                 = lotteryTicket.PrizeSettingList[0].PrizeNum;
                textBox2.Text       = num.ToString();
                this.txtPrize2.Text = lotteryTicket.PrizeSettingList[1].PrizeName;
                TextBox textBox3 = this.txtPrize2Num;
                num                 = lotteryTicket.PrizeSettingList[1].PrizeNum;
                textBox3.Text       = num.ToString();
                this.txtPrize3.Text = lotteryTicket.PrizeSettingList[2].PrizeName;
                TextBox textBox4 = this.txtPrize3Num;
                num           = lotteryTicket.PrizeSettingList[2].PrizeNum;
                textBox4.Text = num.ToString();
                if (lotteryTicket.PrizeSettingList.Count > 3)
                {
                    this.ooOpen.SelectedValue = true;
                    this.txtPrize4.Text       = lotteryTicket.PrizeSettingList[3].PrizeName;
                    TextBox textBox5 = this.txtPrize4Num;
                    num                 = lotteryTicket.PrizeSettingList[3].PrizeNum;
                    textBox5.Text       = num.ToString();
                    this.txtPrize5.Text = lotteryTicket.PrizeSettingList[4].PrizeName;
                    TextBox textBox6 = this.txtPrize5Num;
                    num                 = lotteryTicket.PrizeSettingList[4].PrizeNum;
                    textBox6.Text       = num.ToString();
                    this.txtPrize6.Text = lotteryTicket.PrizeSettingList[5].PrizeName;
                    TextBox textBox7 = this.txtPrize6Num;
                    num           = lotteryTicket.PrizeSettingList[5].PrizeNum;
                    textBox7.Text = num.ToString();
                }
                if (!string.IsNullOrEmpty(lotteryTicket.GradeIds) && lotteryTicket.GradeIds.Length > 1)
                {
                    string[]      collection = lotteryTicket.GradeIds.Split(',');
                    List <string> list       = new List <string>(collection);
                    for (int i = 0; i < this.cbList.Items.Count; i++)
                    {
                        if (list.Contains(this.cbList.Items[i].Value))
                        {
                            this.cbList.Items[i].Selected = true;
                        }
                    }
                }
            }
        }
コード例 #12
0
		public static bool OpenTicket(int ticketId)
		{
			LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(ticketId);
			if (new PrizeRecordDao().OpenTicket(ticketId, lotteryTicket.PrizeSettingList))
			{
				lotteryTicket.IsOpened = true;
				return new LotteryActivityDao().UpdateLotteryTicket(lotteryTicket);
			}
			return false;
		}
コード例 #13
0
        public void RestoreLottery()
        {
            LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(this.activityid);

            if (lotteryTicket == null)
            {
                return;
            }
            this.txtMinValue.Text               = lotteryTicket.MinValue.ToString();
            this.txtCode.Text                   = lotteryTicket.InvitationCode;
            this.txtActiveName.Text             = lotteryTicket.ActivityName;
            this.txtKeyword.Text                = lotteryTicket.ActivityKey;
            this.txtdesc.Text                   = lotteryTicket.ActivityDesc;
            this.imgPic.ImageUrl                = lotteryTicket.ActivityPic;
            this.btnPicDelete.Visible           = !string.IsNullOrEmpty(this.imgPic.ImageUrl);
            this.calendarStartDate.SelectedDate = new System.DateTime?(lotteryTicket.StartTime);
            this.calendarOpenDate.SelectedDate  = new System.DateTime?(lotteryTicket.OpenTime);
            this.ddlHours.SelectedIndex         = lotteryTicket.OpenTime.Hour;
            this.calendarEndDate.SelectedDate   = new System.DateTime?(lotteryTicket.EndTime);
            this.txtPrize1.Text                 = lotteryTicket.PrizeSettingList[0].PrizeName;
            this.txtPrize1Num.Text              = lotteryTicket.PrizeSettingList[0].PrizeNum.ToString();
            this.txtPrize2.Text                 = lotteryTicket.PrizeSettingList[1].PrizeName;
            this.txtPrize2Num.Text              = lotteryTicket.PrizeSettingList[1].PrizeNum.ToString();
            this.txtPrize3.Text                 = lotteryTicket.PrizeSettingList[2].PrizeName;
            this.txtPrize3Num.Text              = lotteryTicket.PrizeSettingList[2].PrizeNum.ToString();
            if (lotteryTicket.PrizeSettingList.Count > 3)
            {
                this.ChkOpen.Checked   = true;
                this.txtPrize4.Text    = lotteryTicket.PrizeSettingList[3].PrizeName;
                this.txtPrize4Num.Text = lotteryTicket.PrizeSettingList[3].PrizeNum.ToString();
                this.txtPrize5.Text    = lotteryTicket.PrizeSettingList[4].PrizeName;
                this.txtPrize5Num.Text = lotteryTicket.PrizeSettingList[4].PrizeNum.ToString();
                this.txtPrize6.Text    = lotteryTicket.PrizeSettingList[5].PrizeName;
                this.txtPrize6Num.Text = lotteryTicket.PrizeSettingList[5].PrizeNum.ToString();
            }
            if (!string.IsNullOrEmpty(lotteryTicket.GradeIds) && lotteryTicket.GradeIds.Length > 1)
            {
                string[] collection = lotteryTicket.GradeIds.Split(new char[]
                {
                    ','
                });
                System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>(collection);
                for (int i = 0; i < this.cbList.Items.Count; i++)
                {
                    if (list.Contains(this.cbList.Items[i].Value))
                    {
                        this.cbList.Items[i].Selected = true;
                    }
                }
            }
        }
コード例 #14
0
        public void RestoreLottery()
        {
            LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(this.activityid);

            if (lotteryTicket != null)
            {
                this.txtMinValue.Text   = lotteryTicket.MinValue.ToString();
                this.txtCode.Text       = lotteryTicket.InvitationCode;
                this.txtActiveName.Text = lotteryTicket.ActivityName;
                this.txtKeyword.Text    = lotteryTicket.ActivityKey;
                this.txtdesc.Text       = lotteryTicket.ActivityDesc;
                string activityPic = lotteryTicket.ActivityPic;
                if (activityPic != "")
                {
                    this.uploader1.UploadedImageUrl = activityPic;
                }
                this.calendarStartDate.SelectedDate = new DateTime?(lotteryTicket.StartTime);
                this.calendarOpenDate.SelectedDate  = new DateTime?(lotteryTicket.OpenTime);
                this.ddlHours.SelectedIndex         = lotteryTicket.OpenTime.Hour;
                this.calendarEndDate.SelectedDate   = new DateTime?(lotteryTicket.EndTime);
                this.txtPrize1.Text    = lotteryTicket.PrizeSettingList[0].PrizeName;
                this.txtPrize1Num.Text = lotteryTicket.PrizeSettingList[0].PrizeNum.ToString();
                this.txtPrize2.Text    = lotteryTicket.PrizeSettingList[1].PrizeName;
                this.txtPrize2Num.Text = lotteryTicket.PrizeSettingList[1].PrizeNum.ToString();
                this.txtPrize3.Text    = lotteryTicket.PrizeSettingList[2].PrizeName;
                this.txtPrize3Num.Text = lotteryTicket.PrizeSettingList[2].PrizeNum.ToString();
                if (lotteryTicket.PrizeSettingList.Count > 3)
                {
                    this.ChkOpen.Checked   = true;
                    this.txtPrize4.Text    = lotteryTicket.PrizeSettingList[3].PrizeName;
                    this.txtPrize4Num.Text = lotteryTicket.PrizeSettingList[3].PrizeNum.ToString();
                    this.txtPrize5.Text    = lotteryTicket.PrizeSettingList[4].PrizeName;
                    this.txtPrize5Num.Text = lotteryTicket.PrizeSettingList[4].PrizeNum.ToString();
                    this.txtPrize6.Text    = lotteryTicket.PrizeSettingList[5].PrizeName;
                    this.txtPrize6Num.Text = lotteryTicket.PrizeSettingList[5].PrizeNum.ToString();
                }
                if (!string.IsNullOrEmpty(lotteryTicket.GradeIds) && (lotteryTicket.GradeIds.Length > 1))
                {
                    List <string> list = new List <string>(lotteryTicket.GradeIds.Split(new char[] { ',' }));
                    for (int i = 0; i < this.cbList.Items.Count; i++)
                    {
                        if (list.Contains(this.cbList.Items[i].Value))
                        {
                            this.cbList.Items[i].Selected = true;
                        }
                    }
                }
            }
        }
コード例 #15
0
ファイル: LotteryActivityDao.cs プロジェクト: tyriankid/WFX
        public bool UpdateLotteryTicket(LotteryTicketInfo info)
        {
            if (info.StartTime > info.EndTime)
            {
                DateTime startTime = info.StartTime;
                info.StartTime = info.EndTime;
                info.EndTime   = startTime;
            }
            StringBuilder builder = new StringBuilder();

            builder.Append("update Vshop_LotteryActivity set ");
            builder.Append("ActivityName=@ActivityName,");
            builder.Append("ActivityType=@ActivityType,");
            builder.Append("StartTime=@StartTime,");
            builder.Append("OpenTime=@OpenTime,");
            builder.Append("EndTime=@EndTime,");
            builder.Append("ActivityDesc=@ActivityDesc,");
            builder.Append("ActivityPic=@ActivityPic,");
            builder.Append("ActivityKey=@ActivityKey,");
            builder.Append("PrizeSetting=@PrizeSetting,");
            builder.Append("GradeIds=@GradeIds,");
            builder.Append("MinValue=@MinValue,");
            builder.Append("InvitationCode=@InvitationCode,");
            builder.Append("IsOpened=@IsOpened");
            builder.Append(" where ActivityId=@ActivityId ");
            builder.Append(";UPDATE vshop_Reply SET Keys = @ActivityKey WHERE ActivityId = @ActivityId  AND [ReplyType] = @ReplyType");
            string    str              = ((LotteryActivityType)info.ActivityType).ToString();
            object    obj2             = Enum.Parse(typeof(ReplyType), str);
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, info.ActivityId);
            this.database.AddInParameter(sqlStringCommand, "ActivityName", DbType.String, info.ActivityName);
            this.database.AddInParameter(sqlStringCommand, "ActivityType", DbType.Int32, info.ActivityType);
            this.database.AddInParameter(sqlStringCommand, "StartTime", DbType.DateTime, info.StartTime);
            this.database.AddInParameter(sqlStringCommand, "OpenTime", DbType.DateTime, info.OpenTime);
            this.database.AddInParameter(sqlStringCommand, "EndTime", DbType.DateTime, info.EndTime);
            this.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, (int)obj2);
            this.database.AddInParameter(sqlStringCommand, "ActivityDesc", DbType.String, info.ActivityDesc);
            this.database.AddInParameter(sqlStringCommand, "ActivityPic", DbType.String, info.ActivityPic);
            this.database.AddInParameter(sqlStringCommand, "ActivityKey", DbType.String, info.ActivityKey);
            this.database.AddInParameter(sqlStringCommand, "PrizeSetting", DbType.String, info.PrizeSetting);
            this.database.AddInParameter(sqlStringCommand, "GradeIds", DbType.String, info.GradeIds);
            this.database.AddInParameter(sqlStringCommand, "MinValue", DbType.Int32, info.MinValue);
            this.database.AddInParameter(sqlStringCommand, "InvitationCode", DbType.String, info.InvitationCode);
            this.database.AddInParameter(sqlStringCommand, "IsOpened", DbType.Boolean, info.IsOpened);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
コード例 #16
0
ファイル: WAPSignUp.cs プロジェクト: spiltservice/cloudshop
        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("/Vshop/login.aspx?ReturnUrl=/Vshop/SignUp.aspx?id=" + num);
            }
            else
            {
                LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num);
                if (lotteryTicket == null)
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                }
                else
                {
                    if (lotteryTicket != null && VshopBrowser.HasSignUp(num, HiContext.Current.UserId) && DateTime.Now >= lotteryTicket.OpenTime)
                    {
                        HttpContext.Current.Response.Redirect($"~/vshop/ticket.aspx?id={num}");
                    }
                    if (lotteryTicket.StartTime > DateTime.Now || DateTime.Now > lotteryTicket.EndTime)
                    {
                        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                    }
                    this.pnlInfo                = (Panel)this.FindControl("pnlInfo");
                    this.litActivityDesc        = (Literal)this.FindControl("litActivityDesc");
                    this.litPrizeNames          = (Common_PrizeNames)this.FindControl("litPrizeNames");
                    this.litStartDate           = (Literal)this.FindControl("litStartDate");
                    this.litEndDate             = (Literal)this.FindControl("litEndDate");
                    this.pnlInfo.Visible        = !string.IsNullOrEmpty(lotteryTicket.InvitationCode);
                    this.litActivityDesc.Text   = lotteryTicket.ActivityDesc;
                    this.litPrizeNames.Activity = lotteryTicket;
                    Literal  literal  = this.litStartDate;
                    DateTime dateTime = lotteryTicket.OpenTime;
                    literal.Text = dateTime.ToString("yyyy年MM月dd日 HH:mm:ss");
                    Literal literal2 = this.litEndDate;
                    dateTime      = lotteryTicket.EndTime;
                    literal2.Text = dateTime.ToString("yyyy年MM月dd日 HH:mm:ss");
                    PageTitle.AddSiteNameTitle("抽奖报名");
                }
            }
        }
コード例 #17
0
        public bool UpdateLotteryTicket(LotteryTicketInfo info)
        {
            if (!this.Update(info, null))
            {
                return(false);
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("UPDATE vshop_Reply SET Keys = @ActivityKey WHERE ActivityId = @ActivityId  AND [ReplyType] = @ReplyType");
            string    value            = info.ActivityType.ToString();
            object    obj              = Enum.Parse(typeof(ReplyType), value);
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            base.database.AddInParameter(sqlStringCommand, "ActivityId", DbType.Int32, info.ActivityId);
            base.database.AddInParameter(sqlStringCommand, "ReplyType", DbType.Int32, (int)obj);
            base.database.AddInParameter(sqlStringCommand, "ActivityKey", DbType.String, info.ActivityKey);
            return(base.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
コード例 #18
0
        protected override void AttachChildControls()
        {
            int num;

            int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num);
            LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num);

            if (lotteryTicket == null)
            {
                base.GotoResourceNotFound("");
            }
            this.litActivityDesc        = (Literal)this.FindControl("litActivityDesc");
            this.litPrizeNames          = (Common_PrizeNames)this.FindControl("litPrizeNames");
            this.litStartDate           = (Literal)this.FindControl("litStartDate");
            this.litEndDate             = (Literal)this.FindControl("litEndDate");
            this.litActivityDesc.Text   = lotteryTicket.ActivityDesc;
            this.litPrizeNames.Activity = lotteryTicket;
            this.litStartDate.Text      = lotteryTicket.OpenTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            this.litEndDate.Text        = lotteryTicket.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            PageTitle.AddSiteNameTitle("微抽奖");
        }
コード例 #19
0
ファイル: VSignUp.cs プロジェクト: damoOnly/e-commerce
        protected override void AttachChildControls()
        {
            int num;

            int.TryParse(System.Web.HttpContext.Current.Request.QueryString.Get("id"), out num);
            if (!(HiContext.Current.User is Member))
            {
                System.Web.HttpContext.Current.Response.Redirect("/Vshop/login.aspx?ReturnUrl=/Vshop/SignUp.aspx?id=" + num);
                return;
            }
            LotteryTicketInfo lotteryTicket = VshopBrowser.GetLotteryTicket(num);

            if (lotteryTicket == null)
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
                return;
            }
            if (lotteryTicket != null && VshopBrowser.HasSignUp(num, HiContext.Current.User.UserId))
            {
                System.Web.HttpContext.Current.Response.Redirect(string.Format("~/vshop/ticket.aspx?id={0}", num));
            }
            if (lotteryTicket.StartTime > System.DateTime.Now || System.DateTime.Now > lotteryTicket.EndTime)
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "myscript", "<script>$(function(){hideSignUpBtn();alert_h(\"活动还未开始或者已经结束!\",function(){window.location.href=\"/vshop/default.aspx\";});});</script>");
            }
            this.pnlInfo                = (System.Web.UI.WebControls.Panel) this.FindControl("pnlInfo");
            this.litActivityDesc        = (System.Web.UI.WebControls.Literal) this.FindControl("litActivityDesc");
            this.litPrizeNames          = (Common_PrizeNames)this.FindControl("litPrizeNames");
            this.litStartDate           = (System.Web.UI.WebControls.Literal) this.FindControl("litStartDate");
            this.litEndDate             = (System.Web.UI.WebControls.Literal) this.FindControl("litEndDate");
            this.pnlInfo.Visible        = !string.IsNullOrEmpty(lotteryTicket.InvitationCode);
            this.litActivityDesc.Text   = lotteryTicket.ActivityDesc;
            this.litPrizeNames.Activity = lotteryTicket;
            this.litStartDate.Text      = lotteryTicket.OpenTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            this.litEndDate.Text        = lotteryTicket.EndTime.ToString("yyyy年MM月dd日 HH:mm:ss");
            PageTitle.AddSiteNameTitle("抽奖报名");
        }
コード例 #20
0
        private void SetStatus(HttpContext context)
        {
            int?intParam = base.GetIntParam(context, "id", false);

            if (!intParam.HasValue)
            {
                throw new HidistroAshxException("错误的编号");
            }
            LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(intParam.Value);

            if (lotteryTicket.OpenTime > DateTime.Now)
            {
                lotteryTicket.OpenTime = DateTime.Now;
                if (VShopHelper.UpdateLotteryTicket(lotteryTicket))
                {
                    base.ReturnSuccessResult(context, "操作成功", 0, true);
                    goto IL_0083;
                }
                throw new HidistroAshxException("操作失败");
            }
            goto IL_0083;
IL_0083:
            throw new HidistroAshxException("状态属于不可改变状态");
        }
コード例 #21
0
 protected void btnUpdateActivity_Click(object sender, EventArgs e)
 {
     if (!this.calendarStartDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择活动开始时间", false);
     }
     else if (!this.calendarOpenDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择抽奖开始时间", false);
     }
     else if (!this.calendarEndDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择抽奖结束时间", false);
     }
     else if (this.calendarStartDate.SelectedDate.Value.CompareTo(this.calendarOpenDate.SelectedDate.Value) > 0)
     {
         this.ShowMsg("报名开始日期不能晚于抽奖开始时间!", false);
     }
     else if (this.calendarOpenDate.SelectedDate.Value.CompareTo(this.calendarEndDate.SelectedDate.Value) >= 0)
     {
         this.ShowMsg("抽奖开始时间不能晚于活动结束时间!", false);
     }
     else
     {
         string uploadedImageUrl = this.uploader1.UploadedImageUrl;
         if (string.IsNullOrEmpty(uploadedImageUrl))
         {
             this.ShowMsg("请上传封面图片", false);
         }
         else
         {
             string str2 = string.Empty;
             for (int i = 0; i < this.cbList.Items.Count; i++)
             {
                 if (this.cbList.Items[i].Selected)
                 {
                     str2 = str2 + "," + this.cbList.Items[i].Value;
                 }
             }
             if (string.IsNullOrEmpty(str2))
             {
                 this.ShowMsg("请选择活动会员等级", false);
             }
             else
             {
                 LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(this.activityid);
                 if ((lotteryTicket.ActivityKey != this.txtKeyword.Text.Trim()) && ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim(), this.wid))
                 {
                     this.ShowMsg("关键字重复!", false);
                 }
                 else
                 {
                     int num2;
                     lotteryTicket.GradeIds       = str2;
                     lotteryTicket.MinValue       = Convert.ToInt32(this.txtMinValue.Text);
                     lotteryTicket.InvitationCode = this.txtCode.Text.Trim();
                     lotteryTicket.ActivityName   = this.txtActiveName.Text;
                     lotteryTicket.ActivityKey    = this.txtKeyword.Text;
                     lotteryTicket.ActivityDesc   = this.txtdesc.Text;
                     lotteryTicket.ActivityPic    = uploadedImageUrl;
                     lotteryTicket.StartTime      = this.calendarStartDate.SelectedDate.Value;
                     lotteryTicket.OpenTime       = this.calendarOpenDate.SelectedDate.Value.AddHours((double)this.ddlHours.SelectedIndex);
                     lotteryTicket.EndTime        = this.calendarEndDate.SelectedDate.Value;
                     if ((int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2)) && int.TryParse(this.txtPrize3Num.Text, out num2))
                     {
                         lotteryTicket.PrizeSettingList.Clear();
                         PrizeSetting item = new PrizeSetting {
                             PrizeName  = this.txtPrize1.Text,
                             PrizeNum   = Convert.ToInt32(this.txtPrize1Num.Text),
                             PrizeLevel = "一等奖"
                         };
                         lotteryTicket.PrizeSettingList.Add(item);
                         PrizeSetting setting2 = new PrizeSetting {
                             PrizeName  = this.txtPrize2.Text,
                             PrizeNum   = Convert.ToInt32(this.txtPrize2Num.Text),
                             PrizeLevel = "二等奖"
                         };
                         lotteryTicket.PrizeSettingList.Add(setting2);
                         PrizeSetting setting3 = new PrizeSetting {
                             PrizeName  = this.txtPrize3.Text,
                             PrizeNum   = Convert.ToInt32(this.txtPrize3Num.Text),
                             PrizeLevel = "三等奖"
                         };
                         lotteryTicket.PrizeSettingList.Add(setting3);
                     }
                     else
                     {
                         this.ShowMsg("奖品数量必须为数字!", false);
                         return;
                     }
                     if (this.ChkOpen.Checked)
                     {
                         if ((string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text)) || string.IsNullOrEmpty(this.txtPrize6.Text))
                         {
                             this.ShowMsg("开启四五六名必须填写", false);
                             return;
                         }
                         if ((int.TryParse(this.txtPrize4Num.Text, out num2) && int.TryParse(this.txtPrize5Num.Text, out num2)) && int.TryParse(this.txtPrize6Num.Text, out num2))
                         {
                             PrizeSetting setting4 = new PrizeSetting {
                                 PrizeName  = this.txtPrize4.Text,
                                 PrizeNum   = Convert.ToInt32(this.txtPrize4Num.Text),
                                 PrizeLevel = "四等奖"
                             };
                             lotteryTicket.PrizeSettingList.Add(setting4);
                             PrizeSetting setting5 = new PrizeSetting {
                                 PrizeName  = this.txtPrize5.Text,
                                 PrizeNum   = Convert.ToInt32(this.txtPrize5Num.Text),
                                 PrizeLevel = "五等奖"
                             };
                             lotteryTicket.PrizeSettingList.Add(setting5);
                             PrizeSetting setting6 = new PrizeSetting {
                                 PrizeName  = this.txtPrize6.Text,
                                 PrizeNum   = Convert.ToInt32(this.txtPrize6Num.Text),
                                 PrizeLevel = "六等奖"
                             };
                             lotteryTicket.PrizeSettingList.Add(setting6);
                         }
                         else
                         {
                             this.ShowMsg("奖品数量必须为数字!", false);
                             return;
                         }
                     }
                     if (VShopHelper.UpdateLotteryTicket(lotteryTicket))
                     {
                         base.Response.Redirect("ManageLotteryTicket.aspx");
                     }
                 }
             }
         }
     }
 }
コード例 #22
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Topic, this.wid);

            if ((replies != null) && (replies.Count > 0))
            {
                foreach (ReplyInfo info in replies)
                {
                    if (info.Keys == key)
                    {
                        TopicInfo topic = VShopHelper.Gettopic(info.ActivityId);
                        if (topic != null)
                        {
                            NewsResponse response = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article item = new Article {
                                Description = topic.Title,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, topic.IconUrl),
                                Title       = topic.Title,
                                Url         = string.Format("http://{0}/vshop/Topics.aspx?TopicId={1}", HttpContext.Current.Request.Url.Host, topic.TopicId)
                            };
                            response.Articles.Add(item);
                            return(response);
                        }
                    }
                }
            }
            IList <ReplyInfo> list2 = ReplyHelper.GetReplies(ReplyType.Vote, this.wid);

            if ((list2 != null) && (list2.Count > 0))
            {
                foreach (ReplyInfo info3 in list2)
                {
                    if (info3.Keys == key)
                    {
                        Hidistro.Entities.Promotions.VoteInfo voteById = StoreHelper.GetVoteById((long)info3.ActivityId);
                        if ((voteById != null) && voteById.IsBackup)
                        {
                            NewsResponse response2 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article2 = new Article {
                                Description = voteById.VoteName,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, voteById.ImageUrl),
                                Title       = voteById.VoteName,
                                Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", HttpContext.Current.Request.Url.Host, voteById.VoteId)
                            };
                            response2.Articles.Add(article2);
                            return(response2);
                        }
                    }
                }
            }
            IList <ReplyInfo> list3 = ReplyHelper.GetReplies(ReplyType.Wheel, this.wid);

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

            if ((list4 != null) && (list4.Count > 0))
            {
                foreach (ReplyInfo info7 in list4)
                {
                    if (info7.Keys == key)
                    {
                        LotteryActivityInfo info8 = VShopHelper.GetLotteryActivityInfo(info7.ActivityId);
                        if (info8 != null)
                        {
                            NewsResponse response4 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article4 = new Article {
                                Description = info8.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info8.ActivityPic),
                                Title       = info8.ActivityName,
                                Url         = string.Format("http://{0}/vshop/Scratch.aspx?activityId={1}", HttpContext.Current.Request.Url.Host, info8.ActivityId)
                            };
                            response4.Articles.Add(article4);
                            return(response4);
                        }
                    }
                }
            }
            IList <ReplyInfo> list5 = ReplyHelper.GetReplies(ReplyType.SmashEgg, this.wid);

            if ((list5 != null) && (list5.Count > 0))
            {
                foreach (ReplyInfo info9 in list5)
                {
                    if (info9.Keys == key)
                    {
                        LotteryActivityInfo info10 = VShopHelper.GetLotteryActivityInfo(info9.ActivityId);
                        if (info10 != null)
                        {
                            NewsResponse response5 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article5 = new Article {
                                Description = info10.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info10.ActivityPic),
                                Title       = info10.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SmashEgg.aspx?activityId={1}", HttpContext.Current.Request.Url.Host, info10.ActivityId)
                            };
                            response5.Articles.Add(article5);
                            return(response5);
                        }
                    }
                }
            }
            IList <ReplyInfo> list6 = ReplyHelper.GetReplies(ReplyType.SignUp, this.wid);

            if ((list6 != null) && (list6.Count > 0))
            {
                foreach (ReplyInfo info11 in list6)
                {
                    if (info11.Keys == key)
                    {
                        ActivityInfo activity = VShopHelper.GetActivity(info11.ActivityId);
                        if (activity != null)
                        {
                            NewsResponse response6 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article6 = new Article {
                                Description = activity.Description,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, activity.PicUrl),
                                Title       = activity.Name,
                                Url         = string.Format("http://{0}/vshop/Activity.aspx?id={1}", HttpContext.Current.Request.Url.Host, activity.ActivityId)
                            };
                            response6.Articles.Add(article6);
                            return(response6);
                        }
                    }
                }
            }
            IList <ReplyInfo> list7 = ReplyHelper.GetReplies(ReplyType.Ticket, this.wid);

            if ((list7 != null) && (list7.Count > 0))
            {
                foreach (ReplyInfo info13 in list7)
                {
                    if (info13.Keys == key)
                    {
                        LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(info13.ActivityId);
                        if (lotteryTicket != null)
                        {
                            NewsResponse response7 = new NewsResponse {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article article7 = new Article {
                                Description = lotteryTicket.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityPic),
                                Title       = lotteryTicket.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SignUp.aspx?id={1}", HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityId)
                            };
                            response7.Articles.Add(article7);
                            return(response7);
                        }
                    }
                }
            }
            return(null);
        }
コード例 #23
0
 protected void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else if (!this.calendarStartDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择活动开始时间", false);
     }
     else if (!this.calendarOpenDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择抽奖开始时间", false);
     }
     else if (!this.calendarEndDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择活动结束时间", false);
     }
     else
     {
         string str = string.Empty;
         if (this.fileUpload.HasFile)
         {
             try
             {
                 str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
             }
             catch
             {
                 this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                 return;
             }
         }
         string str2 = string.Empty;
         for (int i = 0; i < this.cbList.Items.Count; i++)
         {
             if (this.cbList.Items[i].Selected)
             {
                 str2 = str2 + "," + this.cbList.Items[i].Value;
             }
         }
         if (!string.IsNullOrEmpty(str2))
         {
             LotteryTicketInfo info = new LotteryTicketInfo {
                 GradeIds         = str2,
                 MinValue         = Convert.ToInt32(this.txtMinValue.Text),
                 InvitationCode   = this.txtCode.Text.Trim(),
                 ActivityName     = this.txtActiveName.Text,
                 ActivityKey      = this.txtKeyword.Text,
                 ActivityDesc     = this.txtdesc.Text,
                 ActivityPic      = str,
                 ActivityType     = 4,
                 StartTime        = this.calendarStartDate.SelectedDate.Value,
                 OpenTime         = this.calendarOpenDate.SelectedDate.Value.AddHours((double)this.ddlHours.SelectedIndex),
                 EndTime          = this.calendarEndDate.SelectedDate.Value,
                 PrizeSettingList = new List <PrizeSetting>()
             };
             try
             {
                 PrizeSetting item = new PrizeSetting {
                     PrizeName  = this.txtPrize1.Text,
                     PrizeNum   = Convert.ToInt32(this.txtPrize1Num.Text),
                     PrizeLevel = "一等奖"
                 };
                 info.PrizeSettingList.Add(item);
                 PrizeSetting setting2 = new PrizeSetting {
                     PrizeName  = this.txtPrize2.Text,
                     PrizeNum   = Convert.ToInt32(this.txtPrize2Num.Text),
                     PrizeLevel = "二等奖"
                 };
                 info.PrizeSettingList.Add(setting2);
                 PrizeSetting setting3 = new PrizeSetting {
                     PrizeName  = this.txtPrize3.Text,
                     PrizeNum   = Convert.ToInt32(this.txtPrize3Num.Text),
                     PrizeLevel = "三等奖"
                 };
                 info.PrizeSettingList.Add(setting3);
             }
             catch (FormatException)
             {
                 this.ShowMsg("奖品数量格式错误", false);
                 return;
             }
             if (this.ChkOpen.Checked)
             {
                 try
                 {
                     PrizeSetting setting4 = new PrizeSetting {
                         PrizeName  = this.txtPrize4.Text,
                         PrizeNum   = Convert.ToInt32(this.txtPrize4Num.Text),
                         PrizeLevel = "四等奖"
                     };
                     info.PrizeSettingList.Add(setting4);
                     PrizeSetting setting5 = new PrizeSetting {
                         PrizeName  = this.txtPrize5.Text,
                         PrizeNum   = Convert.ToInt32(this.txtPrize5Num.Text),
                         PrizeLevel = "五等奖"
                     };
                     info.PrizeSettingList.Add(setting5);
                     PrizeSetting setting6 = new PrizeSetting {
                         PrizeName  = this.txtPrize6.Text,
                         PrizeNum   = Convert.ToInt32(this.txtPrize6Num.Text),
                         PrizeLevel = "六等奖"
                     };
                     info.PrizeSettingList.Add(setting6);
                 }
                 catch (FormatException)
                 {
                     this.ShowMsg("奖品数量格式错误", false);
                     return;
                 }
             }
             int num2 = VShopHelper.SaveLotteryTicket(info);
             if (num2 > 0)
             {
                 ReplyInfo reply = new TextReplyInfo {
                     Keys        = info.ActivityKey,
                     MatchType   = MatchType.Equal,
                     MessageType = MessageType.Text,
                     ReplyType   = ReplyType.Ticket,
                     ActivityId  = num2
                 };
                 ReplyHelper.SaveReply(reply);
                 base.Response.Redirect("ManageLotteryTicket.aspx");
             }
         }
         else
         {
             this.ShowMsg("请选择活动会员等级", false);
         }
     }
 }
コード例 #24
0
        protected void btnUpdateActivity_Click(object sender, System.EventArgs e)
        {
            if (!this.calendarStartDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择活动开始时间", false);
            }
            else
            {
                if (!this.calendarOpenDate.SelectedDate.HasValue)
                {
                    this.ShowMsg("请选择抽奖开始时间", false);
                }
                else
                {
                    if (!this.calendarEndDate.SelectedDate.HasValue)
                    {
                        this.ShowMsg("请选择活动结束时间", false);
                    }
                    else
                    {
                        string imageUrl = string.Empty;
                        if (this.fileUpload.HasFile)
                        {
                            try
                            {
                                imageUrl = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
                                goto IL_104;
                            }
                            catch
                            {
                                this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                                return;
                            }
                        }
                        if (string.IsNullOrEmpty(this.imgPic.ImageUrl))
                        {
                            this.ShowMsg("您没有选择上传的图片文件!", false);
                            return;
                        }
                        imageUrl = this.imgPic.ImageUrl;
IL_104:
                        string str2 = string.Empty;
                        for (int i = 0; i < this.cbList.Items.Count; i++)
                        {
                            if (this.cbList.Items[i].Selected)
                            {
                                str2 = str2 + "," + this.cbList.Items[i].Value;
                            }
                        }
                        if (string.IsNullOrEmpty(str2))
                        {
                            this.ShowMsg("请选择活动会员等级", false);
                        }
                        else
                        {
                            LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(this.activityid);
                            if (lotteryTicket.ActivityKey != this.txtKeyword.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
                            {
                                this.ShowMsg("关键字重复!", false);
                            }
                            else
                            {
                                lotteryTicket.GradeIds       = str2;
                                lotteryTicket.MinValue       = System.Convert.ToInt32(this.txtMinValue.Text);
                                lotteryTicket.InvitationCode = this.txtCode.Text.Trim();
                                lotteryTicket.ActivityName   = this.txtActiveName.Text;
                                lotteryTicket.ActivityKey    = this.txtKeyword.Text;
                                lotteryTicket.ActivityDesc   = this.txtdesc.Text;
                                lotteryTicket.ActivityPic    = imageUrl;
                                lotteryTicket.StartTime      = this.calendarStartDate.SelectedDate.Value;
                                lotteryTicket.OpenTime       = this.calendarOpenDate.SelectedDate.Value.AddHours((double)this.ddlHours.SelectedIndex);
                                lotteryTicket.EndTime        = this.calendarEndDate.SelectedDate.Value;
                                int num2;
                                if (int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2) && int.TryParse(this.txtPrize3Num.Text, out num2))
                                {
                                    lotteryTicket.PrizeSettingList.Clear();
                                    PrizeSetting item = new PrizeSetting
                                    {
                                        PrizeName  = this.txtPrize1.Text,
                                        PrizeNum   = System.Convert.ToInt32(this.txtPrize1Num.Text),
                                        PrizeLevel = "一等奖"
                                    };
                                    lotteryTicket.PrizeSettingList.Add(item);
                                    PrizeSetting setting2 = new PrizeSetting
                                    {
                                        PrizeName  = this.txtPrize2.Text,
                                        PrizeNum   = System.Convert.ToInt32(this.txtPrize2Num.Text),
                                        PrizeLevel = "二等奖"
                                    };
                                    lotteryTicket.PrizeSettingList.Add(setting2);
                                    PrizeSetting setting3 = new PrizeSetting
                                    {
                                        PrizeName  = this.txtPrize3.Text,
                                        PrizeNum   = System.Convert.ToInt32(this.txtPrize3Num.Text),
                                        PrizeLevel = "三等奖"
                                    };
                                    lotteryTicket.PrizeSettingList.Add(setting3);
                                    if (this.ChkOpen.Checked)
                                    {
                                        if (string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text) || string.IsNullOrEmpty(this.txtPrize6.Text))
                                        {
                                            this.ShowMsg("开启四五六名必须填写", false);
                                            return;
                                        }
                                        if (!int.TryParse(this.txtPrize4Num.Text, out num2) || !int.TryParse(this.txtPrize5Num.Text, out num2) || !int.TryParse(this.txtPrize6Num.Text, out num2))
                                        {
                                            this.ShowMsg("奖品数量必须为数字!", false);
                                            return;
                                        }
                                        PrizeSetting setting4 = new PrizeSetting
                                        {
                                            PrizeName  = this.txtPrize4.Text,
                                            PrizeNum   = System.Convert.ToInt32(this.txtPrize4Num.Text),
                                            PrizeLevel = "四等奖"
                                        };
                                        lotteryTicket.PrizeSettingList.Add(setting4);
                                        PrizeSetting setting5 = new PrizeSetting
                                        {
                                            PrizeName  = this.txtPrize5.Text,
                                            PrizeNum   = System.Convert.ToInt32(this.txtPrize5Num.Text),
                                            PrizeLevel = "五等奖"
                                        };
                                        lotteryTicket.PrizeSettingList.Add(setting5);
                                        PrizeSetting setting6 = new PrizeSetting
                                        {
                                            PrizeName  = this.txtPrize6.Text,
                                            PrizeNum   = System.Convert.ToInt32(this.txtPrize6Num.Text),
                                            PrizeLevel = "六等奖"
                                        };
                                        lotteryTicket.PrizeSettingList.Add(setting6);
                                    }
                                    if (VShopHelper.UpdateLotteryTicket(lotteryTicket))
                                    {
                                        this.imgPic.ImageUrl = imageUrl;
                                        base.Response.Redirect("ManageLotteryTicket.aspx");
                                    }
                                }
                                else
                                {
                                    this.ShowMsg("奖品数量必须为数字!", false);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #25
0
 protected void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else if (!this.calendarStartDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择活动开始时间", false);
     }
     else if (!this.calendarOpenDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择抽奖开始时间", false);
     }
     else if (!this.calendarEndDate.SelectedDate.HasValue)
     {
         this.ShowMsg("请选择活动结束时间", false);
     }
     else if (this.calendarEndDate.SelectedDate.Value < this.calendarStartDate.SelectedDate.Value)
     {
         this.ShowMsg("活动开始时间不能晚于活动结束时间", false);
     }
     else
     {
         string activityPic = this.UploadImage();
         string text        = string.Empty;
         for (int i = 0; i < this.cbList.Items.Count; i++)
         {
             if (this.cbList.Items[i].Selected)
             {
                 text = text + "," + this.cbList.Items[i].Value;
             }
         }
         if (string.IsNullOrEmpty(text))
         {
             this.ShowMsg("请选择活动会员等级", false);
         }
         else
         {
             LotteryTicketInfo lotteryTicketInfo = new LotteryTicketInfo();
             lotteryTicketInfo.GradeIds         = text;
             lotteryTicketInfo.MinValue         = Convert.ToInt32(this.txtMinValue.Text);
             lotteryTicketInfo.InvitationCode   = this.txtCode.Text.Trim();
             lotteryTicketInfo.ActivityName     = this.txtActiveName.Text;
             lotteryTicketInfo.ActivityKey      = this.txtKeyword.Text;
             lotteryTicketInfo.ActivityDesc     = this.txtdesc.Text;
             lotteryTicketInfo.ActivityPic      = activityPic;
             lotteryTicketInfo.ActivityType     = 4;
             lotteryTicketInfo.StartTime        = this.calendarStartDate.SelectedDate.Value;
             lotteryTicketInfo.OpenTime         = this.calendarOpenDate.SelectedDate.Value;
             lotteryTicketInfo.EndTime          = this.calendarEndDate.SelectedDate.Value;
             lotteryTicketInfo.PrizeSettingList = new List <PrizeSetting>();
             try
             {
                 lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                 {
                     PrizeName  = this.txtPrize1.Text,
                     PrizeNum   = Convert.ToInt32(this.txtPrize1Num.Text),
                     PrizeLevel = "一等奖"
                 });
                 lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                 {
                     PrizeName  = this.txtPrize2.Text,
                     PrizeNum   = Convert.ToInt32(this.txtPrize2Num.Text),
                     PrizeLevel = "二等奖"
                 });
                 lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                 {
                     PrizeName  = this.txtPrize3.Text,
                     PrizeNum   = Convert.ToInt32(this.txtPrize3Num.Text),
                     PrizeLevel = "三等奖"
                 });
             }
             catch (FormatException)
             {
                 this.ShowMsg("奖品数量格式错误", false);
                 return;
             }
             if (this.ooOpen.SelectedValue)
             {
                 try
                 {
                     lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                     {
                         PrizeName  = this.txtPrize4.Text,
                         PrizeNum   = Convert.ToInt32(this.txtPrize4Num.Text),
                         PrizeLevel = "四等奖"
                     });
                     lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                     {
                         PrizeName  = this.txtPrize5.Text,
                         PrizeNum   = Convert.ToInt32(this.txtPrize5Num.Text),
                         PrizeLevel = "五等奖"
                     });
                     lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                     {
                         PrizeName  = this.txtPrize6.Text,
                         PrizeNum   = Convert.ToInt32(this.txtPrize6Num.Text),
                         PrizeLevel = "六等奖"
                     });
                 }
                 catch (FormatException)
                 {
                     this.ShowMsg("奖品数量格式错误", false);
                     return;
                 }
             }
             int num = VShopHelper.SaveLotteryTicket(lotteryTicketInfo);
             if (num > 0)
             {
                 ReplyInfo replyInfo = new TextReplyInfo();
                 replyInfo.Keys        = lotteryTicketInfo.ActivityKey;
                 replyInfo.MatchType   = MatchType.Equal;
                 replyInfo.MessageType = MessageType.Text;
                 replyInfo.ReplyType   = ReplyType.Ticket;
                 replyInfo.ActivityId  = num;
                 ReplyHelper.SaveReply(replyInfo);
                 base.Response.Redirect("ManageLotteryTicket.aspx");
             }
         }
     }
 }
コード例 #26
0
 private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
 {
     System.Collections.Generic.IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Topic);
     if (replies != null && replies.Count > 0)
     {
         foreach (ReplyInfo current in replies)
         {
             if (current.Keys == key)
             {
                 TopicInfo topicInfo = VShopHelper.Gettopic(current.ActivityId);
                 if (topicInfo != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = topicInfo.Title,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, topicInfo.IconUrl),
                                 Title       = topicInfo.Title,
                                 Url         = string.Format("http://{0}/vshop/Topics.aspx?TopicId={1}", System.Web.HttpContext.Current.Request.Url.Host, topicInfo.TopicId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies2 = ReplyHelper.GetReplies(ReplyType.Vote);
     if (replies2 != null && replies2.Count > 0)
     {
         foreach (ReplyInfo current2 in replies2)
         {
             if (current2.Keys == key)
             {
                 VoteInfo voteById = StoreHelper.GetVoteById((long)current2.ActivityId);
                 if (voteById != null && voteById.IsBackup)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = voteById.VoteName,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.ImageUrl),
                                 Title       = voteById.VoteName,
                                 Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.VoteId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies3 = ReplyHelper.GetReplies(ReplyType.Wheel);
     if (replies3 != null && replies3.Count > 0)
     {
         foreach (ReplyInfo current3 in replies3)
         {
             if (current3.Keys == key)
             {
                 LotteryActivityInfo lotteryActivityInfo = VShopHelper.GetLotteryActivityInfo(current3.ActivityId);
                 if (lotteryActivityInfo != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryActivityInfo.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityPic),
                                 Title       = lotteryActivityInfo.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/BigWheel.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies4 = ReplyHelper.GetReplies(ReplyType.Scratch);
     if (replies4 != null && replies4.Count > 0)
     {
         foreach (ReplyInfo current4 in replies4)
         {
             if (current4.Keys == key)
             {
                 LotteryActivityInfo lotteryActivityInfo2 = VShopHelper.GetLotteryActivityInfo(current4.ActivityId);
                 if (lotteryActivityInfo2 != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryActivityInfo2.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo2.ActivityPic),
                                 Title       = lotteryActivityInfo2.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/Scratch.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo2.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies5 = ReplyHelper.GetReplies(ReplyType.SmashEgg);
     if (replies5 != null && replies5.Count > 0)
     {
         foreach (ReplyInfo current5 in replies5)
         {
             if (current5.Keys == key)
             {
                 LotteryActivityInfo lotteryActivityInfo3 = VShopHelper.GetLotteryActivityInfo(current5.ActivityId);
                 if (lotteryActivityInfo3 != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryActivityInfo3.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo3.ActivityPic),
                                 Title       = lotteryActivityInfo3.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/SmashEgg.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo3.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies6 = ReplyHelper.GetReplies(ReplyType.SignUp);
     if (replies6 != null && replies6.Count > 0)
     {
         foreach (ReplyInfo current6 in replies6)
         {
             if (current6.Keys == key)
             {
                 ActivityInfo activity = VShopHelper.GetActivity(current6.ActivityId);
                 if (activity != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = activity.Description,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, activity.PicUrl),
                                 Title       = activity.Name,
                                 Url         = string.Format("http://{0}/vshop/Activity.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, activity.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     System.Collections.Generic.IList <ReplyInfo> replies7 = ReplyHelper.GetReplies(ReplyType.Ticket);
     if (replies7 != null && replies7.Count > 0)
     {
         foreach (ReplyInfo current7 in replies7)
         {
             if (current7.Keys == key)
             {
                 LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(current7.ActivityId);
                 if (lotteryTicket != null)
                 {
                     AbstractResponse result = new NewsResponse
                     {
                         CreateTime   = System.DateTime.Now,
                         FromUserName = request.ToUserName,
                         ToUserName   = request.FromUserName,
                         //修改1
                         Articles =
                         {
                             new Article
                             {
                                 Description = lotteryTicket.ActivityDesc,
                                 PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityPic),
                                 Title       = lotteryTicket.ActivityName,
                                 Url         = string.Format("http://{0}/vshop/SignUp.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityId)
                             }
                         }
                     };
                     return(result);
                 }
             }
         }
     }
     return(null);
 }
コード例 #27
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);
        }
コード例 #28
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            System.Collections.Generic.IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Topic);
            AbstractResponse result;

            if (replies != null && replies.Count > 0)
            {
                foreach (ReplyInfo info in replies)
                {
                    if (info.Keys == key)
                    {
                        TopicInfo topic = VShopHelper.Gettopic(info.ActivityId);
                        if (topic != null)
                        {
                            NewsResponse response = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article item = new Article
                            {
                                Description = topic.Title,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, topic.IconUrl),
                                Title       = topic.Title,
                                Url         = string.Format("http://{0}/vshop/Topics.aspx?TopicId={1}", System.Web.HttpContext.Current.Request.Url.Host, topic.TopicId)
                            };
                            response.Articles.Add(item);
                            result = response;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list2 = ReplyHelper.GetReplies(ReplyType.Vote);
            if (list2 != null && list2.Count > 0)
            {
                foreach (ReplyInfo info2 in list2)
                {
                    if (info2.Keys == key)
                    {
                        VoteInfo voteById = StoreHelper.GetVoteById((long)info2.ActivityId);
                        if (voteById != null && voteById.IsBackup)
                        {
                            NewsResponse response2 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article2 = new Article
                            {
                                Description = voteById.VoteName,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.ImageUrl),
                                Title       = voteById.VoteName,
                                Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", System.Web.HttpContext.Current.Request.Url.Host, voteById.VoteId)
                            };
                            response2.Articles.Add(article2);
                            result = response2;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list3 = ReplyHelper.GetReplies(ReplyType.Wheel);
            if (list3 != null && list3.Count > 0)
            {
                foreach (ReplyInfo info3 in list3)
                {
                    if (info3.Keys == key)
                    {
                        LotteryActivityInfo lotteryActivityInfo = VShopHelper.GetLotteryActivityInfo(info3.ActivityId);
                        if (lotteryActivityInfo != null)
                        {
                            NewsResponse response3 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article3 = new Article
                            {
                                Description = lotteryActivityInfo.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityPic),
                                Title       = lotteryActivityInfo.ActivityName,
                                Url         = string.Format("http://{0}/vshop/BigWheel.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryActivityInfo.ActivityId)
                            };
                            response3.Articles.Add(article3);
                            result = response3;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list4 = ReplyHelper.GetReplies(ReplyType.Scratch);
            if (list4 != null && list4.Count > 0)
            {
                foreach (ReplyInfo info4 in list4)
                {
                    if (info4.Keys == key)
                    {
                        LotteryActivityInfo info5 = VShopHelper.GetLotteryActivityInfo(info4.ActivityId);
                        if (info5 != null)
                        {
                            NewsResponse response4 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article4 = new Article
                            {
                                Description = info5.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, info5.ActivityPic),
                                Title       = info5.ActivityName,
                                Url         = string.Format("http://{0}/vshop/Scratch.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, info5.ActivityId)
                            };
                            response4.Articles.Add(article4);
                            result = response4;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list5 = ReplyHelper.GetReplies(ReplyType.SmashEgg);
            if (list5 != null && list5.Count > 0)
            {
                foreach (ReplyInfo info6 in list5)
                {
                    if (info6.Keys == key)
                    {
                        LotteryActivityInfo info7 = VShopHelper.GetLotteryActivityInfo(info6.ActivityId);
                        if (info7 != null)
                        {
                            NewsResponse response5 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article5 = new Article
                            {
                                Description = info7.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, info7.ActivityPic),
                                Title       = info7.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SmashEgg.aspx?activityId={1}", System.Web.HttpContext.Current.Request.Url.Host, info7.ActivityId)
                            };
                            response5.Articles.Add(article5);
                            result = response5;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list6 = ReplyHelper.GetReplies(ReplyType.SignUp);
            if (list6 != null && list6.Count > 0)
            {
                foreach (ReplyInfo info8 in list6)
                {
                    if (info8.Keys == key)
                    {
                        ActivityInfo activity = VShopHelper.GetActivity(info8.ActivityId);
                        if (activity != null)
                        {
                            NewsResponse response6 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article6 = new Article
                            {
                                Description = activity.Description,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, activity.PicUrl),
                                Title       = activity.Name,
                                Url         = string.Format("http://{0}/vshop/Activity.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, activity.ActivityId)
                            };
                            response6.Articles.Add(article6);
                            result = response6;
                            return(result);
                        }
                    }
                }
            }
            System.Collections.Generic.IList <ReplyInfo> list7 = ReplyHelper.GetReplies(ReplyType.Ticket);
            if (list7 != null && list7.Count > 0)
            {
                foreach (ReplyInfo info9 in list7)
                {
                    if (info9.Keys == key)
                    {
                        LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(info9.ActivityId);
                        if (lotteryTicket != null)
                        {
                            NewsResponse response7 = new NewsResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new System.Collections.Generic.List <Article>()
                            };
                            Article article7 = new Article
                            {
                                Description = lotteryTicket.ActivityDesc,
                                PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityPic),
                                Title       = lotteryTicket.ActivityName,
                                Url         = string.Format("http://{0}/vshop/SignUp.aspx?id={1}", System.Web.HttpContext.Current.Request.Url.Host, lotteryTicket.ActivityId)
                            };
                            response7.Articles.Add(article7);
                            result = response7;
                            return(result);
                        }
                    }
                }
            }
            result = null;
            return(result);
        }
コード例 #29
0
        protected void btnAddActivity_Click(object sender, System.EventArgs e)
        {
            if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
                return;
            }
            if (!this.calendarStartDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择活动开始时间", false);
                return;
            }
            if (!this.calendarOpenDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择抽奖开始时间", false);
                return;
            }
            if (!this.calendarEndDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择活动结束时间", false);
                return;
            }
            if (this.calendarEndDate.SelectedDate.Value < this.calendarStartDate.SelectedDate.Value)
            {
                this.ShowMsg("活动开始时间不能晚于活动结束时间", false);
                return;
            }
            string activityPic = string.Empty;

            if (this.fileUpload.HasFile)
            {
                try
                {
                    activityPic = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
            }
            string text = string.Empty;

            for (int i = 0; i < this.cbList.Items.Count; i++)
            {
                if (this.cbList.Items[i].Selected)
                {
                    text = text + "," + this.cbList.Items[i].Value;
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                LotteryTicketInfo lotteryTicketInfo = new LotteryTicketInfo();
                lotteryTicketInfo.GradeIds         = text;
                lotteryTicketInfo.MinValue         = System.Convert.ToInt32(this.txtMinValue.Text);
                lotteryTicketInfo.InvitationCode   = this.txtCode.Text.Trim();
                lotteryTicketInfo.ActivityName     = this.txtActiveName.Text;
                lotteryTicketInfo.ActivityKey      = this.txtKeyword.Text;
                lotteryTicketInfo.ActivityDesc     = this.txtdesc.Text;
                lotteryTicketInfo.ActivityPic      = activityPic;
                lotteryTicketInfo.ActivityType     = 4;
                lotteryTicketInfo.StartTime        = this.calendarStartDate.SelectedDate.Value;
                lotteryTicketInfo.OpenTime         = this.calendarOpenDate.SelectedDate.Value.AddHours((double)this.ddlHours.SelectedIndex);
                lotteryTicketInfo.EndTime          = this.calendarEndDate.SelectedDate.Value;
                lotteryTicketInfo.PrizeSettingList = new System.Collections.Generic.List <PrizeSetting>();
                try
                {
                    lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                    {
                        PrizeName  = this.txtPrize1.Text,
                        PrizeNum   = System.Convert.ToInt32(this.txtPrize1Num.Text),
                        PrizeLevel = "一等奖"
                    });
                    lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                    {
                        PrizeName  = this.txtPrize2.Text,
                        PrizeNum   = System.Convert.ToInt32(this.txtPrize2Num.Text),
                        PrizeLevel = "二等奖"
                    });
                    lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                    {
                        PrizeName  = this.txtPrize3.Text,
                        PrizeNum   = System.Convert.ToInt32(this.txtPrize3Num.Text),
                        PrizeLevel = "三等奖"
                    });
                }
                catch (System.FormatException)
                {
                    this.ShowMsg("奖品数量格式错误", false);
                    return;
                }
                if (this.ChkOpen.Checked)
                {
                    try
                    {
                        lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                        {
                            PrizeName  = this.txtPrize4.Text,
                            PrizeNum   = System.Convert.ToInt32(this.txtPrize4Num.Text),
                            PrizeLevel = "四等奖"
                        });
                        lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                        {
                            PrizeName  = this.txtPrize5.Text,
                            PrizeNum   = System.Convert.ToInt32(this.txtPrize5Num.Text),
                            PrizeLevel = "五等奖"
                        });
                        lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting
                        {
                            PrizeName  = this.txtPrize6.Text,
                            PrizeNum   = System.Convert.ToInt32(this.txtPrize6Num.Text),
                            PrizeLevel = "六等奖"
                        });
                    }
                    catch (System.FormatException)
                    {
                        this.ShowMsg("奖品数量格式错误", false);
                        return;
                    }
                }
                int num = VShopHelper.SaveLotteryTicket(lotteryTicketInfo);
                if (num > 0)
                {
                    ReplyHelper.SaveReply(new TextReplyInfo
                    {
                        Keys        = lotteryTicketInfo.ActivityKey,
                        MatchType   = MatchType.Equal,
                        MessageType = MessageType.Text,
                        ReplyType   = ReplyType.Ticket,
                        ActivityId  = num
                    });
                    base.Response.Redirect("ManageLotteryTicket.aspx");
                }
                return;
            }
            this.ShowMsg("请选择活动会员等级", false);
        }