Exemplo n.º 1
0
        public static UserCloudModel GetClouds(User user, IUserVaultService _uservaultService //IUserCloudService _usercloudService,
                                               , ICloudService _cloudService, IVaultTemplateService _vaultTemplateService, IMFVaultService _vaultService, IMFilesVaultService _mfvaultService, string host, params string[] roleNames)
        {
            var clouds = _cloudService.GetCloudsByUserRoles(roleNames);
            var userId = user.Id;

            var appModel   = new UserCloudModel();
            var userVaults = _uservaultService.GetVaults(userId);

            foreach (var app in clouds)
            {
                var a    = app;
                var appM = new CloudModel {
                    App = a.ToDto()
                };
                if (app.Id == CloudConstants.MyProjects)
                {
                    var templates = new List <VaultTemplate>();
                    foreach (var t in _vaultTemplateService.GetTemplatesByCloud(app.Id))
                    {
                        templates.Add(t);
                        //a.Templates.Add(t);
                    }
                    if (templates.Count > 0)
                    {
                        var appVaults =
                            userVaults.Where(c => templates.Any(d => c.TemplateId > 0 && c.TemplateId == d.Id));
                        appM.Vaults.AddRange(appVaults.Select(c => c.ToDtoWithoutTemplate()));
                    }
                    appM.Url = "/IntegratedManagement/Index";
                }
                //else if (app.Id == CloudConstants.ProjManagements)
                //{
                //    //todo 指定路径

                //}
                appModel.Apps.Add(appM);
            }
            var password   = DBWorldCache.Get(userId.ToString());
            var appVaultsC = _mfvaultService.GetVaultsByCloud(CloudConstants.SubContracts);
            var vv         = new List <MFilesVault>();

            foreach (var v in appVaultsC)
            {
                if (_vaultService.HasUser(user, password, v))
                {
                    vv.Add(v);
                }
            }
            if (vv.Count > 0)
            {
                var cc = _cloudService.GetCloudById(CloudConstants.SubContracts);
                var cM = new CloudModel {
                    App = cc.ToDto()
                };
                cM.Vaults.AddRange(vv.Select(c => c.ToDtoWithoutTemplate()));
                appModel.Apps.Add(cM);
            }
            return(appModel);
        }
Exemplo n.º 2
0
        public WorkingHourController(IVaultServerService vaultServer, IMFWorkHourService workHourService
                                     , IProjectService projService, IUserVaultService userVaultService)

        {
            _projService      = projService;
            _userVaultService = userVaultService;
            _vaultServer      = vaultServer;
            _workHourService  = workHourService;
        }
Exemplo n.º 3
0
 public CloudController(ICloudService cloudService
                        , IUserVaultService uservaultService, IVaultTemplateService vaultTemplateService, IRepository <Company> companyRepo, IRepository <Area> areaRepo
                        , IMFVaultService vaultService, IUserService userService, IMFilesVaultService mfvaultService, IAuthenticationManager authenticationManager)
     : base(authenticationManager) //, IUserCloudService usercloudService
 {
     _cloudService         = cloudService;
     _companyRepo          = companyRepo;
     _areaRepo             = areaRepo;
     _uservaultService     = uservaultService;
     _vaultTemplateService = vaultTemplateService;
     _vaultService         = vaultService;
     _userService          = userService;
     _mfvaultService       = mfvaultService;
 }
Exemplo n.º 4
0
 public AccountController(UserManager <User, long> userManager, SignInManager <User, long> signInManager, IAuthenticationManager authManager, IUserService userService
                          , IUserVaultService uservaultService, IRepository <MFilesVault> vaultRepository, IMFilesVaultService mfvaultService
                          , ICloudService cloudService, IVaultTemplateService vaultTemplateService, IProjectService projService, IProjectMemberService projectMemberService
                          , IVaultServerService vaultserverService, IMFUserService mfuserService, IMFVaultService vaultService) //IUserCloudService usercloudService,
     : base(authManager, signInManager, userManager)
 {
     _userService = userService;
     //_usercloudService = usercloudService;
     _uservaultService     = uservaultService;
     _cloudService         = cloudService;
     _vaultTemplateService = vaultTemplateService;
     _projService          = projService;
     _projectMemberService = projectMemberService;
     _mfvaultService       = mfvaultService;
     _vaultserverService   = vaultserverService;
     _mfuserService        = mfuserService;
     _vaultService         = vaultService;
     _vaultRepository      = vaultRepository;
 }