Esempio n. 1
0
        protected override GetNewsTypeListRD ProcessRequest(DTO.Base.APIRequest <GetNewsTypeListRP> pRequest)
        {
            var rd = new GetNewsTypeListRD();

            int?pageSize  = pRequest.Parameters.PageSize;
            int?pageIndex = pRequest.Parameters.PageIndex;

            var bll = new LNewsTypeBLL(CurrentUserInfo);

            var ds = bll.GetNewsTypeList(CurrentUserInfo.ClientID, pageIndex ?? 0, pageSize ?? 15);

            if (ds.Tables[0].Rows.Count == 0)
            {
                rd.NewsTypeList = null;
            }
            else
            {
                var temp = ds.Tables[0].AsEnumerable().Select(t => new NewsTypeInfo
                {
                    NewsTypeId   = t["NewsTypeId"].ToString(),
                    NewsTypeName = t["NewsTypeName"].ToString()
                });
                rd.NewsTypeList = temp.ToArray();
            }
            return(rd);
        }
        /// <summary>
        /// 新闻类型
        /// </summary>
        public string GetNewsTypeData()
        {
            //var newsTypeArray = new[] {
            //    new { Id = "", Description = "" }
            //    new { Id = "1", Description = "首页新闻模块" },
            //    new { Id = "2", Description = "校友故事模块" },
            //    new { Id = "3", Description = "发布会" }
            //};

            //string content = string.Empty;

            //var jsonData = new JsonData();
            //jsonData.totalCount = newsTypeArray.Length.ToString();
            //jsonData.data = newsTypeArray;

            //content = jsonData.ToJSON();
            //return content;

            var loggingSession           = new SessionManager().CurrentUserLoginInfo;
            var service                  = new LNewsTypeBLL(loggingSession);
            IList <LNewsTypeEntity> data = new List <LNewsTypeEntity>();
            string content               = string.Empty;

            data = service.QueryByEntity(new LNewsTypeEntity {
                CustomerId = loggingSession.ClientID
            }, null).ToList();

            var jsonData = new JsonData();

            jsonData.totalCount = data.Count.ToString();
            jsonData.data       = data;

            content = jsonData.ToJSON();
            return(content);
        }
        protected override Utility.Web.ComponentModel.TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes               nodes   = new TreeNodes();
            LNewsTypeBLL            service = new LNewsTypeBLL(new SessionManager().CurrentUserLoginInfo);
            IList <LNewsTypeEntity> units;

            string key     = string.Empty;
            string content = string.Empty;

            key = pParentNodeID;

            var orderBy = new OrderBy[] {
                new OrderBy {
                    FieldName = "CreateTime", Direction = OrderByDirections.Desc
                }
            };

            if (key == null || key == "-1" || key == "root" || key.Length == 0)
            {
                units = service.QueryByEntity(new LNewsTypeEntity()
                {
                    IsDelete   = 0,
                    CustomerId = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }
            else
            {
                units = service.QueryByEntity(new LNewsTypeEntity()
                {
                    IsDelete     = 0,
                    ParentTypeId = key,
                    CustomerId   = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }

            foreach (var item in units)
            {
                nodes.Add(item.NewsTypeId, item.NewsTypeName, item.ParentTypeId, false);
            }
            return(nodes);
        }