Ejemplo n.º 1
0
        public static string GetOpenWindowStringToAdd(int publishmentSystemID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            return(PageUtilityWX.GetOpenWindowString("添加文本回复关键词", "modal_keywordAddText.aspx", arguments));
        }
Ejemplo n.º 2
0
        public static string GetOpenWindowString(int publishmentSystemID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            return(PageUtilityWX.GetOpenWindowStringWithCheckBoxValue("设置中奖状态", "modal_winnerSetting.aspx", arguments, "IDCollection", "请选择需要设置的中奖名单", 400, 300));
        }
Ejemplo n.º 3
0
        public static string GetOpenWindowStringToAdd(int publishmentSystemID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            return(PageUtilityWX.GetOpenWindowString("添加门店属性", "modal_storeCategoryAdd.aspx", arguments, 400, 300));
        }
Ejemplo n.º 4
0
        public static string GetSitePreivewHtml(PublishmentSystemInfo publishmentSystemInfo, int nodeID, int contentID)
        {
            if (contentID > 0)
            {
                var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeID);
                var tableName  = NodeManager.GetTableName(publishmentSystemInfo, nodeID);

                var contentInfo = DataProvider.ContentDao.GetContentInfoNotTrash(tableStyle, tableName, contentID);
                if (contentInfo != null)
                {
                    var pageUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, contentInfo);
                    return($@"内容页:{contentInfo.Title}&nbsp;<a href=""{pageUrl}"" target=""blank"">查看</a>");
                }
            }
            else if (nodeID > 0)
            {
                var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeID);
                if (nodeInfo != null)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(publishmentSystemInfo.PublishmentSystemId, nodeID);
                    var pageUrl   = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, nodeInfo);
                    return($@"栏目页:{nodeNames}&nbsp;<a href=""{pageUrl}"" target=""blank"">查看</a>");
                }
            }
            return(string.Empty);
        }
Ejemplo n.º 5
0
        public static string GetChannelOrContentSelectScript(PublishmentSystemInfo publishmentSystemInfo, int nodeID, int contentID)
        {
            var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeID);

            if (nodeInfo != null)
            {
                if (contentID > 0)
                {
                    var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo);
                    var tableName  = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);

                    var contentInfo = DataProvider.ContentDao.GetContentInfoNotTrash(tableStyle, tableName, contentID);

                    if (contentInfo != null)
                    {
                        var pageUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, contentInfo);
                        return($@"contentSelect(""{contentInfo.Title}"", ""{nodeID}"", ""{contentID}"", ""{pageUrl}"")");
                    }
                }
                else if (nodeID > 0)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(publishmentSystemInfo.PublishmentSystemId, nodeID);
                    var pageUrl   = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, nodeInfo);
                    return($"selectChannel('{nodeNames}', '{nodeID}', '{pageUrl}');");
                }
            }
            return(string.Empty);
        }
Ejemplo n.º 6
0
        public static string GetNavigationUrl(PublishmentSystemInfo publishmentSystemInfo, ENavigationType navigationType, EKeywordType keywordType, int functionID, int channelID, int contentID, string url)
        {
            var navigationUrl = string.Empty;

            if (navigationType == ENavigationType.Url)
            {
                navigationUrl = url;
            }
            else if (navigationType == ENavigationType.Function)
            {
                navigationUrl = KeywordManager.GetFunctionUrl(publishmentSystemInfo, keywordType, functionID);
            }
            else if (navigationType == ENavigationType.Site)
            {
                if (contentID > 0)
                {
                    var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, channelID);
                    var tableName  = NodeManager.GetTableName(publishmentSystemInfo, channelID);

                    var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentID);

                    navigationUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, contentInfo);
                }
                else if (channelID > 0)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(publishmentSystemInfo.PublishmentSystemId, channelID);
                    navigationUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, channelID));
                }
            }

            return(navigationUrl);
        }
Ejemplo n.º 7
0
        public string GetFunctionOrChannelOrContentSelectScript(WebMenuInfo menuInfo)
        {
            if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Function))
            {
                if (menuInfo.FunctionId > 0)
                {
                    var functionName = KeywordManager.GetFunctionName(EKeywordTypeUtils.GetEnumType(menuInfo.KeywordType), menuInfo.FunctionId);
                    return($@"selectKeyword(""{menuInfo.KeywordType},{menuInfo.FunctionId},{functionName}"")");
                }
            }
            else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Site))
            {
                if (menuInfo.ContentId > 0)
                {
                    var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, menuInfo.ChannelId);
                    var tableName  = NodeManager.GetTableName(PublishmentSystemInfo, menuInfo.ChannelId);

                    var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, menuInfo.ContentId);

                    var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo);

                    return
                        ($@"contentSelect(""{contentInfo.Title}"", ""{menuInfo.ChannelId}"", ""{menuInfo.ContentId}"", ""{pageUrl}"")");
                }
                else if (menuInfo.ChannelId > 0)
                {
                    var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, menuInfo.ChannelId);
                    var pageUrl   = PageUtilityWX.GetChannelUrl(PublishmentSystemInfo, NodeManager.GetNodeInfo(PublishmentSystemId, menuInfo.ChannelId));
                    return($"selectChannel('{nodeNames}', '{menuInfo.ChannelId}', '{pageUrl}');");
                }
            }

            return(string.Empty);
        }
Ejemplo n.º 8
0
        public static string GetOpenWindowStringToAdd(int publishmentSystemID, bool isSingle)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("isSingle", isSingle.ToString());
            return(PageUtilityWX.GetOpenWindowString("添加图文回复关键词", "modal_keywordAddNews.aspx", arguments));
        }
Ejemplo n.º 9
0
        public static string GetOpenWindowString(int publishmentSystemID, string jsMethod)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("jsMethod", jsMethod);
            return(PageUtilityWX.GetOpenWindowString("选择导航图标", "modal_imageCssClassSelect.aspx", arguments, true));
        }
Ejemplo n.º 10
0
        public static string GetOpenWindowString(int publishmentSystemID, int actID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("actID", actID.ToString());
            return(PageUtilityWX.GetOpenWindowString("�����Ż݄�", "modal_couponRelated.aspx", arguments, 400, 300));
        }
Ejemplo n.º 11
0
        public static string GetOpenWindowStringToEdit(int publishmentSystemID, int couponID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("couponID", couponID.ToString());
            return(PageUtilityWX.GetOpenWindowString("编辑优惠劵", "modal_couponAdd.aspx", arguments, 400, 300));
        }
Ejemplo n.º 12
0
        public static string GetOpenWindowString(int publishmentSystemID, int couponID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("couponID", couponID.ToString());
            return(PageUtilityWX.GetOpenWindowStringWithCheckBoxValue("新增优惠劵数量", "modal_couponSNSetting.aspx", arguments, "IDCollection", "请选择需要设置的SN码", 400, 300));
        }
Ejemplo n.º 13
0
        public static string GetOpenWindowStringToEdit(int publishmentSystemID, int keywordID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("keywordID", keywordID.ToString());
            return(PageUtilityWX.GetOpenWindowString("编辑图文回复关键词", "modal_keywordAddNews.aspx", arguments));
        }
Ejemplo n.º 14
0
        public static string GetOpenWindowString(int publishmentSystemID, bool isEntity)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("isEntity", isEntity.ToString());
            return(PageUtilityWX.GetOpenWindowStringWithCheckBoxValue("设置实体卡状态", "modal_cardSNSetting.aspx", arguments, "IDCollection", "请选择需要设置的会员卡", 400, 300));
        }
Ejemplo n.º 15
0
        public static string GetOpenWindowStringToAdd(int publishmentSystemID, int cardID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("cardID", cardID.ToString());
            return(PageUtilityWX.GetOpenWindowString("会员卡操作员", "modal_cardOperatorAdd.aspx", arguments, 450, 450));
        }
Ejemplo n.º 16
0
        public static string GetOpenWindowString(int publishmentSystemID, int keywordID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("keywordID", keywordID.ToString());
            return(PageUtilityWX.GetOpenWindowString("Ô¤ÀÀ", "modal_keywordPreview.aspx", arguments, 400, 300));
        }
Ejemplo n.º 17
0
        public static string GetOpenUploadWindowString(int publishmentSystemID, int cardID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("cardID", cardID.ToString());

            return(PageUtilityWX.GetOpenWindowString("导入实体卡", "modal_cardEntitySNImport.aspx", arguments, 400, 300));
        }
Ejemplo n.º 18
0
        public static string GetOpenUploadWindowString(int publishmentSystemID, int couponID, int flg)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("couponID", couponID.ToString());
            arguments.Add("flg", flg.ToString());
            return(PageUtilityWX.GetOpenWindowString("上传优惠劵", "modal_couponSNUpload.aspx", arguments, 400, 300));
        }
Ejemplo n.º 19
0
        public static string GetOpenWindowString(int publishmentSystemID, int cardID, int cardSNID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("cardID", cardID.ToString());
            arguments.Add("cardSNID", cardSNID.ToString());
            return(PageUtilityWX.GetOpenWindowString("会员卡充值", "modal_cardRecharge.aspx", arguments, 400, 380));
        }
Ejemplo n.º 20
0
        public static string GetOpenWindowStringToEdit(int publishmentSystemID, int cardID, int cardEntitySNID)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("cardID", cardID.ToString());
            arguments.Add("cardEntitySNID", cardEntitySNID.ToString());
            return(PageUtilityWX.GetOpenWindowString("编辑实体卡", "modal_cardEntitySNAdd.aspx", arguments, 450, 450));
        }
Ejemplo n.º 21
0
        public static string GetOpenWindowStringByItemIndex(int publishmentSystemID, string jsMethod, string itemIndex)
        {
            var arguments = new NameValueCollection();

            arguments.Add("publishmentSystemID", publishmentSystemID.ToString());
            arguments.Add("jsMethod", jsMethod);
            arguments.Add("itemIndex", itemIndex);
            return(PageUtilityWX.GetOpenWindowString("选择微官网内容", "modal_contentSelect.aspx", arguments));
        }
Ejemplo n.º 22
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            try
            {
                var idsCollection = Request.Form["IDsCollection"];

                if (string.IsNullOrEmpty(idsCollection))
                {
                    FailMessage("操作失败,请选择需要显示的内容");
                    return;
                }

                if (_isKeywordAdd)
                {
                    if (_keywordId > 0)
                    {
                        var idsList    = TranslateUtils.StringCollectionToStringList(idsCollection);
                        var resourceId = 0;
                        foreach (var ids in idsList)
                        {
                            var nodeId     = TranslateUtils.ToInt(ids.Split('_')[0]);
                            var contentId  = TranslateUtils.ToInt(ids.Split('_')[1]);
                            var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeId);
                            var tableName  = NodeManager.GetTableName(PublishmentSystemInfo, nodeId);

                            var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId);

                            var resourceInfo = new KeywordResourceInfo();

                            resourceInfo.ResourceId          = 0;
                            resourceInfo.PublishmentSystemId = PublishmentSystemId;
                            resourceInfo.KeywordId           = _keywordId;
                            resourceInfo.Title          = contentInfo.Title;
                            resourceInfo.ImageUrl       = contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl);
                            resourceInfo.Summary        = MPUtils.GetSummary(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Summary), contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content));
                            resourceInfo.ResourceType   = EResourceType.Site;
                            resourceInfo.IsShowCoverPic = false;
                            resourceInfo.Content        = contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content);
                            resourceInfo.NavigationUrl  = string.Empty;
                            resourceInfo.ChannelId      = contentInfo.NodeId;
                            resourceInfo.ContentId      = contentInfo.Id;
                            resourceInfo.Taxis          = 0;

                            var id = DataProviderWx.KeywordResourceDao.Insert(resourceInfo);
                            if (resourceId == 0)
                            {
                                resourceId = id;
                            }
                        }

                        var redirectUrl = PageKeywordNewsAdd.GetRedirectUrl(PublishmentSystemId, _keywordId, resourceId, !_isMultiple);
                        PageUtils.CloseModalPageAndRedirect(Page, redirectUrl);
                    }
                }
                else
                {
                    var scripts = string.Empty;
                    if (_isMultiple)
                    {
                        var titleBuilder = new StringBuilder();
                        var idsList      = TranslateUtils.StringCollectionToStringList(idsCollection);
                        foreach (var ids in idsList)
                        {
                            var nodeId     = TranslateUtils.ToInt(ids.Split('_')[0]);
                            var contentId  = TranslateUtils.ToInt(ids.Split('_')[1]);
                            var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeId);
                            var tableName  = NodeManager.GetTableName(PublishmentSystemInfo, nodeId);

                            var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId);

                            titleBuilder.AppendFormat("{0}&nbsp;<a href='{1}' target='blank'>查看</a><br />", contentInfo.Title, PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo));
                        }
                        scripts = $@"window.parent.{_jsMethod}(""{idsCollection}"", ""{titleBuilder}"");";
                    }
                    else
                    {
                        var nodeId     = TranslateUtils.ToInt(idsCollection.Split('_')[0]);
                        var contentId  = TranslateUtils.ToInt(idsCollection.Split('_')[1]);
                        var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, nodeId);
                        var tableName  = NodeManager.GetTableName(PublishmentSystemInfo, nodeId);

                        var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId);

                        var imageUrl = contentInfo.GetExtendedAttribute(BackgroundContentAttribute.ImageUrl);
                        var imageSrc = PageUtility.ParseNavigationUrl(PublishmentSystemInfo, imageUrl);
                        var summary  = MPUtils.GetSummary(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Summary), contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content));

                        var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo);
                        scripts =
                            $@"window.parent.{_jsMethod}(""{contentInfo.Title}"", ""{nodeId}"", ""{contentId}"", ""{pageUrl}"", ""{imageUrl}"", ""{imageSrc}"", ""{summary}"");";

                        if (Request.QueryString["itemIndex"] != null)
                        {
                            scripts =
                                $@"window.parent.{_jsMethod}({_itemIndex}, ""{contentInfo.Title}"", {nodeId}, {contentId});";
                        }
                    }

                    PageUtils.CloseModalPageWithoutRefresh(Page, scripts);
                }
            }
            catch (Exception ex)
            {
                FailMessage(ex, "失败:" + ex.Message);
            }
        }
Ejemplo n.º 23
0
        private IResponseMessageBase GetResponseMessage(KeywordInfo keywordInfo, string keyword)
        {
            try
            {
                if (keywordInfo != null && !keywordInfo.IsDisabled)
                {
                    if (keywordInfo.KeywordType == EKeywordType.Text)
                    {
                        DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestText);

                        var responseMessage = CreateResponseMessage <ResponseMessageText>();
                        responseMessage.Content = keywordInfo.Reply;
                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.News)
                    {
                        DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestNews);

                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();

                        foreach (var resourceInfo in DataProviderWX.KeywordResourceDAO.GetResourceInfoList(keywordInfo.KeywordID))
                        {
                            var imageUrl = PageUtils.AddProtocolToUrl(PageUtility.ParseNavigationUrl(publishmentSystemInfo, resourceInfo.ImageUrl));

                            var pageUrl = string.Empty;
                            if (resourceInfo.ResourceType == EResourceType.Site)
                            {
                                if (resourceInfo.ChannelID > 0 && resourceInfo.ContentID > 0)
                                {
                                    pageUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, resourceInfo.ChannelID, resourceInfo.ContentID, false);
                                }
                                else if (resourceInfo.ChannelID > 0)
                                {
                                    pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, resourceInfo.ChannelID);
                                }
                                else
                                {
                                    pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, publishmentSystemInfo.PublishmentSystemId);
                                }
                            }
                            else if (resourceInfo.ResourceType == EResourceType.Content)
                            {
                                pageUrl = PageUtilityWX.GetWeiXinFileUrl(publishmentSystemInfo, resourceInfo.KeywordID, resourceInfo.ResourceID);
                            }
                            else if (resourceInfo.ResourceType == EResourceType.Url)
                            {
                                pageUrl = resourceInfo.NavigationUrl;
                            }

                            responseMessage.Articles.Add(new Article()
                            {
                                Title       = resourceInfo.Title,
                                Description = MPUtils.GetSummary(resourceInfo.Summary, resourceInfo.Content),
                                PicUrl      = imageUrl,
                                Url         = pageUrl
                            });
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Coupon)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = CouponManager.Trigger(keywordInfo, keyword, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Vote)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = VoteManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Message)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = MessageManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Appointment)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = AppointmentManager.Trigger(keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Conference)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = ConferenceManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Map)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = MapManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.View360)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = View360Manager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Album)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = AlbumManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Scratch)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = LotteryManager.Trigger(keywordInfo, ELotteryType.Scratch, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.BigWheel)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = LotteryManager.Trigger(keywordInfo, ELotteryType.BigWheel, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.GoldEgg)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = LotteryManager.Trigger(keywordInfo, ELotteryType.GoldEgg, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Flap)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = LotteryManager.Trigger(keywordInfo, ELotteryType.Flap, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.YaoYao)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = LotteryManager.Trigger(keywordInfo, ELotteryType.YaoYao, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Search)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = SearchManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Store)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = StoreManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Collect)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = CollectManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                    else if (keywordInfo.KeywordType == EKeywordType.Card)
                    {
                        var responseMessage = CreateResponseMessage <ResponseMessageNews>();
                        var articleList     = CardManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName);
                        if (articleList.Count > 0)
                        {
                            foreach (var article in articleList)
                            {
                                responseMessage.Articles.Add(article);
                            }
                        }

                        return(responseMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtils.AddLog(string.Empty, "Gexia Error", ex.StackTrace);
            }

            return(null);
        }
Ejemplo n.º 24
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            searchID = TranslateUtils.ToInt(GetQueryString("searchID"));

            if (!IsPostBack)
            {
                var pageTitle = searchID > 0 ? "编辑微搜索" : "添加微搜索";
                BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Search, pageTitle, AppManager.WeiXin.Permission.WebSite.Search);
                ltlPageTitle.Text = pageTitle;

                ltlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{SearchManager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";
                ltlContentImageUrl.Text =
                    $@"<img id=""preview_contentImageUrl"" src=""{SearchManager.GetContentImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";

                ltlSearchNavs.Text = $@"
itemController.openFunctionSelect = function(itemIndex){{
    var openString = ""{Modal.FunctionSelect.GetOpenWindowStringByItemIndex(PublishmentSystemID, "selectFunction",
                    "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
itemController.openChannelSelect = function(itemIndex){{
    var openString = ""{CMS.BackgroundPages.Modal.ChannelSelect.GetOpenWindowStringByItemIndex(
                    PublishmentSystemID, "selectChannel", "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
itemController.openContentSelect = function(itemIndex){{
    var openString = ""{Modal.ContentSelect.GetOpenWindowStringByItemIndex(PublishmentSystemID, "selectContent",
                    "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
itemController.openImageCssClassSelect = function(itemIndex){{
    var openString = ""{Modal.ImageCssClassSelect.GetOpenWindowStringByItemIndex(PublishmentSystemID,
                    "selectImageCssClass", "itemIndexValue")}"".replace(""itemIndexValue"", itemIndex);
    openString = openString.substr(0, openString.indexOf(';'));
    eval(openString);
}};
";

                if (searchID == 0)
                {
                    ltlSearchNavs.Text += "itemController.itemCount = 2;itemController.items = [{navigationType : 'Url', imageCssClass : 'fa fa-angle-double-down'}, {navigationType : 'Url', imageCssClass : 'fa fa-angle-double-down'}];";
                }
                else
                {
                    var searchInfo = DataProviderWX.SearchDAO.GetSearchInfo(searchID);

                    tbKeywords.Text     = DataProviderWX.KeywordDAO.GetKeywords(searchInfo.KeywordID);
                    cbIsEnabled.Checked = !searchInfo.IsDisabled;
                    tbTitle.Text        = searchInfo.Title;
                    if (!string.IsNullOrEmpty(searchInfo.ImageUrl))
                    {
                        ltlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, searchInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    tbSummary.Text = searchInfo.Summary;

                    cbIsOutsiteSearch.Checked = searchInfo.IsOutsiteSearch;
                    cbIsNavigation.Checked    = searchInfo.IsNavigation;
                    tbNavTitleColor.Text      = searchInfo.NavTitleColor;
                    tbNavImageColor.Text      = searchInfo.NavImageColor;
                    if (!string.IsNullOrEmpty(searchInfo.ContentImageUrl))
                    {
                        ltlContentImageUrl.Text =
                            $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, searchInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    var searchNavigationInfoList = DataProviderWX.SearchNavigationDAO.GetSearchNavigationInfoList(PublishmentSystemID, searchID);
                    var itemBuilder = new StringBuilder();
                    foreach (var searchNavigationInfo in searchNavigationInfoList)
                    {
                        var searchPageTitle = string.Empty;

                        if (searchNavigationInfo.NavigationType == ENavigationTypeUtils.GetValue(ENavigationType.Url))
                        {
                            searchPageTitle = string.Empty;
                        }
                        else if (searchNavigationInfo.NavigationType == ENavigationTypeUtils.GetValue(ENavigationType.Function))
                        {
                            searchPageTitle = KeywordManager.GetFunctionName(EKeywordTypeUtils.GetEnumType(searchNavigationInfo.KeywordType), searchNavigationInfo.FunctionID);
                        }
                        else if (searchNavigationInfo.NavigationType == ENavigationTypeUtils.GetValue(ENavigationType.Site))
                        {
                            if (searchNavigationInfo.ContentID > 0)
                            {
                                var tableStyle  = NodeManager.GetTableStyle(PublishmentSystemInfo, searchNavigationInfo.ChannelID);
                                var tableName   = NodeManager.GetTableName(PublishmentSystemInfo, searchNavigationInfo.ChannelID);
                                var contentInfo = DataProvider.ContentDAO.GetContentInfo(tableStyle, tableName, searchNavigationInfo.ContentID);

                                var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo);
                                searchPageTitle = $@"内容页:{contentInfo.Title}";
                            }
                            else
                            {
                                var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemID, searchNavigationInfo.ChannelID);
                                var pageUrl   = PageUtility.GetChannelUrl(PublishmentSystemInfo, NodeManager.GetNodeInfo(PublishmentSystemID, searchNavigationInfo.ChannelID));
                                searchPageTitle = $@"栏目页:{nodeNames}";
                            }
                        }

                        itemBuilder.AppendFormat("{{id: '{0}', title: '{1}',pageTitle: '{2}', url: '{3}', imageCssClass: '{4}',navigationType:'{5}',keywordType:'{6}',functionID:'{7}',channelID:'{8}',contentID:'{9}'}},", searchNavigationInfo.ID, searchNavigationInfo.Title, searchPageTitle, searchNavigationInfo.Url, searchNavigationInfo.ImageCssClass, searchNavigationInfo.NavigationType, searchNavigationInfo.KeywordType, searchNavigationInfo.FunctionID, searchNavigationInfo.ChannelID, searchNavigationInfo.ContentID);
                    }

                    if (itemBuilder.Length > 0)
                    {
                        itemBuilder.Length--;
                    }

                    ltlSearchNavs.Text += $@"
itemController.itemCount = {searchNavigationInfoList.Count};itemController.items = [{itemBuilder.ToString()}];";

                    imageUrl.Value        = searchInfo.ImageUrl;
                    contentImageUrl.Value = searchInfo.ContentImageUrl;

                    tbImageAreaTitle.Text = searchInfo.ImageAreaTitle;
                    tbTextAreaTitle.Text  = searchInfo.TextAreaTitle;

                    if (searchInfo.ImageAreaChannelID > 0)
                    {
                        var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemID, searchInfo.ImageAreaChannelID);
                        ltlSearchNavs.Text += $@"
$(document).ready(function() {{
    selectChannel(1, '{nodeNames}', {searchInfo.ImageAreaChannelID});
}});
";
                    }
                    if (searchInfo.TextAreaChannelID > 0)
                    {
                        var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemID, searchInfo.TextAreaChannelID);
                        ltlSearchNavs.Text += $@"
$(document).ready(function() {{
    selectChannel(2, '{nodeNames}', {searchInfo.TextAreaChannelID});
}});
";
                    }
                }

                btnImageChannelSelect.Attributes.Add("onclick", CMS.BackgroundPages.Modal.ChannelSelect.GetOpenWindowStringByItemIndex(PublishmentSystemID, "selectChannel", "1"));
                btnTextChannelSelect.Attributes.Add("onclick", CMS.BackgroundPages.Modal.ChannelSelect.GetOpenWindowStringByItemIndex(PublishmentSystemID, "selectChannel", "2"));

                btnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{BackgroundSearch.GetRedirectUrl(PublishmentSystemID)}"";return false");
            }
        }