Beispiel #1
0
        private bool CreateVshopKeyReply(long voteId, string picUrl)
        {
            NewsReplyInfo newsReplyInfo = new NewsReplyInfo();

            newsReplyInfo.IsDisable = false;
            if (!string.IsNullOrWhiteSpace(this.txtKeys.Text))
            {
                newsReplyInfo.Keys = this.txtKeys.Text.Trim();
            }
            newsReplyInfo.MatchType   = MatchType.Like;
            newsReplyInfo.MessageType = MessageType.News;
            newsReplyInfo.ReplyType   = ReplyType.Keys;
            NewsMsgInfo item = new NewsMsgInfo
            {
                Reply       = newsReplyInfo,
                Content     = this.txtAddVoteName.Text,
                Description = this.txtAddVoteName.Text,
                Title       = this.txtAddVoteName.Text,
                Url         = base.Request.Url.Authority + "/vshop/Vote.aspx?voteId=" + voteId,
                PicUrl      = picUrl
            };

            newsReplyInfo.NewsMsg = new List <NewsMsgInfo>();
            newsReplyInfo.NewsMsg.Add(item);
            return(ReplyHelper.SaveReply(newsReplyInfo));
        }
Beispiel #2
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
            }
            else
            {
                TextReplyInfo info = new TextReplyInfo();
                info.IsDisable = !this.radDisable.SelectedValue;
                if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
                {
                    info.Keys = this.txtKeys.Text.Trim();
                }
                info.Text      = this.fcContent.Text.Trim();
                info.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
                if (this.chkKeys.Checked)
                {
                    info.ReplyType |= ReplyType.Keys;
                }
                if (this.chkSub.Checked)
                {
                    info.ReplyType |= ReplyType.Subscribe;
                }
                if (this.chkNo.Checked)
                {
                    info.ReplyType |= ReplyType.NoMatch;
                }
                if (info.ReplyType == ReplyType.None)
                {
                    this.ShowMsg("请选择回复类型", false);
                }
                else
                {
                    if (ReplyHelper.SaveReply(info))
                    {
                        Hishop.Weixin.MP.Domain.TemplateMessage msg = new Hishop.Weixin.MP.Domain.TemplateMessage();


                        this.ShowMsg("添加成功", true);
                    }
                    else
                    {
                        this.ShowMsg("添加失败", false);
                    }
                }
            }
        }
Beispiel #3
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
                return;
            }
            TextReplyInfo textReplyInfo = new TextReplyInfo();

            textReplyInfo.IsDisable = !this.radDisable.SelectedValue;
            if ((this.chkKeys.Checked || this.chkKefu.Checked) && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
            {
                textReplyInfo.Keys = this.txtKeys.Text.Trim();
            }
            textReplyInfo.Text      = this.fcContent.Text.Trim();
            textReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
            if (this.chkKeys.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.Keys;
            }
            if (this.chkSub.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.Subscribe;
            }
            if (this.chkNo.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.NoMatch;
            }
            if (this.chkKefu.Checked)
            {
                textReplyInfo.ReplyType |= ReplyType.Kefu;
            }
            if (textReplyInfo.ReplyType == ReplyType.None)
            {
                this.ShowMsg("请选择回复类型", false);
                return;
            }
            if (ReplyHelper.SaveReply(textReplyInfo))
            {
                this.ShowMsg("添加成功", true);
                return;
            }
            this.ShowMsg("添加失败", false);
        }
 protected void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else
     {
         string str = string.Empty;
         if (this.fileUpload.HasFile)
         {
             try
             {
                 str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
                 if (!this.calendarStartDate.SelectedDate.HasValue)
                 {
                     this.ShowMsg("请选择活动开始时间", false);
                 }
                 else if (!this.calendarEndDate.SelectedDate.HasValue)
                 {
                     this.ShowMsg("请选择活动结束时间", false);
                 }
                 else
                 {
                     int num;
                     if (!int.TryParse(this.txtMaxNum.Text, out num) || (num.ToString() != this.txtMaxNum.Text))
                     {
                         this.ShowMsg("可抽奖次数必须是整数", false);
                     }
                     else
                     {
                         int num2;
                         LotteryActivityInfo info = new LotteryActivityInfo {
                             ActivityName = this.txtActiveName.Text,
                             ActivityKey  = this.txtKeyword.Text,
                             ActivityDesc = this.txtdesc.Text,
                             ActivityPic  = str,
                             ActivityType = this.type,
                             StartTime    = this.calendarStartDate.SelectedDate.Value,
                             EndTime      = this.calendarEndDate.SelectedDate.Value,
                             MaxNum       = Convert.ToInt32(this.txtMaxNum.Text)
                         };
                         List <PrizeSetting> list = new List <PrizeSetting>();
                         if ((int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2)) && int.TryParse(this.txtPrize3Num.Text, out num2))
                         {
                             decimal             num3       = Convert.ToDecimal(this.txtProbability1.Text);
                             decimal             num4       = Convert.ToDecimal(this.txtProbability2.Text);
                             decimal             num5       = Convert.ToDecimal(this.txtProbability3.Text);
                             List <PrizeSetting> collection = new List <PrizeSetting>();
                             PrizeSetting        item       = new PrizeSetting {
                                 PrizeName   = this.txtPrize1.Text,
                                 PrizeNum    = Convert.ToInt32(this.txtPrize1Num.Text),
                                 PrizeLevel  = "一等奖",
                                 Probability = num3
                             };
                             collection.Add(item);
                             PrizeSetting setting2 = new PrizeSetting {
                                 PrizeName   = this.txtPrize2.Text,
                                 PrizeNum    = Convert.ToInt32(this.txtPrize2Num.Text),
                                 PrizeLevel  = "二等奖",
                                 Probability = num4
                             };
                             collection.Add(setting2);
                             PrizeSetting setting3 = new PrizeSetting {
                                 PrizeName   = this.txtPrize3.Text,
                                 PrizeNum    = Convert.ToInt32(this.txtPrize3Num.Text),
                                 PrizeLevel  = "三等奖",
                                 Probability = num5
                             };
                             collection.Add(setting3);
                             list.AddRange(collection);
                         }
                         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))
                             {
                                 decimal             num6     = Convert.ToDecimal(this.txtProbability4.Text);
                                 decimal             num7     = Convert.ToDecimal(this.txtProbability5.Text);
                                 decimal             num8     = Convert.ToDecimal(this.txtProbability6.Text);
                                 List <PrizeSetting> list3    = new List <PrizeSetting>();
                                 PrizeSetting        setting4 = new PrizeSetting {
                                     PrizeName   = this.txtPrize4.Text,
                                     PrizeNum    = Convert.ToInt32(this.txtPrize4Num.Text),
                                     PrizeLevel  = "四等奖",
                                     Probability = num6
                                 };
                                 list3.Add(setting4);
                                 PrizeSetting setting5 = new PrizeSetting {
                                     PrizeName   = this.txtPrize5.Text,
                                     PrizeNum    = Convert.ToInt32(this.txtPrize5Num.Text),
                                     PrizeLevel  = "五等奖",
                                     Probability = num7
                                 };
                                 list3.Add(setting5);
                                 PrizeSetting setting6 = new PrizeSetting {
                                     PrizeName   = this.txtPrize6.Text,
                                     PrizeNum    = Convert.ToInt32(this.txtPrize6Num.Text),
                                     PrizeLevel  = "六等奖",
                                     Probability = num8
                                 };
                                 list3.Add(setting6);
                                 list.AddRange(list3);
                             }
                             else
                             {
                                 this.ShowMsg("奖品数量必须为数字!", false);
                                 return;
                             }
                         }
                         info.PrizeSettingList = list;
                         int num9 = VShopHelper.InsertLotteryActivity(info);
                         if (num9 > 0)
                         {
                             ReplyInfo reply = new TextReplyInfo {
                                 Keys       = info.ActivityKey,
                                 MatchType  = MatchType.Equal,
                                 ActivityId = num9
                             };
                             string str2 = ((LotteryActivityType)info.ActivityType).ToString();
                             object obj2 = Enum.Parse(typeof(ReplyType), str2);
                             reply.ReplyType = (ReplyType)obj2;
                             ReplyHelper.SaveReply(reply);
                             base.Response.Redirect("ManageLotteryActivity.aspx?type=" + this.type, true);
                             this.ShowMsg("添加成功!", true);
                         }
                     }
                 }
                 return;
             }
             catch
             {
                 this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                 return;
             }
         }
         this.ShowMsg("您没有选择上传的图片文件!", false);
     }
 }
Beispiel #5
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);
         }
     }
 }
Beispiel #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            NewsReplyInfo info;
            int           num = Globals.ToNum(this.hdfMessageType.Value);
            int           articleIDByOldArticle = Globals.ToNum(this.hdfArticleID.Value);
            MessageType   msgtype = (MessageType)num;
            int           num3    = Globals.ToNum(this.rbtlMatchType.SelectedValue);

            if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && (this.type != "subscribe"))
            {
                this.ShowMsg("请输入关键词!", false);
                return;
            }
            if (this.txtKeys.Text.Trim().Length > 50)
            {
                this.ShowMsg("关键词必须少于50个字!", false);
                return;
            }
            if (num3 == 0)
            {
                this.ShowMsg("请选择匹配类型!", false);
                return;
            }
            if ((articleIDByOldArticle < 1) && (msgtype != MessageType.Text))
            {
                if (this.hdfIsOldArticle.Value == "0")
                {
                    this.ShowMsg("请先选择图文!", false);
                    return;
                }
                if (this.replyID > 0)
                {
                    articleIDByOldArticle = ReplyHelper.GetArticleIDByOldArticle(this.replyID, msgtype);
                }
            }
            switch (msgtype)
            {
            case MessageType.Text:
                if (this.fkContent.Text.Length <= 0x3e8)
                {
                    TextReplyInfo reply = new TextReplyInfo {
                        Keys      = this.txtKeys.Text.Trim(),
                        MatchType = (num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch)
                    };
                    if (reply.Keys == "*")
                    {
                        reply.ReplyType = ReplyType.NoMatch;
                        if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0)
                        {
                            this.ShowMsg("无关键字回复回复内容已存在!", false);
                            return;
                        }
                    }
                    else if (this.type == "subscribe")
                    {
                        if (ReplyHelper.GetSubscribeID(this.replyID) > 0)
                        {
                            this.ShowMsg("首次关注回复内容已存在!", false);
                            return;
                        }
                        reply.ReplyType = ReplyType.Subscribe;
                        reply.Keys      = "";
                    }
                    else
                    {
                        reply.ReplyType = ReplyType.Keys;
                        if (ReplyHelper.HasReplyKey(reply.Keys, this.replyID))
                        {
                            this.ShowMsg("该关键词已存在!", false);
                            return;
                        }
                    }
                    reply.MessageType = msgtype;
                    reply.IsDisable   = false;
                    reply.ArticleID   = articleIDByOldArticle;
                    string str = Regex.Replace(Regex.Replace(Regex.Replace(this.fkContent.Text, "</?([^>^a^p]*)>", ""), "<img([^>]*)>", ""), "<ul([^>]*)>", "");
                    reply.Text = str;
                    reply.Id   = this.replyID;
                    if (string.IsNullOrEmpty(reply.Text))
                    {
                        this.ShowMsg("请填写文本内容!", false);
                        return;
                    }
                    if (this.replyID > 0)
                    {
                        ReplyHelper.UpdateReply(reply);
                    }
                    else
                    {
                        ReplyHelper.SaveReply(reply);
                    }
                    goto Label_03D5;
                }
                this.ShowMsg("回复内容必须1000字以内!", false);
                return;

            case MessageType.News:
            case MessageType.List:
                info = new NewsReplyInfo {
                    Keys      = this.txtKeys.Text.Trim(),
                    MatchType = (num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch)
                };
                if (!(info.Keys == "*"))
                {
                    if (this.type == "subscribe")
                    {
                        info.ReplyType = ReplyType.Subscribe;
                        info.Keys      = "";
                        if (ReplyHelper.GetSubscribeID(this.replyID) > 0)
                        {
                            this.ShowMsg("首次关注回复已存在!", false);
                            return;
                        }
                    }
                    else
                    {
                        info.ReplyType = ReplyType.Keys;
                        if (ReplyHelper.HasReplyKey(info.Keys, this.replyID))
                        {
                            this.ShowMsg("该关键词已存在!", false);
                            return;
                        }
                    }
                    break;
                }
                info.ReplyType = ReplyType.NoMatch;
                if (ReplyHelper.GetNoMatchReplyID(this.replyID) <= 0)
                {
                    break;
                }
                this.ShowMsg("无关键词回复已存在!", false);
                return;

            default:
                goto Label_03D5;
            }
            info.MessageType = msgtype;
            info.IsDisable   = false;
            info.ArticleID   = articleIDByOldArticle;
            info.Id          = this.replyID;
            if (num3 < 1)
            {
                this.ShowMsg("请选择类型!", false);
                return;
            }
            if (this.replyID > 0)
            {
                ReplyHelper.UpdateReply(info);
            }
            else
            {
                ReplyHelper.SaveReply(info);
            }
Label_03D5:
            if (this.replyID > 0)
            {
                this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx");
            }
            else
            {
                this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx");
            }
        }
Beispiel #7
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            int         num         = Globals.ToNum(this.hdfMessageType.Value);
            int         num2        = Globals.ToNum(this.hdfArticleID.Value);
            MessageType messageType = (MessageType)num;
            int         num3        = Globals.ToNum(this.rbtlMatchType.SelectedValue);

            if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && this.type != "subscribe")
            {
                this.ShowMsg("请输入关键词!", false);
                return;
            }
            if (this.txtKeys.Text.Trim().Length > 50)
            {
                this.ShowMsg("关键词必须少于50个字!", false);
                return;
            }
            if (num3 == 0)
            {
                this.ShowMsg("请选择匹配类型!", false);
                return;
            }
            if (num2 < 1 && messageType != MessageType.Text)
            {
                if (this.hdfIsOldArticle.Value == "0")
                {
                    this.ShowMsg("请先选择图文!", false);
                    return;
                }
                if (this.replyID > 0)
                {
                    num2 = ReplyHelper.GetArticleIDByOldArticle(this.replyID, messageType);
                }
            }
            switch (messageType)
            {
            case MessageType.Text:
            {
                if (this.fkContent.Text.Length > 1000)
                {
                    this.ShowMsg("回复内容必须1000字以内!", false);
                    return;
                }
                TextReplyInfo textReplyInfo = new TextReplyInfo();
                textReplyInfo.Keys      = this.txtKeys.Text.Trim();
                textReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch));
                if (textReplyInfo.Keys == "*")
                {
                    textReplyInfo.ReplyType = ReplyType.NoMatch;
                    if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0)
                    {
                        this.ShowMsg("无关键字回复回复内容已存在!", false);
                        return;
                    }
                }
                else if (this.type == "subscribe")
                {
                    if (ReplyHelper.GetSubscribeID(this.replyID) > 0)
                    {
                        this.ShowMsg("首次关注回复内容已存在!", false);
                        return;
                    }
                    textReplyInfo.ReplyType = ReplyType.Subscribe;
                    textReplyInfo.Keys      = "";
                }
                else
                {
                    textReplyInfo.ReplyType = ReplyType.Keys;
                    if (ReplyHelper.HasReplyKey(textReplyInfo.Keys, this.replyID))
                    {
                        this.ShowMsg("该关键词已存在!", false);
                        return;
                    }
                }
                textReplyInfo.MessageType = messageType;
                textReplyInfo.IsDisable   = false;
                textReplyInfo.ArticleID   = num2;
                string text = this.fkContent.Text;
                text = System.Text.RegularExpressions.Regex.Replace(text, "</?([^>^a^p]*)>", "");
                text = System.Text.RegularExpressions.Regex.Replace(text, "<img([^>]*)>", "");
                text = text.Replace("<p>", "");
                text = text.Replace("</p>", "\r");
                text = text.Trim(new char[]
                    {
                        '\r'
                    });
                text = text.Replace("\r", "\r\n");
                textReplyInfo.Text = text;
                textReplyInfo.Id   = this.replyID;
                if (string.IsNullOrEmpty(textReplyInfo.Text))
                {
                    this.ShowMsg("请填写文本内容!", false);
                    return;
                }
                if (this.replyID > 0)
                {
                    ReplyHelper.UpdateReply(textReplyInfo);
                }
                else
                {
                    ReplyHelper.SaveReply(textReplyInfo);
                }
                break;
            }

            case MessageType.News:
            case MessageType.List:
            {
                NewsReplyInfo newsReplyInfo = new NewsReplyInfo();
                newsReplyInfo.Keys      = this.txtKeys.Text.Trim();
                newsReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch));
                if (newsReplyInfo.Keys == "*")
                {
                    newsReplyInfo.ReplyType = ReplyType.NoMatch;
                    if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0)
                    {
                        this.ShowMsg("无关键词回复已存在!", false);
                        return;
                    }
                }
                else if (this.type == "subscribe")
                {
                    newsReplyInfo.ReplyType = ReplyType.Subscribe;
                    newsReplyInfo.Keys      = "";
                    if (ReplyHelper.GetSubscribeID(this.replyID) > 0)
                    {
                        this.ShowMsg("首次关注回复已存在!", false);
                        return;
                    }
                }
                else
                {
                    newsReplyInfo.ReplyType = ReplyType.Keys;
                    if (ReplyHelper.HasReplyKey(newsReplyInfo.Keys, this.replyID))
                    {
                        this.ShowMsg("该关键词已存在!", false);
                        return;
                    }
                }
                newsReplyInfo.MessageType = messageType;
                newsReplyInfo.IsDisable   = false;
                newsReplyInfo.ArticleID   = num2;
                newsReplyInfo.Id          = this.replyID;
                if (num3 < 1)
                {
                    this.ShowMsg("请选择类型!", false);
                    return;
                }
                if (this.replyID > 0)
                {
                    ReplyHelper.UpdateReply(newsReplyInfo);
                }
                else
                {
                    ReplyHelper.SaveReply(newsReplyInfo);
                }
                break;
            }
            }
            if (this.replyID > 0)
            {
                this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx");
                return;
            }
            this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx");
        }
Beispiel #8
0
 protected void btnCreate_Click(object sender, System.EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.Tbtitle.Text) && !string.IsNullOrEmpty(this.Tbdescription.Text) && !string.IsNullOrEmpty(this.hdpic.Value))
     {
         if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
         {
             this.ShowMsg("关键字重复!", false);
         }
         else
         {
             NewsReplyInfo reply = new NewsReplyInfo
             {
                 IsDisable = !this.radDisable.SelectedValue
             };
             if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 reply.Keys = this.txtKeys.Text.Trim();
             }
             if (this.chkKeys.Checked && string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 this.ShowMsg("你选择了关键字回复,必须填写关键字!", false);
             }
             else
             {
                 reply.MatchType   = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
                 reply.MessageType = MessageType.News;
                 if (this.chkKeys.Checked)
                 {
                     reply.ReplyType |= ReplyType.Keys;
                 }
                 if (this.chkSub.Checked)
                 {
                     reply.ReplyType |= ReplyType.Subscribe;
                 }
                 if (this.chkNo.Checked)
                 {
                     reply.ReplyType |= ReplyType.NoMatch;
                 }
                 if (reply.ReplyType == ReplyType.None)
                 {
                     this.ShowMsg("请选择回复类型", false);
                 }
                 else
                 {
                     if (string.IsNullOrEmpty(this.Tbtitle.Text))
                     {
                         this.ShowMsg("请输入标题", false);
                     }
                     else
                     {
                         if (string.IsNullOrEmpty(this.hdpic.Value))
                         {
                             this.ShowMsg("请上传封面图", false);
                         }
                         else
                         {
                             if (string.IsNullOrEmpty(this.Tbdescription.Text))
                             {
                                 this.ShowMsg("请输入摘要", false);
                             }
                             else
                             {
                                 if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text))
                                 {
                                     this.ShowMsg("请输入内容或自定义链接", false);
                                 }
                                 else
                                 {
                                     NewsMsgInfo item = new NewsMsgInfo
                                     {
                                         Reply       = reply,
                                         Content     = this.fkContent.Text,
                                         Description = System.Web.HttpUtility.HtmlEncode(this.Tbdescription.Text),
                                         PicUrl      = this.hdpic.Value,
                                         Title       = System.Web.HttpUtility.HtmlEncode(this.Tbtitle.Text),
                                         Url         = this.TbUrl.Text.Trim()
                                     };
                                     reply.NewsMsg = new System.Collections.Generic.List <NewsMsgInfo>();
                                     reply.NewsMsg.Add(item);
                                     if (ReplyHelper.SaveReply(reply))
                                     {
                                         this.ShowMsg("添加成功", true);
                                     }
                                     else
                                     {
                                         this.ShowMsg("添加失败", false);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     else
     {
         this.ShowMsg("您填写的信息不完整!", false);
     }
 }
Beispiel #9
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");
             }
         }
     }
 }
 protected void btnCreate_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.Tbtitle.Text) && !string.IsNullOrEmpty(this.Tbdescription.Text) && !string.IsNullOrEmpty(this.hdpic.Value))
     {
         if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
         {
             this.ShowMsg("关键字重复!", false);
         }
         else
         {
             NewsReplyInfo newsReplyInfo = new NewsReplyInfo();
             string        text          = "";
             newsReplyInfo.IsDisable = !this.radDisable.SelectedValue;
             if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 newsReplyInfo.Keys = this.txtKeys.Text.Trim();
             }
             if (this.chkKeys.Checked && string.IsNullOrWhiteSpace(this.txtKeys.Text))
             {
                 this.ShowMsg("你选择了关键字回复,必须填写关键字!", false);
             }
             else
             {
                 newsReplyInfo.MatchType   = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
                 newsReplyInfo.MessageType = MessageType.News;
                 if (this.chkKeys.Checked)
                 {
                     newsReplyInfo.ReplyType |= ReplyType.Keys;
                 }
                 if (this.chkSub.Checked)
                 {
                     newsReplyInfo.ReplyType |= ReplyType.Subscribe;
                 }
                 if (this.chkNo.Checked)
                 {
                     newsReplyInfo.ReplyType |= ReplyType.NoMatch;
                 }
                 if (newsReplyInfo.ReplyType == ReplyType.None)
                 {
                     this.ShowMsg("请选择回复类型", false);
                 }
                 else if (string.IsNullOrEmpty(this.Tbtitle.Text))
                 {
                     this.ShowMsg("请输入标题", false);
                 }
                 else if (string.IsNullOrEmpty(this.hdpic.Value))
                 {
                     this.ShowMsg("请上传封面图", false);
                 }
                 else if (string.IsNullOrEmpty(this.Tbdescription.Text))
                 {
                     this.ShowMsg("请输入摘要", false);
                 }
                 else
                 {
                     if (this.chkSub.Checked)
                     {
                         if (this.ddlsubType.SelectedValue == "0")
                         {
                             if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrltoSub.Text))
                             {
                                 this.ShowMsg("请输入内容或自定义链接", false);
                                 return;
                             }
                             text = this.TbUrltoSub.Text;
                         }
                         else
                         {
                             if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.ddlCoupon.SelectedValue))
                             {
                                 this.ShowMsg("请输入内容或选择优惠券", false);
                                 return;
                             }
                             text = "http://" + HttpContext.Current.Request.Url.Host + "/Vshop/ShakeCouponsForAttention.aspx?cid=" + this.ddlCoupon.SelectedValue;
                         }
                     }
                     else
                     {
                         if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text))
                         {
                             this.ShowMsg("请输入内容或自定义链接", false);
                             return;
                         }
                         text = this.TbUrl.Text;
                     }
                     string      picUrl = Globals.SaveFile("reply", this.hdpic.Value, "/Storage/master/", true, false, "");
                     NewsMsgInfo item   = new NewsMsgInfo
                     {
                         Reply       = newsReplyInfo,
                         Content     = this.fkContent.Text,
                         Description = HttpUtility.HtmlEncode(this.Tbdescription.Text),
                         PicUrl      = picUrl,
                         Title       = HttpUtility.HtmlEncode(this.Tbtitle.Text),
                         Url         = text.Trim()
                     };
                     newsReplyInfo.NewsMsg = new List <NewsMsgInfo>();
                     newsReplyInfo.NewsMsg.Add(item);
                     if (ReplyHelper.SaveReply(newsReplyInfo))
                     {
                         this.ShowMsg("添加成功", true, "ReplyOnKey.aspx");
                     }
                     else
                     {
                         this.ShowMsg("添加失败", false);
                     }
                 }
             }
         }
     }
     else
     {
         this.ShowMsg("您填写的信息不完整!", false);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     wid = GetCurWebId();
     if (string.IsNullOrEmpty(wid))
     {
         return;
     }
     this.radMatch.Items[0].Text   = "模糊匹配";
     this.radMatch.Items[1].Text   = "精确匹配";
     this.radDisable.Items[0].Text = "启用";
     this.radDisable.Items[1].Text = "禁用";
     this.chkNo.Enabled            = ReplyHelper.GetMismatchReply(this.wid) == null;
     this.chkSub.Enabled           = ReplyHelper.GetSubscribeReply(this.wid) == null;
     if (!this.chkNo.Enabled)
     {
         this.chkNo.ToolTip = "该类型已被使用";
     }
     if (!this.chkSub.Enabled)
     {
         this.chkSub.ToolTip = "该类型已被使用";
     }
     if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"]) && !string.IsNullOrEmpty(base.Request.Form["MultiArticle"]))
     {
         string             str  = base.Request.Form["MultiArticle"];
         List <ArticleList> list = JsonConvert.DeserializeObject <List <ArticleList> >(str);
         if ((list != null) && (list.Count > 0))
         {
             NewsReplyInfo reply = new NewsReplyInfo {
                 MessageType = MessageType.List,
                 IsDisable   = base.Request.Form["radDisable"] != "true"
             };
             if (base.Request.Form["chkKeys"] == "true")
             {
                 reply.Keys = base.Request.Form.Get("Keys");
             }
             if (!string.IsNullOrWhiteSpace(reply.Keys) && ReplyHelper.HasReplyKey(reply.Keys, this.wid))
             {
                 base.Response.Write("key");
                 base.Response.End();
             }
             reply.MatchType = (base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal;
             reply.ReplyType = ReplyType.None;
             if (base.Request.Form["chkKeys"] == "true")
             {
                 reply.ReplyType |= ReplyType.Keys;
             }
             if (base.Request.Form["chkSub"] == "true")
             {
                 reply.ReplyType |= ReplyType.Subscribe;
             }
             if (base.Request.Form["chkNo"] == "true")
             {
                 reply.ReplyType |= ReplyType.NoMatch;
             }
             List <NewsMsgInfo> list2 = new List <NewsMsgInfo>();
             foreach (ArticleList list3 in list)
             {
                 if (list3.Status != "del")
                 {
                     NewsMsgInfo item = list3;
                     if (item != null)
                     {
                         item.Reply = reply;
                         list2.Add(item);
                     }
                 }
             }
             reply.NewsMsg = list2;
             if (ReplyHelper.SaveReply(reply))
             {
                 base.Response.Write("true");
                 base.Response.End();
             }
         }
     }
 }
Beispiel #12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.radMatch.Items[0].Text   = "模糊匹配";
            this.radMatch.Items[1].Text   = "精确匹配";
            this.radDisable.Items[0].Text = "启用";
            this.radDisable.Items[1].Text = "禁用";
            this.chkNo.Enabled            = (ReplyHelper.GetMismatchReply() == null);
            this.chkSub.Enabled           = (ReplyHelper.GetSubscribeReply() == null);
            if (!this.chkNo.Enabled)
            {
                this.chkNo.ToolTip = "该类型已被使用";
            }
            if (!this.chkSub.Enabled)
            {
                this.chkSub.ToolTip = "该类型已被使用";
            }
            if (string.IsNullOrEmpty(base.Request.QueryString["cmd"]))
            {
                return;
            }
            if (string.IsNullOrEmpty(base.Request.Form["MultiArticle"]))
            {
                return;
            }
            string value = base.Request.Form["MultiArticle"];

            System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject(value, typeof(System.Collections.Generic.List <ArticleList>)) as System.Collections.Generic.List <ArticleList>;
            if (list != null && list.Count > 0)
            {
                NewsReplyInfo newsReplyInfo = new NewsReplyInfo();
                newsReplyInfo.MessageType = MessageType.List;
                newsReplyInfo.IsDisable   = (base.Request.Form["radDisable"] != "true");
                if (base.Request.Form["chkKeys"] == "true")
                {
                    newsReplyInfo.Keys = base.Request.Form.Get("Keys");
                }
                if (!string.IsNullOrWhiteSpace(newsReplyInfo.Keys) && ReplyHelper.HasReplyKey(newsReplyInfo.Keys))
                {
                    base.Response.Write("key");
                    base.Response.End();
                }
                newsReplyInfo.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal);
                newsReplyInfo.ReplyType = ReplyType.None;
                if (base.Request.Form["chkKeys"] == "true")
                {
                    newsReplyInfo.ReplyType |= ReplyType.Keys;
                }
                if (base.Request.Form["chkSub"] == "true")
                {
                    newsReplyInfo.ReplyType |= ReplyType.Subscribe;
                }
                if (base.Request.Form["chkNo"] == "true")
                {
                    newsReplyInfo.ReplyType |= ReplyType.NoMatch;
                }
                System.Collections.Generic.List <NewsMsgInfo> list2 = new System.Collections.Generic.List <NewsMsgInfo>();
                foreach (ArticleList current in list)
                {
                    if (current.Status != "del")
                    {
                        NewsMsgInfo newsMsgInfo = current;
                        if (newsMsgInfo != null)
                        {
                            newsMsgInfo.Reply = newsReplyInfo;
                            list2.Add(newsMsgInfo);
                        }
                    }
                }
                newsReplyInfo.NewsMsg = list2;
                if (ReplyHelper.SaveReply(newsReplyInfo))
                {
                    base.Response.Write("true");
                    base.Response.End();
                }
            }
        }
        protected void btnAddActivity_Click(object sender, System.EventArgs e)
        {
            if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
                return;
            }
            string activityPic = string.Empty;

            if (this.fileUpload.HasFile)
            {
                try
                {
                    activityPic = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
                    goto IL_66;
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
                goto IL_59;
IL_66:
                if (!this.calendarStartDate.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;
                }
                int num;
                if (!int.TryParse(this.txtMaxNum.Text, out num) || num.ToString() != this.txtMaxNum.Text)
                {
                    this.ShowMsg("可抽奖次数必须是整数", false);
                    return;
                }
                LotteryActivityInfo lotteryActivityInfo = new LotteryActivityInfo();
                lotteryActivityInfo.ActivityName = this.txtActiveName.Text;
                lotteryActivityInfo.ActivityKey  = this.txtKeyword.Text;
                lotteryActivityInfo.ActivityDesc = this.txtdesc.Text;
                lotteryActivityInfo.ActivityPic  = activityPic;
                lotteryActivityInfo.ActivityType = this.type;
                lotteryActivityInfo.StartTime    = this.calendarStartDate.SelectedDate.Value;
                lotteryActivityInfo.EndTime      = this.calendarEndDate.SelectedDate.Value;
                lotteryActivityInfo.MaxNum       = System.Convert.ToInt32(this.txtMaxNum.Text);
                System.Collections.Generic.List <PrizeSetting> list = new System.Collections.Generic.List <PrizeSetting>();
                int num2;
                if (int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2) && int.TryParse(this.txtPrize3Num.Text, out num2))
                {
                    decimal probability  = System.Convert.ToDecimal(this.txtProbability1.Text);
                    decimal probability2 = System.Convert.ToDecimal(this.txtProbability2.Text);
                    decimal probability3 = System.Convert.ToDecimal(this.txtProbability3.Text);
                    list.AddRange(new System.Collections.Generic.List <PrizeSetting>
                    {
                        new PrizeSetting
                        {
                            PrizeName   = this.txtPrize1.Text,
                            PrizeNum    = System.Convert.ToInt32(this.txtPrize1Num.Text),
                            PrizeLevel  = "一等奖",
                            Probability = probability
                        },
                        new PrizeSetting
                        {
                            PrizeName   = this.txtPrize2.Text,
                            PrizeNum    = System.Convert.ToInt32(this.txtPrize2Num.Text),
                            PrizeLevel  = "二等奖",
                            Probability = probability2
                        },
                        new PrizeSetting
                        {
                            PrizeName   = this.txtPrize3.Text,
                            PrizeNum    = System.Convert.ToInt32(this.txtPrize3Num.Text),
                            PrizeLevel  = "三等奖",
                            Probability = probability3
                        }
                    });
                    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;
                        }
                        decimal probability4 = System.Convert.ToDecimal(this.txtProbability4.Text);
                        decimal probability5 = System.Convert.ToDecimal(this.txtProbability5.Text);
                        decimal probability6 = System.Convert.ToDecimal(this.txtProbability6.Text);
                        list.AddRange(new System.Collections.Generic.List <PrizeSetting>
                        {
                            new PrizeSetting
                            {
                                PrizeName   = this.txtPrize4.Text,
                                PrizeNum    = System.Convert.ToInt32(this.txtPrize4Num.Text),
                                PrizeLevel  = "四等奖",
                                Probability = probability4
                            },
                            new PrizeSetting
                            {
                                PrizeName   = this.txtPrize5.Text,
                                PrizeNum    = System.Convert.ToInt32(this.txtPrize5Num.Text),
                                PrizeLevel  = "五等奖",
                                Probability = probability5
                            },
                            new PrizeSetting
                            {
                                PrizeName   = this.txtPrize6.Text,
                                PrizeNum    = System.Convert.ToInt32(this.txtPrize6Num.Text),
                                PrizeLevel  = "六等奖",
                                Probability = probability6
                            }
                        });
                    }
                    lotteryActivityInfo.PrizeSettingList = list;
                    int num3 = VShopHelper.InsertLotteryActivity(lotteryActivityInfo);
                    if (num3 > 0)
                    {
                        ReplyInfo replyInfo = new TextReplyInfo();
                        replyInfo.Keys       = lotteryActivityInfo.ActivityKey;
                        replyInfo.MatchType  = MatchType.Equal;
                        replyInfo.ActivityId = num3;
                        string value = ((LotteryActivityType)lotteryActivityInfo.ActivityType).ToString();
                        object obj   = System.Enum.Parse(typeof(ReplyType), value);
                        replyInfo.ReplyType = (ReplyType)obj;
                        ReplyHelper.SaveReply(replyInfo);
                        base.Response.Redirect("ManageLotteryActivity.aspx?type=" + this.type, true);
                        this.ShowMsg("添加成功!", true);
                    }
                    return;
                }
                this.ShowMsg("奖品数量必须为数字!", false);
                return;
            }
IL_59:
            this.ShowMsg("您没有选择上传的图片文件!", false);
        }
Beispiel #14
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);
        }
		protected void Page_Load(object sender, EventArgs e)
		{
			this.radMatch.Items[0].Text = "模糊匹配";
			this.radMatch.Items[1].Text = "精确匹配";
			this.radDisable.Items[0].Text = "启用";
			this.radDisable.Items[1].Text = "禁用";
			this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null);
			this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null);
			if (!this.chkNo.Enabled)
			{
				this.chkNo.ToolTip = "该类型已被使用";
			}
			if (!this.chkSub.Enabled)
			{
				this.chkSub.ToolTip = "该类型已被使用";
			}
			if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"]) && !string.IsNullOrEmpty(base.Request.Form["MultiArticle"]))
			{
				string value = base.Request.Form["MultiArticle"];
				List<ArticleList> list = JsonConvert.DeserializeObject(value, typeof(List<ArticleList>)) as List<ArticleList>;
				if (list != null && list.Count > 0)
				{
					NewsReplyInfo newsReplyInfo = new NewsReplyInfo();
					newsReplyInfo.MessageType = MessageType.List;
					newsReplyInfo.IsDisable = (base.Request.Form["radDisable"] != "true");
					if (base.Request.Form["chkKeys"] == "true")
					{
						newsReplyInfo.Keys = base.Request.Form.Get("Keys");
					}
					if (!string.IsNullOrWhiteSpace(newsReplyInfo.Keys) && ReplyHelper.HasReplyKey(newsReplyInfo.Keys))
					{
						base.Response.Write("key");
						base.Response.End();
					}
					newsReplyInfo.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal);
					newsReplyInfo.ReplyType = ReplyType.None;
					if (base.Request.Form["chkKeys"] == "true")
					{
						newsReplyInfo.ReplyType |= ReplyType.Keys;
					}
					if (base.Request.Form["chkSub"] == "true")
					{
						newsReplyInfo.ReplyType |= ReplyType.Subscribe;
					}
					if (base.Request.Form["chkNo"] == "true")
					{
						newsReplyInfo.ReplyType |= ReplyType.NoMatch;
					}
					List<NewsMsgInfo> list2 = new List<NewsMsgInfo>();
					foreach (ArticleList item in list)
					{
						if (item.Status != "del")
						{
							NewsMsgInfo newsMsgInfo = item;
							if (newsMsgInfo != null)
							{
								newsMsgInfo.Reply = newsReplyInfo;
								list2.Add(newsMsgInfo);
							}
						}
					}
					newsReplyInfo.NewsMsg = list2;
					foreach (NewsMsgInfo item2 in newsReplyInfo.NewsMsg)
					{
						item2.PicUrl = Globals.SaveFile("article", item2.PicUrl, "/Storage/master/", true, false, "");
					}
					if (ReplyHelper.SaveReply(newsReplyInfo))
					{
						base.Response.Write("true");
						base.Response.End();
					}
				}
			}
		}