Exemplo n.º 1
0
        public List <SubscriptTypeEntity> GetActiveSubscriptTypeList()
        {
            _commonDataAccess = new CommonDataAccess(_context);
            var lst = _commonDataAccess.GetActiveSubscriptType();

            return(lst);
        }
Exemplo n.º 2
0
 public FetchPendingChargesHandler(
     IWeeeAuthorization authorization,
     ICommonDataAccess dataAccess)
 {
     this.authorization = authorization;
     this.dataAccess    = dataAccess;
 }
 public FetchInvoiceRunIbisZipFileHandler(
     IWeeeAuthorization authorization,
     ICommonDataAccess dataAccess)
 {
     this.authorization = authorization;
     this.dataAccess    = dataAccess;
 }
 public FetchComplianceYearsWithInvoicesHandler(
     IWeeeAuthorization authorization,
     ICommonDataAccess dataAccess)
 {
     this.authorization = authorization;
     this.dataAccess    = dataAccess;
 }
Exemplo n.º 5
0
        public void DataLoader_ConstructorParameterOfficerDataMapperNull_ReturnsException()
        {
            ICommonDataAccess fakeDataAccess = NSubstitute.Substitute.For <ICommonDataAccess>();

            IOfficerDataMapper fakeOfficerDataMapper = null;

            Assert.Throws <ArgumentNullException>(() => new DataLoader(fakeDataAccess, fakeOfficerDataMapper));
        }
 public GetAllAatfReuseSitesCsvHandler(IWeeeAuthorization authorization, WeeeContext weeContext,
                                       CsvWriterFactory csvWriterFactory, ICommonDataAccess commonDataAccess)
 {
     this.authorization    = authorization;
     this.weeContext       = weeContext;
     this.commonDataAccess = commonDataAccess;
     this.csvWriterFactory = csvWriterFactory;
 }
 public FetchSchemesWithInvoicesHandler(
     IWeeeAuthorization authorization,
     ICommonDataAccess dataAccess,
     IMap <Scheme, SchemeData> schemeMap)
 {
     this.authorization = authorization;
     this.dataAccess    = dataAccess;
     this.schemeMap     = schemeMap;
 }
Exemplo n.º 8
0
        public AddAatfRequestHandlerTests()
        {
            addressMapper    = A.Fake <IMap <AatfAddressData, AatfAddress> >();
            contactMapper    = A.Fake <IMap <AatfContactData, AatfContact> >();
            dataAccess       = A.Fake <IGenericDataAccess>();
            commonDataAccess = A.Fake <ICommonDataAccess>();

            handler = new AddAatfRequestHandler(AuthorizationBuilder.CreateUserWithAllRights(), dataAccess, addressMapper, contactMapper, commonDataAccess);
        }
Exemplo n.º 9
0
        public DefaultSearchEntity GetShowhidePanelByUserId(UserEntity user, string currentPage)
        {
            if (user != null)
            {
                _commonDataAccess = new CommonDataAccess(_context);
                return(_commonDataAccess.GetShowhidePanelByUserId(user.UserId, currentPage));
            }

            return(null);
        }
Exemplo n.º 10
0
 public FetchInvoiceRunCsvHandler(IWeeeAuthorization authorization,
                                  WeeeContext context,
                                  ICommonDataAccess commonDataAccess,
                                  CsvWriterFactory csvWriterFactory)
 {
     this.authorization    = authorization;
     this.context          = context;
     this.commonDataAccess = commonDataAccess;
     this.csvWriterFactory = csvWriterFactory;
 }
Exemplo n.º 11
0
 public GetAatfAeDetailsCsvHandler(IWeeeAuthorization authorization,
                                   WeeeContext context,
                                   CsvWriterFactory csvWriterFactory,
                                   ICommonDataAccess commonDataAccess)
 {
     this.authorization    = authorization;
     this.context          = context;
     this.csvWriterFactory = csvWriterFactory;
     this.commonDataAccess = commonDataAccess;
 }
Exemplo n.º 12
0
 public GetPcsAatfComparisonDataHandler(IWeeeAuthorization authorization,
                                        WeeeContext context,
                                        CsvWriterFactory csvWriterFactory,
                                        ICommonDataAccess commonDataAccess)
 {
     this.authorization    = authorization;
     this.context          = context;
     this.csvWriterFactory = csvWriterFactory;
     this.commonDataAccess = commonDataAccess;
 }
        public GetAllAatfReuseSitesCsvHandlerTests()
        {
            var authorization = new AuthorizationBuilder().AllowInternalAreaAccess().Build();

            context          = A.Fake <WeeeContext>();
            csvWriterFactory = A.Fake <CsvWriterFactory>();
            commonDataAccess = A.Fake <ICommonDataAccess>();

            handler = new GetAllAatfReuseSitesCsvHandler(authorization, context, csvWriterFactory, commonDataAccess);
        }
Exemplo n.º 14
0
        public void DataLoader_ConstructorParametersAreNotNull_ReturnsDataLoader()
        {
            ICommonDataAccess fakeDataAccess = NSubstitute.Substitute.For <ICommonDataAccess>();

            IOfficerDataMapper fakeOfficerDataMapper = NSubstitute.Substitute.For <IOfficerDataMapper>();

            var dataLoader = new DataLoader(fakeDataAccess, fakeOfficerDataMapper);

            Assert.NotNull(dataLoader);
        }
Exemplo n.º 15
0
        public async Task HandleAysnc_HappyPath_ReturnsFileInfoWithCorrectFileName()
        {
            // Arrange
            IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights();

            UKCompetentAuthority authority = new UKCompetentAuthority(
                A.Dummy <Guid>(),
                "Environment Agency",
                "EA",
                A.Dummy <Country>(),
                "*****@*****.**",
                0);

            Scheme scheme = A.Dummy <Scheme>();

            A.CallTo(() => scheme.CompetentAuthority).Returns(authority);

            MemberUpload memberUpload = new MemberUpload(
                A.Dummy <Guid>(),
                scheme,
                A.Dummy <string>(),
                A.Dummy <string>());

            memberUpload.Submit(A.Dummy <User>());

            List <MemberUpload> memberUploads = new List <MemberUpload>();

            memberUploads.Add(memberUpload);

            SystemTime.Freeze(new DateTime(2015, 12, 31));
            InvoiceRun invoiceRun = new InvoiceRun(authority, memberUploads, A.Dummy <User>());

            SystemTime.Unfreeze();

            ulong fileID = 123;

            IbisFileData ibisFileData = new IbisFileData(fileID, "Customer File.dat", "data", "Transaction File.dat", "data");

            invoiceRun.SetIbisFileData(ibisFileData);

            ICommonDataAccess dataAccess = A.Fake <ICommonDataAccess>();

            A.CallTo(() => dataAccess.FetchInvoiceRunAsync(A <Guid> ._)).Returns(invoiceRun);

            FetchInvoiceRunIbisZipFileHandler handler = new FetchInvoiceRunIbisZipFileHandler(
                authorization,
                dataAccess);

            // Act
            FileInfo fileInfo = await handler.HandleAsync(A.Dummy <Requests.Charges.FetchInvoiceRunIbisZipFile>());

            // Assert
            Assert.NotNull(fileInfo);
            Assert.Equal("WEEE invoice files 00123 2015-12-31.zip", fileInfo.FileName);
        }
        public GetAllAatfSentOnDataCsvHandlerTests()
        {
            context          = A.Fake <WeeeContext>();
            commonDataAccess = A.Fake <ICommonDataAccess>();
            storedProcedures = A.Fake <IStoredProcedures>();
            fixture          = new Fixture();

            A.CallTo(() => context.StoredProcedures).Returns(storedProcedures);

            handler = new GetAllAatfSentOnDataCsvHandler(new AuthorizationBuilder().AllowInternalAreaAccess().Build(), context, commonDataAccess);
        }
Exemplo n.º 17
0
        public IDictionary <string, string> GetRelationshipSelectList()
        {
            _commonDataAccess = new CommonDataAccess(_context);
            var lst = _commonDataAccess.GetActiveRelationship();

            return((from x in lst
                    select new
            {
                key = x.RelationshipId.ToString(CultureInfo.InvariantCulture),
                value = x.RelationshipName
            }).ToDictionary(t => t.key, t => t.value));
        }
Exemplo n.º 18
0
        public IDictionary <string, string> GetPhoneTypeSelectList()
        {
            _commonDataAccess = new CommonDataAccess(_context);
            var lst = _commonDataAccess.GetActivePhoneType();

            return((from x in lst
                    select new
            {
                key = x.PhoneTypeId.ToString(),
                value = x.PhoneTypeName
            }).ToDictionary(t => t.key, t => t.value));
        }
Exemplo n.º 19
0
        public IDictionary <string, string> GetTitleEnglishSelectList()
        {
            _commonDataAccess = new CommonDataAccess(_context);
            var lst = _commonDataAccess.GetActiveTitle();

            return((from x in lst
                    where x.Language.ToUpper(CultureInfo.InvariantCulture) == Constants.TitleLanguage.TitleEn
                    select new
            {
                key = x.TitleId.ToString(),
                value = x.TitleName
            }).ToDictionary(t => t.key, t => t.value));
        }
Exemplo n.º 20
0
 public AddAatfRequestHandler(
     IWeeeAuthorization authorization,
     IGenericDataAccess dataAccess,
     IMap <AatfAddressData, AatfAddress> addressMapper,
     IMap <AatfContactData, AatfContact> contactMapper,
     ICommonDataAccess commonDataAccess)
 {
     this.authorization    = authorization;
     this.addressMapper    = addressMapper;
     this.contactMapper    = contactMapper;
     this.commonDataAccess = commonDataAccess;
     this.dataAccess       = dataAccess;
 }
Exemplo n.º 21
0
        public IDictionary <string, string> GetAllMenu()
        {
            IDictionary <string, string> dic = new Dictionary <string, string>();

            _commonDataAccess = new CommonDataAccess(_context);

            var result = _commonDataAccess.GetAllMenu();

            foreach (var item in result)
            {
                dic.Add(item.MenuId.ToString(), item.MenuName);
            }

            return(dic);
        }
Exemplo n.º 22
0
        public IDictionary <string, string> GetAllScreen()
        {
            IDictionary <string, string> dic = new Dictionary <string, string>();

            _commonDataAccess = new CommonDataAccess(_context);

            var result = _commonDataAccess.GetAllScreen();

            foreach (var item in result)
            {
                dic.Add(item.ScreenId.ToString(CultureInfo.InvariantCulture), item.ScreenName);
            }

            return(dic);
        }
Exemplo n.º 23
0
        public GetPcsAatfComparisonDataHandlerTests()
        {
            context          = A.Fake <WeeeContext>();
            csvWriterFactory = A.Fake <CsvWriterFactory>();
            fixture          = new Fixture();
            storedProcedures = A.Fake <IStoredProcedures>();
            commonDataAccess = A.Fake <ICommonDataAccess>();

            A.CallTo(() => context.StoredProcedures).Returns(storedProcedures);

            handler = new GetPcsAatfComparisonDataHandler(new AuthorizationBuilder().AllowInternalAreaAccess().Build(),
                                                          context,
                                                          csvWriterFactory,
                                                          commonDataAccess);
        }
Exemplo n.º 24
0
        private List <ScreenEntity> GetCacheScreenRoles()
        {
            // Check the cache
            List <ScreenEntity> screenRoles = CacheLayer.Get <List <ScreenEntity> >(Constants.CacheKey.ScreenRoles);

            if (screenRoles == null)
            {
                _commonDataAccess = new CommonDataAccess(_context);
                List <ScreenEntity> screenList = _commonDataAccess.GetScreenList();

                // Then add it to the cache so we
                // can retrieve it from there next time
                CacheLayer.Add(screenList, Constants.CacheKey.ScreenRoles);
                screenRoles = CacheLayer.Get <List <ScreenEntity> >(Constants.CacheKey.ScreenRoles);
            }

            return(screenRoles);
        }
Exemplo n.º 25
0
        private List <MenuEntity> GetCacheMainMenu()
        {
            // Check the cache
            List <MenuEntity> mainMenu = CacheLayer.Get <List <MenuEntity> >(Constants.CacheKey.MainMenu);

            if (mainMenu == null)
            {
                _commonDataAccess = new CommonDataAccess(_context);
                List <MenuEntity> menuItems = _commonDataAccess.GetMenuList();

                // Then add it to the cache so we
                // can retrieve it from there next time
                CacheLayer.Add(menuItems, Constants.CacheKey.MainMenu);
                mainMenu = CacheLayer.Get <List <MenuEntity> >(Constants.CacheKey.MainMenu);
            }

            return(mainMenu);
        }
Exemplo n.º 26
0
        private List <ParameterEntity> GetCacheParameters()
        {
            // Check the cache
            List <ParameterEntity> parameters = CacheLayer.Get <List <ParameterEntity> >(Constants.CacheKey.AllParameters);

            if (parameters == null)
            {
                _commonDataAccess = new CommonDataAccess(_context);
                List <ParameterEntity> lstParameter = _commonDataAccess.GetAllParameters();

                // Then add it to the cache so we
                // can retrieve it from there next time
                CacheLayer.Add(lstParameter, Constants.CacheKey.AllParameters);
                parameters = CacheLayer.Get <List <ParameterEntity> >(Constants.CacheKey.AllParameters);
            }

            return(parameters);
        }
 public EditAatfDetailsRequestHandler(
     IWeeeAuthorization authorization,
     IAatfDataAccess aatfDataAccess,
     IGenericDataAccess genericDataAccess,
     IMap <AatfAddressData, AatfAddress> addressMapper,
     IOrganisationDetailsDataAccess organisationDetailsDataAccess,
     ICommonDataAccess commonDataAccess,
     IGetAatfApprovalDateChangeStatus getAatfApprovalDateChangeStatus,
     IQuarterWindowFactory quarterWindowFactory,
     IWeeeTransactionAdapter context)
 {
     this.authorization                   = authorization;
     this.genericDataAccess               = genericDataAccess;
     this.aatfDataAccess                  = aatfDataAccess;
     this.addressMapper                   = addressMapper;
     this.organisationDetailsDataAccess   = organisationDetailsDataAccess;
     this.commonDataAccess                = commonDataAccess;
     this.getAatfApprovalDateChangeStatus = getAatfApprovalDateChangeStatus;
     this.quarterWindowFactory            = quarterWindowFactory;
     this.context = context;
 }
Exemplo n.º 28
0
        public async Task HandleAsync_WithInvoiceRunWithout1B1SFileData_ThrowsInvalidOperationException()
        {
            // Arrange
            IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights();

            UKCompetentAuthority authority = A.Dummy <UKCompetentAuthority>();

            Scheme scheme = A.Dummy <Scheme>();

            A.CallTo(() => scheme.CompetentAuthority).Returns(authority);

            MemberUpload memberUpload = new MemberUpload(
                A.Dummy <Guid>(),
                scheme,
                A.Dummy <string>(),
                A.Dummy <string>());

            memberUpload.Submit(A.Dummy <User>());

            List <MemberUpload> memberUploads = new List <MemberUpload>();

            memberUploads.Add(memberUpload);

            InvoiceRun invoiceRun = new InvoiceRun(authority, memberUploads, A.Dummy <User>());

            ICommonDataAccess dataAccess = A.Fake <ICommonDataAccess>();

            A.CallTo(() => dataAccess.FetchInvoiceRunAsync(A <Guid> ._)).Returns(invoiceRun);

            FetchInvoiceRunIbisZipFileHandler handler = new FetchInvoiceRunIbisZipFileHandler(
                authorization,
                dataAccess);

            // Act
            Func <Task <FileInfo> > testCode = async() => await handler.HandleAsync(A.Dummy <Requests.Charges.FetchInvoiceRunIbisZipFile>());

            // Assert
            await Assert.ThrowsAsync <InvalidOperationException>(testCode);
        }
Exemplo n.º 29
0
        public EditAatfDetailsRequestHandlerTests()
        {
            fixture = new Fixture();
            var authorization = A.Fake <IWeeeAuthorization>();

            genericDataAccess               = A.Fake <IGenericDataAccess>();
            aatfDataAccess                  = A.Fake <IAatfDataAccess>();
            addressMapper                   = A.Fake <IMap <AatfAddressData, AatfAddress> >();
            organisationDetailsDataAccess   = A.Fake <IOrganisationDetailsDataAccess>();
            commonDataAccess                = A.Fake <ICommonDataAccess>();
            getAatfApprovalDateChangeStatus = A.Fake <IGetAatfApprovalDateChangeStatus>();
            quarterWindowFactory            = A.Fake <IQuarterWindowFactory>();
            context = A.Fake <IWeeeTransactionAdapter>();

            handler = new EditAatfDetailsRequestHandler(authorization,
                                                        aatfDataAccess,
                                                        genericDataAccess,
                                                        addressMapper,
                                                        organisationDetailsDataAccess,
                                                        commonDataAccess,
                                                        getAatfApprovalDateChangeStatus,
                                                        quarterWindowFactory,
                                                        context);
        }
Exemplo n.º 30
0
 public int GetBranchCountByName(string searchTerm, int pageSize, int pageNum, int?userId)
 {
     _commonDataAccess = new CommonDataAccess(_context);
     return(_commonDataAccess.GetBranchCountByName(searchTerm, pageSize, pageNum, userId));
 }