Commit 31ffb722 authored by Charles Still's avatar Charles Still
Browse files

fix commit weather / pollen

parents 8d51ca28 bd5604ca
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
......@@ -73,11 +65,27 @@
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.19.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<connectionStrings><add name="delmeEntities" connectionString="metadata=res://*/BeeWeatherModel.csdl|res://*/BeeWeatherModel.ssdl|res://*/BeeWeatherModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=digitalbeekeeper.de;user id=cnam1;password=Belana2016();persistsecurityinfo=True;database=delme&quot;" providerName="System.Data.EntityClient" /><add name="delmeEntities1" connectionString="metadata=res://*/BeesWeatherModel.csdl|res://*/BeesWeatherModel.ssdl|res://*/BeesWeatherModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=digitalbeekeeper.de;user id=cnam1;password=Belana2016();persistsecurityinfo=True;database=delme&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
<!-- Connection settings-->
<connectionStrings>
<add name="delmeEntities" connectionString="metadata=res://*/BeeWeatherModel.csdl|res://*/BeeWeatherModel.ssdl|res://*/BeeWeatherModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=digitalbeekeeper.de;user id=cnam1;password=Belana2016();persistsecurityinfo=True;database=delme&quot;" providerName="System.Data.EntityClient" />
<add name="delmeEntities1" connectionString="metadata=res://*/BeesWeatherModel.csdl|res://*/BeesWeatherModel.ssdl|res://*/BeesWeatherModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=digitalbeekeeper.de;user id=cnam1;password=Belana2016();persistsecurityinfo=True;database=delme&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<!-- Application settings-->
<appSettings>
<!-- ... -->
<add key="CityId" value="2925533" />
<add key="PartregionId" value="91" />
<!-- ... -->
</appSettings>
</configuration>
<!-- Enity framework -->
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.19.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</provider></providers>
</entityFramework>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\EntityFramework.6.4.0\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -40,10 +39,13 @@
<HintPath>..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll</HintPath>
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.0.19.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.19\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\WeatherNet.2.1\lib\Newtonsoft.Json.dll</HintPath>
......@@ -99,7 +101,6 @@
<Reference Include="MySql.Data, Version=8.0.19.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.19\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.0.19.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" />
<Reference Include="MySqlConnector, Version=0.62.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92, processorArchitecture=MSIL">
<HintPath>..\packages\MySqlConnector.0.62.0\lib\net471\MySqlConnector.dll</HintPath>
</Reference>
......@@ -158,7 +159,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="LoggerManager.cs" />
<Compile Include="beehive_poll_forecast.cs">
<DependentUpon>BeesWeatherModel.tt</DependentUpon>
</Compile>
......@@ -186,6 +186,7 @@
<Compile Include="ref_beehive_poll_forecast.cs">
<DependentUpon>BeesWeatherModel.tt</DependentUpon>
</Compile>
<Compile Include="WeatherForecast.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
......@@ -217,12 +218,4 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.0\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.0\build\EntityFramework.targets'))" />
</Target>
<Import Project="..\packages\EntityFramework.6.4.0\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" />
</Project>
</Project>
\ No newline at end of file
......@@ -9,10 +9,12 @@
namespace BeeWeatherPollenTracker
{
using MySql.Data.EntityFramework;
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public partial class delmeEntities1 : DbContext
{
public delmeEntities1()
......
// La génération de code T4 est activée pour le modèle 'C:\CNAM\2A\Darmstadt\BeeWeatherPollenTracker\BeeWeatherPollenTracker\BeesWeatherModel.edmx'.
// La génération de code T4 est activée pour le modèle 'C:\CNAM\2A\Darmstadt\bee-weather\BeeWeatherPollenTracker\BeesWeatherModel.edmx'.
// Pour activer la génération de code héritée, définissez la valeur de la propriété
// du concepteur 'Stratégie de génération de code' sur 'ObjectContext hérité'. Cette propriété est disponible dans la fenêtre Propriétés lorsque le modèle
// est ouvert dans le concepteur.
......
......@@ -4,7 +4,7 @@
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="delmeModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.5" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<Schema Namespace="delmeModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.5" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="beehive_poll_forecast">
<Key>
<PropertyRef Name="Id" />
......@@ -26,11 +26,10 @@
<Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Input_date" Type="date" Nullable="false" />
<Property Name="Forecast_date" Type="date" Nullable="false" />
<Property Name="Temperature" Type="float" Nullable="false" />
<Property Name="Wind" Type="float" Nullable="false" />
<Property Name="Humidity" Type="int" Nullable="false" />
<Property Name="Temperature" Type="double" Nullable="false" />
<Property Name="Wind" Type="double" Nullable="false" />
<Property Name="Humidity" Type="double" Nullable="false" />
<Property Name="Cloudiness" Type="varchar" MaxLength="256" Nullable="false" />
<Property Name="Pressure" Type="int" Nullable="false" />
<Property Name="Location" Type="varchar" MaxLength="256" Nullable="false" />
</EntityType>
<EntityType Name="ref_beehive_poll_forecast">
......@@ -93,27 +92,43 @@
<End Role="beehive_poll_forecast" EntitySet="beehive_poll_forecast" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:StorageModels>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="delmeModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="delmeEntities1" annotation:LazyLoadingEnabled="true">
<EntitySet Name="beehive_poll_forecast" EntityType="delmeModel.beehive_poll_forecast" />
<EntitySet Name="beehive_weather_forecast" EntityType="delmeModel.beehive_weather_forecast" />
<EntitySet Name="ref_beehive_poll_forecast" EntityType="delmeModel.ref_beehive_poll_forecast" />
<AssociationSet Name="fk_ref_pollen_day_after_to" Association="delmeModel.fk_ref_pollen_day_after_to">
<End Role="ref_beehive_poll_forecast" EntitySet="ref_beehive_poll_forecast" />
<End Role="beehive_poll_forecast" EntitySet="beehive_poll_forecast" />
</AssociationSet>
<AssociationSet Name="fk_ref_pollen_today" Association="delmeModel.fk_ref_pollen_today">
<End Role="ref_beehive_poll_forecast" EntitySet="ref_beehive_poll_forecast" />
<End Role="beehive_poll_forecast" EntitySet="beehive_poll_forecast" />
</AssociationSet>
<AssociationSet Name="fk_ref_pollen_tomorrow" Association="delmeModel.fk_ref_pollen_tomorrow">
<End Role="ref_beehive_poll_forecast" EntitySet="ref_beehive_poll_forecast" />
<End Role="beehive_poll_forecast" EntitySet="beehive_poll_forecast" />
</AssociationSet>
</EntityContainer>
<EntityType Name="beehive_poll_forecast">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Last_update_on" Type="DateTime" Nullable="false" />
<Property Name="Region_name" Type="String" MaxLength="256" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Part_region_name" Type="String" MaxLength="256" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Day_after_to" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Tomorrow" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Today" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Pollen" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Region_name" Type="String" Nullable="false" MaxLength="256" FixedLength="false" Unicode="false" />
<Property Name="Part_region_name" Type="String" Nullable="false" MaxLength="256" FixedLength="false" Unicode="false" />
<Property Name="Day_after_to" Type="String" Nullable="false" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="Tomorrow" Type="String" Nullable="false" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="Today" Type="String" Nullable="false" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="Pollen" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Sender" Type="String" MaxLength="256" FixedLength="false" Unicode="false" />
<NavigationProperty Name="ref_beehive_poll_forecast" Relationship="Self.fk_ref_pollen_day_after_to" FromRole="beehive_poll_forecast" ToRole="ref_beehive_poll_forecast" />
<NavigationProperty Name="ref_beehive_poll_forecast1" Relationship="Self.fk_ref_pollen_today" FromRole="beehive_poll_forecast" ToRole="ref_beehive_poll_forecast" />
<NavigationProperty Name="ref_beehive_poll_forecast2" Relationship="Self.fk_ref_pollen_tomorrow" FromRole="beehive_poll_forecast" ToRole="ref_beehive_poll_forecast" />
<NavigationProperty Name="ref_beehive_poll_forecast" Relationship="delmeModel.fk_ref_pollen_day_after_to" FromRole="beehive_poll_forecast" ToRole="ref_beehive_poll_forecast" />
<NavigationProperty Name="ref_beehive_poll_forecast1" Relationship="delmeModel.fk_ref_pollen_today" FromRole="beehive_poll_forecast" ToRole="ref_beehive_poll_forecast" />
<NavigationProperty Name="ref_beehive_poll_forecast2" Relationship="delmeModel.fk_ref_pollen_tomorrow" FromRole="beehive_poll_forecast" ToRole="ref_beehive_poll_forecast" />
</EntityType>
<EntityType Name="beehive_weather_forecast">
<Key>
......@@ -122,26 +137,25 @@
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="Input_date" Type="DateTime" Nullable="false" />
<Property Name="Forecast_date" Type="DateTime" Nullable="false" />
<Property Name="Temperature" Type="Single" Nullable="false" />
<Property Name="Wind" Type="Single" Nullable="false" />
<Property Name="Humidity" Type="Int32" Nullable="false" />
<Property Name="Cloudiness" Type="String" MaxLength="256" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Pressure" Type="Int32" Nullable="false" />
<Property Name="Location" Type="String" MaxLength="256" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Temperature" Type="Double" Nullable="false" />
<Property Name="Wind" Type="Double" Nullable="false" />
<Property Name="Humidity" Type="Double" Nullable="false" />
<Property Name="Cloudiness" Type="String" Nullable="false" MaxLength="256" FixedLength="false" Unicode="false" />
<Property Name="Location" Type="String" Nullable="false" MaxLength="256" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="ref_beehive_poll_forecast">
<Key>
<PropertyRef Name="Id_pollen_measure" />
</Key>
<Property Name="Id_pollen_measure" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="Legend_pollen_measure" Type="String" MaxLength="256" FixedLength="false" Unicode="false" Nullable="false" />
<NavigationProperty Name="beehive_poll_forecast" Relationship="Self.fk_ref_pollen_day_after_to" FromRole="ref_beehive_poll_forecast" ToRole="beehive_poll_forecast" />
<NavigationProperty Name="beehive_poll_forecast1" Relationship="Self.fk_ref_pollen_today" FromRole="ref_beehive_poll_forecast" ToRole="beehive_poll_forecast" />
<NavigationProperty Name="beehive_poll_forecast2" Relationship="Self.fk_ref_pollen_tomorrow" FromRole="ref_beehive_poll_forecast" ToRole="beehive_poll_forecast" />
<Property Name="Id_pollen_measure" Type="String" Nullable="false" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="Legend_pollen_measure" Type="String" Nullable="false" MaxLength="256" FixedLength="false" Unicode="false" />
<NavigationProperty Name="beehive_poll_forecast" Relationship="delmeModel.fk_ref_pollen_day_after_to" FromRole="ref_beehive_poll_forecast" ToRole="beehive_poll_forecast" />
<NavigationProperty Name="beehive_poll_forecast1" Relationship="delmeModel.fk_ref_pollen_today" FromRole="ref_beehive_poll_forecast" ToRole="beehive_poll_forecast" />
<NavigationProperty Name="beehive_poll_forecast2" Relationship="delmeModel.fk_ref_pollen_tomorrow" FromRole="ref_beehive_poll_forecast" ToRole="beehive_poll_forecast" />
</EntityType>
<Association Name="fk_ref_pollen_day_after_to">
<End Role="ref_beehive_poll_forecast" Type="Self.ref_beehive_poll_forecast" Multiplicity="1" />
<End Role="beehive_poll_forecast" Type="Self.beehive_poll_forecast" Multiplicity="*" />
<End Type="delmeModel.ref_beehive_poll_forecast" Role="ref_beehive_poll_forecast" Multiplicity="1" />
<End Type="delmeModel.beehive_poll_forecast" Role="beehive_poll_forecast" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="ref_beehive_poll_forecast">
<PropertyRef Name="Id_pollen_measure" />
......@@ -152,8 +166,8 @@
</ReferentialConstraint>
</Association>
<Association Name="fk_ref_pollen_today">
<End Role="ref_beehive_poll_forecast" Type="Self.ref_beehive_poll_forecast" Multiplicity="1" />
<End Role="beehive_poll_forecast" Type="Self.beehive_poll_forecast" Multiplicity="*" />
<End Type="delmeModel.ref_beehive_poll_forecast" Role="ref_beehive_poll_forecast" Multiplicity="1" />
<End Type="delmeModel.beehive_poll_forecast" Role="beehive_poll_forecast" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="ref_beehive_poll_forecast">
<PropertyRef Name="Id_pollen_measure" />
......@@ -164,8 +178,8 @@
</ReferentialConstraint>
</Association>
<Association Name="fk_ref_pollen_tomorrow">
<End Role="ref_beehive_poll_forecast" Type="Self.ref_beehive_poll_forecast" Multiplicity="1" />
<End Role="beehive_poll_forecast" Type="Self.beehive_poll_forecast" Multiplicity="*" />
<End Type="delmeModel.ref_beehive_poll_forecast" Role="ref_beehive_poll_forecast" Multiplicity="1" />
<End Type="delmeModel.beehive_poll_forecast" Role="beehive_poll_forecast" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="ref_beehive_poll_forecast">
<PropertyRef Name="Id_pollen_measure" />
......@@ -175,23 +189,6 @@
</Dependent>
</ReferentialConstraint>
</Association>
<EntityContainer Name="delmeEntities1" annotation:LazyLoadingEnabled="true">
<EntitySet Name="beehive_poll_forecast" EntityType="Self.beehive_poll_forecast" />
<EntitySet Name="beehive_weather_forecast" EntityType="Self.beehive_weather_forecast" />
<EntitySet Name="ref_beehive_poll_forecast" EntityType="Self.ref_beehive_poll_forecast" />
<AssociationSet Name="fk_ref_pollen_day_after_to" Association="Self.fk_ref_pollen_day_after_to">
<End Role="ref_beehive_poll_forecast" EntitySet="ref_beehive_poll_forecast" />
<End Role="beehive_poll_forecast" EntitySet="beehive_poll_forecast" />
</AssociationSet>
<AssociationSet Name="fk_ref_pollen_today" Association="Self.fk_ref_pollen_today">
<End Role="ref_beehive_poll_forecast" EntitySet="ref_beehive_poll_forecast" />
<End Role="beehive_poll_forecast" EntitySet="beehive_poll_forecast" />
</AssociationSet>
<AssociationSet Name="fk_ref_pollen_tomorrow" Association="Self.fk_ref_pollen_tomorrow">
<End Role="ref_beehive_poll_forecast" EntitySet="ref_beehive_poll_forecast" />
<End Role="beehive_poll_forecast" EntitySet="beehive_poll_forecast" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
......@@ -201,38 +198,37 @@
<EntitySetMapping Name="beehive_poll_forecast">
<EntityTypeMapping TypeName="delmeModel.beehive_poll_forecast">
<MappingFragment StoreEntitySet="beehive_poll_forecast">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Last_update_on" ColumnName="Last_update_on" />
<ScalarProperty Name="Region_name" ColumnName="Region_name" />
<ScalarProperty Name="Part_region_name" ColumnName="Part_region_name" />
<ScalarProperty Name="Day_after_to" ColumnName="Day_after_to" />
<ScalarProperty Name="Tomorrow" ColumnName="Tomorrow" />
<ScalarProperty Name="Today" ColumnName="Today" />
<ScalarProperty Name="Pollen" ColumnName="Pollen" />
<ScalarProperty Name="Sender" ColumnName="Sender" />
<ScalarProperty Name="Pollen" ColumnName="Pollen" />
<ScalarProperty Name="Today" ColumnName="Today" />
<ScalarProperty Name="Tomorrow" ColumnName="Tomorrow" />
<ScalarProperty Name="Day_after_to" ColumnName="Day_after_to" />
<ScalarProperty Name="Part_region_name" ColumnName="Part_region_name" />
<ScalarProperty Name="Region_name" ColumnName="Region_name" />
<ScalarProperty Name="Last_update_on" ColumnName="Last_update_on" />
<ScalarProperty Name="Id" ColumnName="Id" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="beehive_weather_forecast">
<EntityTypeMapping TypeName="delmeModel.beehive_weather_forecast">
<MappingFragment StoreEntitySet="beehive_weather_forecast">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Input_date" ColumnName="Input_date" />
<ScalarProperty Name="Forecast_date" ColumnName="Forecast_date" />
<ScalarProperty Name="Temperature" ColumnName="Temperature" />
<ScalarProperty Name="Wind" ColumnName="Wind" />
<ScalarProperty Name="Humidity" ColumnName="Humidity" />
<ScalarProperty Name="Cloudiness" ColumnName="Cloudiness" />
<ScalarProperty Name="Pressure" ColumnName="Pressure" />
<ScalarProperty Name="Location" ColumnName="Location" />
<ScalarProperty Name="Cloudiness" ColumnName="Cloudiness" />
<ScalarProperty Name="Humidity" ColumnName="Humidity" />
<ScalarProperty Name="Wind" ColumnName="Wind" />
<ScalarProperty Name="Temperature" ColumnName="Temperature" />
<ScalarProperty Name="Forecast_date" ColumnName="Forecast_date" />
<ScalarProperty Name="Input_date" ColumnName="Input_date" />
<ScalarProperty Name="Id" ColumnName="Id" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="ref_beehive_poll_forecast">
<EntityTypeMapping TypeName="delmeModel.ref_beehive_poll_forecast">
<MappingFragment StoreEntitySet="ref_beehive_poll_forecast">
<ScalarProperty Name="Id_pollen_measure" ColumnName="Id_pollen_measure" />
<ScalarProperty Name="Legend_pollen_measure" ColumnName="Legend_pollen_measure" />
<ScalarProperty Name="Id_pollen_measure" ColumnName="Id_pollen_measure" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
......
......@@ -5,12 +5,12 @@
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="a9f5fe2bbdd242e5ac225199ca985c2c" Name="Diagram1">
<EntityTypeShape EntityType="delmeModel.beehive_poll_forecast" Width="1.5" PointX="3" PointY="1" IsExpanded="true" />
<EntityTypeShape EntityType="delmeModel.beehive_weather_forecast" Width="1.5" PointX="5.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="delmeModel.ref_beehive_poll_forecast" Width="1.5" PointX="0.75" PointY="1.625" IsExpanded="true" />
<AssociationConnector Association="delmeModel.fk_ref_pollen_day_after_to" ManuallyRouted="false" />
<AssociationConnector Association="delmeModel.fk_ref_pollen_today" ManuallyRouted="false" />
<AssociationConnector Association="delmeModel.fk_ref_pollen_tomorrow" ManuallyRouted="false" />
<EntityTypeShape EntityType="delmeModel.beehive_poll_forecast" Width="1.5" PointX="3" PointY="1" />
<EntityTypeShape EntityType="delmeModel.beehive_weather_forecast" Width="1.5" PointX="5.75" PointY="0.75" />
<EntityTypeShape EntityType="delmeModel.ref_beehive_poll_forecast" Width="1.5" PointX="0.75" PointY="1.625" />
<AssociationConnector Association="delmeModel.fk_ref_pollen_day_after_to" />
<AssociationConnector Association="delmeModel.fk_ref_pollen_today" />
<AssociationConnector Association="delmeModel.fk_ref_pollen_tomorrow" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
......
using MySql.Data.EntityFramework;

using MySql.Data.EntityFramework;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
......@@ -6,43 +7,46 @@ using System.Configuration;
using System.Data.Entity;
using System.Linq;
using System.Net.Http;
using System.Threading;
using WeatherNet;
using WeatherNet.Clients;
namespace BeeWeatherPollenTracker
{
[DbConfigurationType(typeof(MySqlEFConfiguration))]
internal static class Program
{
private const string OPEN_WEATHER_MAP_API_KEY = "3f80e65ed0609e7e52737e65d522aed8";
private const double FORECAST_LENGTH = 3.0;
private const string POLLEN_FORECAST_URL =
"https://opendata.dwd.de/climate_environment/health/alerts/s31fg.json";
#region Constantes
private const string POLLEN_FORECAST_URL = "https://opendata.dwd.de/climate_environment/health/alerts/s31fg.json";
#endregion
private static LoggerManager logs = null;
static LoggerManager logs = null;
private static void Main(string[] args)
{
// Set up API KEY
ClientSettings.SetApiKey(OPEN_WEATHER_MAP_API_KEY);
// Entity Framework setup
DbConfiguration.SetConfiguration(new MySqlEFConfiguration());
#region Weather
WeatherForecast weather = new WeatherForecast();
Thread t = new Thread(new ThreadStart(weather.Process));
t.Start();
#endregion
#region Pool
// TODO: Create new service to retreive poll info (like weather)
// TODO: Launch service with thread
// Set up the logger manager
logs = LoggerManager.GetInstance();
// Retrieve forecast data from from OWM API
// Retrieve poll forecast data
try
{
var cityId = int.Parse(ConfigurationManager.AppSettings["CityId"]);
var apiResults = FiveDaysForecast.GetByCityId(cityId);
if (!apiResults.Success)
{
throw new ApplicationException(apiResults.Message);
}
// Filter: keep only 3 next days forecast
var forecast = apiResults.Items
.Where(x => x.Date < DateTime.Now.AddDays(FORECAST_LENGTH))
.ToList();
{
// Get Pollen Data
ClimateEnvironment pollenData;
using (HttpClient pollenClient = new HttpClient())
......@@ -72,6 +76,8 @@ namespace BeeWeatherPollenTracker
{
logs.WriteInFile(e);
}
#endregion
}
}
}
using MySql.Data.EntityFramework;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Linq;
using WeatherNet;
using WeatherNet.Clients;
namespace BeeWeatherPollenTracker
{
public class WeatherForecast
{
#region Constantes
private const string OPEN_WEATHER_MAP_API_KEY = "3f80e65ed0609e7e52737e65d522aed8";
private const double FORECAST_LENGTH = 3.0;
#endregion
#region Attributes
// Weather forecast data
private List<beehive_weather_forecast> _weather_forecast_list;
private static LoggerManager logs = null;
#endregion
/// <summary>
/// Create new instance of weatherforcase
/// </summary>
public WeatherForecast()
{
// Initialize weather forecast list
this._weather_forecast_list = new List<beehive_weather_forecast>();
// Set up API KEY
ClientSettings.SetApiKey(OPEN_WEATHER_MAP_API_KEY);
// Set up the logger manager
logs = LoggerManager.GetInstance();
}
public void Process()
{
RetreiveData();
PushForecastToDatabase();
}
/// <summary>
/// Retreive Data from API
/// </summary>
private void RetreiveData()
{
// Retrieve forecast data from from OWM API
var cityId = int.Parse(ConfigurationManager.AppSettings["CityId"]);
var apiResults = FiveDaysForecast.GetByCityId(cityId);
if (!apiResults.Success)
{
throw new ApplicationException(apiResults.Message);
}
// Filter: keep only 3 next days forecast
var forecast = apiResults.Items
.Where(x => x.Date < DateTime.Now.AddDays(FORECAST_LENGTH))
.ToList();
foreach (var item in forecast)
{
beehive_weather_forecast w = new beehive_weather_forecast();
w.Input_date = DateTime.Now;
w.Forecast_date = item.Date;
w.Temperature = item.Temp;
w.Humidity = item.Humidity;
w.Wind = item.WindSpeed;
w.Cloudiness = item.Description;
w.Location = item.City;
_weather_forecast_list.Add(w);
}
}
/// <summary>
/// Push weather forecast to database
/// </summary>
private void PushForecastToDatabase()
{
try
{
// Entity context
var context = new delmeEntities1();
// Add weather forecast to context
foreach (var item in this._weather_forecast_list)
context.beehive_weather_forecast.Add(item);
// Push data in databse
context.SaveChanges();
}
catch (Exception ex)
{
logs.WriteInFile(ex);
}
finally
{
// Clear weather data
this._weather_forecast_list.Clear();
}
}
}
}
......@@ -17,11 +17,10 @@ namespace BeeWeatherPollenTracker
public int Id { get; set; }
public System.DateTime Input_date { get; set; }
public System.DateTime Forecast_date { get; set; }
public float Temperature { get; set; }
public float Wind { get; set; }
public int Humidity { get; set; }
public double Temperature { get; set; }
public double Wind { get; set; }
public double Humidity { get; set; }
public string Cloudiness { get; set; }
public int Pressure { get; set; }
public string Location { get; set; }
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle" version="1.8.3.1" targetFramework="net472" />
<package id="EntityFramework" version="6.4.0" targetFramework="net472" />