Beispiel #1
0
        //
        // GET: /Node/

        public ActionResult Index(string keyword, string CStime, string CEtime, int pagesize = 20, int pageindex = 1)
        {
            return(this.Visit(Core.EnumUserRole.Admin, () =>
            {
                ViewBag.sqldatetimenow = DateTime.Now;
                tb_node_dal dal = new tb_node_dal();
                Webdiyer.WebControls.Mvc.PagedList <tb_node_model> pageList = null;
                int count = 0;
                using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString))
                {
                    PubConn.Open();
                    List <tb_node_model> List = dal.GetList(PubConn, keyword, CStime, CEtime, pagesize, pageindex, out count);
                    pageList = new PagedList <tb_node_model>(List, pageindex, pagesize, count);
                    ViewBag.sqldatetimenow = PubConn.GetServerDate();
                }
                return View(pageList);
            }));
        }
Beispiel #2
0
        public ActionResult SchoolAdminDashboard(string schooluid, int pageno = 1, int pagesize = 0)
        {
            if (pagesize <= 0)
            {
                pagesize = _pageSize;
            }
            var user = _authService.CurrentUserData;

            var modelapi = _webClient.DownloadData <SchoolDetailsResult>("getschooladmindashboard", new { PageIndex = pageno, PageSize = pagesize, UserId = user.UserId, SchoolUId = schooluid });

            if (modelapi != null && modelapi.APIStatus != SchoolStatusEnum.NoSchoolFound)
            {
                if (user.SchoolUId != schooluid)
                {
                    return(RedirectToRoute("UnauthorizedAccess"));
                }
                SchoolDetails model = new SchoolDetails();
                model.SchoolDetail = modelapi.SchoolDetails;
                var Students = new Webdiyer.WebControls.Mvc.PagedList <StudentRegistrationModel>(modelapi.Students.Items, pageno, pagesize, modelapi.Students.TotalItems);
                model.Students = Students;
                model.Grades   = modelapi.Grades;

                if (MvcSiteMapProvider.SiteMaps.Current.CurrentNode != null)
                {
                    if ((model.SchoolDetail.SchoolName).Length > 20)
                    {
                        MvcSiteMapProvider.SiteMaps.Current.CurrentNode.Title = (model.SchoolDetail.SchoolName).Substring(0, 20) + "...";
                    }
                    else
                    {
                        MvcSiteMapProvider.SiteMaps.Current.CurrentNode.Title = model.SchoolDetail.SchoolName;
                    }
                }
                return(View("SchoolAdminDashboard", model));
            }
            else
            {
                return(RedirectToRoute("PageNotFound"));
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">报道ClassId</param>
        /// <param name="classReportId">报道id</param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult ActivityReportDetailsPage(int id, int classReportId, int page = 1)
        {
            ViewBag.id = id;
            int       rcount   = 0;
            int       pagesize = 10;
            ViewClass entity   = new ViewClass();

            entity = client.Get(id);

            if (entity.iReadNums == null)
            {
                entity.iReadNums = 1;
            }
            else
            {
                entity.iReadNums++;
            }
            client.Edit(entity);
            ViewBag.iShareNums = entity.iShareNums == null ? 0 : entity.iShareNums;

            ViewBag.Entity     = entity;
            ViewBag.interCount = interclient.Count(id);                    //分享人数

            ViewBag.MsgInfo = method.listMessage(id, 3, page, out rcount); //评论

            YogisModelsServiceClient ymClient = new YogisModelsServiceClient();
            //老师粉丝
            FollowServiceClient followClient = new FollowServiceClient();
            int teacherFollowCount           = 0;

            foreach (var item in entity.Teachers)
            {
                //followClient.GetFollowUidList(item.UserId, 1, 1, out teacherFollowCount);
                //ViewData[item.UserId.ToString()] = teacherFollowCount;
                var ymModel = ymClient.GetById((int)item.TeacherId);
                int num     = followClient.GetFollowByCount(ymModel.UID);
                ViewData[item.UserId.ToString()] = num;
            }
            //发起人粉丝
            ViewBag.Sponsor = followClient.GetFollowByCount(entity.UserId);

            Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup> messlist = new Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup>(ViewBag.MsgInfo, page, pagesize, rcount);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("PartialMessage", messlist));
            }

            ViewData["ClassStatus"] = Session["ClassStatus"];

            using (ClassReportServiceClient rClient = new ClassReportServiceClient())
            {
                List <ViewClassReport> classReportList = rClient.GetClassId(id);
                ViewBag.ClassReport     = classReportList;
                ViewBag.ClassReportShow = new ViewClassReport();
                if (classReportList.Any())
                {
                    if (classReportId == -99)
                    {
                        ViewBag.ClassReportShow = classReportList.First();
                    }
                    else
                    {
                        ViewBag.ClassReportShow = classReportList.First(p => p.Id == classReportId);
                    }
                }
            }

            return(View(messlist));
        }
        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Details(int id, int page = 1)
        {
            ViewBag.id = id;
            ViewtLearing model = client.GetById(id);

            model.iReadNums = model.iReadNums + 1;
            client.Update(model);//阅读量+1

            if (user != null)
            {
                ViewBag.NickName = user.NickName;
            }

            #region  一篇文章和下一篇文章

            //用pre和next变量分别存放上一篇文章和下一篇文章的id号
            int pre = 0, next = 0, i = 0, j;
            int retCount = 0;
            //计算总记录数
            List <ViewtLearing> listEnity = client.GetPageList_All(0, out retCount);
            ViewBag.listEnity = listEnity.Where(x => x.ifexamine == true).Take(15).ToList();
            int   num   = retCount;
            int[] a     = new int[num];
            var   query = from c in listEnity select c.ID;
            //将所有的文章id号全部放入一个数组中
            foreach (var item in query)
            {
                a[i] = Convert.ToInt32(item);
                i++;
            }
            //循环,获取上一篇和下一篇文章的ID号,分别放入变量pre和next中
            for (j = 0; j < num; j++)
            {
                if (a[j] == id)
                {
                    if (j != 0)
                    {
                        pre = a[j - 1];
                    }
                    if (j != num - 1)
                    {
                        next = a[j + 1];
                    }
                }
            }
            //获取上一篇文章的标题
            if (pre == 0)
            {
                ViewBag.preTitle = "已经是第一篇";
                ViewBag.pre      = id;
            }
            else
            {
                ViewBag.preTitle = listEnity.Where(c => c.ID == pre).Single().sTitle;
                ViewBag.pre      = pre;
            }
            //获取下一篇文章的标题
            if (next == 0)
            {
                ViewBag.nextTitle = "已经是最后一篇";
                ViewBag.next      = id;
            }
            else
            {
                ViewBag.nextTitle = listEnity.Where(c => c.ID == next).Single().sTitle;
                ViewBag.next      = next;
            }

            #endregion
            model.iZanNums = zanclient.Count(id, user.Uid, 2);
            ViewBag.learn  = model;
            int rcount   = 0;
            int pagesize = 10;
            ViewBag.MsgInfo = method.listMessage(id, 2, page, out rcount);//留言 评论
            ViewBag.rcount  = rcount;

            Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup> l = new Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup>(ViewBag.MsgInfo, page, pagesize, rcount);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("PartialMsg", l));
            }
            return(View(l));

              
        }