Beispiel #1
0
        //info          tab页
        //p             页码
        //sp            列表、大图
        //startTime     开始时间
        //endTime       结束时间
        //kw            搜索关键字
        //order         排序
        public ActionResult SchoolBag(int p = 1, int info = 0, int sp = 1, DateTime?start = null, DateTime?end = null, string kw = "", string order = "")
        {
            ViewBag.start = start;
            ViewBag.end   = end;
            ViewBag.kw    = kw;
            ViewBag.info  = info;
            ViewBag.sp    = sp;
            ViewBag.order = order;

            int total;

            if (info == 0)
            {
                var list     = _learningRecord.GetMyCollectCourseList(out total, CurrentTenant.TenantId, CurrentUser.UserId, new int[0], kw, start, end, p, 12, order);
                var pagelist = new RetechWing.MvcPager.PagedList <MyLearningCourse>(list, p, 12, total);
                ViewBag.datalist = pagelist;
            }
            else
            {
                var list     = _resourceManager.GetMyCollectResourceList(out total, CurrentUser.UserId, kw, start, end, 12, p, order);
                var pagelist = new RetechWing.MvcPager.PagedList <RetechWing.Models.Knowledge.KL_Resource>(list, p, 12, total);
                ViewBag.datalist = pagelist;
            }

            return(View());
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p"></param>
        /// <param name="actionName"></param>
        /// <param name="gettype"></param>
        /// <param name="stime"></param>
        /// <param name="etime"></param>
        /// <returns></returns>
        public ActionResult IntegralList(int p = 1, string actionName = "", int gettype = 1, DateTime?stime = null, DateTime?etime = null)
        {
            int total;
            var list = service.GetUserIntegrals(out total, CurrentUser.UserId, gettype, stime, etime, p, 10);

            foreach (var item in list)
            {
                item.CodeDesc = string.IsNullOrWhiteSpace(item.RuleCode) ? item.IntegralDesc : IntegrationRules.Instance.GetDesc(item.RuleCode);
            }

            if (!string.IsNullOrEmpty(actionName))
            {
                list = list.Where(k => k.CodeDesc.ToLower().Contains(actionName.ToLower()));
            }
            total = list.Count();
            var pagelist     = new RetechWing.MvcPager.PagedList <BusinessCommon.Integration.UserIntegral>(list, p, 10, total);
            var integralRank = service.GetUserRankIntegral(CurrentUser.UserId);

            ViewBag.totalIntegral = integralRank == null ? 0 : integralRank.TotalIntegral;
            ViewBag.todayIntegral = integralRank == null ? 0 : integralRank.TodayIntegral;
            ViewBag.integralRank  = (integralRank == null || integralRank.RankIndex < 0) ? 0 : integralRank.RankIndex;
            UserLevel currentLevel = _levelService.GetUserLevel(CurrentTenant.TenantId, CurrentUser.UserId);

            ViewBag.currentLevel = currentLevel;

            return(View(pagelist));
        }
Beispiel #3
0
        public ActionResult TopicDetail(int id, int ism = 0, int p = 1, int isSee = 0)
        {
            var model = _groupService.GetGroupTopic(id);
            var group = _groupService.GetGroupById(model.GroupId);

            ViewBag.replyStatus = group.IsDelete == 1 ? 1 :
                                  (CurrentUser.UserId == model.UserId ? 0 :
                                   ((_groupService.GetGroupMemberList(model.GroupId).Select(g => g.UserId).Contains(CurrentUser.UserId)) ? 0 : 1));

            if (isSee == 0)
            {
                model.Hits = model.Hits + 1;
                _groupService.UpdateGroupTopic(model);
            }
            int total;
            var list     = _groupService.GetGroupTopicReplyList(out total, id, ism, p, 10);
            var pagelist = new RetechWing.MvcPager.PagedList <GroupTopicReply>(list, p, 10, total);

            ViewBag.datalist = pagelist;

            ViewBag.UserId        = CurrentUser.UserId;
            ViewBag.isSeeLandlord = ism;
            ViewBag.MyAttendUsers = MyAttendUsers;
            return(View(model));
        }
Beispiel #4
0
        public ActionResult GroupDetail(int id, int info = 0, int p = 1)
        {
            ViewBag.info = info;
            var model = _groupService.GetGroupById(id);

            ViewBag.IsMyCreate = model.Creater == CurrentUser.UserId ? 1 : 0;
            ViewBag.UserId     = CurrentUser.UserId;

            var members = _groupService.GetGroupMemberList(id, new int[] { 0, 1 });

            ViewBag.memberIds = members.Select(m => m.UserId);
            ViewBag.members   = members.Where(m => m.Status == 0);

            int total;

            if (info == 0)
            {
                //最新话题
                var list = _groupService.GetGroupTopicList(out total, id, "", p, 10, "CreateTime DESC");
                //ViewBag.list = list;

                var pagelist = new RetechWing.MvcPager.PagedList <GroupTopic>(list, p, 10, total);
                ViewBag.datalist = pagelist;
            }
            else
            {
                //最热话题(回复最多)
                var list = _groupService.GetGroupTopicList(out total, id, "", p, 10, "ReplyCount DESC");
                //ViewBag.list = list;

                var pagelist = new RetechWing.MvcPager.PagedList <GroupTopic>(list, p, 10, total);
                ViewBag.datalist = pagelist;
            }
            return(View(model));
        }
Beispiel #5
0
        /// <summary>
        /// 全文检索查询问题
        /// </summary>
        /// <param name="kw">关键词</param>
        /// <param name="p">页码</param>
        /// <param name="orderF">分页字段</param>
        /// <param name="dir">分页方向(0:正序;1:反序)</param>
        /// <param name="ishigh"></param>
        /// <returns></returns>
        public ActionResult SearchQuestions(string kw = "", int p = 1, string orderF = "", int dir = 0, int ishigh = 0)
        {
            ViewBag.uncompleteCount = qaService.GetNoCompleteQuestionCount(CurrentTenant.TenantId);
            ViewBag.completeCount   = qaService.GetCompleteQuestionCount(CurrentTenant.TenantId);
            List <FullSearchQuestion> questions;
            long total = 0;

            //var pageList1 = new RetechWing.MvcPager.PagedList<FullSearchQuestion>(new List<FullSearchQuestion>(), p, 20, total);
            //return View(pageList1);
            int skip = (p - 1) * 20;
            //使用全文检索查询
            var must = new Dictionary <string, object>();

            must.Add("isThematic", 0);
            must.Add("isDelete", 0);

            var listresult = FullSearchService.FullTextSearchProvider.Search <FullTextIndexQuestion>(out total, "intquestion",
                                                                                                     new[] { "title", "question", "tags", "newAnswer" }, kw, skip, 20, "<em>", "</em>", must, dir, orderF);

            //var listresult = FullSearchService.FullTextSearchProvider.Search<IntQuestion>(out total, "intquestion",
            //     new[] { "title" }, kw, skip, 20, "<em>", "</em>", must, dir, orderF);

            var pageList = new RetechWing.MvcPager.PagedList <SearchResult <FullTextIndexQuestion> >(listresult, p, 20, (int)total);

            return(View(pageList));
        }
Beispiel #6
0
        public ActionResult SortQuestions(int sort = 0, string kw = "", int p = 1, string orderF = "", int dir = 0, int ishigh = 0)
        {
            var allsorts = qaService.GetAllSorts(CurrentTenant.TenantId);

            //处理分类
            if (sort == 0)
            {
                ViewBag.sortlist  = new QuestionSort[0];
                ViewBag.childrens = qaService.GetChildrenSorts(0);
            }
            else
            {
                var last     = allsorts.First(s => s.SortId == sort);
                var sortlist = new List <QuestionSort>()
                {
                    last
                };
                while (last.ParentId != 0)
                {
                    last = allsorts.First(s => s.SortId == last.ParentId);
                    sortlist.Add(last);
                }
                ViewBag.sortlist  = sortlist.ToArray();
                ViewBag.childrens = allsorts.Where(s => s.ParentId == sort);
            }
            int    total = 0;
            string order = (string.IsNullOrEmpty(orderF) ? "QuestionTime " : orderF)
                           + (dir == 1 ? " ASC" : " DESC");
            //使用数据库查询
            var questions = qaService.GetQuestions(out total, CurrentTenant.TenantId, sort, p, 20, order, "", kw, null, null, ishigh).ToList();
            var pageList  = new RetechWing.MvcPager.PagedList <FullTextIndexQuestion>(questions, p, 20, total);

            return(View(pageList));
        }
Beispiel #7
0
        /// <summary>
        /// 我的提问
        /// </summary>
        /// <returns></returns>
        public ActionResult MyQs(int info = 0, int p = 1)
        {
            int total;
            var list     = qaService.GetUserQuestions(out total, CurrentUser.UserId, info, p, 10);
            var pagelist = new RetechWing.MvcPager.PagedList <IntQuestion>(list, p, 10, total);

            return(View(pagelist));
        }
Beispiel #8
0
        public ActionResult MyFans(int p = 1, string u = "", string r = "", int x = -1, int d = 0)
        {
            var users = SystemUsers.AsParallel();
            IEnumerable <int> uids = null;
            var fans    = shipService.GetFans(CurrentUser.UserId);
            var atts    = shipService.GetAttentions(CurrentUser.UserId);
            var friends = shipService.GetFriends(CurrentUser.UserId);

            switch (d)
            {
            case 0:    //全部
            {
                uids = fans.Concat(atts);
            }
            break;

            case 1:
            {
                //我的关注
                uids = atts;
            }
            break;

            case 2:
            {
                //我的粉丝
                uids = fans;
            }
            break;

            case 3:
            {
                //互相关注
                uids = friends;
            }
            break;
            }
            if (uids == null)
            {
                uids = new[] { 0 };
            }
            var query = users.Where(user => uids.Contains(user.UserId))
                        .Where(user => user.Username.ToLower().Contains(u.ToLower()))
                        .Where(user => user.Realname.ToLower().Contains(r.ToLower()))
                        .Where(user => x == -1 || user.Sex == x);

            var total     = query.Count();
            var queryPage = query.Skip((p - 1) * 10).Take(10);
            var pagelist  = new RetechWing.MvcPager.PagedList <SysUser>(queryPage, p, 10, total);

            ViewBag.myFans    = fans;
            ViewBag.myAtts    = atts;
            ViewBag.myFriends = friends;
            return(View(pagelist));
        }
Beispiel #9
0
        public ActionResult Index(int p = 1, int info = 0, string kw = "")
        {
            ViewBag.info = info;
            //收藏的版块数
            ViewBag.collectCount   = new BBSService().GetUserCollectCount(CurrentUser.UserId);
            ViewBag.joingroupCount = _groupService.GetMyJoinGroupCount(CurrentUser.UserId);
            int total;

            switch (info)
            {
            case 0:
            {
                //加入的小组
                var list     = _groupService.GetMyJoinGroup(out total, CurrentUser.UserId, kw, p, 10);
                var pagelist = new RetechWing.MvcPager.PagedList <Group>(list, p, 10, total);
                ViewBag.datalist = pagelist;
                var nore = _groupService.GetMyNotRespondingGroup(CurrentUser.UserId);
                ViewBag.noresponse = nore;
                return(View());
            }

            case 1:
            {
                //发起的小组
                var list     = _groupService.GetMyCreateGroup(out total, CurrentUser.UserId, kw, p, 10);
                var pagelist = new RetechWing.MvcPager.PagedList <Group>(list, p, 10, total);
                ViewBag.datalist = pagelist;
                return(View());
            }

            case 2:
            {
                //发起的话题
                var list     = _groupService.GetMyCreateGroupTopic(out total, CurrentUser.UserId, kw, p, 10);
                var pagelist = new RetechWing.MvcPager.PagedList <GroupTopic>(list, p, 10, total);
                ViewBag.datalist = pagelist;
                return(View());
            }

            case 3:
            {
                //回复过的话题
                var list     = _groupService.GetMyReplyGroupTopic(out total, CurrentUser.UserId, kw, p, 10);
                var pagelist = new RetechWing.MvcPager.PagedList <GroupTopic>(list, p, 10, total);
                ViewBag.datalist = pagelist;
                return(View());
            }
            }
            return(View());
        }
Beispiel #10
0
        public ActionResult ShareIndex(int info = 0, int shareType = 99, int p = 1, string kw = "")
        {
            int total;

            ViewBag.info      = info;
            ViewBag.shareType = shareType;
            ViewBag.p         = p;
            ViewBag.kw        = kw;

            var list     = IntSharedManager.GetUserShared(out total, CurrentTenant.TenantId, CurrentUser.UserId, CurrentUser.PostId, CurrentUser.DeptId, info, shareType, kw, p, 10);
            var pagelist = new RetechWing.MvcPager.PagedList <IntShared>(list, p, 10, total);

            ViewBag.datalist      = pagelist;
            ViewBag.MyAttendUsers = MyAttendUsers;
            return(View());
        }
        //private DataAccess.BaseDataAccess baseDataAccess = (DataAccess.BaseDataAccess)DataAccess.DataAccessProvider.DataAccess;
        public ActionResult SqlExecutes(int p = 1, string sortF = "ElapsedMilliseconds", int dir = 0)
        {
            var query = from s in DataAccess.BaseDataAccess.TraceSqls select s;
            switch (sortF)
            {
                case "ElapsedMilliseconds":
                    if (dir == 0)
                    {
                        query = query.OrderBy(q => q.ElapsedMilliseconds);
                    }
                    else
                    {
                        query = query.OrderByDescending(q => q.ElapsedMilliseconds);
                    }
                    break;
                case "Sql":
                    if (dir == 0)
                    {
                        query = query.OrderBy(q => q.Sql);
                    }
                    else
                    {
                        query = query.OrderByDescending(q => q.Sql);
                    }
                    break;
                case "ExecuteTime":
                    if (dir == 0)
                    {
                        query = query.OrderBy(q => q.ExecuteTime);
                    }
                    else
                    {
                        query = query.OrderByDescending(q => q.ExecuteTime);
                    }
                    break;
            }

            query = query.Skip((p - 1) * 20).Take(20);
            var plist = new RetechWing.MvcPager.PagedList<RetechWing.Infrastructure.SqlTraceEntity>(query, p,
                20, DataAccess.BaseDataAccess.TraceSqls.Count);
            return View(plist);
        }
Beispiel #12
0
        /// <summary>
        /// 帖子详情
        /// </summary>
        /// <param name="id">帖子Id</param>
        /// <param name="ism">0:全部;1:只看楼主</param>
        /// <param name="p">页码</param>
        /// <param name="backUrl"></param>
        /// <returns></returns>
        public ActionResult TopicDetail(int id, int ism = 0, int p = 1, string backUrl = null)
        {
            ViewBag.backUrl = backUrl;
            _bbsService.UpdateTopicHits(id);
            var topic = _bbsService.GetTopicById(id);

            int total;
            var replys   = _bbsService.GetTopicReplies(out total, id, ism, 0, p, 20);
            var pagelist = new RetechWing.MvcPager.PagedList <Reply>(replys, p, 20, total);

            // topic.Replies.AddRange(replys);
            foreach (var reply in replys)
            {
                reply.ReplyUser = SystemUsers.First(u => u.UserId == reply.UserId);
            }
            ViewBag.replies       = pagelist;
            ViewBag.MyAttendUsers = MyAttendUsers;
            var isInSection = _bbsService.IsInSection(topic.SubSectionId, CurrentUser.UserId);

            ViewBag.isInSection = isInSection;

            return(View(topic));
        }
Beispiel #13
0
        /// <summary>
        /// 版块首页
        /// </summary>
        /// <returns></returns>
        public ActionResult SectionIndex(int sectId, int pageIndex = 1, string kw = "", string orderF = "", int dir = 0)
        {
            var mainSections = _bbsService.GetMainSectionList(CurrentTenant.TenantId);

            ViewBag.mainSections   = mainSections;
            ViewBag.joingroupCount = new GroupService().GetMyJoinGroupCount(CurrentUser.UserId);

            var subSection = _bbsService.GetSubSection(sectId);

            ViewBag.collectCount     = _bbsService.GetUserCollectCount(CurrentUser.UserId);
            ViewBag.sectioncollcount = _bbsService.GetSubSectionAccount(sectId);
            ViewBag.UserInSection    = _bbsService.IsInSection(sectId, CurrentUser.UserId);
            if (string.IsNullOrEmpty(orderF))
            {
                orderF = "CreateTime";
            }
            orderF = orderF + (dir == 0 ? " ASC " : " DESC");
            int total;
            var list     = _bbsService.GetTopics(out total, sectId, pageIndex, 10, kw, orderF);
            var pageList = new RetechWing.MvcPager.PagedList <Topic>(list, pageIndex, 10, total);

            ViewBag.SubSection = subSection;
            return(View(pageList));
        }