Exemplo n.º 1
0
        public ActionResult GetJsonData(SearchDataTable dt, RotationType rotationType)
        {
            if (rotationType == RotationType.UnKnown)
            {
                return(Json(new
                {
                    data = new List <RotationChartViewModel>()
                }, JsonRequestBehavior.AllowGet));
            }

            int totalNum = 0;
            List <RotationChart> rotationList = rotationService.GetAll(rotationType);

            totalNum = rotationList != null ? rotationList.Count : 0;

            ReturnPageResultIList <RotationChart> data   = new ReturnPageResultIList <Core.RotationChart>(rotationList, totalNum);
            IList <RotationChartViewModel>        gmList = new List <RotationChartViewModel>();

            if (data != null && data.DataT != null)
            {
                gmList = data.DataT.Select(g => new RotationChartViewModel()
                {
                    Id = g.Id, HeadImg = g.ImgSrc, SmallHeadImg = GetThumb(g.ImgSrc), WebLink = g.WebLink, RotationType = g.Type
                }).ToList();
            }

            return(Json(new
            {
                recordsFiltered = data.totalRecords,
                recordsTotal = data.totalPages,
                data = gmList
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult GetJsonData(SearchDataTable dt, MsgViewQuery svm)
        {
            int totalNum = 0;
            MessageRecordQuery fillter = new MessageRecordQuery();

            fillter.PageIndex = dt.pageIndex;
            fillter.PageSize  = dt.length;
            if (svm != null)
            {
                fillter.CreateDate = svm.CreateDate;
                fillter.MessageId  = svm.MsgId;
                fillter.SendState  = svm.SendState;
            }

            List <MessageRecord> msgList = msgService.GetPage(fillter, out totalNum);
            ReturnPageResultIList <MessageRecord> data = new ReturnPageResultIList <MessageRecord>(msgList, totalNum);
            IList <MsgViewModel> gmList = new List <MsgViewModel>();

            if (data != null && data.DataT != null)
            {
                gmList = data.DataT.Select(g => new MsgViewModel()
                {
                    Id = g.Id, UserId = g.OperatorId, Number = g.MessageId, State = g.SendState, CreateTime = g.CreateDate.ToString("yyyy-MM-dd HH:mm"), Phone = g.ToAddress, SendDate = g.SendDate == null || g.SendDate == DateTime.MinValue ? "--" : g.SendDate.ToString("yyyy-MM-dd HH:mm"), OrderDate = DateTime.MinValue.Equals(g.MsgData.OrderDate) ? "--" : g.MsgData.OrderDate.ToString("yyyy-MM-dd"), OrderName = g.MsgData.OrderName
                }).ToList();
            }

            return(Json(new
            {
                recordsFiltered = data.totalRecords,
                recordsTotal = data.totalPages,
                data = gmList
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult GetJsonData(SearchDataTable dt, SearchViewModel svm)
        {
            int totalNum = 0;
            FilterEntityModel fillter = new FilterEntityModel();

            fillter.PageIndex    = dt.pageIndex;
            fillter.PageSize     = dt.length;
            fillter.KeyValueList = new List <KeyValueObj>();
            if (svm != null && !string.IsNullOrEmpty(svm.FilterKey) && !string.IsNullOrEmpty(svm.FilterVal))
            {
                string     fkey  = string.Empty;
                SearchType ftype = (SearchType)Convert.ToInt16(svm.FilterKey);

                switch (ftype)
                {
                case SearchType.Name:
                    fkey = "Name";
                    fillter.FilterType = FilterType.Like;
                    break;

                case SearchType.Type:
                    fkey = "Category";
                    break;

                case SearchType.Number:
                    fkey = "Number";
                    break;

                case SearchType.Area:
                    fkey = "City";
                    break;
                }

                fillter.KeyValueList.Add(new KeyValueObj()
                {
                    Key = fkey, Value = svm.FilterVal
                });
            }

            List <TeaCertificate> teaList = teaService.GetPage(fillter, out totalNum);
            ReturnPageResultIList <TeaCertificate> data = new ReturnPageResultIList <Core.TeaCertificate>(teaList, totalNum);
            IList <TeaViewModel> gmList = new List <TeaViewModel>();

            if (data != null && data.DataT != null)
            {
                gmList = data.DataT.Select(g => new TeaViewModel()
                {
                    Id = g.Id, UserId = g.UserId, TeacherName = g.Name, Number = g.Number, Gender = g.Gender, State = (int)g.State, CreateTime = g.CreateDate.ToString("yyyy-MM-dd HH:mm"), Category = g.Category, Level = g.Level, Province = Convert.ToInt32(g.Province), City = Convert.ToInt32(g.City), UserName = g.UserName, Area = GetAreaStr(g.Province, g.City)
                }).ToList();
            }

            return(Json(new
            {
                recordsFiltered = data.totalRecords,
                recordsTotal = data.totalPages,
                data = gmList
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ActionResult GetJsonData(SearchDataTable dt, SearchViewModel svm)
        {
            int totalNum = 0;
            FilterEntityModel fillter = new FilterEntityModel();

            fillter.PageIndex    = dt.pageIndex;
            fillter.PageSize     = dt.length;
            fillter.KeyValueList = new List <KeyValueObj>();
            if (svm != null && !string.IsNullOrEmpty(svm.FilterKey) && !string.IsNullOrEmpty(svm.FilterVal))
            {
                string     fkey  = string.Empty;
                SearchType ftype = (SearchType)Convert.ToInt16(svm.FilterKey);

                switch (ftype)
                {
                case SearchType.Name:
                    fkey = "Name";
                    fillter.FilterType = FilterType.Like;
                    break;

                case SearchType.State:
                    fkey = "State";
                    break;

                case SearchType.Number:
                    fkey = "Telephone";
                    break;
                }

                fillter.KeyValueList.Add(new KeyValueObj()
                {
                    Key = fkey, Value = svm.FilterVal
                });
            }

            List <User> userList = uService.GetPage(fillter, out totalNum);
            ReturnPageResultIList <User> data   = new ReturnPageResultIList <Core.User>(userList, totalNum);
            IList <UserViewModel>        gmList = new List <UserViewModel>();

            if (data != null && data.DataT != null)
            {
                gmList = data.DataT.Select(g => new UserViewModel()
                {
                    Id = g.Id, RealName = g.Name, UserName = g.UserName, Phone = g.Telephone, State = (int)g.State, CreateTime = g.CreateDate.ToString("yyyy-MM-dd HH:mm"), Email = g.Email, IsSupAdmin = g.IsAdmin
                }).ToList();
            }

            return(Json(new
            {
                recordsFiltered = data.totalRecords,
                recordsTotal = data.totalPages,
                data = gmList
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public ActionResult GetJsonData(SearchDataTable dt, SearchViewModel svm)
        {
            int totalNum = 0;
            FilterEntityModel fillter = new FilterEntityModel();

            fillter.PageIndex    = dt.pageIndex;
            fillter.PageSize     = dt.length;
            fillter.KeyValueList = new List <KeyValueObj>();
            if (svm != null && !string.IsNullOrEmpty(svm.FilterKey) && !string.IsNullOrEmpty(svm.FilterVal))
            {
                string     fkey  = string.Empty;
                SearchType ftype = (SearchType)Convert.ToInt16(svm.FilterKey);

                switch (ftype)
                {
                case SearchType.Title:
                    fkey = "Title";
                    fillter.FilterType = FilterType.Like;
                    break;

                case SearchType.Type:
                    fkey = "Category";
                    break;

                case SearchType.State:
                    fkey = "State";
                    break;
                }

                fillter.KeyValueList.Add(new KeyValueObj()
                {
                    Key = fkey, Value = svm.FilterVal
                });
            }

            List <FileDownload> downList = downService.GetPage(fillter, out totalNum);
            ReturnPageResultIList <FileDownload> data   = new ReturnPageResultIList <Core.FileDownload>(downList, totalNum);
            IList <DownloadViewModel>            gmList = new List <DownloadViewModel>();

            if (data != null && data.DataT != null)
            {
                gmList = data.DataT.Select(g => new DownloadViewModel()
                {
                    Id = g.Id, UserId = g.UserId, FileName = g.Name, CategoryName = g.CategoryName, State = (int)g.State, CreateTime = g.CreateDate.ToString("yyyy-MM-dd HH:mm"), Category = g.Category, FileType = g.Type, FileTitle = g.Title, UserName = g.UserName, Src = g.Src
                }).ToList();
            }

            return(Json(new
            {
                recordsFiltered = data.totalRecords,
                recordsTotal = data.totalPages,
                data = gmList
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public ActionResult GetJsonData(SearchDataTable dt, FilterViewModel filter)
        {
            int totalNum = 0;
            List <CategoryDictionary> categoryList = cdService.GetAll(filter.CategoryType);

            totalNum = categoryList != null ? categoryList.Count : 0;

            if (filter.CategoryType == CategoryType.Examination && categoryList != null && categoryList.Count > 0)
            {
                if (filter.IsParent)
                {
                    categoryList.RemoveAll(g => g.Parent > 0);
                }
                else
                {
                    categoryList.RemoveAll(g => g.Parent == 0);
                }
            }

            ReturnPageResultIList <CategoryDictionary> data = new ReturnPageResultIList <Core.CategoryDictionary>(categoryList, totalNum);
            IList <CategoryViewModel> gmList = new List <CategoryViewModel>();

            if (data != null && data.DataT != null)
            {
                gmList = data.DataT.Select(g => new CategoryViewModel()
                {
                    Id = g.Id, CategoryName = g.Name, CategoryType = g.Type, ParentId = g.Parent, ParentName = g.ParentName, State = (int)g.State, UserName = g.UserName, CreateTime = g.CreateDate.ToString("yyyy-MM-dd HH:mm")
                }).ToList();
            }

            return(Json(new
            {
                recordsFiltered = data.totalRecords,
                recordsTotal = data.totalPages,
                data = gmList
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public ActionResult GetJsonData(SearchDataTable dt, SearchViewModel svm)
        {
            try
            {
                int totalNum = 0;
                FilterEntityModel fillter = new FilterEntityModel();
                fillter.PageIndex    = dt.pageIndex;
                fillter.PageSize     = dt.length;
                fillter.KeyValueList = new List <KeyValueObj>();

                if (svm != null)
                {
                    if (!string.IsNullOrEmpty(svm.ReserveField))
                    {
                        fillter.KeyValueReserves = new List <KeyValueObj>()
                        {
                            new KeyValueObj()
                            {
                                Key = "Section", Value = svm.ReserveField
                            }
                        };
                    }

                    if (!string.IsNullOrEmpty(svm.FilterKey) && !string.IsNullOrEmpty(svm.FilterVal))
                    {
                        SearchType  ftype = (SearchType)Convert.ToInt16(svm.FilterKey);
                        KeyValueObj kvb   = new KeyValueObj()
                        {
                            Value = svm.FilterVal
                        };
                        switch (ftype)
                        {
                        case SearchType.Title:
                            kvb.Key            = "Title";
                            fillter.FilterType = FilterType.Like;
                            break;

                        case SearchType.State:
                            kvb.Key = "State";
                            break;

                        case SearchType.Type:
                            kvb.Key = "Category";
                            break;

                        case SearchType.Date:
                            kvb.Key            = "PublishDate";
                            kvb.FieldType      = FieldType.Date;
                            fillter.FilterType = FilterType.Between;
                            break;
                        }

                        fillter.KeyValueList.Add(kvb);
                    }
                }

                List <Article> downList = articleService.GetPage(fillter, out totalNum);
                ReturnPageResultIList <Article> data   = new ReturnPageResultIList <Core.Article>(downList, totalNum);
                IList <ArticleViewModel>        gmList = new List <ArticleViewModel>();

                if (data != null && data.DataT != null)
                {
                    gmList = data.DataT.Select(g => new ArticleViewModel()
                    {
                        Id = g.Id, UserId = g.UserId, Title = g.Title, CategoryName = !string.IsNullOrEmpty(g.ParCategoryName) ? g.ParCategoryName + "-" + g.CategoryName : g.CategoryName, State = (int)g.State, CreateTime = g.CreateDate.ToString("yyyy-MM-dd HH:mm"), PublishDate = g.PublishDate <= DateTime.MinValue ? "无发布日期" : g.PublishDate.ToString("yyyy-MM-dd HH:mm"), Category = g.Category, UserName = g.UserName, ParCategory = g.ParCategory, HeadImg = g.HeadImg, SmallHeadImg = GetThumb(g.HeadImg), Section = g.Section, ParCategoryName = g.ParCategoryName
                    }).ToList();
                }

                return(Json(new
                {
                    recordsFiltered = data.totalRecords,
                    recordsTotal = data.totalPages,
                    data = gmList
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                AddLog("GetList", ex.ToString());
            }

            return(EmptyJsonResult());
        }