Ejemplo n.º 1
0
        public ActionResult CommonRedirect(string MenuKey, string targetUrl)
        {
            if (string.IsNullOrEmpty(ViewBag.LillyId))
            {
                return(Redirect("/notauthed.html"));
            }
            Uri url;

            if (string.IsNullOrEmpty(MenuKey) || string.IsNullOrEmpty(targetUrl) || !Uri.TryCreate(targetUrl, UriKind.Absolute, out url))
            {
                return(Redirect("/notauthed.html"));
            }
            var category = CommonService.lstCategory.FirstOrDefault(a => a.CategoryCode == MenuKey);

            if (category != null)
            {
                int    appId = Convert.ToInt32(category.AppId);
                string errorMessage;
                if (!SmartphoneMenuPermissionManager.PermissionCheck(MenuKey, ViewBag.LillyId, appId, out errorMessage))
                {
                    ViewBag.emessage = errorMessage;
                    return(View("../articlehistory/unauthorize"));
                }
                var builder = new UriBuilder(url);

                var query = HttpUtility.ParseQueryString(builder.Query);

                builder.Query = query.ToString();
                return(Redirect(builder.ToString()));
            }
            return(Redirect("/notauthed.html"));
        }
Ejemplo n.º 2
0
        public void PerssionCheck()
        {
            cache.Remove("Category");
            string message;

            SmartphoneMenuPermissionManager.PermissionCheck("ST_RCOUR_VIEW", "WF81892", 16, out message);

            Assert.IsTrue(message == null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// video vote
        /// </summary>
        /// <returns></returns>
        public ActionResult VideoArticle(string menukey)
        {
            if (string.IsNullOrEmpty(ViewBag.LillyId))
            {
                return(Redirect("/notauthed.html"));
            }
            var category = CommonService.lstCategory.FirstOrDefault(a => a.CategoryCode == menukey);

            if (category != null)
            {
                int    appId = Convert.ToInt32(category.AppId);
                string errorMessage;
                if (!SmartphoneMenuPermissionManager.PermissionCheck(menukey, ViewBag.LillyId, appId, out errorMessage))
                {
                    ViewBag.emessage = errorMessage;
                    return(View("../articlehistory/unauthorize"));
                }
                ViewBag.Title = category.CategoryName;
            }
            var vimage = VideoImageList();

            if (vimage == null)
            {
                return(ErrorNotification("Sysconfig表中VideoImage字段值为空!"));
            }
            var VideoImage = vimage.Where(x => x.MenuKey == menukey).FirstOrDefault();

            if (VideoImage == null)
            {
                return(ErrorNotification("Sysconfig表中未找到VideoImage:MenuCode的数据!"));
            }
            ViewBag.ImgUrl = VideoImage.PictureUrl;
            string lillyId  = ViewBag.LillyId;
            var    articles = _objService.Repository.Entities.Where(x => x.ArticleCateSub == menukey && x.IsDeleted != true).Select(x => new { x.ArticleTitle, x.ArticleURL, x.Id, x.ThumbImageId, x.ThumbImageUrl, x.IsLike, x.ArticleStatus }).ToList();

            var articleids = articles.Select(x => x.Id).ToArray();
            var thumbQuery = _articleThumbsUpService.Repository.Entities.Where(x => articleids.Contains(x.ArticleID) && x.Type == ThumbupType.Article.ToString() && x.IsDeleted != true).GroupBy(x => x.ArticleID).Select(x => new { ArticleID = x.Key, ThumbsUps = x.Count(), IsThumbuped = x.Count(y => y.UserID == lillyId) > 0 });
            var thumbs     = thumbQuery.ToList().AsParallel();

            var list = articles.AsParallel().Select(x =>
            {
                var thumb = thumbs.FirstOrDefault(y => x.Id == y.ArticleID);
                var url   = string.Format("{0}/Common/PushFile?id={1}&FileName={2}", WechatBaseUrl, x.ThumbImageId,
                                          x.ThumbImageUrl);
                return(thumb == null ? new VideoArticleView {
                    ArticleId = x.Id, ArticleTitle = x.ArticleTitle, ArticleURL = x.ArticleURL, IsThumbuped = false, ThumbsUps = 0, Url = url, IsLike = x.IsLike.GetValueOrDefault(), ArticleStatus = x.ArticleStatus
                } :
                       new VideoArticleView {
                    ArticleId = x.Id, ArticleTitle = x.ArticleTitle, ArticleURL = x.ArticleURL, IsThumbuped = thumb.IsThumbuped, ThumbsUps = thumb.ThumbsUps, Url = url, IsLike = x.IsLike.GetValueOrDefault(), ArticleStatus = x.ArticleStatus
                });
            }).ToList();

            //ViewBag.articles = list;

            return(View(list));
        }
Ejemplo n.º 4
0
        public ActionResult Menudetail(string MenuKey)
        {
            if (string.IsNullOrEmpty(ViewBag.LillyId))
            {
                return(Redirect("/notauthed.html"));
            }

            var category = CommonService.lstCategory.FirstOrDefault(a => a.CategoryCode == MenuKey);

            if (category != null)
            {
                int    appId = Convert.ToInt32(category.AppId);
                string errorMessage;
                if (!SmartphoneMenuPermissionManager.PermissionCheck(MenuKey, ViewBag.LillyId, appId, out errorMessage))
                {
                    ViewBag.emessage = errorMessage;
                    return(View("../articlehistory/unauthorize"));
                }
            }

            var con = new PageCondition {
                PageSize = 10
            };
            int tacount       = 0;
            var list          = _objService.getMenuHistoryList(MenuKey, con, out tacount);
            var menuePushInfo = new ArticleInfoView {
                ArticleHistoryList = list
            };

            var cate = _categoryService.Repository.Entities.FirstOrDefault(a => a.CategoryCode == MenuKey);

            if (cate != null)
            {
                ViewBag.Title = cate.CategoryName;
            }
            //记录用户行为
            ExecuteBehavior(category.AppId.Value, 5, MenuKey, "");

            return(View(menuePushInfo));
        }
Ejemplo n.º 5
0
        public ActionResult WxMain()
        {
            if (string.IsNullOrEmpty(ViewBag.LillyId))
            {
                return(Redirect("/notauthed.html"));
            }
            var MenuKey  = Request["MenuKey"];
            var category = CommonService.lstCategory.FirstOrDefault(a => a.CategoryCode == MenuKey);

            if (category != null)
            {
                int    appId = Convert.ToInt32(category.AppId);
                string errorMessage;
                if (!SmartphoneMenuPermissionManager.PermissionCheck(MenuKey, ViewBag.LillyId, appId, out errorMessage))
                {
                    ViewBag.emessage = errorMessage;
                    return(View("../articlehistory/unauthorize"));
                }
            }
            //记录用户行为
            ExecuteBehavior(25, 13, "Access_Dashboard_Query");
            return(View());
        }