コード例 #1
0
ファイル: DataRecieverService.cs プロジェクト: xardas663/mgr
        public async Task <List <ListViewDataRow> > GetDesiredDataFromApiForListView(bool isTemperature, bool isHumidity, int amount, string date, string sensorName)
        {
            if (isTemperature && isHumidity)
            {
                isHumidity = false;
            }

            if (isTemperature)
            {
                var rowList      = CreateNewListForTemperature();
                var repo         = new TemperatureRepository();
                var temperatures = await repo.GetTemperatures(amount, date, sensorName);

                foreach (var item in temperatures)
                {
                    rowList.Add(new ListViewDataRow()
                    {
                        RoomName   = item.TemperatureSensor.Room.Name.ToString(),
                        SensorName = item.TemperatureSensor.Name.ToString(),
                        Value      = item.Value.ToString(),
                        Date       = item.Date.ToShortDateString()
                    });
                }
                return(rowList);
            }
            else if (isHumidity)
            {
                var rowList  = CreateNewListForHumidity();
                var repo     = new HumidityRepository();
                var humidity = await repo.GetHumidity(amount, date, sensorName);

                foreach (var item in humidity)
                {
                    rowList.Add(new ListViewDataRow()
                    {
                        RoomName   = item.HumiditySensor.Room.Name.ToString(),
                        SensorName = item.HumiditySensor.Name.ToString(),
                        Value      = item.Value.ToString(),
                        Date       = item.Date.ToShortDateString()
                    });
                }
                return(rowList);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: UnitOfWork.cs プロジェクト: patrykokruta/HomeHelper
 public UnitOfWork(ApplicationDbContext db)
 {
     _db                = db;
     Room               = new RoomRepository(_db);
     Device             = new DeviceRepository(_db);
     HttpDevice         = new HttpDeviceRepository(_db);
     MqttDevice         = new MqttDeviceRepository(_db);
     ZigbeeDevice       = new ZigbeeDeviceRepository(_db);
     PublishMessage     = new MqttPublishingMessageRepository(_db);
     SubscribeMessage   = new MqttSubscriptionMessageRepository(_db);
     BatteryReading     = new BatteryRepository(_db);
     ContactReading     = new ContactRepository(_db);
     HumidityReading    = new HumidityRepository(_db);
     MotionReading      = new MotionRepository(_db);
     TemperatureReading = new TemperatureRepository(_db);
 }
コード例 #3
0
ファイル: DataRecieverService.cs プロジェクト: xardas663/mgr
        public async Task <List <PlotData> > GetHumidityFromApiForPlot(string dateTime, string sensorName)
        {
            var humidityList = new List <PlotData>();
            var repo         = new HumidityRepository();
            var humidity     = await repo.GetHumidity(100, dateTime, sensorName);

            foreach (var item in humidity)
            {
                humidityList.Add(new PlotData()
                {
                    Value = item.Value,
                    Date  = item.Date
                });
            }
            return(humidityList);
        }
コード例 #4
0
 public UnitOfWork(GrowingPlantsContext context)
 {
     UserRepository                = new UserRepository(context);
     TreeRepository                = new TreeRepository(context);
     MeasurementUnitRepository     = new MeasurementUnitRepository(context);
     LightRepository               = new LightRepository(context);
     HumidityRepository            = new HumidityRepository(context);
     TemperatureRepository         = new TemperatureRepository(context);
     FavoriteTreeRepository        = new FavoriteTreeRepository(context);
     CountryRepository             = new CountryRepository(context);
     PlantingProcessRepository     = new PlantingProcessRepository(context);
     PlantingEnvironmentRepository = new PlantingEnvironmentRepository(context);
     ProcessStepRepository         = new ProcessStepRepository(context);
     PlantingActionRepository      = new PlantingActionRepository(context);
     RecurrenceRepository          = new RecurrenceRepository(context);
     NotificationRepository        = new NotificationRepository(context);
     PlantingSpotRepository        = new PlantingSpotRepository(context);
     PlantTypeRepository           = new PlantTypeRepository(context);
     GalleryRepository             = new GalleryRepository(context);
     PictureRepository             = new PictureRepository(context);
 }
コード例 #5
0
 public HumidityController()
 {
     _humidityRepository = new HumidityRepository();
 }
コード例 #6
0
ファイル: DataRecieverService.cs プロジェクト: xardas663/mgr
        public async Task <IEnumerable <HumidityAvgYearly> > GetHumidityAvgYearly(string sensorName)
        {
            var repo = new HumidityRepository();

            return(await repo.GetHumidityAvgYearly(sensorName));
        }