Beispiel #1
0
        public ResponseInfoModel GetInfo(int id)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var wildlifeManager = _wildlifeCategoryService.Get(id);
                var output          = wildlifeManager.MapTo <GetWildLifeCategoryOutput>();
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/wildlifeclass/getinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #2
0
        public ResponseInfoModel Selectlist()
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var templateList = _templateService.GetNoTrackingList(a => true).ToList();
                var outputList   = templateList.MapTo <List <GetTemplateSelectListOutput> >();
                json.Result = outputList;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/template/selectlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #3
0
        public ResponseInfoModel Delete([FromBody] DeleteWildlifeManagementInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                int[] idInts = ConvertStringToIntArr(input.IDs);

                if (_routeViewSpotService.GetNoTrackingList(a => idInts.Contains(a.RouteID)).Any())
                {
                    throw new UserFriendlyException("有路线景点顺序不能删除");
                }

                if (!_routeService.Delete(a => idInts.Contains(a.ID)))
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.DeleteFail;
                }
                else
                {
                    foreach (var id in idInts)
                    {
                        _logService.Insert(new Log()
                        {
                            ActionContent = LocalizationConst.Delete,
                            SourceType    = _moduleName,
                            SourceID      = id,
                            LogUserID     = input.UserID,
                            LogTime       = DateTime.Now,
                            LogIPAddress  = IPHelper.GetIPAddress,
                        });
                    }
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/route/delete", LocalizationConst.DeleteFail);
            }
            return(json);
        }
Beispiel #4
0
        public ResponseInfoModel Delete([FromBody] DeleteUserInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                int[] idInts = ConvertStringToIntArr(input.ids);

                if (_PublicityContentService.GetNoTrackingList(a => idInts.Contains(a.PublicityCategoryID)).Any())
                {
                    throw new UserFriendlyException("位置下有链接不可删除");
                }

                if (!_publicityCategoryService.Delete(a => idInts.Contains(a.ID)))
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.DeleteFail;
                }
                else
                {
                    foreach (var id in idInts)
                    {
                        _logService.Insert(new Log()
                        {
                            ActionContent = LocalizationConst.Delete,
                            SourceType    = _moduleName,
                            SourceID      = id,
                            LogUserID     = input.userID,
                            LogTime       = DateTime.Now,
                            LogIPAddress  = IPHelper.GetIPAddress,
                        });
                    }
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/deleteposition", LocalizationConst.DeleteFail);
            }
            return(json);
        }
Beispiel #5
0
        public ResponseInfoModel GetpositionInfo(int ID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var position = _publicityCategoryService.Get(ID);
                var output   = position.MapTo <GetPublicityCategoryOutput>();
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/positionlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #6
0
        public ResponseInfoModel Positiontypelist()
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var list       = _publicityTypesService.GetNoTrackingList(a => true).OrderBy(a => a.OrderID).OrderByDescending(a => a.ID).ToList();
                var outputList = list.MapTo <List <GetPublicityTypeListOutput> >();
                json.Result = outputList;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/positiontypelist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #7
0
        public ResponseInfoModel shlist(int LogUser)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var output = _articleService.GetShlist(LogUser);

                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/shlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #8
0
        public ResponseInfoModel ChangeStickTop([FromBody] ChangeStickTopInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();

                var article = _articleService.Get(input.ID);
                if (article == null)
                {
                    throw new UserFriendlyException(LocalizationConst.NoExist);
                }

                article.IsStickTop = input.IsStickTop;

                if (!_articleService.Update(article))
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.UpdateFail;
                }
                else
                {
                    _logService.Insert(new Log()
                    {
                        ActionContent = LocalizationConst.Update,
                        SourceType    = _moduleName,
                        SourceID      = input.ID,
                        LogTime       = DateTime.Now,
                        LogUserID     = input.ModifyUser,
                        LogIPAddress  = IPHelper.GetIPAddress,
                    });
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/changeStickTop", LocalizationConst.UpdateFail);
            }
            return(json);
        }
Beispiel #9
0
        public ResponseInfoModel Getinfo(int id)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var user   = _userService.GetInclude(id);
                var output = user.MapTo <GetUserOutput>();
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/user/getinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #10
0
        public ResponseInfoModel ChangePersonalInfo([FromBody] ChangePersonalInfoInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var user = _userService.Get(input.ID);
                if (user == null)
                {
                    throw new UserFriendlyException(LocalizationConst.NoExist);
                }
                user            = input.MapTo(user);
                user.ModifyTime = DateTime.Now;
                user.ModifyIP   = IPHelper.GetIPAddress;

                if (!_userService.Update(user))
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.UpdateFail;
                }
                else
                {
                    _logService.Insert(new Log()
                    {
                        ActionContent = LocalizationConst.Update,
                        SourceType    = _moduleName,
                        SourceID      = input.ID,
                        LogTime       = DateTime.Now,
                        LogUserID     = input.ModifyUser,
                        LogIPAddress  = IPHelper.GetIPAddress,
                    });
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/user/changePersonalInfo", LocalizationConst.UpdateFail);
            }
            return(json);
        }
Beispiel #11
0
        public ResponseInfoModel Lookdetail([FromUri] CreateVisitRecordInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();

                var output = _articleService.LookDetail(input.id, input.ClientScreen, input.VisitUrl, input.ReferUrl, input.CategoryId);
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/lookdetail", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #12
0
        public ResponseInfoModel Roleslist()
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                var roleList   = _roleService.GetNoTrackingList(a => true).OrderBy(a => a.OrderID).ThenByDescending(a => a.CreateTime).ToList();
                var outputList = roleList.MapTo <List <GetRoleListListOutput> >();
                json.Result = outputList;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/role/roleslist", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel Treelist()
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var categoryList = _articleCategoryService.GetNoTrackingList(a => true).OrderBy(a => a.OrderID).ToList();
                var outputList   = categoryList.MapTo <List <GetCategoryTreeListOutput> >();

                json.Result = outputList;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/treelist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #14
0
        public ResponseInfoModel Showlist([FromUri] GetPublicityShowListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var outputList = _PublicityContentService.GetShowList(input);
                json.Result = new ListInfo()
                {
                    List = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/showlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel Frontlist(int ParentID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var outputList = _articleCategoryService.FrontlistByParent(ParentID);
                json.Result = new ListInfo()
                {
                    List = outputList
                };;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/Frontlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #16
0
        public ResponseInfoModel Selectlist()
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var list = _userService.GetNoTrackingList(a => true).Select(s => new GetSelectListOutput()
                {
                    ID = s.ID, UserName = s.UserName
                }).ToList();
                json.Result = list;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/user/selectlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel GetCateInfo(string RefNo)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var outputList = _articleCategoryService.FrontlistByRefNo(RefNo);
                json.Result = new ListInfo()
                {
                    List = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/getcateinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel Novalid(string RefNo, int?ID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var navgation = _articleCategoryService.Get(a => a.RefNo == RefNo && (!ID.HasValue || a.ID != ID));
                if (navgation != null)
                {
                    json.Success = 0;
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/novalid", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel GetCrumbs(int id)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var outputList = _articleCategoryService.GetCrumbs(id);
                json.Result = new ListInfo()
                {
                    List = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/getcrumbs", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #20
0
        public ResponseInfoModel Getinfo(int ID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var template = _templateService.Get(ID);
                var attach   = _articleAttachService.Get(a => a.ArticleGuid == template.Guid);
                var output   = template.MapTo <GetTemplateOutput>();
                output.Attach = attach.MapTo <GetTemplateAttachOutput>();
                json.Result   = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/template/getinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #21
0
        public ResponseInfoModel Valid(string NavName)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var navgation = _navgationService.Get(a => a.NavName == NavName);
                if (navgation != null)
                {
                    json.Success = 0;
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/navgation/valid", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #22
0
        public ResponseInfoModel AddRoutespot([FromBody] CreateRouteViewSpotInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();

                var route = input.MapTo <RouteViewSpot>();
                route.CreatTime = DateTime.Now;
                route.CreateIP  = IPHelper.GetIPAddress;

                var entity = _routeViewSpotService.Insert(route);
                if (entity == null)
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.InsertFail;
                }
                else
                {
                    _logService.Insert(new Log()
                    {
                        ActionContent = LocalizationConst.Insert,
                        SourceType    = _moduleName,
                        SourceID      = entity.ID,
                        LogTime       = DateTime.Now,
                        LogUserID     = input.CreatUser,
                        LogIPAddress  = IPHelper.GetIPAddress,
                    });
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/route/addroutespot", LocalizationConst.InsertFail);
            }
            return(json);
        }
Beispiel #23
0
        public ResponseInfoModel AddInfo([FromBody] CreateUserInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                int[] idInts = ConvertStringToIntArr(input.RoleIDS);
                var   user   = input.MapTo <User>();
                user.CreateTime = DateTime.Now;
                user.CreateIP   = IPHelper.GetIPAddress;

                var entity = _userService.AddInfo(user, idInts);
                if (entity == null)
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.InsertFail;
                }
                else
                {
                    _logService.Insert(new Log()
                    {
                        ActionContent = LocalizationConst.Insert,
                        SourceType    = _moduleName,
                        SourceID      = entity.ID,
                        LogTime       = DateTime.Now,
                        LogUserID     = input.CreateUser,
                        LogIPAddress  = IPHelper.GetIPAddress,
                    });
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/user/addInfo", LocalizationConst.InsertFail);
            }
            return(json);
        }
        public ResponseInfoModel DeleteDetail([FromBody] DeleteWildliftContentInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();

                int[] idInts = ConvertStringToIntArr(input.IDs);

                if (!_wildlifeContentService.Delete(a => idInts.Contains(a.ID)))
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.DeleteFail;
                }
                else
                {
                    foreach (var id in idInts)
                    {
                        _logService.Insert(new Log()
                        {
                            ActionContent = LocalizationConst.Delete,
                            SourceType    = _moduleName,
                            SourceID      = id,
                            LogUserID     = input.UserID,
                            LogTime       = DateTime.Now,
                            LogIPAddress  = IPHelper.GetIPAddress,
                        });
                    }
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/wildlifemanager/deletedetail", LocalizationConst.DeleteFail);
            }
            return(json);
        }
Beispiel #25
0
        public ResponseInfoModel Selpositionlist(int PublicityTypesID)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var list = _publicityCategoryService.GetNoTrackingList(a => a.PublicityTypesID == PublicityTypesID)
                           .OrderBy(a => a.OrderID)
                           .OrderByDescending(a => a.CreateTime)
                           .ToList();
                var outputList = list.MapTo <List <GetSelCategoryOutput> >();
                json.Result = outputList;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/contentlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #26
0
        public ResponseInfoModel ShowListByName([FromUri] GetPublicityShowNameListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var publicity = _publicityCategoryService.Get(a => a.PublicityCategoryName == input.PublicityCateName);
                if (publicity == null)
                {
                    json.Result = new ListInfo()
                    {
                        List = new object[] { }
                    };
                    return(json);
                }
                else
                {
                    GetPublicityShowListInput newInput = new GetPublicityShowListInput()
                    {
                        PublicityTypesID = input.PublicityTypesID,
                        PublicityCateID  = publicity.ID,
                        Top = input.Top
                    };
                    var outputList = _PublicityContentService.GetShowList(newInput);
                    json.Result = new ListInfo()
                    {
                        List = outputList
                    };
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/publicity/showListByName", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #27
0
        public ResponseInfoModel Add([FromBody] CreateWildLifeCategoryInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                var wildlifeCategory = input.MapTo <WildlifeCategory>();
                wildlifeCategory.CreateIP  = IPHelper.GetIPAddress;
                wildlifeCategory.CreatTime = DateTime.Now;

                var entity = _wildlifeCategoryService.Insert(wildlifeCategory);
                if (entity == null)
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.InsertFail;
                }
                else
                {
                    _logService.Insert(new Log()
                    {
                        ActionContent = LocalizationConst.Insert,
                        SourceType    = _moduleName,
                        SourceID      = entity.ID,
                        LogTime       = DateTime.Now,
                        LogUserID     = input.CreatUser,
                        LogIPAddress  = IPHelper.GetIPAddress,
                    });
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/wildlifeclass/add", LocalizationConst.InsertFail);
            }
            return(json);
        }
Beispiel #28
0
        public ResponseInfoModel TopListByRefno2([FromUri] GetArticleTopRefNoInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();

                var articleCategory = _articleCategoryService.Get(a => a.RefNo == input.RefNo);
                if (articleCategory == null)
                {
                    json.Result = new ListInfo()
                    {
                        List = new object[] { }
                    };
                    return(json);
                }
                else
                {
                    int cateId = articleCategory.ID;

                    int[] articleCategoryIds = { cateId };
                    var   outputList         = _articleService.GetTopRefnoList(input.Top, articleCategoryIds.ToArray(), cateId);
                    json.Result = new ListInfo()
                    {
                        List = outputList
                    };
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/toplistbyrefno2", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel GetDetailInfo(int id)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var wildlifeContent = _wildlifeContentService.Get(id);
                var output          = wildlifeContent.MapTo <GetWildlifeContentOutput>();
                if (output != null)
                {
                    output.Attachs = _articleAttachService.GetNoTrackingList(a => a.ModuleType == (int)AttachTypesEnum.动植物管理详细附件 && a.ArticleGuid == wildlifeContent.FileID).MapTo <List <GetObjAttachOutput> >();
                }
                json.Result = output;
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/wildlifemanager/getdetailinfo", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel ChangeOrderID([FromBody] ChangeCategoryOrderIDInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();

                if (!_articleCategoryService.ChangeOrderID(input))
                {
                    json.Success = 0;
                    json.Result  = LocalizationConst.UpdateFail;
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/changeOrderID", LocalizationConst.UpdateFail);
            }
            return(json);
        }