public AccountManager(IWindsorContainer windsorContainer, IEmailConfirmationManager emailConfirmationManager, IDataTableBinder dataTableBinder, IUserAuditor auditor)
        {
            if (windsorContainer == null)
            {
                throw new ArgumentNullException("windsorContainer");
            }
            if (emailConfirmationManager == null)
            {
                throw new ArgumentNullException("emailConfirmationManager");
            }
            if (dataTableBinder == null)
            {
                throw new ArgumentNullException("dataTableBinder");
            }
            if (auditor == null)
            {
                throw new ArgumentNullException("auditor");
            }
            IRepositoryContainer repositoryContainer = windsorContainer.Resolve <IRepositoryContainer>();

            UserRepository     = repositoryContainer.Obtain <IUserRepository>();
            SchoolRepository   = repositoryContainer.Obtain <ISchoolRepository>();
            ProviderRepository = repositoryContainer.Obtain <IProviderRepository>();
            RoleRepository     = repositoryContainer.Obtain <IRoleRepository>();
            UserRoleRepository = repositoryContainer.Obtain <IUserRoleRepository>();
            UserAccessChangeEventRepository = repositoryContainer.Obtain <IUserAccessChangeEventRepository>();
            LoginEventRepository            = repositoryContainer.Obtain <ILoginEventRepository>();
            EulaAgreementRepository         = repositoryContainer.Obtain <IEulaAgreementRepository>();
            RepositoryContainer             = repositoryContainer;
            EmailConfirmationManager        = emailConfirmationManager;
            DataTableBinder = dataTableBinder;
            Auditor         = auditor;
        }
예제 #2
0
 protected CustomFieldManager(IRepositoryContainer repositories, IBlobClient blobClient, IDataTableBinder dataTableBinder, IUserAuditor auditor)
 {
     if (repositories == null)
     {
         throw new ArgumentNullException("repositories");
     }
     if (blobClient == null)
     {
         throw new ArgumentNullException("blobClient");
     }
     if (dataTableBinder == null)
     {
         throw new ArgumentNullException("dataTableBinder");
     }
     if (auditor == null)
     {
         throw new ArgumentNullException("auditor");
     }
     RepositoryContainer           = repositories;
     CustomDataOriginRepository    = repositories.Obtain <ICustomDataOriginRepository>();
     CustomFieldCategoryRepository = repositories.Obtain <ICustomFieldCategoryRepository>();
     CustomFieldRepository         = repositories.Obtain <ICustomFieldRepository>();
     CustomFieldTypeRepository     = repositories.Obtain <ICustomFieldTypeRepository>();
     CustomFieldValueRepository    = repositories.Obtain <ICustomFieldValueRepository>();
     StudentRepository             = repositories.Obtain <IStudentRepository>();
     ServiceTypeRepository         = repositories.Obtain <IServiceTypeRepository>();
     DataFileBlobContainer         = blobClient.CreateContainer(DataFileBlobContainerName);
     DataTableBinder = dataTableBinder;
     Auditor         = auditor;
 }
 public SchoolDistrictManager(IRepositoryContainer repositories, IDataTableBinder dataTableBinder, IUserAuditor auditor)
 {
     if (repositories == null)
     {
         throw new ArgumentNullException("repositories");
     }
     if (dataTableBinder == null)
     {
         throw new ArgumentNullException("dataTableBinder");
     }
     if (auditor == null)
     {
         throw new ArgumentNullException("auditor");
     }
     RepositoryContainer = repositories;
     PropertyRepository = repositories.Obtain<IPropertyRepository>();
     StudentRepository = repositories.Obtain<IStudentRepository>();
     ServiceTypeRepository = repositories.Obtain<IServiceTypeRepository>();
     SubjectRepository = repositories.Obtain<ISubjectRepository>();
     PriorityRepository = repositories.Obtain<IPriorityRepository>();
     FulfillmentStatusRepository = repositories.Obtain<IFulfillmentStatusRepository>();
     ProviderRepository = repositories.Obtain<IProviderRepository>();
     SchoolRepository = repositories.Obtain<ISchoolRepository>();
     PrivateHealthDataViewEventRepository = repositories.Obtain<IPrivateHealthDataViewEventRepository>();
     DataTableBinder = dataTableBinder;
     Auditor = auditor;
 }
 public AccountManager(IWindsorContainer windsorContainer, IEmailConfirmationManager emailConfirmationManager, IDataTableBinder dataTableBinder, IUserAuditor auditor)
 {
     if (windsorContainer == null)
     {
         throw new ArgumentNullException("windsorContainer");
     }
     if (emailConfirmationManager == null)
     {
         throw new ArgumentNullException("emailConfirmationManager");
     }
     if (dataTableBinder == null)
     {
         throw new ArgumentNullException("dataTableBinder");
     }
     if (auditor == null)
     {
         throw new ArgumentNullException("auditor");
     }
     IRepositoryContainer repositoryContainer = windsorContainer.Resolve<IRepositoryContainer>();
     UserRepository = repositoryContainer.Obtain<IUserRepository>();
     SchoolRepository = repositoryContainer.Obtain<ISchoolRepository>();
     ProviderRepository = repositoryContainer.Obtain<IProviderRepository>();
     RoleRepository = repositoryContainer.Obtain<IRoleRepository>();
     UserRoleRepository = repositoryContainer.Obtain<IUserRoleRepository>();
     UserAccessChangeEventRepository = repositoryContainer.Obtain<IUserAccessChangeEventRepository>();
     LoginEventRepository = repositoryContainer.Obtain<ILoginEventRepository>();
     EulaAgreementRepository = repositoryContainer.Obtain<IEulaAgreementRepository>();
     RepositoryContainer = repositoryContainer;
     EmailConfirmationManager = emailConfirmationManager;
     DataTableBinder = dataTableBinder;
     Auditor = auditor;
 }
 protected CustomFieldManager(IRepositoryContainer repositories, IBlobClient blobClient, IDataTableBinder dataTableBinder, IUserAuditor auditor)
 {
     if (repositories == null)
     {
         throw new ArgumentNullException("repositories");
     }
     if (blobClient == null)
     {
         throw new ArgumentNullException("blobClient");
     }
     if (dataTableBinder == null)
     {
         throw new ArgumentNullException("dataTableBinder");
     }
     if (auditor == null)
     {
         throw new ArgumentNullException("auditor");
     }
     RepositoryContainer = repositories;
     CustomDataOriginRepository = repositories.Obtain<ICustomDataOriginRepository>();
     CustomFieldCategoryRepository = repositories.Obtain<ICustomFieldCategoryRepository>();
     CustomFieldRepository = repositories.Obtain<ICustomFieldRepository>();
     CustomFieldTypeRepository = repositories.Obtain<ICustomFieldTypeRepository>();
     CustomFieldValueRepository = repositories.Obtain<ICustomFieldValueRepository>();
     StudentRepository = repositories.Obtain<IStudentRepository>();
     ServiceTypeRepository = repositories.Obtain<IServiceTypeRepository>();
     DataFileBlobContainer = blobClient.CreateContainer(DataFileBlobContainerName);
     DataTableBinder = dataTableBinder;
     Auditor = auditor;
 }
예제 #6
0
 public SchoolDistrictManager(IRepositoryContainer repositories, IDataTableBinder dataTableBinder, IUserAuditor auditor)
 {
     if (repositories == null)
     {
         throw new ArgumentNullException("repositories");
     }
     if (dataTableBinder == null)
     {
         throw new ArgumentNullException("dataTableBinder");
     }
     if (auditor == null)
     {
         throw new ArgumentNullException("auditor");
     }
     RepositoryContainer                  = repositories;
     PropertyRepository                   = repositories.Obtain <IPropertyRepository>();
     StudentRepository                    = repositories.Obtain <IStudentRepository>();
     ServiceTypeRepository                = repositories.Obtain <IServiceTypeRepository>();
     SubjectRepository                    = repositories.Obtain <ISubjectRepository>();
     PriorityRepository                   = repositories.Obtain <IPriorityRepository>();
     FulfillmentStatusRepository          = repositories.Obtain <IFulfillmentStatusRepository>();
     ProviderRepository                   = repositories.Obtain <IProviderRepository>();
     SchoolRepository                     = repositories.Obtain <ISchoolRepository>();
     PrivateHealthDataViewEventRepository = repositories.Obtain <IPrivateHealthDataViewEventRepository>();
     DataTableBinder = dataTableBinder;
     Auditor         = auditor;
 }
 public void InitializeTest()
 {
     Target   = new StudentProfileExportDataMapper();
     TestData = new TestData();
     User     = new EducationSecurityPrincipal(new User {
         UserKey = "whatever"
     });
     PermissionFactory.SetCurrent(MockRepository.GenerateMock <IPermissionFactory>());
     MockUserAuditor = MockRepository.GenerateMock <IUserAuditor>();
     User.Identity.User.PrivateHealthDataViewEvents = new List <PrivateHealthDataViewEvent>();
 }
        private static SchoolDistrictManager CreateTargetWithEmptyLookupLists()
        {
            IRepositoryContainer mockRepositoryContainer = MockRepository.GenerateMock <IRepositoryContainer>();
            IStudentRepository   mockStudentRepository   = MockRepository.GenerateMock <IStudentRepository>();
            IProviderRepository  mockProviderRepository  = MockRepository.GenerateMock <IProviderRepository>();
            IDataTableBinder     mockDataTableBinder     = MockRepository.GenerateMock <IDataTableBinder>();
            IUserAuditor         mockUserAuditor         = MockRepository.GenerateMock <IUserAuditor>();

            mockStudentRepository.Expect(m => m.Items).Return(Enumerable.Empty <Student>().AsQueryable());
            mockProviderRepository.Expect(m => m.Items).Return(Enumerable.Empty <Provider>().AsQueryable());
            mockRepositoryContainer.Expect(m => m.Obtain <IProviderRepository>()).Return(mockProviderRepository);
            mockRepositoryContainer.Expect(m => m.Obtain <IStudentRepository>()).Return(mockStudentRepository);
            return(new SchoolDistrictManager(mockRepositoryContainer, mockDataTableBinder, mockUserAuditor));
        }
예제 #9
0
        public void InitializeTest()
        {
            IBlobClient    mockBlobClient    = MockRepository.GenerateMock <IBlobClient>();
            IBlobContainer mockBlobContainer = MockRepository.GenerateMock <IBlobContainer>();

            mockBlobContainer.Expect(m => m.DownloadToStream(null, null)).IgnoreArguments().Do(new Action <string, Stream>((address, target) =>
            {
                byte[] byteArray = File.ReadAllBytes(address);
                target.Write(byteArray, 0, (int)byteArray.Length);
            }));
            mockBlobContainer.Expect(m => m.UploadFromStream(null, null)).IgnoreArguments().Do(new Action <string, Stream>((address, stream) =>
            {
                File.WriteAllBytes(address, ((MemoryStream)stream).ToArray());
            }));
            mockBlobClient.Expect(m => m.CreateContainer(null)).IgnoreArguments().Return(mockBlobContainer);
            MockUserAuditor = MockRepository.GenerateMock <IUserAuditor>();
            Target          = new PrivateHealthFieldManager(Repositories.MockRepositoryContainer, mockBlobClient, MockDataTableBinder, MockUserAuditor);
            ExportFileFactory.SetCurrent(MockRepository.GenerateMock <IExportFileFactory>());
        }
 public IEnumerable<object> MapData(StudentProfileExportFieldDescriptor fieldConfiguration, Student data, EducationSecurityPrincipal user, IUserAuditor auditor)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     if (auditor == null)
     {
         throw new ArgumentNullException("auditor");
     }
     List<object> dataList = new List<object> { data.School.Name, data.Grade, data.FullName };
     IViewStudentDetailPermission permission = (IViewStudentDetailPermission)PermissionFactory.Current.Create("StudentProfileExportMapData", data);
     if(permission.TryGrantAccess(user))
     {
         if (!permission.CustomFieldOnly)
         {
             dataList.Add(data.StudentSISId);
         }
         MapStandardData(fieldConfiguration, data, dataList, permission.CustomFieldOnly);
         dataList.AddRange(fieldConfiguration.SelectedCustomFields.Select(f => FindLatestValue(data, f)).Select(v => v == null ? string.Empty : v.Value));
         var fields = fieldConfiguration.SelectedCustomFields.Select(f => FindLatestValue(data, f));
         if (fields.Where(f => f != null).ToList().Count() > 0)
         {
             user.Identity.User.PrivateHealthDataViewEvents.Add(auditor.CreatePrivateHealthInfoViewEvent(user.Identity.User, fields.Where(f => f != null).ToList()));
         }
         if (!permission.CustomFieldOnly)
         {
             dataList.AddRange(fieldConfiguration.SelectedServiceTypes.Select(serviceType => FindServicesOfferingNames(data, serviceType)));
         }
     }
     return dataList;
 }
예제 #11
0
        public IEnumerable <object> MapData(StudentProfileExportFieldDescriptor fieldConfiguration, Student data, EducationSecurityPrincipal user, IUserAuditor auditor)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (auditor == null)
            {
                throw new ArgumentNullException("auditor");
            }
            List <object> dataList = new List <object> {
                data.School.Name, data.Grade, data.FullName
            };
            IViewStudentDetailPermission permission = (IViewStudentDetailPermission)PermissionFactory.Current.Create("StudentProfileExportMapData", data);

            if (permission.TryGrantAccess(user))
            {
                if (!permission.CustomFieldOnly)
                {
                    dataList.Add(data.StudentSISId);
                }
                MapStandardData(fieldConfiguration, data, dataList, permission.CustomFieldOnly);
                dataList.AddRange(fieldConfiguration.SelectedCustomFields.Select(f => FindLatestValue(data, f)).Select(v => v == null ? string.Empty : v.Value));
                var fields = fieldConfiguration.SelectedCustomFields.Select(f => FindLatestValue(data, f));
                if (fields.Where(f => f != null).ToList().Count() > 0)
                {
                    user.Identity.User.PrivateHealthDataViewEvents.Add(auditor.CreatePrivateHealthInfoViewEvent(user.Identity.User, fields.Where(f => f != null).ToList()));
                }
                if (!permission.CustomFieldOnly)
                {
                    dataList.AddRange(fieldConfiguration.SelectedServiceTypes.Select(serviceType => FindServicesOfferingNames(data, serviceType)));
                }
            }
            return(dataList);
        }
 public PrivateHealthFieldManager(IRepositoryContainer repositories, IBlobClient blobClient, IDataTableBinder dataTableBinder, IUserAuditor auditor)
     : base(repositories, blobClient, dataTableBinder, auditor)
 {
     ProviderRepository = repositories.Obtain <IProviderRepository>();
 }
 public PublicFieldManager(IRepositoryContainer repositories, IBlobClient blobClient, IDataTableBinder dataTableBinder, IUserAuditor auditor)
     : base(repositories, blobClient, dataTableBinder, auditor)
 {
 }
 public void InitializeTest()
 {
     MockUserAuditor = MockRepository.GenerateMock <IUserAuditor>();
     Target          = new SchoolDistrictManager(Repositories.MockRepositoryContainer, MockDataTableBinder, MockUserAuditor);
 }
 public PrivateHealthFieldManager(IRepositoryContainer repositories, IBlobClient blobClient, IDataTableBinder dataTableBinder, IUserAuditor auditor)
     : base(repositories, blobClient, dataTableBinder, auditor)
 {
     ProviderRepository = repositories.Obtain<IProviderRepository>();
 }
예제 #16
0
 IEnumerable <object> IExportDataMapper.MapData(object descriptor, object data, EducationSecurityPrincipal user, IUserAuditor auditor)
 {
     return(MapData((StudentProfileExportFieldDescriptor)descriptor, (Student)data, user, auditor));
 }
 IEnumerable<object> IExportDataMapper.MapData(object descriptor, object data, EducationSecurityPrincipal user, IUserAuditor auditor)
 {
     return MapData((StudentProfileExportFieldDescriptor)descriptor, (Student)data, user, auditor);
 }
 public PublicFieldManager(IRepositoryContainer repositories, IBlobClient blobClient, IDataTableBinder dataTableBinder, IUserAuditor auditor)
     : base(repositories, blobClient, dataTableBinder, auditor)
 {
 }