Exemple #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            // Db
            string connectionString    = Configuration.GetConnectionString("Development");
            AirMonitorDbContext     db = InstallationPersistenceDiFactory.CreateDbContext(connectionString);
            IInstallationRepository installationRepository = InstallationPersistenceDiFactory.CreateInstallationRepository(db);
            IMeasurementRepository  measurementRepository  = InstallationPersistenceDiFactory.CreateMeasurementRepository(db);

            services.AddSingleton <IInstallationRepository>(installationRepository);
            services.AddSingleton <IMeasurementRepository>(measurementRepository);

            // Client
            ClientConfig clientConfig = new ClientConfig();

            Configuration.Bind("ClientConfig", clientConfig);
            IAirlyClient client = AirlyClientFactory.Create(clientConfig);

            services.AddSingleton <IAirlyClient>(client);
            services.AddSingleton <AirlyClientWrapper>();
            services.AddSingleton <IInstallationClient>(x => x.GetRequiredService <AirlyClientWrapper>());
            services.AddSingleton <IMeasurementClient>(x => x.GetRequiredService <AirlyClientWrapper>());

            // Service
            services.AddSingleton <IInstallationFacade, InstallationService>();
            services.AddSingleton <IMeasurementFacade, MeasurementService>();
            // services.AddSingleton<IIntegrationFacade, _Obsolete_IntegrationService>();
            services.AddSingleton <IIntegrationFacade, AirlyIntegrationService>();

            services.AddControllersWithViews();
        }
Exemple #2
0
        public void Init()
        {
            Mock <IInstallationRepository <InstallationModel> >       mockInstallationRepository    = new Mock <IInstallationRepository <InstallationModel> >();
            Mock <IMeasurementTypeRepository <MeasurementTypeModel> > mockMeasurementTypeRepository = new Mock <IMeasurementTypeRepository <MeasurementTypeModel> >();

            List <MeasurementTypeModel> measurementtypes = new List <MeasurementTypeModel>
            {
                new MeasurementTypeModel {
                    typeid = 0, Measurement = new List <int> {
                        0
                    }, description = "test", maxvalue = 0, minvalue = 0, unit = "Grad Celsius"
                }
            };
            List <InstallationModel> installations = new List <InstallationModel>
            {
                new InstallationModel {
                    installationid = 0, customerid = 0, description = "test", latitude = 44, longitude = 55, Measurement = new List <int> {
                        0
                    }, serialno = "serial"
                }
            };

            mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny <int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList <InstallationModel>());
            mockMeasurementTypeRepository.Setup(mr => mr.GetById(It.IsAny <int>())).Returns((int id) => measurementtypes.Where(measurementtype => measurementtype.typeid == id).Single());

            this.mockmrepo  = new MockMeasurementRepository();
            this.mockmtrepo = mockMeasurementTypeRepository.Object;
            this.mockirepo  = mockInstallationRepository.Object;
        }
Exemple #3
0
        public static IInstallationRepository CreateInstallationRepository(AirMonitorDbContext db)
        {
            InstallationDao         dao        = InstallationDao.Factory.Create(db);
            IInstallationRepository repository = InstallationRepository.Factory.Create(dao);

            return(repository);
        }
Exemple #4
0
 public ClientStore(
     IInstallationRepository installationRepository,
     IOrganizationRepository organizationRepository,
     IUserRepository userRepository,
     GlobalSettings globalSettings,
     StaticClientStore staticClientStore,
     ILicensingService licensingService,
     ICurrentContext currentContext,
     IOrganizationUserRepository organizationUserRepository,
     IProviderUserRepository providerUserRepository,
     IProviderOrganizationRepository providerOrganizationRepository,
     IOrganizationApiKeyRepository organizationApiKeyRepository)
 {
     _installationRepository         = installationRepository;
     _organizationRepository         = organizationRepository;
     _userRepository                 = userRepository;
     _globalSettings                 = globalSettings;
     _staticClientStore              = staticClientStore;
     _licensingService               = licensingService;
     _currentContext                 = currentContext;
     _organizationUserRepository     = organizationUserRepository;
     _providerUserRepository         = providerUserRepository;
     _providerOrganizationRepository = providerOrganizationRepository;
     _organizationApiKeyRepository   = organizationApiKeyRepository;
 }
 public OrganizationService(
     IOrganizationRepository organizationRepository,
     IOrganizationUserRepository organizationUserRepository,
     ICollectionRepository collectionRepository,
     IUserRepository userRepository,
     IGroupRepository groupRepository,
     IDataProtectionProvider dataProtectionProvider,
     IMailService mailService,
     IPushNotificationService pushNotificationService,
     IPushRegistrationService pushRegistrationService,
     IDeviceRepository deviceRepository,
     IEventService eventService,
     IInstallationRepository installationRepository,
     GlobalSettings globalSettings)
 {
     _organizationRepository     = organizationRepository;
     _organizationUserRepository = organizationUserRepository;
     _collectionRepository       = collectionRepository;
     _userRepository             = userRepository;
     _groupRepository            = groupRepository;
     _dataProtector           = dataProtectionProvider.CreateProtector("OrganizationServiceDataProtector");
     _mailService             = mailService;
     _pushNotificationService = pushNotificationService;
     _pushRegistrationService = pushRegistrationService;
     _deviceRepository        = deviceRepository;
     _eventService            = eventService;
     _installationRepository  = installationRepository;
     _globalSettings          = globalSettings;
 }
Exemple #6
0
 public ClientStore(
     IInstallationRepository installationRepository,
     GlobalSettings globalSettings)
 {
     _installationRepository = installationRepository;
     _globalSettings         = globalSettings;
 }
Exemple #7
0
        public void Init()
        {
            Mock <ICustomerRepository <CustomerModel> >         mockCustomerRepository     = new Mock <ICustomerRepository <CustomerModel> >();
            Mock <IInstallationRepository <InstallationModel> > mockInstallationRepository = new Mock <IInstallationRepository <InstallationModel> >();

            List <InstallationModel> installations = new List <InstallationModel>
            {
                new InstallationModel {
                    installationid = 0, customerid = 0, description = "test", latitude = 44, longitude = 55, Measurement = new List <int> {
                        0
                    }, serialno = "serial"
                }
            };
            List <CustomerModel> customers = new List <CustomerModel>
            {
                new CustomerModel {
                    customerid = 0, engineerid = 0, firstname = "Anton", lastname = "Huber", password = "******", email = "*****@*****.**", username = "******", Installation = new List <int> {
                        0
                    }
                }
            };

            mockCustomerRepository.Setup(mr => mr.GetAll()).Returns(customers);
            mockCustomerRepository.Setup(mr => mr.GetById(It.IsAny <int>())).Returns((int customerid) => customers.Where(customer => customer.customerid == customerid).Single());
            mockCustomerRepository.Setup(mr => mr.Add(It.IsAny <CustomerModel>())).Callback((CustomerModel customer) => customers.Add(customer));
            mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny <int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList <InstallationModel>());

            this.mockcrepo = mockCustomerRepository.Object;
            this.mockirepo = mockInstallationRepository.Object;
        }
        public void Init()
        {
            Mock<ICustomerRepository<CustomerModel>> mockCustomerRepository = new Mock<ICustomerRepository<CustomerModel>>();
            Mock<IEngineerRepository<EngineerModel>> mockEngineerRepository = new Mock<IEngineerRepository<EngineerModel>>();
            Mock<IInstallationRepository<InstallationModel>> mockInstallationRepository = new Mock<IInstallationRepository<InstallationModel>>();

            List<EngineerModel> engineers = new List<EngineerModel>
            {
                new EngineerModel {engineerid=0, firstname="Karl", lastname="Maier", password="******",email="*****@*****.**", username="******"}
            };
            List<InstallationModel> installations = new List<InstallationModel>
            {
                new InstallationModel { installationid= 0, customerid=0, description="test", latitude=44, longitude=55, Measurement= new List<int>{0}, serialno="serial"}
            };
            List<CustomerModel> customers = new List<CustomerModel>
            {
                new CustomerModel { customerid=0, engineerid=0, firstname="Anton", lastname="Huber", password="******",email="*****@*****.**", username="******", Installation=new List<int> {0}}
            };

            mockCustomerRepository.Setup(mr => mr.GetAll()).Returns(customers);
            mockCustomerRepository.Setup(mr => mr.GetById(It.IsAny<int>())).Returns((int customerid) => customers.Where(customer => customer.customerid == customerid).Single());
            mockCustomerRepository.Setup(mr => mr.Add(It.IsAny<CustomerModel>())).Callback((CustomerModel customer) => customers.Add(customer));
            mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny<int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList<InstallationModel>());
            mockInstallationRepository.Setup(mr => mr.Add(It.IsAny<InstallationModel>())).Callback((InstallationModel installation) => installations.Add(installation));
            mockInstallationRepository.Setup(mr => mr.GetAll()).Returns(installations);
            mockEngineerRepository.Setup(mr => mr.GetMyCustomers(It.IsAny<int>())).Returns((int id) => customers.Where(customer => customer.engineerid == id).ToList<CustomerModel>());

            this.mockcrepo = mockCustomerRepository.Object;
            this.mockirepo = mockInstallationRepository.Object;
            this.mockerepo = mockEngineerRepository.Object;
        }
Exemple #9
0
 public MeasurementRepository(IDbConnection connection,
                              IInstallationRepository installationRepository,
                              IMeasurementItemRepository itemRepository)
 {
     _connection             = connection;
     _installationRepository = installationRepository;
     _itemRepository         = itemRepository;
 }
Exemple #10
0
 public ClientStore(
     IInstallationRepository installationRepository,
     IOrganizationRepository organizationRepository,
     GlobalSettings globalSettings,
     StaticClientStore staticClientStore)
 {
     _installationRepository = installationRepository;
     _organizationRepository = organizationRepository;
     _globalSettings         = globalSettings;
     _staticClientStore      = staticClientStore;
 }
 public ToolsController(
     GlobalSettings globalSettings,
     IOrganizationRepository organizationRepository,
     IOrganizationService organizationService,
     IUserService userService,
     ITransactionRepository transactionRepository,
     IInstallationRepository installationRepository,
     IOrganizationUserRepository organizationUserRepository)
 {
     _globalSettings             = globalSettings;
     _organizationRepository     = organizationRepository;
     _organizationService        = organizationService;
     _userService                = userService;
     _transactionRepository      = transactionRepository;
     _installationRepository     = installationRepository;
     _organizationUserRepository = organizationUserRepository;
 }
        public void Init()
        {
            Mock<IInstallationRepository<InstallationModel>> mockInstallationRepository = new Mock<IInstallationRepository<InstallationModel>>();
            Mock<IMeasurementTypeRepository<MeasurementTypeModel>> mockMeasurementTypeRepository = new Mock<IMeasurementTypeRepository<MeasurementTypeModel>>();

            List<MeasurementTypeModel> measurementtypes = new List<MeasurementTypeModel>
            {
                new MeasurementTypeModel { typeid=0, Measurement = new List<int> {0}, description = "test", maxvalue = 0, minvalue =0, unit = "Grad Celsius"}
            };
            List<InstallationModel> installations = new List<InstallationModel>
            {
                new InstallationModel { installationid= 0, customerid=0, description="test", latitude=44, longitude=55, Measurement= new List<int>{0}, serialno="serial"}
            };
            mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny<int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList<InstallationModel>());
            mockMeasurementTypeRepository.Setup(mr => mr.GetById(It.IsAny<int>())).Returns((int id) => measurementtypes.Where(measurementtype => measurementtype.typeid == id).Single());

            this.mockmrepo = new MockMeasurementRepository();
            this.mockmtrepo = mockMeasurementTypeRepository.Object;
            this.mockirepo = mockInstallationRepository.Object;
        }
Exemple #13
0
 public ToolsController(
     GlobalSettings globalSettings,
     IOrganizationRepository organizationRepository,
     IOrganizationService organizationService,
     IUserService userService,
     ITransactionRepository transactionRepository,
     IInstallationRepository installationRepository,
     IOrganizationUserRepository organizationUserRepository,
     ITaxRateRepository taxRateRepository,
     IPaymentService paymentService,
     IStripeAdapter stripeAdapter)
 {
     _globalSettings             = globalSettings;
     _organizationRepository     = organizationRepository;
     _organizationService        = organizationService;
     _userService                = userService;
     _transactionRepository      = transactionRepository;
     _installationRepository     = installationRepository;
     _organizationUserRepository = organizationUserRepository;
     _taxRateRepository          = taxRateRepository;
     _paymentService             = paymentService;
     _stripeAdapter              = stripeAdapter;
 }
Exemple #14
0
        public ClientService(ITechnicienRepository _technicienRepository,
                             IEmployéRCRepository _employéRCRepository,
                             IBranchementRepository _branchementRepository,
                             ICompteRepository _compteRepository,
                             IClientRepository _clientRepository,
                             IClientEntrepriseRepository _clientEntrepriseRepository,
                             IClientPersonneRepository _clientPersonneRepository,

                             IFilmRepository _filmRepository,
                             IInstallationRepository _installationRepository,
                             IEquipementRepository _equipementRepository,
                             IServiceDiffusionRepository _serviceDiffusionRepository,
                             IEstDesserviDansRepository _estDesserviDansRepository,
                             IFactureRepository _factureRepository,
                             ILoueFilmRepository _loueFilmRepository,
                             IPaiementRepository _paiementRepository,
                             ITerritoireRepository _territoireRepository)
        {
            this._branchementRepository      = _branchementRepository;
            this._compteRepository           = _compteRepository;
            this._clientRepository           = _clientRepository;
            this._clientRepository           = _clientRepository;
            this._clientPersonneRepository   = _clientPersonneRepository;
            this._clientEntrepriseRepository = _clientEntrepriseRepository;
            this._filmRepository             = _filmRepository;
            this._installationRepository     = _installationRepository;
            this._equipementRepository       = _equipementRepository;
            this._serviceDiffusionRepository = _serviceDiffusionRepository;
            this._estDesserviDansRepository  = _estDesserviDansRepository;
            this._factureRepository          = _factureRepository;
            this._loueFilmRepository         = _loueFilmRepository;
            this._paiementRepository         = _paiementRepository;
            this._territoireRepository       = _territoireRepository;
            this._technicienRepository       = _technicienRepository;
            this._employéRCRepository        = _employéRCRepository;
        }
 public CustomerBL(ICustomerRepository <CustomerModel> crepo, IInstallationRepository <InstallationModel> irepo)
 {
     this.crepo = crepo;
     this.irepo = irepo;
 }
 public ClientStore(
     IInstallationRepository installationRepository)
 {
     _installationRepository = installationRepository;
 }
Exemple #17
0
 public InstallationService(ILogger <InstallationService> logger, IInstallationRepository repository)
 {
     this._logger     = logger ?? throw new ArgumentException("Logger is null.");
     this._repository = repository ?? throw new ArgumentException("IInstallationRepository is null.");
 }
 public CompteRepository(SolutionCleanCabloPlusContext contexte, IInstallationRepository installationRepository) : base(contexte)
 {
     this.installationRepository = installationRepository;
 }
 public EngineerBL(ICustomerRepository<CustomerModel> crepo, IEngineerRepository<EngineerModel> erepo, IInstallationRepository<InstallationModel> irepo)
 {
     this.crepo = crepo;
     this.erepo = erepo;
     this.irepo = irepo;
 }
Exemple #20
0
 public InstallationService(IInstallationRepository installationRepository) =>
 public StatisticService(IInstallationRepository <InstallationModel> irepo, IMeasurementRepository <MeasurementModel> mrepo, IMeasurementTypeRepository <MeasurementTypeModel> mtrepo)
 {
     this.irepo  = irepo;
     this.mrepo  = mrepo;
     this.mtrepo = mtrepo;
 }
 public EngineerBL(ICustomerRepository <CustomerModel> crepo, IEngineerRepository <EngineerModel> erepo, IInstallationRepository <InstallationModel> irepo)
 {
     this.crepo = crepo;
     this.erepo = erepo;
     this.irepo = irepo;
 }
 public CustomerBL(ICustomerRepository<CustomerModel> crepo, IInstallationRepository<InstallationModel> irepo)
 {
     this.crepo = crepo;
     this.irepo = irepo;
 }
Exemple #24
0
 public InstallationManager(IInstallationRepository installationRepository)
 {
     this.installationRepository = installationRepository;
 }
 public InstallationService(IInstallationRepository installationRepository)
 {
     _installationRepository = installationRepository;
 }
 public InstallationBL(IInstallationRepository<InstallationModel> irepo)
 {
     this.irepo = irepo;
 }
 public StatisticService(IInstallationRepository<InstallationModel> irepo, IMeasurementRepository<MeasurementModel> mrepo, IMeasurementTypeRepository<MeasurementTypeModel> mtrepo)
 {
     this.irepo = irepo;
     this.mrepo = mrepo;
     this.mtrepo = mtrepo;
 }
 public InstallationBL(IInstallationRepository <InstallationModel> irepo)
 {
     this.irepo = irepo;
 }
 public InstallationsController(
     IInstallationRepository installationRepository)
 {
     _installationRepository = installationRepository;
 }
Exemple #30
0
 public InstallationService(CrmService crmService, IInstallationRepository installationRepository)
 {
     _crmService             = crmService;
     _InstallationRepository = installationRepository;
 }