示例#1
0
        public override AbstractResponse OnTextRequest(TextRequest textRequest)
        {
            AbstractResponse keyResponse = this.GetKeyResponse(textRequest.Content, textRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            IList <ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Keys);

            if (replies == null || (replies.Count == 0 && this.IsOpenManyService()))
            {
                return(this.GotoManyCustomerService(textRequest));
            }
            foreach (ReplyInfo item in replies)
            {
                if (item.MatchType == MatchType.Equal && item.Keys == textRequest.Content)
                {
                    AbstractResponse response = this.GetResponse(item, textRequest.FromUserName, null);
                    response.ToUserName   = textRequest.FromUserName;
                    response.FromUserName = textRequest.ToUserName;
                    return(response);
                }
                if (item.MatchType == MatchType.Like && item.Keys.Contains(textRequest.Content))
                {
                    AbstractResponse response2 = this.GetResponse(item, textRequest.FromUserName, null);
                    response2.ToUserName   = textRequest.FromUserName;
                    response2.FromUserName = textRequest.ToUserName;
                    return(response2);
                }
            }
            return(this.DefaultResponse(textRequest));
        }
示例#2
0
        public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest)
        {
            WriteLog("GetSubscribeReply");
            ReplyInfo        subscribeReply = ReplyHelper.GetSubscribeReply();
            AbstractResponse result;

            if (subscribeReply == null)
            {
                WriteLog("subscribeReply == null");
                result = null;
            }
            else
            {
                WriteLog("取消关注再关注,进入这个事件");
                subscribeReply.Keys = "登录";
                AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName);

                if (response == null)
                {
                    this.GotoManyCustomerService(subscribeEventRequest);
                }
                response.ToUserName   = subscribeEventRequest.FromUserName;
                response.FromUserName = subscribeEventRequest.ToUserName;
                result = response;
                //取消关注再关注,进入这个事件
                ScanVisitDistributor(subscribeEventRequest, subscribeEventRequest.EventKey);
            }
            return(result);
        }
示例#3
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            int      num      = clickEventRequest.EventKey.ToInt(0);
            MenuInfo menuInfo = null;

            if (num > 0)
            {
                menuInfo = VShopHelper.GetMenu(num);
            }
            if (menuInfo == null)
            {
                return(null);
            }
            ReplyInfo reply = ReplyHelper.GetReply(menuInfo.ReplyId);

            if (reply == null)
            {
                return(null);
            }
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName, null);

            if (response == null)
            {
                return(this.GotoManyCustomerService(clickEventRequest));
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
示例#4
0
        protected void BindSingleArticle(int id)
        {
            NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(id) as NewsReplyInfo;

            if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0)
            {
                base.GotoResourceNotFound();
                return;
            }
            this.ViewState["MsgId"]       = newsReplyInfo.Id;
            this.txtKeys.Text             = newsReplyInfo.Keys;
            this.radMatch.SelectedValue   = (newsReplyInfo.MatchType == MatchType.Like);
            this.radDisable.SelectedValue = !newsReplyInfo.IsDisable;
            this.chkKeys.Checked          = (ReplyType.Keys == (newsReplyInfo.ReplyType & ReplyType.Keys));
            this.chkSub.Checked           = (ReplyType.Subscribe == (newsReplyInfo.ReplyType & ReplyType.Subscribe));
            this.chkNo.Checked            = (ReplyType.NoMatch == (newsReplyInfo.ReplyType & ReplyType.NoMatch));
            if (this.chkNo.Checked)
            {
                this.chkNo.Enabled = true;
                this.chkNo.ToolTip = "";
            }
            if (this.chkSub.Checked)
            {
                this.chkSub.Enabled = true;
                this.chkSub.ToolTip = "";
            }
            this.Tbtitle.Text       = newsReplyInfo.NewsMsg[0].Title;
            this.LbimgTitle.Text    = newsReplyInfo.NewsMsg[0].Title;
            this.Tbdescription.Text = System.Web.HttpUtility.HtmlDecode(newsReplyInfo.NewsMsg[0].Description);
            this.fkContent.Text     = newsReplyInfo.NewsMsg[0].Content;
            this.Lbmsgdesc.Text     = newsReplyInfo.NewsMsg[0].Description;
            this.TbUrl.Text         = newsReplyInfo.NewsMsg[0].Url;
            this.uploadpic.Src      = newsReplyInfo.NewsMsg[0].PicUrl;
            this.hdpic.Value        = newsReplyInfo.NewsMsg[0].PicUrl;
        }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     wid = GetCurWebId();
     if (string.IsNullOrEmpty(wid))
     {
         return;
     }
     this.btnAdd.Click            += new EventHandler(this.btnSubmit_Click);
     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 (!base.IsPostBack)
     {
         this.chkKeys.Checked = true;
     }
 }
示例#6
0
        private void BindArticleCategory()
        {
            List <Hidistro.Entities.VShop.ReplyInfo> list = ReplyHelper.GetAllReply().ToList <Hidistro.Entities.VShop.ReplyInfo>().FindAll(a => a.ReplyType < ReplyType.Wheel);

            this.rptList.DataSource = list;
            this.rptList.DataBind();
        }
示例#7
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            int      menuId = System.Convert.ToInt32(clickEventRequest.EventKey);
            MenuInfo menu   = VShopHelper.GetMenu(menuId);

            if (menu == null)
            {
                return(null);
            }
            ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);

            if (reply == null)
            {
                return(null);
            }
            //if (reply.ReplyType == ReplyType.Kefu)不合法
            //{
            //    this.GotoManyCustomerService(clickEventRequest);
            //}
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(clickEventRequest);
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
示例#8
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            WeiXinHelper.UpdateRencentOpenID(clickEventRequest.FromUserName);
            Hidistro.Entities.VShop.MenuInfo menu = VShopHelper.GetMenu(Convert.ToInt32(clickEventRequest.EventKey));
            if (menu == null)
            {
                return(null);
            }
            Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);
            if (reply == null)
            {
                return(null);
            }
            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(clickEventRequest);
            }
            response.ToUserName   = clickEventRequest.FromUserName;
            response.FromUserName = clickEventRequest.ToUserName;
            return(response);
        }
示例#9
0
        private void BindArticleCategory()
        {
            List <ReplyInfo> list = ReplyHelper.GetAllReply(this.wid).ToList <ReplyInfo>().FindAll(a => a.ReplyType < ReplyType.Wheel);

            this.grdArticleCategories.DataSource = list;
            this.grdArticleCategories.DataBind();
        }
示例#10
0
        public override AbstractResponse OnTextRequest(TextRequest textRequest)
        {
            WeiXinHelper.UpdateRencentOpenID(textRequest.FromUserName);
            AbstractResponse keyResponse = this.GetKeyResponse(textRequest.Content, textRequest);

            if (keyResponse != null)
            {
                return(keyResponse);
            }
            IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Keys);

            if ((replies == null) || ((replies.Count == 0) && this.IsOpenManyService()))
            {
                this.GotoManyCustomerService(textRequest);
            }
            foreach (Hidistro.Entities.VShop.ReplyInfo info in replies)
            {
                if ((info.MatchType == MatchType.Equal) && (info.Keys == textRequest.Content))
                {
                    AbstractResponse response = this.GetResponse(info, textRequest.FromUserName);
                    response.ToUserName   = textRequest.FromUserName;
                    response.FromUserName = textRequest.ToUserName;
                    return(response);
                }
                if ((info.MatchType == MatchType.Like) && info.Keys.Contains(textRequest.Content))
                {
                    AbstractResponse response3 = this.GetResponse(info, textRequest.FromUserName);
                    response3.ToUserName   = textRequest.FromUserName;
                    response3.FromUserName = textRequest.ToUserName;
                    return(response3);
                }
            }
            return(this.DefaultResponse(textRequest));
        }
示例#11
0
        private AbstractResponse GetKeyResponse(string key, AbstractRequest request)
        {
            IList <Hidistro.Entities.VShop.ReplyInfo> replies = ReplyHelper.GetReplies(ReplyType.Vote);

            if ((replies != null) && (replies.Count > 0))
            {
                foreach (Hidistro.Entities.VShop.ReplyInfo info in replies)
                {
                    if (info.Keys == key)
                    {
                        VoteInfo voteById = StoreHelper.GetVoteById((long)info.ActivityId);
                        if ((voteById != null) && voteById.IsBackup)
                        {
                            NewsResponse response = new NewsResponse
                            {
                                CreateTime   = DateTime.Now,
                                FromUserName = request.ToUserName,
                                ToUserName   = request.FromUserName,
                                Articles     = new List <Article>()
                            };
                            Article item = new Article
                            {
                                Description = voteById.VoteName,
                                PicUrl      = this.FormatImgUrl(voteById.ImageUrl),
                                Title       = voteById.VoteName,
                                Url         = string.Format("http://{0}/vshop/Vote.aspx?voteId={1}", HttpContext.Current.Request.Url.Host, voteById.VoteId)
                            };
                            response.Articles.Add(item);
                            return(response);
                        }
                    }
                }
            }
            return(null);
        }
示例#12
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));
        }
示例#13
0
        public override AbstractResponse DefaultResponse(AbstractRequest requestMessage)
        {
            ReplyInfo        mismatchReply = ReplyHelper.GetMismatchReply();
            AbstractResponse result;

            if (mismatchReply == null || this.IsOpenManyService())
            {
                result = this.GotoManyCustomerService(requestMessage);
            }
            else
            {
                AbstractResponse response = this.GetResponse(mismatchReply, requestMessage.FromUserName);
                if (response == null)
                {
                    result = this.GotoManyCustomerService(requestMessage);
                }
                else
                {
                    response.ToUserName   = requestMessage.FromUserName;
                    response.FromUserName = requestMessage.ToUserName;
                    result = response;
                }
            }
            return(result);
        }
示例#14
0
        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);
            IList <CouponInfo> allUsedCoupons = CouponHelper.GetAllUsedCoupons(1);

            if (allUsedCoupons != null && allUsedCoupons.Count > 0)
            {
                foreach (CouponInfo item in allUsedCoupons)
                {
                    if (CouponHelper.GetCouponSurplus(item.CouponId) > 0)
                    {
                        this.ddlCoupon.Items.Add(new ListItem(item.CouponName.ToNullString(), item.CouponId.ToNullString()));
                    }
                }
            }
            if (this.ddlCoupon.Items.Count == 0)
            {
                this.ddlsubType.Items.RemoveAt(1);
                this.ddlCoupon.Items.Add(new ListItem("请选择优惠券", "0"));
            }
            if (!this.chkNo.Enabled)
            {
                this.chkNo.ToolTip = "该类型已被使用";
            }
            if (!this.chkSub.Enabled)
            {
                this.chkSub.ToolTip = "该类型已被使用";
            }
        }
示例#15
0
 private void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else
     {
         int maxValue = 0;
         if (!this.txtStartDate.SelectedDate.HasValue)
         {
             this.ShowMsg("请选择开始日期!", false);
         }
         else if (!this.txtEndDate.SelectedDate.HasValue)
         {
             this.ShowMsg("请选择结束日期!", false);
         }
         else
         {
             DateTime dateTime = this.txtStartDate.SelectedDate.Value;
             if (dateTime.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0)
             {
                 this.ShowMsg("开始日期不能晚于结束日期!", false);
             }
             else if (this.txtMaxValue.Text != "" && !int.TryParse(this.txtMaxValue.Text, out maxValue))
             {
                 this.ShowMsg("人数上限格式错误!", false);
             }
             else
             {
                 VActivityInfo vActivityInfo = new VActivityInfo();
                 vActivityInfo.CloseRemark = this.txtCloseRemark.Text.Trim();
                 vActivityInfo.Description = this.txtDescription.Text.Trim();
                 VActivityInfo vActivityInfo2 = vActivityInfo;
                 dateTime = this.txtEndDate.SelectedDate.Value;
                 dateTime = dateTime.AddMinutes(59.0);
                 vActivityInfo2.EndDate  = dateTime.AddSeconds(59.0);
                 vActivityInfo.Item1     = this.txtItem1.Text.Trim();
                 vActivityInfo.Item2     = this.txtItem2.Text.Trim();
                 vActivityInfo.Item3     = this.txtItem3.Text.Trim();
                 vActivityInfo.Item4     = this.txtItem4.Text.Trim();
                 vActivityInfo.Item5     = this.txtItem5.Text.Trim();
                 vActivityInfo.Keys      = this.txtKeys.Text.Trim();
                 vActivityInfo.MaxValue  = maxValue;
                 vActivityInfo.Name      = this.txtName.Text.Trim();
                 vActivityInfo.PicUrl    = this.UploadImage();
                 vActivityInfo.StartDate = this.txtStartDate.SelectedDate.Value;
                 if (VShopHelper.SaveActivity(vActivityInfo))
                 {
                     base.Response.Redirect("ManageActivity.aspx");
                 }
                 else
                 {
                     this.ShowMsg("添加失败", false);
                 }
             }
         }
     }
 }
示例#16
0
        protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
        {
            BindType bindType = (BindType)Convert.ToInt32(this.ddlType.SelectedValue);

            switch (bindType)
            {
            case BindType.Url:
                this.liUrl.Visible   = true;
                this.liValue.Visible = false;
                break;

            case BindType.Key:
            case BindType.Topic:
                this.liUrl.Visible   = false;
                this.liValue.Visible = true;
                break;

            default:
                this.liUrl.Visible   = false;
                this.liValue.Visible = false;
                break;
            }
            this.btnAddMenu.Enabled = true;
            switch (bindType)
            {
            case BindType.Key:
                this.liTitle.InnerText   = "选择关键字:";
                this.ddlValue.DataSource = from a in ReplyHelper.GetAllReply()
                                           where !string.IsNullOrWhiteSpace(a.Keys)
                                           select a;
                this.ddlValue.DataTextField  = "Keys";
                this.ddlValue.DataValueField = "Id";
                this.ddlValue.DataBind();
                break;

            case BindType.Topic:
            {
                this.liTitle.InnerText = "选择页面:";
                IList <TopicInfo> list = VShopHelper.Gettopics();
                if (list.Count > 0)
                {
                    this.ddlValue.DataSource     = list;
                    this.ddlValue.DataTextField  = "Title";
                    this.ddlValue.DataValueField = "TopicId";
                    this.ddlValue.DataBind();
                }
                else
                {
                    this.ddlValue.Items.Clear();
                    ListItem listItem = new ListItem();
                    listItem.Text  = "";
                    listItem.Value = "";
                    this.ddlValue.Items.Insert(0, listItem);
                    this.btnAddMenu.Enabled = false;
                }
                break;
            }
            }
        }
示例#17
0
        public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest)
        {
            string text = "";

            if (subscribeEventRequest.EventKey != null)
            {
                text = subscribeEventRequest.EventKey;
            }
            if (text.Contains("qrscene_"))
            {
                text = text.Replace("qrscene_", "").Trim();
                if (text == "1")
                {
                    if (WeiXinHelper.BindAdminOpenId.Count > 10)
                    {
                        WeiXinHelper.BindAdminOpenId.Clear();
                    }
                    if (WeiXinHelper.BindAdminOpenId.ContainsKey(subscribeEventRequest.Ticket))
                    {
                        WeiXinHelper.BindAdminOpenId[subscribeEventRequest.Ticket] = subscribeEventRequest.FromUserName;
                    }
                    else
                    {
                        WeiXinHelper.BindAdminOpenId.Add(subscribeEventRequest.Ticket, subscribeEventRequest.FromUserName);
                    }
                    return(new TextResponse
                    {
                        CreateTime = System.DateTime.Now,
                        Content = "您正在扫描尝试绑定管理员身份,身份已识别",
                        ToUserName = subscribeEventRequest.FromUserName,
                        FromUserName = subscribeEventRequest.ToUserName
                    });
                }
                ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(subscribeEventRequest.Ticket);
                Globals.Debuglog(text + ":" + subscribeEventRequest.Ticket, "_Debuglog.txt");
                if (!MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName) && scanInfosByTicket != null && scanInfosByTicket.BindUserId > 0)
                {
                    this.CreatMember(subscribeEventRequest.FromUserName, scanInfosByTicket.BindUserId);
                    ScanHelp.updateScanInfosLastActiveTime(System.DateTime.Now, scanInfosByTicket.Sceneid);
                }
            }
            WeiXinHelper.UpdateRencentOpenID(subscribeEventRequest.FromUserName);
            Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply();
            if (subscribeReply == null)
            {
                return(null);
            }
            subscribeReply.Keys = "登录";
            AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName);

            if (response == null)
            {
                this.GotoManyCustomerService(subscribeEventRequest);
            }
            response.ToUserName   = subscribeEventRequest.FromUserName;
            response.FromUserName = subscribeEventRequest.ToUserName;
            return(response);
        }
示例#18
0
        protected void btnUpdateTopic_Click(object sender, System.EventArgs e)
        {
            TopicInfo topic = VShopHelper.Gettopic(this.topicId);

            if (topic.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
            }
            else
            {
                if (this.fileUpload.HasFile)
                {
                    try
                    {
                        ResourcesHelper.DeleteImage(topic.IconUrl);
                        topic.IconUrl        = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
                        this.imgPic.ImageUrl = topic.IconUrl;
                    }
                    catch
                    {
                        this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                        return;
                    }
                }
                topic.TopicId   = this.topicId;
                topic.Title     = this.txtTopicTitle.Text.Trim();
                topic.Keys      = this.txtKeys.Text.Trim();
                topic.IconUrl   = topic.IconUrl;
                topic.Content   = this.fcContent.Text;
                topic.AddedDate = System.DateTime.Now;
                topic.IsRelease = true;
                ValidationResults results = Validation.Validate <TopicInfo>(topic, new string[]
                {
                    "ValTopicInfo"
                });
                string msg = string.Empty;
                if (results.IsValid)
                {
                    if (VShopHelper.Updatetopic(topic))
                    {
                        this.ShowMsg("已经成功修改当前专题", true);
                    }
                    else
                    {
                        this.ShowMsg("修改专题失败", false);
                    }
                }
                else
                {
                    foreach (ValidationResult result in (System.Collections.Generic.IEnumerable <ValidationResult>)results)
                    {
                        msg += Formatter.FormatErrorMessage(result.Message);
                    }
                    this.ShowMsg(msg, false);
                }
            }
        }
示例#19
0
文件: AddTopic.cs 项目: tyriankid/WFX
 protected void btnAddTopic_Click(object sender, System.EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else
     {
         string str = string.Empty;
         if (this.fileUpload.HasFile)
         {
             try
             {
                 str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
             }
             catch
             {
                 this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                 return;
             }
         }
         TopicInfo target = new TopicInfo
         {
             Title     = this.txtTopicTitle.Text.Trim(),
             Keys      = this.txtKeys.Text.Trim(),
             IconUrl   = str,
             Content   = this.fcContent.Text,
             AddedDate = System.DateTime.Now,
             IsRelease = true
         };
         ValidationResults results = Validation.Validate <TopicInfo>(target, new string[]
         {
             "ValTopicInfo"
         });
         string msg = string.Empty;
         if (results.IsValid)
         {
             int num;
             if (VShopHelper.Createtopic(target, out num) && num > 0)
             {
                 base.Response.Redirect("SetTopicProducts.aspx?topicid=" + num);
             }
             else
             {
                 this.ShowMsg("添加专题错误", false);
             }
         }
         else
         {
             foreach (ValidationResult result in (System.Collections.Generic.IEnumerable <ValidationResult>)results)
             {
                 msg += Formatter.FormatErrorMessage(result.Message);
             }
             this.ShowMsg(msg, false);
         }
     }
 }
示例#20
0
        protected string RenderInfo(object menuIdObj)
        {
            ReplyInfo reply = ReplyHelper.GetReply((int)menuIdObj);

            if (reply != null)
            {
                return(reply.Keys);
            }
            return(string.Empty);
        }
示例#21
0
        protected void btnAddTopic_Click(object sender, System.EventArgs e)
        {
            if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
                return;
            }
            string iconUrl = string.Empty;

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

            topicInfo.Title     = this.txtTopicTitle.Text.Trim();
            topicInfo.Keys      = this.txtKeys.Text.Trim();
            topicInfo.IconUrl   = iconUrl;
            topicInfo.Content   = this.fcContent.Text;
            topicInfo.AddedDate = System.DateTime.Now;
            topicInfo.IsRelease = true;
            ValidationResults validationResults = Validation.Validate <TopicInfo>(topicInfo, new string[]
            {
                "ValTopicInfo"
            });
            string text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(current.Message);
                }
                this.ShowMsg(text, false);
            }
            else
            {
                int num;
                if (VShopHelper.Createtopic(topicInfo, out num) && num > 0)
                {
                    base.Response.Redirect("SetTopicProducts.aspx?topicid=" + num);
                    return;
                }
                this.ShowMsg("添加专题错误", false);
                return;
            }
        }
示例#22
0
        protected void BindSingleArticle(int id)
        {
            NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(id) as NewsReplyInfo;

            if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0)
            {
                base.GotoResourceNotFound();
            }
            else
            {
                this.ViewState["MsgId"]       = newsReplyInfo.ReplyId;
                this.txtKeys.Text             = newsReplyInfo.Keys;
                this.radMatch.SelectedValue   = (newsReplyInfo.MatchType == MatchType.Like);
                this.radDisable.SelectedValue = !newsReplyInfo.IsDisable;
                this.chkKeys.Checked          = (ReplyType.Keys == (newsReplyInfo.ReplyType & ReplyType.Keys));
                this.chkSub.Checked           = (ReplyType.Subscribe == (newsReplyInfo.ReplyType & ReplyType.Subscribe));
                this.chkNo.Checked            = (ReplyType.NoMatch == (newsReplyInfo.ReplyType & ReplyType.NoMatch));
                if (this.chkNo.Checked)
                {
                    this.chkNo.Enabled = true;
                    this.chkNo.ToolTip = "";
                }
                if (this.chkSub.Checked)
                {
                    this.chkSub.Enabled = true;
                    this.chkSub.ToolTip = "";
                }
                this.Tbtitle.Text       = newsReplyInfo.NewsMsg[0].Title;
                this.LbimgTitle.Text    = newsReplyInfo.NewsMsg[0].Title;
                this.Tbdescription.Text = HttpUtility.HtmlDecode(newsReplyInfo.NewsMsg[0].Description);
                this.fkContent.Text     = newsReplyInfo.NewsMsg[0].Content;
                this.Lbmsgdesc.Text     = newsReplyInfo.NewsMsg[0].Description;
                this.uploadpic.Src      = newsReplyInfo.NewsMsg[0].PicUrl;
                this.hdpic.Value        = newsReplyInfo.NewsMsg[0].PicUrl;
                string url = newsReplyInfo.NewsMsg[0].Url;
                if (this.chkSub.Checked)
                {
                    if (url.ToNullString().ToLower().Contains("http://" + HttpContext.Current.Request.Url.Host + "/vshop/shakecouponsforattention.aspx?cid="))
                    {
                        this.ddlsubType.SelectedValue = "1";
                        this.ddlCoupon.SelectedValue  = url.ToNullString().ToLower().Replace("http://" + HttpContext.Current.Request.Url.Host + "/vshop/shakecouponsforattention.aspx?cid=", "");
                    }
                    else
                    {
                        this.ddlsubType.SelectedValue = "0";
                        this.TbUrltoSub.Text          = url;
                    }
                }
                else
                {
                    this.TbUrl.Text = url;
                }
            }
        }
示例#23
0
        public override AbstractResponse OnEvent_ScanRequest(ScanEventRequest scanEventRequest)
        {
            string eventKey = scanEventRequest.EventKey;

            if (eventKey == "1")
            {
                if (WeiXinHelper.BindAdminOpenId.Count > 10)
                {
                    WeiXinHelper.BindAdminOpenId.Clear();
                }
                if (WeiXinHelper.BindAdminOpenId.ContainsKey(scanEventRequest.Ticket))
                {
                    WeiXinHelper.BindAdminOpenId[scanEventRequest.Ticket] = scanEventRequest.FromUserName;
                }
                else
                {
                    WeiXinHelper.BindAdminOpenId.Add(scanEventRequest.Ticket, scanEventRequest.FromUserName);
                }
                return(new TextResponse {
                    CreateTime = DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName
                });
            }
            ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(scanEventRequest.Ticket);

            Globals.Debuglog(eventKey + ":" + scanEventRequest.Ticket, "_Debuglog.txt");
            bool flag = MemberProcessor.IsExitOpenId(scanEventRequest.FromUserName);

            if ((!flag && (scanInfosByTicket != null)) && (scanInfosByTicket.BindUserId > 0))
            {
                this.CreatMember(scanEventRequest.FromUserName, scanInfosByTicket.BindUserId);
            }
            if (scanInfosByTicket != null)
            {
                ScanHelp.updateScanInfosLastActiveTime(DateTime.Now, scanInfosByTicket.Sceneid);
            }
            if (flag)
            {
                return(new TextResponse {
                    CreateTime = DateTime.Now, Content = "您刚扫描了分销商公众号二维码!", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName
                });
            }
            Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply();
            if (subscribeReply == null)
            {
                return(null);
            }
            subscribeReply.Keys = "扫描";
            AbstractResponse response = this.GetResponse(subscribeReply, scanEventRequest.FromUserName);

            response.ToUserName   = scanEventRequest.FromUserName;
            response.FromUserName = scanEventRequest.ToUserName;
            return(response);
        }
示例#24
0
        private void btnEditActivity_Click(object sender, EventArgs e)
        {
            int result = 0;

            if (!this.txtStartDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择开始日期!", false);
            }
            else if (!this.txtEndDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择结束日期!", false);
            }
            else if (this.txtStartDate.SelectedDate.Value.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0)
            {
                this.ShowMsg("开始日期不能晚于结束日期!", false);
            }
            else if ((this.txtMaxValue.Text != "") && !int.TryParse(this.txtMaxValue.Text, out result))
            {
                this.ShowMsg("人数上限格式错误!", false);
            }
            else
            {
                ActivityInfo activity = VShopHelper.GetActivity(base.GetUrlIntParam("id"));
                if ((activity.Keys != this.txtKeys.Text.Trim()) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
                {
                    this.ShowMsg("关键字重复!", false);
                }
                else
                {
                    activity.CloseRemark = this.txtCloseRemark.Text.Trim();
                    activity.Description = this.txtDescription.Text.Trim();
                    activity.EndDate     = this.txtEndDate.SelectedDate.Value.AddMinutes(59.0).AddSeconds(59.0);
                    activity.Item1       = this.txtItem1.Text.Trim();
                    activity.Item2       = this.txtItem2.Text.Trim();
                    activity.Item3       = this.txtItem3.Text.Trim();
                    activity.Item4       = this.txtItem4.Text.Trim();
                    activity.Item5       = this.txtItem5.Text.Trim();
                    activity.Keys        = this.txtKeys.Text.Trim();
                    activity.MaxValue    = result;
                    activity.Name        = this.txtName.Text.Trim();
                    activity.PicUrl      = this.uploader1.UploadedImageUrl;
                    activity.StartDate   = this.txtStartDate.SelectedDate.Value;
                    if (VShopHelper.UpdateActivity(activity))
                    {
                        base.Response.Redirect("ManageActivity.aspx");
                    }
                    else
                    {
                        this.ShowMsg("更新失败", false);
                    }
                }
            }
        }
示例#25
0
 private void btnAddActivity_Click(object sender, EventArgs e)
 {
     if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
     {
         this.ShowMsg("关键字重复!", false);
     }
     else
     {
         int result = 0;
         if (!this.txtStartDate.SelectedDate.HasValue)
         {
             this.ShowMsg("请选择开始日期!", false);
         }
         else if (!this.txtEndDate.SelectedDate.HasValue)
         {
             this.ShowMsg("请选择结束日期!", false);
         }
         else if (this.txtStartDate.SelectedDate.Value.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0)
         {
             this.ShowMsg("开始日期不能晚于结束日期!", false);
         }
         else if ((this.txtMaxValue.Text != "") && !int.TryParse(this.txtMaxValue.Text, out result))
         {
             this.ShowMsg("人数上限格式错误!", false);
         }
         else
         {
             ActivityInfo activity = new ActivityInfo {
                 CloseRemark = this.txtCloseRemark.Text.Trim(),
                 Description = this.txtDescription.Text.Trim(),
                 EndDate     = this.txtEndDate.SelectedDate.Value.AddMinutes(59.0).AddSeconds(59.0),
                 Item1       = this.txtItem1.Text.Trim(),
                 Item2       = this.txtItem2.Text.Trim(),
                 Item3       = this.txtItem3.Text.Trim(),
                 Item4       = this.txtItem4.Text.Trim(),
                 Item5       = this.txtItem5.Text.Trim(),
                 Keys        = this.txtKeys.Text.Trim(),
                 MaxValue    = result,
                 Name        = this.txtName.Text.Trim(),
                 PicUrl      = this.uploader1.UploadedImageUrl,
                 StartDate   = this.txtStartDate.SelectedDate.Value
             };
             if (VShopHelper.SaveActivity(activity))
             {
                 base.Response.Redirect("ManageActivity.aspx");
             }
             else
             {
                 this.ShowMsg("添加失败", false);
             }
         }
     }
 }
示例#26
0
 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 (!base.IsPostBack)
     {
         this.id = base.GetUrlIntParam("id");
         this.BindSingleArticle(this.id);
     }
     else
     {
         this.uploadpic.Src = this.hdpic.Value;
     }
     if (base.GetUrlBoolParam("iscallback"))
     {
         this.UploadImage();
     }
     else if (!string.IsNullOrEmpty(base.Request.Form["del"]))
     {
         string path = base.Request.Form["del"];
         string str2 = Globals.PhysicalPath(path);
         try
         {
             if (File.Exists(str2))
             {
                 File.Delete(str2);
                 base.Response.Write("true");
             }
         }
         catch (Exception)
         {
             base.Response.Write("false");
         }
         base.Response.End();
     }
 }
示例#27
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.btnAdd.Click            += new System.EventHandler(this.btnSubmit_Click);
     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 (!base.IsPostBack)
     {
         int           urlIntParam   = base.GetUrlIntParam("id");
         TextReplyInfo textReplyInfo = ReplyHelper.GetReply(urlIntParam) as TextReplyInfo;
         if (textReplyInfo == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         this.fcContent.Text           = textReplyInfo.Text;
         this.txtKeys.Text             = textReplyInfo.Keys;
         this.radMatch.SelectedValue   = (textReplyInfo.MatchType == MatchType.Like);
         this.radDisable.SelectedValue = !textReplyInfo.IsDisable;
         this.chkKeys.Checked          = (ReplyType.Keys == (textReplyInfo.ReplyType & ReplyType.Keys));
         this.chkSub.Checked           = (ReplyType.Subscribe == (textReplyInfo.ReplyType & ReplyType.Subscribe));
         this.chkNo.Checked            = (ReplyType.NoMatch == (textReplyInfo.ReplyType & ReplyType.NoMatch));
         this.chkKefu.Checked          = (ReplyType.Kefu == textReplyInfo.ReplyType);
         if (this.chkNo.Checked)
         {
             this.chkNo.Enabled = true;
             this.chkNo.ToolTip = "";
         }
         if (this.chkSub.Checked)
         {
             this.chkSub.Enabled = true;
             this.chkSub.ToolTip = "";
         }
         if (this.chkKefu.Checked)
         {
             this.chkKeys.Checked = false;
             this.chkSub.Checked  = false;
             this.chkNo.Checked   = false;
         }
     }
 }
示例#28
0
        protected void ddlType_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            BindType bindType  = (BindType)System.Convert.ToInt32(this.ddlType.SelectedValue);
            BindType bindType2 = bindType;

            switch (bindType2)
            {
            case BindType.Key:
            case BindType.Topic:
                this.liUrl.Visible   = false;
                this.liValue.Visible = true;
                break;

            default:
                if (bindType2 == BindType.Url)
                {
                    this.liUrl.Visible   = true;
                    this.liValue.Visible = false;
                }
                else
                {
                    this.liUrl.Visible   = false;
                    this.liValue.Visible = false;
                }
                break;
            }
            switch (bindType)
            {
            case BindType.Key:
                this.liTitle.InnerText   = "选择关键字:";
                this.ddlValue.DataSource =
                    from a in ReplyHelper.GetAllReply()
                    where !string.IsNullOrWhiteSpace(a.Keys)
                    select a;
                this.ddlValue.DataTextField  = "Keys";
                this.ddlValue.DataValueField = "Id";
                this.ddlValue.DataBind();
                return;

            case BindType.Topic:
                this.liTitle.InnerText       = "选择专题:";
                this.ddlValue.DataSource     = VShopHelper.Gettopics();
                this.ddlValue.DataTextField  = "Title";
                this.ddlValue.DataValueField = "TopicId";
                this.ddlValue.DataBind();
                return;

            default:
                return;
            }
        }
示例#29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     wid = GetCurWebId();
     if (string.IsNullOrEmpty(wid))
     {
         return;
     }
     this.btnAdd.Click            += new EventHandler(this.btnSubmit_Click);
     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 (!base.IsPostBack)
     {
         TextReplyInfo reply = ReplyHelper.GetReply(base.GetUrlIntParam("id")) as TextReplyInfo;
         if (reply == null)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             this.fcContent.Text           = reply.Text;
             this.txtKeys.Text             = reply.Keys;
             this.radMatch.SelectedValue   = reply.MatchType == MatchType.Like;
             this.radDisable.SelectedValue = !reply.IsDisable;
             this.chkKeys.Checked          = ReplyType.Keys == (reply.ReplyType & ReplyType.Keys);
             this.chkSub.Checked           = ReplyType.Subscribe == (reply.ReplyType & ReplyType.Subscribe);
             this.chkNo.Checked            = ReplyType.NoMatch == (reply.ReplyType & ReplyType.NoMatch);
             if (this.chkNo.Checked)
             {
                 this.chkNo.Enabled = true;
                 this.chkNo.ToolTip = "";
             }
             if (this.chkSub.Checked)
             {
                 this.chkSub.Enabled = true;
                 this.chkSub.ToolTip = "";
             }
         }
     }
 }
示例#30
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            TextReplyInfo reply = ReplyHelper.GetReply(base.GetUrlIntParam("id")) as TextReplyInfo;

            if (!string.IsNullOrEmpty(this.txtKeys.Text) && reply.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim()))
            {
                this.ShowMsg("关键字重复!", false);
            }
            else
            {
                reply.IsDisable = !this.radDisable.SelectedValue;
                if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text))
                {
                    reply.Keys = this.txtKeys.Text.Trim();
                }
                else
                {
                    reply.Keys = string.Empty;
                }
                reply.Text      = this.fcContent.Text.Trim();
                reply.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal);
                reply.ReplyType = ReplyType.None;
                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 (ReplyHelper.UpdateReply(reply))
                    {
                        this.ShowMsg("修改成功", true);
                    }
                    else
                    {
                        this.ShowMsg("修改失败", false);
                    }
                }
            }
        }