Ejemplo n.º 1
0
 public FilesController(IMFilesVaultService mfvaultService, IMFObjectService mfobjService,
                        ISharedFileService fileshareService, IAuthenticationManager authManager)
     : base(authManager)
 {
     _mfvaultService   = mfvaultService;
     _mfobjService     = mfobjService;
     _fileshareService = fileshareService;
 }
Ejemplo n.º 2
0
 protected ProjectBaseController(IProjectService projectService, IMFilesVaultService mfvaultService,
                                 IMfUserGroupService mfgroupService, IVaultTemplateService vaultTemplateService, IMFObjectService mfilesObjService,
                                 IAuthenticationManager authManager)
     : base(authManager)
 {
     _mfvaultService       = mfvaultService;
     _mfusergroupService   = mfgroupService;
     _projectService       = projectService;
     _vaultTemplateService = vaultTemplateService;
     _mfilesObjService     = mfilesObjService;
 }
Ejemplo n.º 3
0
 public InviteController(UserManager <User, long> userManager, IUserService userService, IProjectMemberService projectMemberService
                         , IProjectService projectService, IVaultTemplateService vaultTempService, IMFilesVaultService mfvaultService
                         , IMFObjectService mfobjService, IMfUserGroupService mfusergroupService, IEmailService emailService)
 {
     _userManger           = userManager;
     _userService          = userService;
     _projectMemberService = projectMemberService;
     _projectService       = projectService;
     _vaultTempService     = vaultTempService;
     _mfvaultService       = mfvaultService;
     _mfobjService         = mfobjService;
     _mfusergroupService   = mfusergroupService;
     _emailService         = emailService;
 }
Ejemplo n.º 4
0
 public static string Invite(InviteModel inviteModel, UserManager <User, long> _userManger, long userId, string userName
                             , IUserService _userService, IProjectMemberService _projectMemberService, IProjectService _projectService
                             , IVaultTemplateService _vaultTempService, IMFilesVaultService _mfvaultService, IMFObjectService _mfobjService
                             , IMfUserGroupService _mfusergroupService, IEmailService _emailService, string baseUri)
 {
     if (String.IsNullOrEmpty(inviteModel.Email))
     {
         var userDto = AccountController.GetUserProfile(_userManger, userId);//UserClient.GetProfile(baseUri, token);
         //if (!userRes.Success)
         //{
         //    return BadRequest("当前用户认证失效");
         //}
         //var userDto = JsonConvert.DeserializeObject<UserDto>(userRes.Content);
         inviteModel.Email = userDto.Email;
     }
     //Log.Info("API获取ProjectClient...");
     if (inviteModel.InviteEmail != "")//分email和用户ID两种记录方式
     {
         //Log.Info("API生成BindingModel...");
         var model = new ProjectInvitationEmailModel
         {
             ProjectId         = inviteModel.ProjectId,
             InviteeEmail      = inviteModel.InviteEmail,
             InvitationMessage = "请加入" + inviteModel.ProjectName + "项目",
             InviteePartId     = inviteModel.PartyId,
             MFUserId          = inviteModel.MFUserId,
             BidProjId         = inviteModel.BidProjId
         };
         //Log.Info("API添加数据库信息...");
         var res = Api.ProjectMembersController.InviteMemberByEmail(model, userId, userName
                                                                    , _userService, _projectMemberService, _projectService, _vaultTempService
                                                                    , _mfvaultService, _mfobjService, _mfusergroupService);
         if (String.IsNullOrEmpty(res))
         {
             //Log.Info("API添加数据库信息成功...");
             var sendEmailError = SendInviteEmail(baseUri, inviteModel.PartyName, inviteModel.InviteEmail,
                                                  inviteModel.Email, inviteModel.ProjectName, inviteModel.ProjectId, inviteModel.UserId,
                                                  inviteModel.PartyId, _emailService);
             if (sendEmailError == "success")
             {
                 return(String.Empty);
             }
             else
             {
                 return(sendEmailError);
             }
         }
         else
         {
             var err = res;
             Log.Error("API添加数据库信息失败:" + err);
             return(err);
         }
     }
     else
     {
         var model = new ProjectInvitationUserModel
         {
             ProjectId         = inviteModel.ProjectId,
             InviteeId         = inviteModel.UserId,
             InvitationMessage = "请加入" + inviteModel.ProjectName + "项目",
             InviteePartId     = inviteModel.PartyId
         };
         var res = Api.ProjectMembersController.InviteMemberByUserId(model, userId, userName,
                                                                     _projectService, _projectMemberService, _vaultTempService
                                                                     , _mfvaultService, _userService, _mfobjService, _mfusergroupService);
         if (String.IsNullOrEmpty(res))
         {
             var sendEmailError = SendInviteEmail(baseUri, inviteModel.PartyName, inviteModel.InviteEmail,
                                                  inviteModel.Email, inviteModel.ProjectName, inviteModel.ProjectId, inviteModel.UserId,
                                                  inviteModel.PartyId, _emailService);
             if (sendEmailError == "success")
             {
                 return(String.Empty);
             }
             else
             {
                 return(sendEmailError);
             }
         }
         else
         {
             var err = res;
             return(err);
         }
     }
 }
Ejemplo n.º 5
0
 protected static MFProjectParty GetMfParty(MFilesVault vault, MetadataAliases aliases, string partyName, IMFObjectService mfilesObjService, int?currentUserId = null)
 {
     return(mfilesObjService.GetParty(vault, partyName, aliases, currentUserId));
 }
Ejemplo n.º 6
0
 protected static void UpdateMfObj <T>(MFilesVault vault, MetadataAliases aliases, T entity, IMFObjectService mfilesObjService) where T : InternalEntity
 {
     mfilesObjService.Update(vault, aliases, entity);
 }