Esempio n. 1
0
        public ActionResult GetPubicInformationByType(int page, int limit, int type)
        {
            var dataObj = PublicInformationService.GetEntities(u => u.DelFlag == 1 && u.Type == type);
            var data    = dataObj
                          .OrderByDescending(x => x.SubTime)
                          .Take(limit * page).Skip(limit * (page - 1)).ToList();//进行分页
            var result = new List <PublicInformationDTO>();

            foreach (var item in data)
            {
                var info = new PublicInformationDTO
                {
                    Id         = item.Id,
                    Title      = item.Title,
                    Content    = Server.HtmlDecode(item.Content),
                    SubTime    = TimeFormatter.TimeFormat(item.SubTime.ToString()),
                    SubUnit    = item.SubUnit,
                    Author     = item.Author,
                    BrowseTime = item.BrowseTime ?? 0,
                    Remark     = item.Remark,
                    Type       = GetInfoType(item.Type ?? 0)
                };
                result.Add(info);
            }
            var jsondata = new
            {
                msg   = string.Empty,
                code  = Status.success,
                count = dataObj.Count(),
                data  = result
            };

            return(Json(jsondata, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult GetPubicInformationById(int Id)
        {
            var info     = new PublicInformationDTO();
            var dataObjs = PublicInformationService.GetEntities(u => u.Id == Id && u.DelFlag == 1);

            if (dataObjs != null && dataObjs.Count() > 0)
            {
                var dataObj = dataObjs.FirstOrDefault();
                info.Id         = dataObj.Id;
                info.Title      = dataObj.Title;
                info.Content    = Server.HtmlDecode(dataObj.Content);
                info.SubTime    = TimeFormatter.TimeFormat(dataObj.SubTime.ToString());
                info.SubUnit    = dataObj.SubUnit;
                info.Author     = dataObj.Author;
                info.BrowseTime = dataObj.BrowseTime ?? 0;
                info.Remark     = dataObj.Remark;
                info.Type       = GetInfoType(dataObj.Type ?? 0);
                var jsondata = new
                {
                    code  = Status.success,
                    count = 1,
                    data  = info
                };
                return(Json(jsondata, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    code = Status.error,
                    count = 0,
                    data = info
                }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 3
0
        public ActionResult GetTourismPlanning(int page, int limit, string keyword = "")
        {
            var dataObj = TouristPlanningService.GetEntities(u => u.DelFlag == 1);
            var data    = new List <TouristPlanning>();

            if (keyword.Length > 0)
            {
                data = dataObj.Where(x => x.Name.Contains(keyword) || x.PlanLeader.Contains(keyword) || x.PlanUnit.Contains(keyword)).ToList();
            }
            else
            {
                data = dataObj.ToList();
            }
            var res = data
                      .OrderByDescending(x => x.SubTime)
                      .Take(limit * page).Skip(limit * (page - 1)).ToList();//进行分页
            var result = new List <TouristPlanningDTO>();

            foreach (var item in res)
            {
                var info = new TouristPlanningDTO
                {
                    Id           = item.Id,
                    Name         = item.Name,
                    Introduce    = Server.HtmlDecode(item.Introduce),
                    SubTime      = TimeFormatter.TimeFormat(item.SubTime.ToString()),
                    PlanUnit     = item.PlanUnit,
                    PlanLeader   = item.PlanLeader,
                    BrowseTime   = item.BrowseTime ?? 0,
                    Remark       = item.Remark,
                    Latitude     = item.Latitude,
                    Longitude    = item.Longitude,
                    Location     = item.Location,
                    MessageCount = item.MessageCount ?? 0,
                    PlanArea     = item.PlanArea,
                    PlanImage    = item.PlanImage,
                    PlanTarget   = item.PlanTarget,
                    PlanYears    = item.PlanYears
                                   //  Type = GetInfoType(item.Type ?? 0)
                };
                result.Add(info);
            }
            var jsondata = new
            {
                msg   = string.Empty,
                code  = Status.success,
                count = data.Count(),
                data  = result
            };

            return(Json(jsondata, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public ActionResult GetALLTourismPlanning()
        {
            var dataObj = TouristPlanningService.GetEntities(u => u.DelFlag == 1);
            var res     = dataObj.OrderByDescending(x => x.SubTime).ToList();
            var result  = new List <TouristPlanningDTO>();

            foreach (var item in res)
            {
                var info = new TouristPlanningDTO
                {
                    Id           = item.Id,
                    Name         = item.Name,
                    Introduce    = Server.HtmlDecode(item.Introduce),
                    SubTime      = TimeFormatter.TimeFormat(item.SubTime.ToString()),
                    PlanUnit     = item.PlanUnit,
                    PlanLeader   = item.PlanLeader,
                    BrowseTime   = item.BrowseTime ?? 0,
                    Remark       = item.Remark,
                    Latitude     = item.Latitude,
                    Longitude    = item.Longitude,
                    Location     = item.Location,
                    MessageCount = item.MessageCount ?? 0,
                    PlanArea     = item.PlanArea,
                    PlanImage    = item.PlanImage,
                    PlanTarget   = item.PlanTarget,
                    PlanYears    = item.PlanYears
                                   //  Type = GetInfoType(item.Type ?? 0)
                };
                result.Add(info);
            }
            var jsondata = new
            {
                msg   = string.Empty,
                code  = Status.success,
                count = result.Count(),
                data  = result
            };

            return(Json(jsondata, JsonRequestBehavior.AllowGet));
        }