Ejemplo n.º 1
0
 public User AddUser(User user)
 {
     if (!PositionInfoRepo.Exists(this.MappingTo<PositionInfo>()))
     {
         throw new Exception("岗位不存在");
     }
     if (!User.UserInfoRepo.Exists(user.MappingTo<UserInfo>()))
     {
         throw new Exception("用户不存在");
     }
     PositionUserInfo pu = new PositionUserInfo();
     pu.UserId = user.Id;
     pu.OrganizationId = this.OrganizationId;
     pu.PositionId = this.Id;
     PositionUserInfoRepo.Save(pu);
     return user;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 新增用户
 /// </summary>
 /// <param name="user"></param>
 public User AddUser(User user)
 {
     if (user == null) return user;
     var positionUserList = PositionUserInfoRepo.Read();
     if (!positionUserList.Exists(pu => pu.OrganizationId == this.Code && pu.UserId == user.Account))
     {
         PositionUserInfo positionUserInfo = new PositionUserInfo();
         positionUserInfo.PositionId = "";
         positionUserInfo.UserId = user.Id;
         positionUserInfo.OrganizationId = this.Id;
         PositionUserInfoRepo.Save(positionUserInfo);
     }
     return user;
 }