Example #1
0
        public ActionResult CreatePosts(string filter)
        {
            var UserPosts = new UserPosts();

            UserPosts.UserName = filter;
            ViewBag.name       = filter;
            return(View(UserPosts));
        }
Example #2
0
 //POST:/Users/GetCommentsForPost
 public IActionResult GetCommentsForPost(UserPosts mymodel)
 {
     if (!ModelState.IsValid)
     {
         return(View(mymodel));
     }
     mymodel.Posts = DataService.GetCommentsForPost(mymodel.User.Id);
     mymodel.User  = DataService.GetUserById(mymodel.User.Id);
     return(View(mymodel));
 }
Example #3
0
        public IActionResult Get(string id)
        {
            UserPosts userPost = _dataRepository.Get(id);

            if (userPost == null)
            {
                return(NotFound("User post record couldn't be found."));
            }

            return(Ok(userPost));
        }
Example #4
0
        public IActionResult Delete(string id)
        {
            UserPosts userPost = _dataRepository.Get(id);

            if (userPost == null)
            {
                return(NotFound("User post record couldn't be found."));
            }

            _dataRepository.Delete(userPost);
            return(NoContent());
        }
        public ResponseModel AddNewPost(PostModel postModel)
        {
            ResponseModel result = new ResponseModel();

            result = AddNewPostValidate(postModel);

            if (!result.IsSuccess)
            {
                return(result);
            }

            using (TransactionScope tran = new TransactionScope())
            {
                try
                {
                    UserPosts post = new UserPosts();
                    post.Body            = postModel.Body;
                    post.CategoryID      = postModel.CategoryID;
                    post.CreateDate      = DateTime.Now;
                    post.IsActive        = true;
                    post.IsPublish       = postModel.IsPublish;
                    post.MetaKeywords    = postModel.MetaKeywords;
                    post.MetaDescription = postModel.MetaDescription;
                    post.MetaTitle       = postModel.MetaTitle;
                    post.Summary         = postModel.Summary;
                    post.Tags            = postModel.Tags;
                    post.IsNews          = postModel.IsNews;
                    post.Uri             = postModel.Uri;
                    post.UserID          = postModel.UserID;
                    post.TopPhotoUrl     = postModel.TopPhotoUrl;
                    post.Title           = postModel.Title;

                    if (postModel.MainImage != null)
                    {
                        _imgM.SavePostMainPage(postModel.MainImage, postModel.FileSaveMap);
                    }

                    post.ID = _postRepo.Insert(post);

                    result.IsSuccess = true;
                    result.Message   = "Makale başarı ile kaydedilmiştir.";
                    tran.Complete();
                    return(result);
                }
                catch (Exception ex)
                {
                    tran.Dispose();
                    result.Message = ex.Message;
                    return(result);
                }
            }
        }
Example #6
0
        public IActionResult Add([FromBody] UserPosts userPost)
        {
            if (userPost == null)
            {
                return(BadRequest("User post is Null"));
            }

            string userId = _usersContext.Users.FirstOrDefault(u => u.Token == UserIdentityToken).Id;

            userPost.refUserId = userId;
            userPost.Id        = Guid.NewGuid().ToString();
            _dataRepository.Add(userPost);

            return(CreatedAtAction("Get", new { Id = userPost.Id }, userPost));
        }
Example #7
0
 public object CommentsViewModel(int userId) => new
 {
     Id,
     Author     = Author?.ViewModel,
     Comments   = Comments.Select(c => c.ViewModel),
     LikesCount = Likes.Count,
     Tags       = TagPosts.Select(tp => tp.Tag.EmptyViewModel),
     Badges     = BadgePosts.Select(bp => bp.Badge),
     PublishDate,
     Title,
     Content,
     SavesCount = UserPosts.Count,
     Liked      = Likes.Any(l => l.UserId == userId),
     Saved      = UserPosts.Any(up => up.UserId == userId)
 };
Example #8
0
        public async Task <long> Create(CreateUserDto input)
        {
            var user = ObjectMapper.Map <User>(input);

            user.TenantId         = AbpSession.TenantId;
            user.Password         = _passwordHasher.HashPassword(user, input.Password);
            user.IsEmailConfirmed = true;
            user.WorkNumber       = user.WorkNumber?.Trim() ?? "";
            if (!user.WorkNumber.IsNullOrWhiteSpace())
            {
                //验证工号是否唯一
                var has = _userRepository.GetAll().FirstOrDefault(ite => ite.WorkNumber == user.WorkNumber);
                if (has != null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "工号重复,请换一个工号");
                }
            }

            (await _userManager.CreateAsync(user)).CheckErrors(LocalizationManager);;

            if (input.RoleNames != null)
            {
                (await _userManager.SetRoles(user, input.RoleNames)).CheckErrors(LocalizationManager);
            }

            foreach (var item in input.OrgPostIds)
            {
                var orgPostModel = await _organizationUnitPostsRepository.GetAsync(item);

                var userPost = new UserPosts()
                {
                    Id = Guid.NewGuid(), UserId = user.Id, PostId = orgPostModel.PostId, OrgPostId = orgPostModel.Id, OrgId = orgPostModel.OrganizationUnitId
                };
                await _userPostsRepository.InsertAsync(userPost);
            }
            foreach (var item in input.RelationSystemIds)
            {
                var r_s = new ContractWithSystem()
                {
                    Id = Guid.NewGuid(), UserId = user.Id, SystemId = item
                };
                await _contractWithSystemRepository.InsertAsync(r_s);
            }

            CurrentUnitOfWork.SaveChanges();
            return(user.Id);
        }
Example #9
0
        public IActionResult Update(string id, [FromBody] UserPosts userPost)
        {
            if (userPost == null)
            {
                return(BadRequest("User post is Null"));
            }

            UserPosts userPostToUpdate = _dataRepository.Get(id);

            if (userPostToUpdate == null)
            {
                return(NotFound("User post record couldn't be found."));
            }

            _dataRepository.Update(userPostToUpdate, userPost);
            return(NoContent());
        }
Example #10
0
        public ActionResult CreatePosts(UserPosts posts)
        {
            if (!ModelState.IsValid)
            {
                return(View(posts));
            }

            // int typeid= photo.PhotoId;
            var model = new UserPosts();

            model.UserName  = posts.UserName;
            model.Comments  = posts.Comments;
            model.Createdon = System.DateTime.Now;
            // model.PhotoId = typeid;
            galRepo.UploadPosts(model);

            return(RedirectPermanent("/home"));
        }
Example #11
0
        public async Task <IEnumerable <UserPosts> > GetUserPosts(string id)
        {
            var collection = await _context.Products.Where(X => X.ApplicationUserId == id).ToListAsync();

            List <UserPosts> result = new List <UserPosts>();

            foreach (var item in collection)
            {
                UserPosts temp = new UserPosts
                {
                    PostId        = item.Id,
                    ProductName   = item.ProductName,
                    StartDateTime = item.StartDateTime,
                    EndDateTime   = item.EndDateTime
                };
                result.Add(temp);
            }
            return((IEnumerable <UserPosts>)result);
        }
Example #12
0
        public IHttpActionResult SharePost(int UserId, int PostId)
        {
            try
            {
                var post    = db.UserPosts.Where(x => x.Id == PostId).FirstOrDefault();
                var newPost = new UserPosts();
                newPost.AuthorId      = UserId;
                newPost.Content       = post.Content;
                newPost.PostDate      = DateTime.Now;
                newPost.PrimaryPostId = PostId;
                db.UserPosts.Add(newPost);
                db.SaveChanges();

                return(Ok(newPost.Id));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Example #13
0
 public IHttpActionResult SavePost([FromBody] UserPosts p)
 {
     try
     {
         p.PostDate = DateTime.Now;
         if (p.Id != 0) // edit
         {
             var pdb = db.UserPosts.Where(x => x.Id == p.Id).FirstOrDefault();
             pdb.Content = p.Content;
         }
         else // new post
         {
             db.UserPosts.Add(p);
         }
         db.SaveChanges();
         return(Json(p.Id));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        public ResponseModel UpdatePost(PostModel postModel)
        {
            ResponseModel result = new ResponseModel();

            result = AddNewPostValidate(postModel);

            if (!result.IsSuccess)
            {
                return(result);
            }

            using (TransactionScope tran = new TransactionScope())
            {
                try
                {
                    UserPosts post = new UserPosts();
                    post = _postRepo.GetByID(postModel.ID);
                    if (post == null || post.ID <= 0)
                    {
                        result.Message = "Post bulunamadı!";
                        return(result);
                    }

                    post.Body            = postModel.Body;
                    post.CategoryID      = postModel.CategoryID;
                    post.CreateDate      = DateTime.Now;
                    post.IsPublish       = postModel.IsPublish;
                    post.MetaKeywords    = postModel.MetaKeywords;
                    post.MetaDescription = postModel.MetaDescription;
                    post.MetaTitle       = postModel.MetaTitle;
                    post.Summary         = postModel.Summary;
                    post.Tags            = postModel.Tags;
                    post.IsNews          = postModel.IsNews;
                    if (postModel.MainImage != null)
                    {
                        _imgM.SavePostMainPage(postModel.MainImage, postModel.FileSaveMap);
                        _imgM.RemoveOldPostImages(post.TopPhotoUrl);
                    }

                    post.Uri         = postModel.Uri;
                    post.TopPhotoUrl = postModel.TopPhotoUrl;
                    bool upd_val = _postRepo.Update(post);

                    result.IsSuccess = upd_val;

                    if (upd_val)
                    {
                        tran.Complete();
                        result.IsSuccess = true;
                        result.Message   = "Makale başarı ile güncellemiştir!";
                        return(result);
                    }
                    else
                    {
                        tran.Dispose();
                        result.Message = "Makale güncellenirken hata oluştu!";
                        return(result);
                    }
                }
                catch (Exception ex)
                {
                    tran.Dispose();
                    result.Message = ex.Message;
                    return(result);
                }
            }
        }
Example #15
0
        public IActionResult Index()
        {
            AppUser currentUser    = null;
            var     x              = (ClaimsIdentity)this.User.Identity;
            var     claimsIdentity = (ClaimsIdentity)this.User.Identity;
            var     claim          = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier);

            if (claim != null)
            {
                var userId = claim.Value;
                currentUser = _db.AppUsers.Find(userId);

                if (currentUser.isBlocked != null && currentUser.isBlocked == true)
                {
                    //LOGOUT HERE
                    //HttpContext.Response.Redirect("../Areas/Identity/Pages/Account/Lockout");
                    //return RedirectToPage("/Account/Lockout");
                    return(View("Locked"));
                }

                List <string> friendsIds = _db.Friends.Where(f => f.receiverUserID == userId && f.Status == Status.RequestConfirmed).Select(f => f.senderUserID).ToList();
                friendsIds.AddRange(_db.Friends.Where(f => f.senderUserID == userId && f.Status == Status.RequestConfirmed).Select(f => f.receiverUserID).ToList());

                var CurrentPosts = _db.Posts.Include(p => p.Comment).ThenInclude(c => (c as Comment).User)
                                   .Include(p => p.Like).ThenInclude(l => (l as Like).User)
                                   .Include(p => p.Publisher)
                                   .Where(p => p.PublisherId == userId ||
                                          (friendsIds.Contains(p.PublisherId) &&
                                           (p.Publisher.isBlocked == null || p.Publisher.isBlocked == false))).ToList();

                foreach (var post in CurrentPosts)
                {
                    var commentsToRemove = post.Comment.Where(c => (c.User.isBlocked != null && c.User.isBlocked == true)).ToList();
                    if (commentsToRemove != null && commentsToRemove.Count > 0)
                    {
                        foreach (var comment in commentsToRemove)
                        {
                            post.Comment.Remove(comment);
                        }
                    }

                    var likesToRemove = post.Like.Where(c => (c.User.isBlocked != null && c.User.isBlocked == true)).ToList();
                    if (likesToRemove != null && likesToRemove.Count > 0)
                    {
                        foreach (var like in likesToRemove)
                        {
                            post.Like.Remove(like);
                        }
                    }
                }

                List <int> likedPosts = _db.Likes.Where(l => l.UserID == userId && l.isLiked).Select(l => l.PostID).ToList();

                //  if (CurrentPosts != null)
                if (CurrentPosts.Count > 0)

                {
                    UserPosts uspo1 = new UserPosts()
                    {
                        myUser  = currentUser,
                        allpost = new List <Post>()
                    };
                    //return View(currentUser);
                    return(View(CurrentPosts));
                }
                //else
                //{
                return(View(new List <Post>()));
                //}
            }

            UserPosts uspo = new UserPosts()
            {
                myUser  = currentUser,
                allpost = new List <Post>()
            };

            // return View(new List<Post>());
            return(View(uspo));
        }
Example #16
0
        public override async Task <UserDto> Create(CreateUserDto input)
        {
            CheckCreatePermission();

            var user = ObjectMapper.Map <User>(input);

            user.TenantId         = AbpSession.TenantId;
            user.Password         = _passwordHasher.HashPassword(user, input.Password);
            user.IsEmailConfirmed = true;
            user.WorkNumber       = user.WorkNumber.Trim();
            //验证工号是否唯一
            var has = _userRepository.GetAll().FirstOrDefault(ite => ite.WorkNumber == user.WorkNumber);

            if (has != null)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "工号重复,请换一个工号");
            }
            CheckErrors(await _userManager.CreateAsync(user));

            //改为由岗位继承角色
            //if (input.RoleNames != null)
            //{
            //    CheckErrors(await _userManager.SetRoles(user, input.RoleNames));
            //}
            if (input.OrganizationUnitId == 0)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "请至少指定一个部门。");
            }
            if (input.OrgPostIds == null || input.OrgPostIds.Count == 0)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "请至少指定一个岗位。");
            }
            //设置所在部门
            await _abpOrganizationUnitsManager.AddToOrganizationUnitAsync(user.Id, input.OrganizationUnitId);

            //角色
            var roles = new List <string>();

            foreach (var item in input.OrgPostIds)
            {
                var orgPostModel = await _organizationUnitPostsRepository.GetAsync(item);

                var userPost = new UserPosts()
                {
                    Id = Guid.NewGuid(), UserId = user.Id, PostId = orgPostModel.PostId, OrgPostId = orgPostModel.Id, OrgId = orgPostModel.OrganizationUnitId
                };
                if (item == input.MainPostId)
                {
                    userPost.IsMain = true;// 设置主岗位
                }
                var rs = _organizationUnitPostsRoleRepository.GetAll().Where(ite => ite.OrgPostId == item).Select(ite => ite.RoleName).ToList();
                foreach (var r in rs)
                {
                    var existrole = await _roleManager.GetRoleByNameAsync(r);

                    if (existrole != null)
                    {
                        roles.Add(r);
                    }
                }
                await _userPostsRepository.InsertAsync(userPost);

                if (orgPostModel.Level == Level.分管领导) //如果是领导岗位 则更新部门领导
                {
                    var org   = _workflowOrganizationUnitsRepository.Get(orgPostModel.OrganizationUnitId);
                    var tmp   = new List <string>();
                    var users = _userPostsRepository.GetAll().Where(ite => ite.OrgPostId == item).ToList();
                    var us    = new List <User>();
                    foreach (var u in users)
                    {
                        var us1 = _userRepository.FirstOrDefault(u.UserId);
                        if (us1 != null)
                        {
                            us.Add(us1);
                        }
                    }
                    us.Add(user);
                    tmp = us.Select(ite => $"u_{ite.Id}").ToList();
                    org.ChargeLeader = string.Join(",", tmp);
                }
                if (orgPostModel.Level == Level.部门领导)//如果是领导岗位 则更新部门领导
                {
                    var org   = _workflowOrganizationUnitsRepository.Get(orgPostModel.OrganizationUnitId);
                    var tmp   = new List <string>();
                    var users = _userPostsRepository.GetAll().Where(ite => ite.OrgPostId == item).ToList();
                    var us    = new List <User>();
                    foreach (var u in users)
                    {
                        var us1 = _userRepository.FirstOrDefault(u.UserId);
                        if (us1 != null)
                        {
                            us.Add(us1);
                        }
                    }
                    us.Add(user);
                    tmp        = us.Select(ite => $"u_{ite.Id}").ToList();
                    org.Leader = string.Join(",", tmp);
                }
            }
            if (roles == null)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "所选岗位角色为空,请先为岗位指定角色。");
            }
            CheckUserRole(roles);
            CheckErrors(await _userManager.SetRoles(user, roles.ToArray()));
            foreach (var item in input.RelationSystemIds)
            {
                var r_s = new ContractWithSystem()
                {
                    Id = Guid.NewGuid(), UserId = user.Id, SystemId = item
                };
                await _contractWithSystemRepository.InsertAsync(r_s);
            }


            #region  创建IM账号
            try
            {
                var im_Service     = AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IM_UserManager>();
                var exit_UserCount = _userRepository.GetAll().Count();
                if (exit_UserCount == 0)
                {
                    var firesOrg    = _workflowOrganizationUnitsRepository.FirstOrDefault(r => !r.ParentId.HasValue);
                    var companyName = "公司全体";
                    if (firesOrg != null)
                    {
                        companyName = firesOrg.DisplayName;
                    }
                    im_Service.CreateIMUsers(new List <CreateIMUserInput>()
                    {
                        new CreateIMUserInput()
                        {
                            nickname = input.Name, password = input.Password, username = user.Id.ToString()
                        }
                    }, true, companyName);
                }
                else
                {
                    im_Service.CreateIMUsers(new List <CreateIMUserInput>()
                    {
                        new CreateIMUserInput()
                        {
                            nickname = input.Name, password = input.Password, username = user.Id.ToString()
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                //处理im报错
            }

            #endregion

            CurrentUnitOfWork.SaveChanges();

            return(MapToEntityDto(user));
        }
 public void UploadUserPosts(UserPosts posts)
 {
     db.UserPosts.Add(posts);
     db.SaveChanges();
 }
Example #18
0
        public async Task UpdateUserAsyn(UpdateUserInput input)
        {
            Debug.Assert(input.User.Id != null, "input.User.Id should be set.");

            var user = await _userManager.GetUserByIdAsync(input.User.Id.Value);

            var oldName = user.Name;

            //Update user properties
            //input.User.MapTo(user); //Passwords is not mapped (see mapping configuration)
            user.Name         = input.User.Name;
            user.UserName     = input.User.UserName;
            user.EmailAddress = input.User.EmailAddress;
            user.PhoneNumber  = input.User.PhoneNumber;
            user.Sex          = input.User.Sex;
            user.EnterTime    = input.User.EnterTime;
            user.IdCard       = input.User.IdCard;


            if (!string.IsNullOrWhiteSpace(input.User.Password))
            {
                CheckErrors(await _userManager.ChangePasswordAsync(user, input.User.Password));
            }

            CheckErrors(await _userManager.UpdateAsync(user));



            //Update roles 改为不能直接设置角色,而通过岗位继承角色
            //if (input.AssignedRoleNames != null && input.AssignedRoleNames.Length != 0)
            //{
            //    var ret = await SetRoles(user, input.AssignedRoleNames);
            //    CheckErrors(ret);
            //}


            //if (input.SetRandomPassword)
            //{
            //    input.User.Password = User.CreateRandomPassword();
            //}


            if (input.PostIds != null && input.PostIds.Count == 0)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "请选择至少一个岗位");
            }
            if (input.PostIds.Count != input.PostIds.Distinct().Count())
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "请不要重复选择同一岗位");
            }
            if (input.MainPostId == Guid.Empty || input.PostIds.Contains(input.MainPostId) == false)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "主岗位不在所选岗位中,请重新选择。");
            }
            var exit_post = _userPostsRepository.GetAll().Where(r => r.UserId == user.Id);

            foreach (var item in exit_post)
            {
                await _userPostsRepository.DeleteAsync(item);
            }
            var  orgids  = new List <long>();//所在部门集合
            long mainorg = 0;

            foreach (var item in input.PostIds)
            {
                var orgPostModel = await _organizationUnitPostsRepository.GetAsync(item);

                if (orgids.Exists(ite => ite == orgPostModel.OrganizationUnitId) == false)
                {
                    orgids.Add(orgPostModel.OrganizationUnitId);
                }
                var userPost = new UserPosts()
                {
                    Id = Guid.NewGuid(), UserId = user.Id, PostId = orgPostModel.PostId, OrgPostId = orgPostModel.Id, OrgId = orgPostModel.OrganizationUnitId
                };
                if (item == input.MainPostId)
                {
                    userPost.IsMain = true;// 设置主岗位
                    mainorg         = orgPostModel.OrganizationUnitId;
                }
                await _userPostsRepository.InsertAsync(userPost);
            }
            //部门更新
            var oldorgs   = _userOrganizationUnitsRepository.GetAll().Where(ite => ite.UserId == input.User.Id).ToList();
            var oldids    = oldorgs.Select(ite => ite.OrganizationUnitId).ToList();
            var addorg    = orgids.Except(oldids).ToList();
            var updateorg = orgids.Intersect(oldids).ToList();
            var delorg    = oldids.Except(orgids).ToList();

            foreach (var x in addorg)
            {
                _userOrganizationUnitsRepository.Insert(new WorkFlowUserOrganizationUnits()
                {
                    IsMain             = mainorg == x,
                    OrganizationUnitId = x,
                    UserId             = user.Id,
                });
            }
            foreach (var x in updateorg)
            {
                var t = oldorgs.First(ite => ite.OrganizationUnitId == x);
                if (x == mainorg)
                {
                    t.IsMain = true;
                }
            }
            foreach (var x in delorg)
            {
                var t = oldorgs.First(ite => ite.OrganizationUnitId == x);
                _userOrganizationUnitsRepository.Delete(ite => ite.Id == t.Id);
            }

            CurrentUnitOfWork.SaveChanges();
            foreach (var item in input.PostIds)
            {
                var orgPostModel = await _organizationUnitPostsRepository.GetAsync(item);

                var org = _workflowOrganizationUnitsRepository.Get(orgPostModel.OrganizationUnitId);
                var tmp = new List <string>();
                if (orgPostModel.Level == Level.分管领导)
                {
                    var users = _userPostsRepository.GetAll().Where(ite => ite.OrgPostId == item).ToList();
                    var us    = new List <User>();
                    foreach (var u in users)
                    {
                        var us1 = _userRepository.FirstOrDefault(u.UserId);
                        if (us1 != null)
                        {
                            us.Add(us1);
                        }
                    }
                    tmp = us.Select(ite => $"u_{ite.Id}").ToList();
                    org.ChargeLeader = string.Join(",", tmp);
                }
                if (orgPostModel.Level == Level.部门领导)
                {
                    var users = _userPostsRepository.GetAll().Where(ite => ite.OrgPostId == item).ToList();
                    var us    = new List <User>();
                    foreach (var u in users)
                    {
                        var us1 = _userRepository.FirstOrDefault(u.UserId);
                        if (us1 != null)
                        {
                            us.Add(us1);
                        }
                    }
                    tmp        = us.Select(ite => $"u_{ite.Id}").ToList();
                    org.Leader = string.Join(",", tmp);
                }
                _workflowOrganizationUnitsRepository.Update(org);
            }
            //调整岗位后 更新角色
            var newroles = _organizationUnitPostsRoleRepository.GetAll().Where(ite => input.PostIds.Contains(ite.OrgPostId)).Select(ite => ite.RoleName).Distinct().ToArray();

            CheckUserRole(newroles.ToList());
            await _userManager.SetRoles(user, newroles);

            //联系人关联系统
            var exit_sys_realtion = _contractWithSystemRepository.GetAll().Where(r => r.UserId == user.Id);

            foreach (var item in exit_sys_realtion)
            {
                await _contractWithSystemRepository.DeleteAsync(item);
            }
            if (input.RealtionSystemIds != null)
            {
                foreach (var item in input.RealtionSystemIds)
                {
                    var entity = new ContractWithSystem()
                    {
                        Id = Guid.NewGuid(), SystemId = item, UserId = user.Id
                    };
                    await _contractWithSystemRepository.InsertAsync(entity);
                }
            }

            CurrentUnitOfWork.SaveChanges();
            #region  更新im用户信息
            try
            {
                var im_Service = AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IM_UserManager>();
                if (!string.IsNullOrWhiteSpace(input.User.Password))
                {
                    im_Service.UpdateIMUserPassword(input.User.Id.ToString(), input.User.Password);
                }
                if (input.User.Name != oldName)
                {
                    im_Service.UpdateIMUserNickname(input.User.Id.ToString(), input.User.Name);
                }
            }
            catch (Exception)
            {
            }
            #endregion
        }