Пример #1
0
        protected string DoGetNewsTypes(string pRequest)
        {
            //请求参数反序列化
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetNewsTypeListRP> >();

            //参数校验

            //构造响应数据
            var rd = new APIResponse <GetNewsTypeListRD>(new GetNewsTypeListRD());

            try
            {
                //获取数据集

                /*DataTable dt = new DataTable();
                 *  dt.Columns.Add("TypeId");
                 *  dt.Columns.Add("TypeName");
                 *  dt.Rows.Add(new string[]{"34E07242-B38F-4262-9AA9-21A18C73DEF5","资讯信息"});
                 *  dt.Rows.Add(new string[] { "A13F9C0D-BA0E-4F08-8075-1F4DA2E099B1", "项目推荐" });
                 */
                rd.Data.TypeList = PrivateLNewsTypeBLL.GetNewsTypes("");
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                throw new Exception(ex.Message, ex);
            }
            return(rd.ToJSON());
        }
Пример #2
0
        protected string DoGetTypeListPage(string pRequest)
        {
            //请求参数反序列化
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetTypeListPageRP> >();

            //参数校验
            rp.Parameters.Validate();

            //构造响应数据
            var rd = new APIResponse <GetTypeListPageRD>(new GetTypeListPageRD());

            try
            {
                //获取列表信息
                int pageCount = 0;
                int rowCount  = 0;
                rd.Data.Page      = PrivateLNewsTypeBLL.GetTypeListPage(rp.Parameters.SortField, rp.Parameters.SortOrder, rp.Parameters.PageIndex, rp.Parameters.PageSize, ref pageCount, ref rowCount);
                rd.Data.PageCount = pageCount;
                rd.Data.RowCount  = rowCount;
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                throw new Exception(ex.Message, ex);
            }
            return(rd.ToJSON());
        }
Пример #3
0
        protected string DoGetNewsTypesDetail(string pRequest)
        {
            //请求参数反序列化
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetNewsTypesDetailRP> >();

            //参数校验
            rp.Parameters.Validate();

            //构造响应数据
            var rd = new APIResponse <GetNewsTypesDetailRD>(new GetNewsTypesDetailRD());

            try
            {
                //Get News Detail Info
                LNewsTypeEntity tyEn = PrivateLNewsTypeBLL.GetByID(rp.Parameters.TypeId);
                if (tyEn != null)
                {
                    rd.Data.NewsTypeId   = tyEn.NewsTypeId;
                    rd.Data.NewsTypeName = tyEn.NewsTypeName;
                    rd.Data.TypeLevel    = tyEn.TypeLevel - 1;
                    rd.Data.ParentTypeId = tyEn.ParentTypeId;
                    LNewsTypeEntity preEn = PrivateLNewsTypeBLL.GetByID(tyEn.ParentTypeId);
                    rd.Data.ParentTypeName = preEn != null ? preEn.NewsTypeName : string.Empty;
                }
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                throw new Exception(ex.Message, ex);
            }
            return(rd.ToJSON());
        }
Пример #4
0
        protected string DoUpdateNewsTypes(string pRequest)
        {
            //请求参数反序列化
            var rp = pRequest.DeserializeJSONTo <APIRequest <UpdateNewsTypesRP> >();

            //参数校验
            rp.Parameters.Validate();

            //构造响应数据
            var rd = new APIResponse <UpdateNewsTypesRD>(new UpdateNewsTypesRD());

            try
            {
                //Get News Detail Info
                PrivateLNewsTypeBLL.Update(new LNewsTypeEntity()
                {
                    NewsTypeId = rp.Parameters.TypeId, ParentTypeId = rp.Parameters.ParentId, NewsTypeName = rp.Parameters.TypeName, TypeLevel = rp.Parameters.ParentLevel + 1
                }, false);
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                throw new Exception(ex.Message, ex);
            }
            return(rd.ToJSON());
        }
Пример #5
0
        protected string DoAddNewsTypes(string pRequest)
        {
            //请求参数反序列化
            var rp = pRequest.DeserializeJSONTo <APIRequest <AddNewsTypesRP> >();

            //参数校验
            rp.Parameters.Validate();

            //构造响应数据
            var rd = new APIResponse <AddNewsTypesRD>(new AddNewsTypesRD());

            try
            {
                //Get News Detail Info
                PrivateLNewsTypeBLL.Create(new LNewsTypeEntity()
                {
                    NewsTypeId = Guid.NewGuid().ToString(), ParentTypeId = rp.Parameters.ParentId, NewsTypeName = rp.Parameters.TypeName, TypeLevel = rp.Parameters.ParentLevel + 1, CustomerId = PrivateLoggingSessionInfo.ClientID
                });
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                throw new Exception(ex.Message, ex);
            }
            return(rd.ToJSON());
        }
Пример #6
0
        protected string DoDelNewsType(string pRequest)
        {
            //请求参数反序列化
            var rp = pRequest.DeserializeJSONTo <APIRequest <DelNewsTypeRP> >();

            //参数校验
            rp.Parameters.Validate();

            //构造响应数据
            var rd = new APIResponse <DelNewsTypeRD>(new DelNewsTypeRD());

            try
            {
                //Get News Detail Info
                PrivateLNewsTypeBLL.Delete(rp.Parameters.TypeIds.Split(','));
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                throw new Exception(ex.Message, ex);
            }
            return(rd.ToJSON());
        }