public async Task <DResult <OrganizationAbstractDto> > AddPosition([FromBody] PositionAddDto positionAddDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.AddPosition(positionAddDto)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <OrganizationAbstractDto>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 2
0
 public async Task <DResult <IList <string> > > GetRoleCodes(string UserId)
 {
     try
     {
         return(DResult.Succ(businessUser.GetRoles(UserId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <string> >(ex.Message, 500));
     }
 }
Esempio n. 3
0
 public async Task <DResult <PagedList <UserInfoDto> > > GetUsersOfInfo([FromBody] UserQueryPageDto userQueryDto)
 {
     try
     {
         return(DResult.Succ(businessUser.GetUsersOfInfo(userQueryDto)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <UserInfoDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 4
0
 public async Task <DResult <bool> > IsHasPrivilege(string UserId, string PrivilegeId = null, string PrivilegeCode = null)
 {
     try
     {
         return(DResult.Succ(businessUser.IsHasPrivilege(UserId, PrivilegeId, PrivilegeCode)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <bool>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 5
0
 public async Task <DResult <string> > AddUser([FromBody] UserAddDto vUser)
 {
     try
     {
         return(DResult.Succ(businessUser.AddUser(vUser)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <string>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 6
0
        public override void OnActionExecuting(HttpActionContext context)
        {
            //? 验证是否通过
            if (context.ModelState.IsValid)
            {
                return;
            }
            //? 0条错误信息
            if (context.ModelState.Count == 0)
            {
                return;
            }

            bool flag = false;

            var sb = new StringBuilder();


            foreach (ModelState entry in context.ModelState.Values)
            {
                foreach (ModelError item in entry.Errors)
                {
                    string message = item.ErrorMessage;

                    if (message.IsEmpty())
                    {
                        if (item.Exception is null)
                        {
                            continue;
                        }

                        message = item.Exception.Message;
                    }

                    if (flag)
                    {
                        sb.AppendLine();
                    }
                    else
                    {
                        flag = true;
                    }

                    sb.Append(message);
                }
            }

            context.Response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(JsonHelper.ToJson(DResult.Error(sb.ToString(), StatusCodes.RequestForbidden)), Encoding.UTF8, "application/json")
            };
        }
Esempio n. 7
0
 public async Task <DResult <int> > DeleteUser(string UserId)
 {
     try
     {
         return(DResult.Succ(businessUser.DeleteUser(UserId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <IList <AttributionTypeQueryInfoDto> > > GetOrganizationTypeQueryAttributionType(string TypeId)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationTypeQueryAttributionType(TypeId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <AttributionTypeQueryInfoDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <IList <OrganizationDto> > > GetOrganizationsByDName(string TypeId, string Name, string SystemId, string OrganizationId)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationsByDName(TypeId, Name, SystemId, OrganizationId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <OrganizationDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <OrganizationInfoMoreDto> > GetOrganizationInfoOfId(string OrganizationId)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationInfo(OrganizationId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <OrganizationInfoMoreDto>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <IList <IList <OrganizationDto> > > > GetParentListAll(string OrganizationId)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetParentListAll(OrganizationId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <IList <OrganizationDto> > >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <int> > DeleteOrganizationType(string OrganizationTypeId)
 {
     try
     {
         return(DResult.Succ(businessOrganization.DeleteOrganizationType(OrganizationTypeId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <long> > GetOrganizationUserCount(string OrganizationId, int HierarchyType)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationUserCount(OrganizationId, HierarchyType)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <long>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <PagedList <OrganizationDto> > > GetOrganizationOfTypeAsPage(string TypeId, int Page, int Size, bool IsLoadAll = false)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationOfType(TypeId, Page, Size, IsLoadAll)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <OrganizationDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <PagedList <RelationOrganizationDetailDto> > > GetRelationOrganizations(string OrganizationCode, string Name, int Page, int Size, string OrganizationId = null, string TypeId = null,
                                                                                                    string RelationTypeId = null, IList <KeyValueItem> Conditions = null)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetRelationOrganizations(OrganizationCode, Name, Page, Size, OrganizationId, TypeId, RelationTypeId, Conditions)));
     }
     catch (Exception ex) {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <RelationOrganizationDetailDto> >(ex.Message, 500));
     }
 }
 public async Task <DResult <PagedList <OrganizationDto> > > GetOrganizationsByDNameAsPage(string TypeId, string Name, string SystemId, string OrganizationId, string TypeName = null, string SystemCode = null, int Page = 0, int Size = 0)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationsByDNameAsPage(TypeId, Name, SystemId, OrganizationId, TypeName, SystemCode, Page, Size)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <OrganizationDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 17
0
 public async Task <DResult <PagedList <ItemDto> > > QueryItem(string systemId, string name, int page, int size)
 {
     try
     {
         return(DResult.Succ(businessItem.QueryItem(systemId, name, page, size)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <ItemDto> >(ex.Message, 500));
     }
 }
 public async Task <DResult <PagedList <OrganizationDto> > > GetSubOrganizationsNoChildren(string organizationId, int page = 0, int size = 0)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetSubOrganizationsNoChildren(organizationId, page, size)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <OrganizationDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 19
0
        public async Task <DResult> RemoveConfig(string module, string env)
        {
            if (env == "default")
            {
                env = null;
            }
            var result = await _contract.RemoveAsync(Project.Id, module, env);

            //:todo 通知删除 1.删除默认的,通知缺省的,2.删除具体的,获取默认再通知
            NotifyConfig(module, env, null);
            return(result > 0 ? DResult.Success : DResult.Error("删除失败"));
        }
 public async Task <DResult <PagedList <OrganizationDto> > > QueryOrganizationAsPage([FromBody] OrganizationQueryPageDto queryPageDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.QueryOrganizations(queryPageDto.keyValues, queryPageDto.Page, queryPageDto.Size, queryPageDto.TypeId, queryPageDto.SystemId, queryPageDto.SystemCode)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <OrganizationDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 21
0
 public async Task <DResult <int> > UpdateUser([FromBody] UserUpdateDto userUpdateDto)
 {
     try
     {
         return(DResult.Succ(businessUser.UpdateUser(userUpdateDto)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <PagedList <OrganizationDto> > > GetAllOrganizationInfoOfCode(string Code, int Page, int Size)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationAllInfo(Code, Page, Size)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <OrganizationDto> >(ex.Message, 500));
     }
 }
Esempio n. 23
0
 public async Task <DResult <IList <UserInfoDto> > > GetUsers(IList <string> UserIds)
 {
     try
     {
         return(DResult.Succ(businessUser.GetUsers(UserIds)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <UserInfoDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
 public async Task <DResult <PagedList <PositionInfoDto> > > QueryPositions([FromBody] PositionPageQueryDto pageQueryDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.QueryPositions(pageQueryDto)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <PositionInfoDto> >(ex.Message, 500));
     }
 }
Esempio n. 25
0
 public async Task <DResult <UserInfoDto> > GetMyInfoOfId(string UserId)
 {
     try
     {
         return(DResult.Succ(businessUser.GetMyInfo(UserId)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <UserInfoDto>(ex.Message, 500));
     }
 }
 public async Task <DResult <int> > UpdatePosition([FromBody] PositionUpdateDto positionUpdateDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.UpdatePosition(positionUpdateDto)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <int>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 27
0
 public async Task <DResult <PagedList <OrganizationAbstractDto> > > QueryUserOrganizationsByName(string UserId, string Name, int Page, int Size)
 {
     try
     {
         return(DResult.Succ(businessUser.QueryUserOrganizationsByName(UserId, Name, Page, Size)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <PagedList <OrganizationAbstractDto> >(ex.Message, 500));
     }
 }
 public async Task <DResult <IList <OrganizationTypeDto> > > GetOrganizationType(string SystemId, string SystemCode)
 {
     try
     {
         return(DResult.Succ(businessOrganization.GetOrganizationType(SystemId, SystemCode)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <IList <OrganizationTypeDto> >(ExceptionParse.ParseString(ex.Message), 500));
     }
 }
Esempio n. 29
0
 public async Task <DResult <PagedList <V2UserInfoDto> > > GetV2BatchUsers(string UserId, string Name, IList <int> Roles, bool IsBeilian, int Page = 0, int Size = 0)
 {
     try
     {
         return(DResult.Succ(businessUser.GetUsers(UserId, Name, Roles, IsBeilian, Page, Size)));
     }
     catch (Exception e)
     {
         Logger.Error(e.ToString());
         return(DResult.Error <PagedList <V2UserInfoDto> >(e.Message, 500));
     }
 }
 public async Task <DResult <string> > AddOrganizationType([FromBody] OrganizationTypeAddDto organizationTypeAddDto)
 {
     try
     {
         return(DResult.Succ(businessOrganization.AddOrganizationType(organizationTypeAddDto)));
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(DResult.Error <string>(ExceptionParse.ParseString(ex.Message), 500));
     }
 }