Réécriture de l'envoi de SMS (OVH) + Ajout d'une fonction d'import depuis des fichiers Excel + Ajout d'une donnée pour le numéro d'appartement.
This commit is contained in:
parent
22de04c0c9
commit
f4aac126eb
@ -37,15 +37,7 @@
|
|||||||
<Label>Nom de naissance :</Label>
|
<Label>Nom de naissance :</Label>
|
||||||
<TextBox Name="nomNaissanceTextBox" Text="{Binding Path=NomNaissance}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
<TextBox Name="nomNaissanceTextBox" Text="{Binding Path=NomNaissance}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
||||||
<Label>Prénom :</Label>
|
<Label>Prénom :</Label>
|
||||||
<TextBox Name="prenomTextBox" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" Validation.Error="ValidationError" Binding.TargetUpdated="BindingTargetUpdated" Binding.SourceUpdated="BindingSourceUpdated" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150">
|
<TextBox Name="prenomTextBox" Text="{Binding Path=Prenom}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
||||||
<TextBox.Text>
|
|
||||||
<Binding Path="Prenom" NotifyOnSourceUpdated="True" NotifyOnTargetUpdated="true" NotifyOnValidationError="true">
|
|
||||||
<Binding.ValidationRules>
|
|
||||||
<Validation:MandatoryString/>
|
|
||||||
</Binding.ValidationRules>
|
|
||||||
</Binding>
|
|
||||||
</TextBox.Text>
|
|
||||||
</TextBox>
|
|
||||||
<Label>Age :</Label>
|
<Label>Age :</Label>
|
||||||
<TextBox Name="ageTextBox" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" Validation.Error="ValidationError" Binding.TargetUpdated="BindingTargetUpdated" Binding.SourceUpdated="BindingSourceUpdated" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="30">
|
<TextBox Name="ageTextBox" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" Validation.Error="ValidationError" Binding.TargetUpdated="BindingTargetUpdated" Binding.SourceUpdated="BindingSourceUpdated" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="30">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
@ -69,17 +61,11 @@
|
|||||||
<GroupBox Header="Adresse Locale" Margin="10,10,0,0" VerticalAlignment="Top">
|
<GroupBox Header="Adresse Locale" Margin="10,10,0,0" VerticalAlignment="Top">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Label>Numéro et rue :</Label>
|
<Label>Numéro et rue :</Label>
|
||||||
<TextBox Name="adresseTextBox" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" Validation.Error="ValidationError" Binding.TargetUpdated="BindingTargetUpdated" Binding.SourceUpdated="BindingSourceUpdated" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150">
|
<TextBox Name="adresseTextBox" Text="{Binding Path=Adresse}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
||||||
<TextBox.Text>
|
|
||||||
<Binding Path="Adresse" NotifyOnSourceUpdated="True" NotifyOnTargetUpdated="true" NotifyOnValidationError="true">
|
|
||||||
<Binding.ValidationRules>
|
|
||||||
<Validation:MandatoryString/>
|
|
||||||
</Binding.ValidationRules>
|
|
||||||
</Binding>
|
|
||||||
</TextBox.Text>
|
|
||||||
</TextBox>
|
|
||||||
<Label>Bâtiment :</Label>
|
<Label>Bâtiment :</Label>
|
||||||
<TextBox Name="adresseBatimentTextBox" Text="{Binding Path=AdresseBatiment}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
<TextBox Name="adresseBatimentTextBox" Text="{Binding Path=AdresseBatiment}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
||||||
|
<Label>Numéro d'appartement:</Label>
|
||||||
|
<TextBox Name="adresseNumeroBatimentTextBox" Text="{Binding Path=AdresseNumeroBatiment}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
||||||
<Label>Quartier :</Label>
|
<Label>Quartier :</Label>
|
||||||
<TextBox Name="quartierTextBox" Text="{Binding Path=Quartier}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
<TextBox Name="quartierTextBox" Text="{Binding Path=Quartier}" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="150"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@ -49,10 +49,7 @@ namespace Hermes {
|
|||||||
|
|
||||||
public void Save_Click(object sender, RoutedEventArgs e) {
|
public void Save_Click(object sender, RoutedEventArgs e) {
|
||||||
nomTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
nomTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
nomNaissanceTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
|
||||||
prenomTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
|
||||||
ageTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
ageTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
adresseTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
|
||||||
if(_isInvalidElements.Count == 0) {
|
if(_isInvalidElements.Count == 0) {
|
||||||
ModelContext dbContext = ModelContext.Getinstance();
|
ModelContext dbContext = ModelContext.Getinstance();
|
||||||
if(editRef == null) {
|
if(editRef == null) {
|
||||||
|
@ -65,8 +65,9 @@
|
|||||||
<Reference Include="EntityFramework.SqlServerCompact, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<Reference Include="EntityFramework.SqlServerCompact, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\EntityFramework.SqlServerCompact.6.4.4\lib\net45\EntityFramework.SqlServerCompact.dll</HintPath>
|
<HintPath>packages\EntityFramework.SqlServerCompact.6.4.4\lib\net45\EntityFramework.SqlServerCompact.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="isendpro, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\iSendProSMS.1.1.3\lib\isendpro.dll</HintPath>
|
<HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Office.Interop.Outlook.15.0.4797.1003\lib\net20\Microsoft.Office.Interop.Outlook.dll</HintPath>
|
<HintPath>packages\Microsoft.Office.Interop.Outlook.15.0.4797.1003\lib\net20\Microsoft.Office.Interop.Outlook.dll</HintPath>
|
||||||
@ -79,9 +80,6 @@
|
|||||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RestSharp.Net2, Version=102.7.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\RestSharp.Net2.1.1.11\lib\net20\RestSharp.Net2.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
@ -110,6 +108,9 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Compile Include="Converter\NegateBoolean.cs" />
|
<Compile Include="Converter\NegateBoolean.cs" />
|
||||||
|
<Compile Include="ImportWindow.xaml.cs">
|
||||||
|
<DependentUpon>ImportWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="InputWindow.xaml.cs">
|
<Compile Include="InputWindow.xaml.cs">
|
||||||
<DependentUpon>InputWindow.xaml</DependentUpon>
|
<DependentUpon>InputWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -117,10 +118,20 @@
|
|||||||
<Compile Include="Migrations\202012051414539_V1.designer.cs">
|
<Compile Include="Migrations\202012051414539_V1.designer.cs">
|
||||||
<DependentUpon>202012051414539_V1.cs</DependentUpon>
|
<DependentUpon>202012051414539_V1.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Migrations\202012271642572_V2.cs" />
|
||||||
|
<Compile Include="Migrations\202012271642572_V2.designer.cs">
|
||||||
|
<DependentUpon>202012271642572_V2.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Migrations\202012272059415_V3.cs" />
|
||||||
|
<Compile Include="Migrations\202012272059415_V3.designer.cs">
|
||||||
|
<DependentUpon>202012272059415_V3.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Migrations\Configuration.cs" />
|
<Compile Include="Migrations\Configuration.cs" />
|
||||||
<Compile Include="Model\Citoyen.cs" />
|
<Compile Include="Model\Citoyen.cs" />
|
||||||
<Compile Include="Model\Preferences.cs" />
|
<Compile Include="Model\Preferences.cs" />
|
||||||
<Compile Include="Model\ModelContext.cs" />
|
<Compile Include="Model\ModelContext.cs" />
|
||||||
|
<Compile Include="OVHQueryBody.cs" />
|
||||||
|
<Compile Include="OVHResponseBody.cs" />
|
||||||
<Compile Include="PreferencesWindow.xaml.cs">
|
<Compile Include="PreferencesWindow.xaml.cs">
|
||||||
<DependentUpon>PreferencesWindow.xaml</DependentUpon>
|
<DependentUpon>PreferencesWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -134,6 +145,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="ImportWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="InputWindow.xaml">
|
<Page Include="InputWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -179,6 +194,12 @@
|
|||||||
<EmbeddedResource Include="Migrations\202012051414539_V1.resx">
|
<EmbeddedResource Include="Migrations\202012051414539_V1.resx">
|
||||||
<DependentUpon>202012051414539_V1.cs</DependentUpon>
|
<DependentUpon>202012051414539_V1.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Migrations\202012271642572_V2.resx">
|
||||||
|
<DependentUpon>202012271642572_V2.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Migrations\202012272059415_V3.resx">
|
||||||
|
<DependentUpon>202012272059415_V3.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
33
ImportWindow.xaml
Normal file
33
ImportWindow.xaml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<Window x:Class="Hermes.ImportWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Hermes"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
Title="Importer" Height="310" Width="230"
|
||||||
|
Closing="Window_Closing">
|
||||||
|
<Grid Background="WhiteSmoke">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="45"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Margin="5,5,5,0">
|
||||||
|
<Label>Feuille à importer :</Label>
|
||||||
|
<ComboBox Name="sheetComboBox" Height="23"/>
|
||||||
|
<Label>Quartier à définir</Label>
|
||||||
|
<TextBox Name="quartierTextBox" VerticalContentAlignment="Center" Height="23"/>
|
||||||
|
<Label>Nom de rue à définir</Label>
|
||||||
|
<TextBox Name="adresseTextBox" VerticalContentAlignment="Center" Height="23"/>
|
||||||
|
<Label>Bâtiment à définir</Label>
|
||||||
|
<TextBox Name="batimentTextBox" VerticalContentAlignment="Center" Height="23"/>
|
||||||
|
<WrapPanel>
|
||||||
|
<Label>Résidence</Label>
|
||||||
|
<CheckBox Name="residenceCheckBox" VerticalAlignment="Center"/>
|
||||||
|
</WrapPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<Button Name="importButton" IsDefault="true" Grid.Row="1" Width="100" Height="25" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0" Click="Importer_Click">Importer</Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
151
ImportWindow.xaml.cs
Normal file
151
ImportWindow.xaml.cs
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows;
|
||||||
|
using Hermes.Model;
|
||||||
|
using Excel = Microsoft.Office.Interop.Excel;
|
||||||
|
|
||||||
|
namespace Hermes {
|
||||||
|
public partial class ImportWindow : Window {
|
||||||
|
private bool importing = false;
|
||||||
|
private Excel.Application xlApp;
|
||||||
|
private Excel.Workbook xlWb;
|
||||||
|
private static Regex communeRgx = new Regex(@"(\d{5})(.*)");
|
||||||
|
|
||||||
|
private static string prepareValue(object value, bool notNull = false) {
|
||||||
|
if(value != null) {
|
||||||
|
return value.ToString().Trim();
|
||||||
|
}
|
||||||
|
if(notNull) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImportWindow(Window parent, string filepath) {
|
||||||
|
InitializeComponent();
|
||||||
|
Owner = parent;
|
||||||
|
List<string> sheets = new List<string>();
|
||||||
|
|
||||||
|
adresseTextBox.Text = Path.GetFileNameWithoutExtension(filepath);
|
||||||
|
|
||||||
|
xlApp = new Excel.Application();
|
||||||
|
xlWb = xlApp.Workbooks.Open(filepath);
|
||||||
|
for(int i = 1; i <= xlWb.Sheets.Count; i++) {
|
||||||
|
Excel.Worksheet sheet = xlWb.Sheets.Item[i];
|
||||||
|
sheets.Add(sheet.Name);
|
||||||
|
}
|
||||||
|
sheetComboBox.ItemsSource = sheets;
|
||||||
|
|
||||||
|
if(sheets.Count == 0) {
|
||||||
|
importButton.IsEnabled = false;
|
||||||
|
} else {
|
||||||
|
sheetComboBox.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Importer_Click(object sender, RoutedEventArgs e) {
|
||||||
|
importing = true;
|
||||||
|
Excel.Worksheet sheet = xlWb.Sheets.Item[sheetComboBox.SelectedIndex + 1];
|
||||||
|
string cell = prepareValue(sheet.Cells[1, "J"].Value);
|
||||||
|
bool complement = false;
|
||||||
|
string rue = adresseTextBox.Text == null ? "" : adresseTextBox.Text;
|
||||||
|
if(!string.IsNullOrEmpty(cell)) {
|
||||||
|
complement = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 2; string.IsNullOrEmpty(prepareValue(sheet.Cells[i, "A"].Value)) != true ; i++) {
|
||||||
|
Citoyen citoyen = new Citoyen();
|
||||||
|
citoyen.Nom = prepareValue(sheet.Cells[i, "A"].Value);
|
||||||
|
citoyen.Prenom = prepareValue(sheet.Cells[i, "B"].Value);
|
||||||
|
if(complement) {
|
||||||
|
string num = prepareValue(sheet.Cells[i, "D"].Value);
|
||||||
|
if(residenceCheckBox.IsChecked == true) {
|
||||||
|
citoyen.Adresse = rue;
|
||||||
|
citoyen.AdresseNumeroBatiment = num;
|
||||||
|
} else {
|
||||||
|
citoyen.Adresse = $"{num} {rue}";
|
||||||
|
}
|
||||||
|
citoyen.Mail = prepareValue(sheet.Cells[i, "E"].Value);
|
||||||
|
citoyen.Tel = prepareValue(sheet.Cells[i, "F"].Value);
|
||||||
|
if(citoyen.Tel != null) {
|
||||||
|
citoyen.Tel = citoyen.Tel.Replace(".", " ");
|
||||||
|
}
|
||||||
|
citoyen.TelPort = prepareValue(sheet.Cells[i, "G"].Value);
|
||||||
|
if(citoyen.TelPort != null) {
|
||||||
|
citoyen.TelPort = citoyen.TelPort.Replace(".", " ");
|
||||||
|
}
|
||||||
|
string res = prepareValue(sheet.Cells[i, "H"].Value, true);
|
||||||
|
if(res.ToLower().Equals("r.principale")) {
|
||||||
|
citoyen.TypeResidence = false;
|
||||||
|
} else {
|
||||||
|
citoyen.TypeResidence = true;
|
||||||
|
}
|
||||||
|
if(citoyen.TypeResidence == true) {
|
||||||
|
citoyen.AdresseExt = prepareValue(sheet.Cells[i, "I"].Value);
|
||||||
|
Match m = communeRgx.Match(prepareValue(sheet.Cells[i, "J"].Value, true));
|
||||||
|
if(m.Success) {
|
||||||
|
citoyen.AdresseExtCP = m.Groups[1].Value.Trim();
|
||||||
|
citoyen.AdresseExtVille = m.Groups[2].Value.Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
string num = prepareValue(sheet.Cells[i, "C"].Value);
|
||||||
|
if(residenceCheckBox.IsChecked == true) {
|
||||||
|
citoyen.Adresse = rue;
|
||||||
|
citoyen.AdresseNumeroBatiment = num;
|
||||||
|
} else {
|
||||||
|
citoyen.Adresse = $"{num} {rue}";
|
||||||
|
}
|
||||||
|
citoyen.Mail = prepareValue(sheet.Cells[i, "D"].Value);
|
||||||
|
citoyen.Tel = prepareValue(sheet.Cells[i, "E"].Value);
|
||||||
|
if(citoyen.Tel != null) {
|
||||||
|
citoyen.Tel = citoyen.Tel.Replace(".", " ");
|
||||||
|
}
|
||||||
|
citoyen.TelPort = prepareValue(sheet.Cells[i, "F"].Value);
|
||||||
|
if(citoyen.TelPort != null) {
|
||||||
|
citoyen.TelPort = citoyen.TelPort.Replace(".", " ");
|
||||||
|
}
|
||||||
|
string res = prepareValue(sheet.Cells[i, "G"].Value, true);
|
||||||
|
if(res.ToLower().Equals("r.principale")) {
|
||||||
|
citoyen.TypeResidence = false;
|
||||||
|
} else {
|
||||||
|
citoyen.TypeResidence = true;
|
||||||
|
}
|
||||||
|
if(citoyen.TypeResidence == true) {
|
||||||
|
citoyen.AdresseExt = prepareValue(sheet.Cells[i, "H"].Value);
|
||||||
|
Match m = communeRgx.Match(prepareValue(sheet.Cells[i, "I"].Value, true));
|
||||||
|
if(m.Success) {
|
||||||
|
citoyen.AdresseExtCP = m.Groups[1].Value.Trim();
|
||||||
|
citoyen.AdresseExtVille = m.Groups[2].Value.Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
citoyen.AdresseBatiment = batimentTextBox.Text;
|
||||||
|
citoyen.Quartier = quartierTextBox.Text;
|
||||||
|
citoyen.DateCreation = DateTime.Now;
|
||||||
|
citoyen.DateModification = DateTime.Now;
|
||||||
|
ModelContext.Getinstance().CitoyenSet.Add(citoyen);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelContext.Getinstance().SaveChanges();
|
||||||
|
Marshal.FinalReleaseComObject(sheet);
|
||||||
|
importing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||||
|
if(importing) {
|
||||||
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xlWb.Close();
|
||||||
|
Marshal.FinalReleaseComObject(xlWb);
|
||||||
|
xlApp.Quit();
|
||||||
|
Marshal.FinalReleaseComObject(xlApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -99,30 +99,12 @@
|
|||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_A0F83BCCDBA77804851DAAE18F54AC65"
|
|
||||||
"OwnerKey" = "8:_C4AD2B19587A5D3179211CF729B66A33"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_A0F83BCCDBA77804851DAAE18F54AC65"
|
|
||||||
"OwnerKey" = "8:_EDA497A114444E23814EEE023731C727"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_A3A39C8B97A947A09D3B1660AC88FF5E"
|
"MsmKey" = "8:_A3A39C8B97A947A09D3B1660AC88FF5E"
|
||||||
"OwnerKey" = "8:_UNDEFINED"
|
"OwnerKey" = "8:_UNDEFINED"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_C4AD2B19587A5D3179211CF729B66A33"
|
|
||||||
"OwnerKey" = "8:_EDA497A114444E23814EEE023731C727"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_C767BE5A43214C2C9E31CD47DB92AA96"
|
"MsmKey" = "8:_C767BE5A43214C2C9E31CD47DB92AA96"
|
||||||
"OwnerKey" = "8:_UNDEFINED"
|
"OwnerKey" = "8:_UNDEFINED"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
@ -166,37 +148,13 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_F434633E0B073F068C7E19B9E5AB2EC4"
|
"MsmKey" = "8:_F434633E0B073F068C7E19B9E5AB2EC4"
|
||||||
"OwnerKey" = "8:_C4AD2B19587A5D3179211CF729B66A33"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_F434633E0B073F068C7E19B9E5AB2EC4"
|
|
||||||
"OwnerKey" = "8:_EDA497A114444E23814EEE023731C727"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_F434633E0B073F068C7E19B9E5AB2EC4"
|
|
||||||
"OwnerKey" = "8:_A0F83BCCDBA77804851DAAE18F54AC65"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_UNDEFINED"
|
|
||||||
"OwnerKey" = "8:_EDA497A114444E23814EEE023731C727"
|
"OwnerKey" = "8:_EDA497A114444E23814EEE023731C727"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_UNDEFINED"
|
"MsmKey" = "8:_UNDEFINED"
|
||||||
"OwnerKey" = "8:_C4AD2B19587A5D3179211CF729B66A33"
|
"OwnerKey" = "8:_EDA497A114444E23814EEE023731C727"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_UNDEFINED"
|
|
||||||
"OwnerKey" = "8:_A0F83BCCDBA77804851DAAE18F54AC65"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
@ -287,7 +245,7 @@
|
|||||||
"InstallerBootstrapper" = "3:2"
|
"InstallerBootstrapper" = "3:2"
|
||||||
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
|
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
|
||||||
{
|
{
|
||||||
"Enabled" = "11:TRUE"
|
"Enabled" = "11:FALSE"
|
||||||
"PromptEnabled" = "11:TRUE"
|
"PromptEnabled" = "11:TRUE"
|
||||||
"PrerequisitesLocation" = "2:1"
|
"PrerequisitesLocation" = "2:1"
|
||||||
"Url" = "8:"
|
"Url" = "8:"
|
||||||
@ -603,37 +561,6 @@
|
|||||||
"IsDependency" = "11:FALSE"
|
"IsDependency" = "11:FALSE"
|
||||||
"IsolateTo" = "8:"
|
"IsolateTo" = "8:"
|
||||||
}
|
}
|
||||||
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A0F83BCCDBA77804851DAAE18F54AC65"
|
|
||||||
{
|
|
||||||
"AssemblyRegister" = "3:1"
|
|
||||||
"AssemblyIsInGAC" = "11:FALSE"
|
|
||||||
"AssemblyAsmDisplayName" = "8:RestSharp.Net2, Version=102.7.0.0, Culture=neutral, processorArchitecture=MSIL"
|
|
||||||
"ScatterAssemblies"
|
|
||||||
{
|
|
||||||
"_A0F83BCCDBA77804851DAAE18F54AC65"
|
|
||||||
{
|
|
||||||
"Name" = "8:RestSharp.Net2.dll"
|
|
||||||
"Attributes" = "3:512"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"SourcePath" = "8:RestSharp.Net2.dll"
|
|
||||||
"TargetName" = "8:"
|
|
||||||
"Tag" = "8:"
|
|
||||||
"Folder" = "8:_358759A83B6F4CD5AEAA9CCDB02A52A0"
|
|
||||||
"Condition" = "8:"
|
|
||||||
"Transitive" = "11:FALSE"
|
|
||||||
"Vital" = "11:TRUE"
|
|
||||||
"ReadOnly" = "11:FALSE"
|
|
||||||
"Hidden" = "11:FALSE"
|
|
||||||
"System" = "11:FALSE"
|
|
||||||
"Permanent" = "11:FALSE"
|
|
||||||
"SharedLegacy" = "11:FALSE"
|
|
||||||
"PackageAs" = "3:1"
|
|
||||||
"Register" = "3:1"
|
|
||||||
"Exclude" = "11:FALSE"
|
|
||||||
"IsDependency" = "11:TRUE"
|
|
||||||
"IsolateTo" = "8:"
|
|
||||||
}
|
|
||||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_A3A39C8B97A947A09D3B1660AC88FF5E"
|
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_A3A39C8B97A947A09D3B1660AC88FF5E"
|
||||||
{
|
{
|
||||||
"SourcePath" = "8:..\\bin\\Release\\amd64\\sqlcecompact40.dll"
|
"SourcePath" = "8:..\\bin\\Release\\amd64\\sqlcecompact40.dll"
|
||||||
@ -654,37 +581,6 @@
|
|||||||
"IsDependency" = "11:FALSE"
|
"IsDependency" = "11:FALSE"
|
||||||
"IsolateTo" = "8:"
|
"IsolateTo" = "8:"
|
||||||
}
|
}
|
||||||
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_C4AD2B19587A5D3179211CF729B66A33"
|
|
||||||
{
|
|
||||||
"AssemblyRegister" = "3:1"
|
|
||||||
"AssemblyIsInGAC" = "11:FALSE"
|
|
||||||
"AssemblyAsmDisplayName" = "8:isendpro, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"
|
|
||||||
"ScatterAssemblies"
|
|
||||||
{
|
|
||||||
"_C4AD2B19587A5D3179211CF729B66A33"
|
|
||||||
{
|
|
||||||
"Name" = "8:isendpro.dll"
|
|
||||||
"Attributes" = "3:512"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"SourcePath" = "8:isendpro.dll"
|
|
||||||
"TargetName" = "8:"
|
|
||||||
"Tag" = "8:"
|
|
||||||
"Folder" = "8:_358759A83B6F4CD5AEAA9CCDB02A52A0"
|
|
||||||
"Condition" = "8:"
|
|
||||||
"Transitive" = "11:FALSE"
|
|
||||||
"Vital" = "11:TRUE"
|
|
||||||
"ReadOnly" = "11:FALSE"
|
|
||||||
"Hidden" = "11:FALSE"
|
|
||||||
"System" = "11:FALSE"
|
|
||||||
"Permanent" = "11:FALSE"
|
|
||||||
"SharedLegacy" = "11:FALSE"
|
|
||||||
"PackageAs" = "3:1"
|
|
||||||
"Register" = "3:1"
|
|
||||||
"Exclude" = "11:FALSE"
|
|
||||||
"IsDependency" = "11:TRUE"
|
|
||||||
"IsolateTo" = "8:"
|
|
||||||
}
|
|
||||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C767BE5A43214C2C9E31CD47DB92AA96"
|
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C767BE5A43214C2C9E31CD47DB92AA96"
|
||||||
{
|
{
|
||||||
"SourcePath" = "8:..\\bin\\Release\\amd64\\sqlceqp40.dll"
|
"SourcePath" = "8:..\\bin\\Release\\amd64\\sqlceqp40.dll"
|
||||||
@ -916,15 +812,15 @@
|
|||||||
{
|
{
|
||||||
"Name" = "8:Microsoft Visual Studio"
|
"Name" = "8:Microsoft Visual Studio"
|
||||||
"ProductName" = "8:Hermes"
|
"ProductName" = "8:Hermes"
|
||||||
"ProductCode" = "8:{D2CA66FB-020C-41EF-BD0D-991FFC306669}"
|
"ProductCode" = "8:{47E0BBDE-B1C6-4BF8-8164-6E09BD69DBC8}"
|
||||||
"PackageCode" = "8:{89CBF16D-49D3-4DE5-9CEE-4CE55ADD05AE}"
|
"PackageCode" = "8:{AC7DFDAB-2DF2-41B7-9066-3253344EBC79}"
|
||||||
"UpgradeCode" = "8:{A8FB75F3-57A5-4B7D-A0AE-9E87F69529B0}"
|
"UpgradeCode" = "8:{A8FB75F3-57A5-4B7D-A0AE-9E87F69529B0}"
|
||||||
"AspNetVersion" = "8:2.0.50727.0"
|
"AspNetVersion" = "8:2.0.50727.0"
|
||||||
"RestartWWWService" = "11:FALSE"
|
"RestartWWWService" = "11:FALSE"
|
||||||
"RemovePreviousVersions" = "11:TRUE"
|
"RemovePreviousVersions" = "11:TRUE"
|
||||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||||
"InstallAllUsers" = "11:FALSE"
|
"InstallAllUsers" = "11:FALSE"
|
||||||
"ProductVersion" = "8:0.9.1"
|
"ProductVersion" = "8:1.0.0"
|
||||||
"Manufacturer" = "8:Aztrom"
|
"Manufacturer" = "8:Aztrom"
|
||||||
"ARPHELPTELEPHONE" = "8:"
|
"ARPHELPTELEPHONE" = "8:"
|
||||||
"ARPHELPLINK" = "8:"
|
"ARPHELPLINK" = "8:"
|
||||||
@ -1466,7 +1362,7 @@
|
|||||||
{
|
{
|
||||||
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_EDA497A114444E23814EEE023731C727"
|
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_EDA497A114444E23814EEE023731C727"
|
||||||
{
|
{
|
||||||
"SourcePath" = "8:..\\obj\\Debug\\Hermes.exe"
|
"SourcePath" = "8:..\\obj\\Release\\Hermes.exe"
|
||||||
"TargetName" = "8:"
|
"TargetName" = "8:"
|
||||||
"Tag" = "8:"
|
"Tag" = "8:"
|
||||||
"Folder" = "8:_358759A83B6F4CD5AEAA9CCDB02A52A0"
|
"Folder" = "8:_358759A83B6F4CD5AEAA9CCDB02A52A0"
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Menu Grid.Row="0" Background="White">
|
<Menu Grid.Row="0" Background="White">
|
||||||
<MenuItem Header="Fichier">
|
<MenuItem Header="Fichier">
|
||||||
|
<MenuItem Header="Importer" Click="Importer_Click" />
|
||||||
<MenuItem Header="Quitter" Click="Quitter_Click"/>
|
<MenuItem Header="Quitter" Click="Quitter_Click"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Édition">
|
<MenuItem Header="Édition">
|
||||||
<MenuItem Header="Ajouter..." Click="Ajouter_Click"/>
|
<MenuItem Header="Ajouter..." Click="Ajouter_Click"/>
|
||||||
<MenuItem Header="Édition multiple">
|
<MenuItem Header="Édition multiple">
|
||||||
|
<MenuItem Header="Adresse" Click="GroupEdit_Adresse"/>
|
||||||
<MenuItem Header="Quartier" Click="GroupEdit_Quartier"/>
|
<MenuItem Header="Quartier" Click="GroupEdit_Quartier"/>
|
||||||
<MenuItem Header="Bâtiment" Click="GroupEdit_Batiment"/>
|
<MenuItem Header="Bâtiment" Click="GroupEdit_Batiment"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@ -41,6 +43,7 @@
|
|||||||
<MenuItem Name="quartierViewCheckBox" Header="Quartier" IsCheckable="true"/>
|
<MenuItem Name="quartierViewCheckBox" Header="Quartier" IsCheckable="true"/>
|
||||||
<MenuItem Name="adresseViewCheckBox" Header="Adresse locale" IsCheckable="true" IsChecked="True"/>
|
<MenuItem Name="adresseViewCheckBox" Header="Adresse locale" IsCheckable="true" IsChecked="True"/>
|
||||||
<MenuItem Name="adresseBatimentViewCheckBox" Header="Bâtiment" IsCheckable="true"/>
|
<MenuItem Name="adresseBatimentViewCheckBox" Header="Bâtiment" IsCheckable="true"/>
|
||||||
|
<MenuItem Name="adresseNumeroBatimentViewCheckBox" Header="Numéro d'appartement" IsCheckable="true"/>
|
||||||
<MenuItem Name="adresseExtViewCheckBox" Header="Adresse" IsCheckable="true"/>
|
<MenuItem Name="adresseExtViewCheckBox" Header="Adresse" IsCheckable="true"/>
|
||||||
<MenuItem Name="adresseExtCPViewCheckBox" Header="Code postal" IsCheckable="true"/>
|
<MenuItem Name="adresseExtCPViewCheckBox" Header="Code postal" IsCheckable="true"/>
|
||||||
<MenuItem Name="adresseExtVilleViewCheckBox" Header="Ville" IsCheckable="true"/>
|
<MenuItem Name="adresseExtVilleViewCheckBox" Header="Ville" IsCheckable="true"/>
|
||||||
@ -110,6 +113,7 @@
|
|||||||
<DataGridTextColumn Header="Quartier" Visibility="{Binding Source={x:Reference quartierViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding Quartier}" Width="*"/>
|
<DataGridTextColumn Header="Quartier" Visibility="{Binding Source={x:Reference quartierViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding Quartier}" Width="*"/>
|
||||||
<DataGridTextColumn Header="Adresse Locale" Visibility="{Binding Source={x:Reference adresseViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding Adresse}" Width="*"/>
|
<DataGridTextColumn Header="Adresse Locale" Visibility="{Binding Source={x:Reference adresseViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding Adresse}" Width="*"/>
|
||||||
<DataGridTextColumn Header="Bâtiment" Visibility="{Binding Source={x:Reference adresseBatimentViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseBatiment}" Width="*"/>
|
<DataGridTextColumn Header="Bâtiment" Visibility="{Binding Source={x:Reference adresseBatimentViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseBatiment}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="Numéro d'appartement" Visibility="{Binding Source={x:Reference adresseNumeroBatimentViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseNumeroBatiment}" Width="*"/>
|
||||||
<DataGridTextColumn Header="Adresse" Visibility="{Binding Source={x:Reference adresseExtViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseExt}" Width="*"/>
|
<DataGridTextColumn Header="Adresse" Visibility="{Binding Source={x:Reference adresseExtViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseExt}" Width="*"/>
|
||||||
<DataGridTextColumn Header="Code postal" Visibility="{Binding Source={x:Reference adresseExtCPViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseExtCP}" Width="*"/>
|
<DataGridTextColumn Header="Code postal" Visibility="{Binding Source={x:Reference adresseExtCPViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseExtCP}" Width="*"/>
|
||||||
<DataGridTextColumn Header="Ville" Visibility="{Binding Source={x:Reference adresseExtVilleViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseExtVille}" Width="*"/>
|
<DataGridTextColumn Header="Ville" Visibility="{Binding Source={x:Reference adresseExtVilleViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding AdresseExtVille}" Width="*"/>
|
||||||
|
@ -48,7 +48,7 @@ namespace Hermes {
|
|||||||
|
|
||||||
private void GroupEdit_Batiment(object sender, RoutedEventArgs e) {
|
private void GroupEdit_Batiment(object sender, RoutedEventArgs e) {
|
||||||
if(dgCitoyens.SelectedItems.Count == 0) {
|
if(dgCitoyens.SelectedItems.Count == 0) {
|
||||||
MessageBox.Show("Aucun citoyen sélectionné.", "Édition groupée", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
MessageBox.Show("Aucun citoyen sélectionné.", "Édition multiple", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace Hermes {
|
|||||||
|
|
||||||
private void GroupEdit_Quartier(object sender, RoutedEventArgs e) {
|
private void GroupEdit_Quartier(object sender, RoutedEventArgs e) {
|
||||||
if(dgCitoyens.SelectedItems.Count == 0) {
|
if(dgCitoyens.SelectedItems.Count == 0) {
|
||||||
MessageBox.Show("Aucun citoyen sélectionné.", "Édition groupée", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
MessageBox.Show("Aucun citoyen sélectionné.", "Édition multiple", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +78,22 @@ namespace Hermes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GroupEdit_Adresse(object sender, RoutedEventArgs e) {
|
||||||
|
if(dgCitoyens.SelectedItems.Count == 0) {
|
||||||
|
MessageBox.Show("Aucun citoyen sélectionné.", "Édition multiple", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputWindow inputBox = new InputWindow("Associer une adresse :", "Entrez un numéro et un nom de rue :", this);
|
||||||
|
if(inputBox.ShowDialog() == true) {
|
||||||
|
foreach(Citoyen citoyen in dgCitoyens.SelectedItems) {
|
||||||
|
citoyen.Adresse = inputBox.InputText;
|
||||||
|
citoyen.DateModification = DateTime.Now;
|
||||||
|
}
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Supprimer_Click(object sender, RoutedEventArgs e) {
|
private void Supprimer_Click(object sender, RoutedEventArgs e) {
|
||||||
if(dgCitoyens.SelectedItems.Count > 0) {
|
if(dgCitoyens.SelectedItems.Count > 0) {
|
||||||
MessageBoxResult result = MessageBox.Show("Voulez-vous supprimer ces citoyens ?", "Suppression", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
MessageBoxResult result = MessageBox.Show("Voulez-vous supprimer ces citoyens ?", "Suppression", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||||
@ -165,7 +181,7 @@ namespace Hermes {
|
|||||||
MessageBoxResult result = MessageBox.Show("Voulez-vous réaliser une tâche de publipostage pour ces citoyens ?", "Publipostage", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
MessageBoxResult result = MessageBox.Show("Voulez-vous réaliser une tâche de publipostage pour ces citoyens ?", "Publipostage", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||||
if(result == MessageBoxResult.Yes) {
|
if(result == MessageBoxResult.Yes) {
|
||||||
string csvPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "hermes_tmp_datasource.csv");
|
string csvPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "hermes_tmp_datasource.csv");
|
||||||
string csvHeader = "\"Civilité\";\"Nom\";\"Nom de naissance\";\"Prénom\";\"Profession\";\"Type de résidence\";\"E-Mail\";\"Téléphone\";\"Mobile\";\"Quartier\";\"Bâtiment\";\"Adresse principale\";\"Code postal principal\";\"Ville principale\";\"Adresse secondaire\";\"Code postal secondaire\";\"Ville secondaire\"";
|
string csvHeader = "\"Civilité\";\"Nom\";\"Nom de naissance\";\"Prénom\";\"Profession\";\"Type de résidence\";\"E-Mail\";\"Téléphone\";\"Mobile\";\"Quartier\";\"Bâtiment\";\"Numéro appartement\";\"Adresse principale\";\"Code postal principal\";\"Ville principale\";\"Adresse secondaire\";\"Code postal secondaire\";\"Ville secondaire\"";
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.AppendLine(csvHeader);
|
sb.AppendLine(csvHeader);
|
||||||
foreach(Citoyen citoyen in dgCitoyens.SelectedItems) {
|
foreach(Citoyen citoyen in dgCitoyens.SelectedItems) {
|
||||||
@ -180,6 +196,7 @@ namespace Hermes {
|
|||||||
string telPort = citoyen.TelPort == null ? "" : citoyen.TelPort;
|
string telPort = citoyen.TelPort == null ? "" : citoyen.TelPort;
|
||||||
string quartier = citoyen.Quartier == null ? "" : citoyen.Quartier;
|
string quartier = citoyen.Quartier == null ? "" : citoyen.Quartier;
|
||||||
string batiment = citoyen.AdresseBatiment == null ? "" : citoyen.AdresseBatiment;
|
string batiment = citoyen.AdresseBatiment == null ? "" : citoyen.AdresseBatiment;
|
||||||
|
string numeroBatiment = citoyen.AdresseNumeroBatiment == null ? "" : citoyen.AdresseNumeroBatiment;
|
||||||
string adressePrincipale = citoyen.AdressePrincipale == null ? "" : citoyen.AdressePrincipale;
|
string adressePrincipale = citoyen.AdressePrincipale == null ? "" : citoyen.AdressePrincipale;
|
||||||
string cpPrincipal = citoyen.AdressePrincipaleCP == null ? "" : citoyen.AdressePrincipaleCP;
|
string cpPrincipal = citoyen.AdressePrincipaleCP == null ? "" : citoyen.AdressePrincipaleCP;
|
||||||
string villePrincipale = citoyen.AdressePrincipaleVille == null ? "" : citoyen.AdressePrincipaleVille;
|
string villePrincipale = citoyen.AdressePrincipaleVille == null ? "" : citoyen.AdressePrincipaleVille;
|
||||||
@ -187,7 +204,7 @@ namespace Hermes {
|
|||||||
string cpSecondaire = citoyen.AdresseSecondaireCP == null ? "" : citoyen.AdresseSecondaireCP;
|
string cpSecondaire = citoyen.AdresseSecondaireCP == null ? "" : citoyen.AdresseSecondaireCP;
|
||||||
string villeSecondaire = citoyen.AdresseSecondaireVille == null ? "" : citoyen.AdresseSecondaireVille;
|
string villeSecondaire = citoyen.AdresseSecondaireVille == null ? "" : citoyen.AdresseSecondaireVille;
|
||||||
|
|
||||||
sb.AppendLine($"\"{civilite}\";\"{nom}\";\"{nomNaissance}\";\"{prenom}\";\"{profession}\";\"{typeResidence}\";\"{mail}\";\"{tel}\";\"{telPort}\";\"{quartier}\";\"{batiment}\";\"{adressePrincipale}\";\"{cpPrincipal}\";\"{villePrincipale}\";\"{adresseSecondaire}\";\"{cpSecondaire}\";\"{villeSecondaire}\"");
|
sb.AppendLine($"\"{civilite}\";\"{nom}\";\"{nomNaissance}\";\"{prenom}\";\"{profession}\";\"{typeResidence}\";\"{mail}\";\"{tel}\";\"{telPort}\";\"{quartier}\";\"{batiment}\";\"{numeroBatiment}\";\"{adressePrincipale}\";\"{cpPrincipal}\";\"{villePrincipale}\";\"{adresseSecondaire}\";\"{cpSecondaire}\";\"{villeSecondaire}\"");
|
||||||
|
|
||||||
File.WriteAllText(csvPath, sb.ToString(), Encoding.GetEncoding("ISO-8859-1"));
|
File.WriteAllText(csvPath, sb.ToString(), Encoding.GetEncoding("ISO-8859-1"));
|
||||||
}
|
}
|
||||||
@ -207,6 +224,15 @@ namespace Hermes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Importer_Click(object sender, RoutedEventArgs e) {
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "Classeur Excel|*.xls;*.xlsx;*.xlsm|Tous les ficiers|*.*";
|
||||||
|
if(ofd.ShowDialog() == true) {
|
||||||
|
ImportWindow importWindow = new ImportWindow(this, ofd.FileName);
|
||||||
|
importWindow.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DgCitoyen_DoubleClick(object sender, MouseButtonEventArgs e) {
|
private void DgCitoyen_DoubleClick(object sender, MouseButtonEventArgs e) {
|
||||||
if(dgCitoyens.SelectedItem != null) {
|
if(dgCitoyens.SelectedItem != null) {
|
||||||
CitoyenWindow citoyenWindow = new CitoyenWindow(this, (Citoyen) dgCitoyens.SelectedItem);
|
CitoyenWindow citoyenWindow = new CitoyenWindow(this, (Citoyen) dgCitoyens.SelectedItem);
|
||||||
@ -275,10 +301,12 @@ namespace Hermes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string addrBat = citoyen.AdresseBatiment == null ? "" : citoyen.AdresseBatiment;
|
|
||||||
string addr = $"{citoyen.Adresse} {addrBat}".ToLower();
|
|
||||||
if(!String.IsNullOrEmpty(adresseFilterTextBox.Text)) {
|
if(!String.IsNullOrEmpty(adresseFilterTextBox.Text)) {
|
||||||
if(!addr.Contains(adresseFilterTextBox.Text.ToLower())) {
|
string addrNumBat = citoyen.AdresseNumeroBatiment == null ? "" : citoyen.AdresseNumeroBatiment;
|
||||||
|
string addrBat = citoyen.AdresseBatiment == null ? "" : citoyen.AdresseBatiment;
|
||||||
|
string addr = citoyen.Adresse == null ? "" : citoyen.Adresse;
|
||||||
|
string addrFull = $"{addr} {addrNumBat} {addrBat}".ToLower();
|
||||||
|
if(!addrFull.Contains(adresseFilterTextBox.Text.ToLower())) {
|
||||||
e.Accepted = false;
|
e.Accepted = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
29
Migrations/202012271642572_V2.Designer.cs
generated
Normal file
29
Migrations/202012271642572_V2.Designer.cs
generated
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
namespace Hermes.Migrations
|
||||||
|
{
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
using System.Data.Entity.Migrations.Infrastructure;
|
||||||
|
using System.Resources;
|
||||||
|
|
||||||
|
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||||
|
public sealed partial class V2 : IMigrationMetadata
|
||||||
|
{
|
||||||
|
private readonly ResourceManager Resources = new ResourceManager(typeof(V2));
|
||||||
|
|
||||||
|
string IMigrationMetadata.Id
|
||||||
|
{
|
||||||
|
get { return "202012271642572_V2"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Source
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Target
|
||||||
|
{
|
||||||
|
get { return Resources.GetString("Target"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
Migrations/202012271642572_V2.cs
Normal file
18
Migrations/202012271642572_V2.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
namespace Hermes.Migrations
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
|
||||||
|
public partial class V2 : DbMigration
|
||||||
|
{
|
||||||
|
public override void Up()
|
||||||
|
{
|
||||||
|
AddColumn("dbo.Citoyens", "AdresseNumeroBatiment", c => c.String(maxLength: 4000));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Down()
|
||||||
|
{
|
||||||
|
DropColumn("dbo.Citoyens", "AdresseNumeroBatiment");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
Migrations/202012271642572_V2.resx
Normal file
126
Migrations/202012271642572_V2.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="Target" xml:space="preserve">
|
||||||
|
<value>H4sIAAAAAAAEAO1a3VLrNhC+70zfweNrThzgXPQwyTkDAVqmh59i4F6xN0FTWXYlmSHP1os+Ul+hK/9bNsEOjqfT6R1Zab9drVb7Z/7+86/Zt9eAWS8gJA353D6cTG0LuBf6lK/ndqxWn36yv3398YfZhR+8Wk/5vmO9Dzm5nNvPSkUnjiO9ZwiInATUE6EMV2rihYFD/NA5mk6/OIeHDiCEjViWNbuPuaIBJD/w5yLkHkQqJuw69IHJjI4rboJq3ZAAZEQ8mNu/gMC/J8lG2zpllKAOLrCVbRHOQ0UUanjyKMFVIuRrN0ICYQ+bCHDfijAJmeYn5fauh5ge6UM4JWMO5cVShUFPwMPjzCqOyb6Tbe3Cami3C7Sv2uhTJ7ab2wuqwg0gsinrZMGE3le37CTbf2Cl1IPi7qeTLxN0kwNrETMVC5hziJUg7MC6i5eMer/C5iH8Hficx4xVdUKtcK1GQNKdCCMQanMPq0zTK9+2nDqfYzIWbBWe9BBXXB0f2dYNCidLBsWVVw7sqlDAz8BBEAX+HVEKBNcYkBitId2QtaAvlFEFuUT0M3wstnVNXr8DX6vnuf15OsX3cUlfwc9JmRqPnOLjQi4lYnhP0k0YjCLkhlApCT7B/Uu7E8DHONU5Xm3jWJr4gGHnfSXDFUiZPMR9K6rx70FSdL5S0bMwZEB4ixtvB7smlI2gMowj5C4Uav+CfouJUBTE/iWd+gK9aoRHlgk6IzrH8hFsmAm8iQMQ4ehiL15HlbW4G1PaE2VsBJfRoXEhIKs+zHDZMwxpRqwi6Ip6uwDOnLJ62VrTYDJZgdCBU3auayo8/9c2DVmJt43h4CO5tRvI04iihYcWtd1HsZ9RhOIl5HlZu54mgg5VDU/FZiVzVpnJqh8qBXVB1Wt5JNhWqUbaBU2KQt/ZDlJ7PA2U2mrbwYsjlr2akzZreVPnvNHVza5JFOElVLq8jGK5aYu3+OT274CCFMPxZEsjVGhbSMJ3QtZgrKJo1PSSCqkwVpEl0V6w8IPGttqFvmHnXFTjzswwURo/Z9F/p2xtPZkJUBrwEs+kU29yPCg0Kbu/BmfSYhNGREvQWYQsDvhbgWsbd9kiVTFKanekpAWqgiSEXvyVNsAAqqx0R8w7mCpWTuuOYvQnVTBjqY9mZdtS166kd0czGpMqoLHUHTPtT6pQKaWHVmAAJIRe/GlbYWCkxO44ZddQBSqp3ZGKrqAKVBB745TVdwteudgb16ztW9DNLb1lJIV8C3BC3wVNVzLteHplF8SsbmkHzRb7RYGy6jaDQLnSD7Feepuo9dUm8swxkomZrpxGvjIKWjMDdsqP1YJj5wS5BaRDktzKvZ9EWdTbVYiC2BOnBaUPRqVWruJUyCM7S6PUNLcU0ouS0ygtZ1mZ9/5XhUbdl26xLTTSCyY6rPncjVQQTPSGifsHc0G8gFjA5LP+FpJvuyacYrJVaZtoJ2u1bxT/nu8FjpQ+6/bRYPROl+r88W4v23MsYQ7u+QsR3jMRLd1gidxzTj8kZmN+PRh4fQo/GGzr0N1HojKGPt10NIfwg+nZOnNfUvWheftw2sFeMKvT9MFwzeH5YMDGrHxoXHNGPTR++yR8aCmVwfceoMsx4B7Aa/O/QQOQOcVuiz8fmmJ3BNxpiv3fSLTGFHmw692P0zRmxDsi9xsJNweNnWa+2wa+acmKDroM8SipmtmibBjhA+PgNjlDzIubxfrMqf6j0Owcc/a6hND/NsTB02+zBM33XPFVmF80nrKqUb7FTOagCL5tcooZbUU8hcueLkD054InwmLcchEswb/it7GKYnWKkSxYslpfNHO2y0+G4nWdZ7eR/iWHOAKqSXV4uuVnMWV+ofdlS3h6A0L7ZRYKUCtX6ZCw3hRINyHvCJSZ7xwi4DqQPEAQMQSTt9wlL7CLbo8SvsOaeJu823ob5P2LqJt9dk7JWpBAZhglP/5EH/aD16//AK8jv/4vJwAA</value>
|
||||||
|
</data>
|
||||||
|
<data name="DefaultSchema" xml:space="preserve">
|
||||||
|
<value>dbo</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
29
Migrations/202012272059415_V3.Designer.cs
generated
Normal file
29
Migrations/202012272059415_V3.Designer.cs
generated
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
namespace Hermes.Migrations
|
||||||
|
{
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
using System.Data.Entity.Migrations.Infrastructure;
|
||||||
|
using System.Resources;
|
||||||
|
|
||||||
|
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||||
|
public sealed partial class V3 : IMigrationMetadata
|
||||||
|
{
|
||||||
|
private readonly ResourceManager Resources = new ResourceManager(typeof(V3));
|
||||||
|
|
||||||
|
string IMigrationMetadata.Id
|
||||||
|
{
|
||||||
|
get { return "202012272059415_V3"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Source
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Target
|
||||||
|
{
|
||||||
|
get { return Resources.GetString("Target"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
Migrations/202012272059415_V3.cs
Normal file
26
Migrations/202012272059415_V3.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
namespace Hermes.Migrations
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
|
||||||
|
public partial class V3 : DbMigration
|
||||||
|
{
|
||||||
|
public override void Up()
|
||||||
|
{
|
||||||
|
AddColumn("dbo.Preferences", "ovhSmsServiceName", c => c.String(maxLength: 4000));
|
||||||
|
AddColumn("dbo.Preferences", "ovhSmsApplicationName", c => c.String(maxLength: 4000));
|
||||||
|
AddColumn("dbo.Preferences", "ovhSmsApplicationKey", c => c.String(maxLength: 4000));
|
||||||
|
AddColumn("dbo.Preferences", "ovhSmsConsumerKey", c => c.String(maxLength: 4000));
|
||||||
|
DropColumn("dbo.Preferences", "SmsApiKey");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Down()
|
||||||
|
{
|
||||||
|
AddColumn("dbo.Preferences", "SmsApiKey", c => c.String(maxLength: 4000));
|
||||||
|
DropColumn("dbo.Preferences", "ovhSmsConsumerKey");
|
||||||
|
DropColumn("dbo.Preferences", "ovhSmsApplicationKey");
|
||||||
|
DropColumn("dbo.Preferences", "ovhSmsApplicationName");
|
||||||
|
DropColumn("dbo.Preferences", "ovhSmsServiceName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
Migrations/202012272059415_V3.resx
Normal file
126
Migrations/202012272059415_V3.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="Target" xml:space="preserve">
|
||||||
|
<value>H4sIAAAAAAAEAO1a23LbNhB970z/gcNnR5STPDQeKRlHtltP40tNJ+8QuZIxBUEWADXWt+Whn9Rf6IJ3gpRMyhTb6fTNWgDnLC5c7MH6r+9/zj49B8zagJA05HP7dDK1LeBe6FO+ntuxWr35yf708ccfZpd+8Gx9y/u90/1wJJdz+0mp6MxxpPcEAZGTgHoilOFKTbwwcIgfOm+n0w/O6akDCGEjlmXNHmKuaADJD/y5CLkHkYoJuwl9YDKzY4uboFq3JAAZEQ/m9i8g8O9J0tG2zhkl6IMLbGVbhPNQEYUenn2V4CoR8rUboYGwx20E2G9FmITM87Oye9dJTN/qSTjlwBzKi6UKg56Ap++yVXHM4QetrV2sGq7bJa6v2upZJ2s3txdUhVtAZJPrbMGE7ldf2UnW/8RKrSfF3k8nHyZ4TE6sRcxULGDOIVaCsBPrPl4y6v0K28fwd+BzHjNW9Qm9wraaAU33IoxAqO0DrDJPr33bcurjHHNgMawyJp3ENVfv3trWLZKTJYNiyysTdlUo4GfgIIgC/54oBYJrDEgWrcFucC3ohjKqIGfEc4Yfi23dkOcvwNfqaW6/n07x+7iiz+DnpsyNr5zix4WjlIjhJabbMBiF5JZQKQl+gsdnuxfAx5jVBW5tY1ra+Ihh52UnwxVImXyIx3ZU4z+ApHj4Skc/hyEDwluO8X6wG0LZCC7DOCT3oVDHJ/otJkJREMdnOvcFnqoRPrKM6DPRdywfYQ0zwts4ABGOTnv5PCrX4n5Mtm+UsRGOjA6NCwFZ9mGGy55hSA/ELIKuqHcI4Mwps5e9OQ1eJisQOnDKznlNZcz/uU2DKzltYxzwkY51uHlyA+mC2FAPtGksyvMoYtnp/4do8ViNxYryTerQfwTK/bEAiRWheNjz/Ed/4toI+kpoRAQUhVlQkBlXfXIpqAuqrpnQYFulG6nanBSCytkPUgtSDZRaa9vEiymWmthJRXEunp0d6nl2Q6IIN6GipjOL5aZSevHG7a80gxTD8WSL4Cy8LZgwHpE1GK1IjZ5eUSEV3glkSfQpWPhBo1ttQ3esc07V2DMzHJeLnw/Rf6fD2rSvCVAu4BXOSac4yfSg8KRU2Y2RyVMGYUS0BPdFyOKA77og9o0upWgVo7R2R0qkZhUkMfQaX5FbBlClpTtirhSrWLmtO4qhA6tgRlMfz0p5WPeutHdHMwRgFdBo6o6Z6sAqVGrp4RUYAImh1/hUvhkYqbE7TqnOqkCltTtSob6qQIWxN06pclrwysbeuKaGakE3u/TmSARTC3BiPwRNZ4zteLrlEMQsP2wHzRr7RYFS3ZhBoGzph1iXOCZqvbWJPHOMy8S8rpzGfWUIB/MG7HQ/VhOOgy/IPSAdLsm9o49zURa6pgpRGHvitKD0wWjRJFW8lua+2A3x0cRvdHkFR5L276VIevRlqKmKJnyteeTPq5Gcm10K9iJJN5LxWZYYv1zvamTKaRfbwkXbYGqAWbK7lQqCie4wcf9g+uyAWMDkva7S5d1uCKeYnqj0AcNO2mrVs39PJcuR0mfdylmjv8FQfeO++MrS88HMLCnxDRHeExEt+rlE7llBGhKzUVkZDLxeHxoMtrUc5KNRGc+R3Xw0y0OD+dlaDVpS9apK0HDewVEwq3WewXDNss5gwEYVZ2hcs3oyNH57jWZolkpJ5gjQ5QP1EcBrL9ODBiCzvtIWf15VX+kIeFB95b9x0Rr1jcG29ziHZmf1YmCGHcWK47FUCgUDk7SUIg5k6Fd5aL5ndyot7KsrpHk+ftXLEKeSupk1ysZivKLq0MYzRFmiqXBmTvX//mYXmOisSwj9X4AcPH0+StC8zzVfhfmG4yyrHuVdzAwIFMGASM4xDVgRT2Gzp7M2XZX6RliMXS6DJfjX/C5WUazOMfwHS1YTkzNnP39Se6n7PLuL9C85xBTQTapj+h3/HFPmF35ftcT0HRD6XGbxE71ylY6j622BdBvyjkDZ8l1ABFxH30cIIoZg8o67ZAOH+PZVwhdYE2+bS9TdIC9vRH3ZZxeUrAUJZIZRjsefeIb94Pnj377TQUz+KgAA</value>
|
||||||
|
</data>
|
||||||
|
<data name="DefaultSchema" xml:space="preserve">
|
||||||
|
<value>dbo</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
@ -3,7 +3,8 @@
|
|||||||
namespace Hermes.Migrations {
|
namespace Hermes.Migrations {
|
||||||
internal sealed class Configuration : DbMigrationsConfiguration<Hermes.Model.ModelContext> {
|
internal sealed class Configuration : DbMigrationsConfiguration<Hermes.Model.ModelContext> {
|
||||||
public Configuration() {
|
public Configuration() {
|
||||||
AutomaticMigrationsEnabled = false;
|
AutomaticMigrationsEnabled = true;
|
||||||
|
AutomaticMigrationDataLossAllowed = true;
|
||||||
ContextKey = "Hermes";
|
ContextKey = "Hermes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ namespace Hermes.Model {
|
|||||||
private string _quartier;
|
private string _quartier;
|
||||||
private string _adresse;
|
private string _adresse;
|
||||||
private string _adresseBatiment;
|
private string _adresseBatiment;
|
||||||
|
private string _adresseNumeroBatiment;
|
||||||
private string _adresseExt;
|
private string _adresseExt;
|
||||||
private string _adresseExtCP;
|
private string _adresseExtCP;
|
||||||
private string _adresseExtVille;
|
private string _adresseExtVille;
|
||||||
@ -127,6 +128,13 @@ namespace Hermes.Model {
|
|||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string AdresseNumeroBatiment {
|
||||||
|
get => _adresseNumeroBatiment;
|
||||||
|
set {
|
||||||
|
_adresseNumeroBatiment = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
public string AdresseExt {
|
public string AdresseExt {
|
||||||
get => TypeResidence == false ? null : _adresseExt;
|
get => TypeResidence == false ? null : _adresseExt;
|
||||||
set {
|
set {
|
||||||
@ -294,6 +302,7 @@ namespace Hermes.Model {
|
|||||||
citoyen.Quartier = Quartier;
|
citoyen.Quartier = Quartier;
|
||||||
citoyen.Adresse = Adresse;
|
citoyen.Adresse = Adresse;
|
||||||
citoyen.AdresseBatiment = AdresseBatiment;
|
citoyen.AdresseBatiment = AdresseBatiment;
|
||||||
|
citoyen.AdresseNumeroBatiment = AdresseNumeroBatiment;
|
||||||
citoyen.AdresseExt = AdresseExt;
|
citoyen.AdresseExt = AdresseExt;
|
||||||
citoyen.AdresseExtCP = AdresseExtCP;
|
citoyen.AdresseExtCP = AdresseExtCP;
|
||||||
citoyen.AdresseExtVille = AdresseExtVille;
|
citoyen.AdresseExtVille = AdresseExtVille;
|
||||||
|
@ -11,7 +11,16 @@ namespace Hermes.Model {
|
|||||||
public string Ville {
|
public string Ville {
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
public string SmsApiKey {
|
public string ovhSmsServiceName {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string ovhSmsApplicationName {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string ovhSmsApplicationKey {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string ovhSmsConsumerKey {
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
OVHQueryBody.cs
Normal file
28
OVHQueryBody.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Hermes {
|
||||||
|
class OVHQueryBody {
|
||||||
|
public string charset {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string[] receivers {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string message {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string priority {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public bool senderForResponse {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
/*public bool noStopClause {
|
||||||
|
get; set;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
22
OVHResponseBody.cs
Normal file
22
OVHResponseBody.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Hermes {
|
||||||
|
class OVHResponseBody {
|
||||||
|
public int totalCreditsRemoved {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string[] invalidReceivers {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string[] validReceivers {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public int[] ids {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,14 +5,14 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Hermes"
|
xmlns:local="clr-namespace:Hermes"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Options" Height="250" Width="300"
|
Title="Options" Height="330" Width="300"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
Closing="Window_Closing">
|
Closing="Window_Closing">
|
||||||
<Grid Background="WhiteSmoke">
|
<Grid Background="WhiteSmoke">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="160"/>
|
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TabControl Grid.Row="0" Margin="5,5,5,0">
|
<TabControl Grid.Row="0" Margin="5,5,5,0">
|
||||||
<TabItem Header="Général">
|
<TabItem Header="Général">
|
||||||
@ -25,8 +25,14 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Envoi de SMS">
|
<TabItem Header="Envoi de SMS">
|
||||||
<StackPanel Margin="5,5,5,5" VerticalAlignment="Top">
|
<StackPanel Margin="5,5,5,5" VerticalAlignment="Top">
|
||||||
<Label>Clé API ISendPro :</Label>
|
<Label>OVH ServiceName :</Label>
|
||||||
<TextBox Name="cleApiISendProTextBox" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="250"/>
|
<TextBox Name="ovhSmsServiceNameTextBox" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="250"/>
|
||||||
|
<Label>OVH ApplicationKey :</Label>
|
||||||
|
<TextBox Name="ovhSmsApplicationNameTextBox" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="250"/>
|
||||||
|
<Label>OVH ApplicationSecret :</Label>
|
||||||
|
<TextBox Name="ovhSmsApplicationKeyTextBox" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="250"/>
|
||||||
|
<Label>OVH ConsumerKey :</Label>
|
||||||
|
<TextBox Name="ovhSmsConsumerKeyTextBox" HorizontalAlignment="Left" VerticalContentAlignment="Center" Height="23" Width="250"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
@ -16,7 +16,11 @@ namespace Hermes {
|
|||||||
Preferences pref = dbContext.Preferences.Local[0];
|
Preferences pref = dbContext.Preferences.Local[0];
|
||||||
villeTextBox.Text = pref.Ville;
|
villeTextBox.Text = pref.Ville;
|
||||||
villeCPTextBox.Text = pref.VilleCP;
|
villeCPTextBox.Text = pref.VilleCP;
|
||||||
cleApiISendProTextBox.Text = pref.SmsApiKey;
|
|
||||||
|
ovhSmsServiceNameTextBox.Text = pref.ovhSmsServiceName;
|
||||||
|
ovhSmsApplicationNameTextBox.Text = pref.ovhSmsApplicationName;
|
||||||
|
ovhSmsApplicationKeyTextBox.Text = pref.ovhSmsApplicationKey;
|
||||||
|
ovhSmsConsumerKeyTextBox.Text = pref.ovhSmsConsumerKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,13 +41,19 @@ namespace Hermes {
|
|||||||
Preferences pref = new Preferences();
|
Preferences pref = new Preferences();
|
||||||
pref.Ville = villeTextBox.Text;
|
pref.Ville = villeTextBox.Text;
|
||||||
pref.VilleCP = villeCPTextBox.Text;
|
pref.VilleCP = villeCPTextBox.Text;
|
||||||
pref.SmsApiKey = cleApiISendProTextBox.Text;
|
pref.ovhSmsServiceName = ovhSmsServiceNameTextBox.Text;
|
||||||
|
pref.ovhSmsApplicationName = ovhSmsApplicationNameTextBox.Text;
|
||||||
|
pref.ovhSmsApplicationKey = ovhSmsApplicationKeyTextBox.Text;
|
||||||
|
pref.ovhSmsConsumerKey = ovhSmsConsumerKeyTextBox.Text;
|
||||||
dbContext.Preferences.Add(pref);
|
dbContext.Preferences.Add(pref);
|
||||||
} else {
|
} else {
|
||||||
Preferences pref = dbContext.Preferences.Local[0];
|
Preferences pref = dbContext.Preferences.Local[0];
|
||||||
pref.Ville = villeTextBox.Text;
|
pref.Ville = villeTextBox.Text;
|
||||||
pref.VilleCP = villeCPTextBox.Text;
|
pref.VilleCP = villeCPTextBox.Text;
|
||||||
pref.SmsApiKey = cleApiISendProTextBox.Text;
|
pref.ovhSmsServiceName = ovhSmsServiceNameTextBox.Text;
|
||||||
|
pref.ovhSmsApplicationName = ovhSmsApplicationNameTextBox.Text;
|
||||||
|
pref.ovhSmsApplicationKey = ovhSmsApplicationKeyTextBox.Text;
|
||||||
|
pref.ovhSmsConsumerKey = ovhSmsConsumerKeyTextBox.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
|
@ -51,6 +51,6 @@ using System.Windows;
|
|||||||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
||||||
// en utilisant '*', comme indiqué ci-dessous :
|
// en utilisant '*', comme indiqué ci-dessous :
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.9.1.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.9.1.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
[assembly: NeutralResourcesLanguage("fr-FR")]
|
[assembly: NeutralResourcesLanguage("fr-FR")]
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
using Hermes.Model;
|
using Hermes.Model;
|
||||||
using IO.Swagger.Api;
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
using IO.Swagger.Model;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
|
|
||||||
@ -13,6 +15,20 @@ namespace Hermes {
|
|||||||
public partial class SmsWindow : Window {
|
public partial class SmsWindow : Window {
|
||||||
private ObservableCollection<SmsSendingStatus> status = new ObservableCollection<SmsSendingStatus>();
|
private ObservableCollection<SmsSendingStatus> status = new ObservableCollection<SmsSendingStatus>();
|
||||||
private bool sending = false;
|
private bool sending = false;
|
||||||
|
private Regex numPrefixRgx = new Regex(@"^0");
|
||||||
|
|
||||||
|
|
||||||
|
public static string HashSHA1(string input) {
|
||||||
|
SHA1 sha = SHA1.Create();
|
||||||
|
byte[] bHash = sha.ComputeHash(Encoding.UTF8.GetBytes(input));
|
||||||
|
StringBuilder sBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
for(int i = 0; i < bHash.Length; i++) {
|
||||||
|
sBuilder.Append(bHash[i].ToString("x2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sBuilder.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public SmsWindow(Window parent, List<Citoyen> rcps) {
|
public SmsWindow(Window parent, List<Citoyen> rcps) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -22,7 +38,7 @@ namespace Hermes {
|
|||||||
SmsSendingStatus s = new SmsSendingStatus();
|
SmsSendingStatus s = new SmsSendingStatus();
|
||||||
s.Nom = rcp.Nom;
|
s.Nom = rcp.Nom;
|
||||||
s.Prenom = rcp.Prenom;
|
s.Prenom = rcp.Prenom;
|
||||||
s.Mobile = rcp.TelPort.Replace(" ", "");
|
s.Mobile = numPrefixRgx.Replace(rcp.TelPort.Replace(" ", ""), "+33");
|
||||||
s.Status = "En attente";
|
s.Status = "En attente";
|
||||||
status.Add(s);
|
status.Add(s);
|
||||||
}
|
}
|
||||||
@ -41,10 +57,12 @@ namespace Hermes {
|
|||||||
ModelContext dbContext = ModelContext.Getinstance();
|
ModelContext dbContext = ModelContext.Getinstance();
|
||||||
bool error = false;
|
bool error = false;
|
||||||
string message = new TextRange(messageTextBox.Document.ContentStart, messageTextBox.Document.ContentEnd).Text;
|
string message = new TextRange(messageTextBox.Document.ContentStart, messageTextBox.Document.ContentEnd).Text;
|
||||||
string apiKey = dbContext.Preferences.Local[0].SmsApiKey;
|
Preferences pref = dbContext.Preferences.Local[0];
|
||||||
|
|
||||||
if(String.IsNullOrWhiteSpace(apiKey)) {
|
|
||||||
MessageBox.Show("Erreur lors de la tentative d'envoi : Clé ISendPro invalide.", "Envoi de SMS", MessageBoxButton.OK, MessageBoxImage.Error);
|
if(String.IsNullOrWhiteSpace(pref.ovhSmsServiceName) || String.IsNullOrWhiteSpace(pref.ovhSmsApplicationName)
|
||||||
|
|| String.IsNullOrWhiteSpace(pref.ovhSmsApplicationKey) || String.IsNullOrWhiteSpace(pref.ovhSmsConsumerKey)) {
|
||||||
|
MessageBox.Show("Erreur lors de la tentative d'envoi : Clés d'accès invalides.", "Envoi de SMS", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,44 +76,57 @@ namespace Hermes {
|
|||||||
messageTextBox.IsEnabled = false;
|
messageTextBox.IsEnabled = false;
|
||||||
sending = true;
|
sending = true;
|
||||||
|
|
||||||
ApiClient apiClient = new ApiClient();
|
|
||||||
SmsApi smsApi = new SmsApi(apiClient);
|
string query = $"https://eu.api.ovh.com/1.0/sms/{pref.ovhSmsServiceName}/jobs";
|
||||||
|
|
||||||
foreach(SmsSendingStatus stat in status) {
|
foreach(SmsSendingStatus stat in status) {
|
||||||
if(!stat.Status.Equals("Envoyé")) {
|
if(!stat.Status.Equals("Envoyé")) {
|
||||||
SmsUniqueRequest req = new SmsUniqueRequest();
|
OVHQueryBody body = new OVHQueryBody();
|
||||||
req.Keyid = apiKey;
|
body.charset = "UTF-8";
|
||||||
req.Sms = message;
|
body.receivers = new string[] { stat.Mobile };
|
||||||
req.Smslong = "999";
|
body.message = message;
|
||||||
req.Num = stat.Mobile;
|
body.priority = "high";
|
||||||
try {
|
body.senderForResponse = true;
|
||||||
SMSReponse resp = smsApi.SendSms(req);
|
|
||||||
if(resp != null && resp.Etat != null && resp.Etat.Etat != null && resp.Etat.Etat.Count > 0) {
|
string bodyStr = JsonConvert.SerializeObject(body);
|
||||||
SMSReponseEtatEtat eta = resp.Etat.Etat[0];
|
|
||||||
if(eta.Code != null && eta.Code == 0 && eta.Tel != null) {
|
string ts = ((Int32) DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString();
|
||||||
stat.Status = "Envoyé";
|
string signature = "$1$" + HashSHA1(pref.ovhSmsApplicationKey + "+" + pref.ovhSmsConsumerKey + "+" + "POST" + "+" + query + "+" + bodyStr + "+" + ts);
|
||||||
} else {
|
|
||||||
error = true;
|
HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(query);
|
||||||
stat.Status = eta.Message;
|
req.Method = "POST";
|
||||||
}
|
req.ContentType = "application/json";
|
||||||
} else {
|
req.Headers.Add("X-Ovh-Application:" + pref.ovhSmsApplicationName);
|
||||||
error = true;
|
req.Headers.Add("X-Ovh-Consumer:" + pref.ovhSmsConsumerKey);
|
||||||
stat.Status = "Erreur technique";
|
req.Headers.Add("X-Ovh-Signature:" + signature);
|
||||||
|
req.Headers.Add("X-Ovh-Timestamp:" + ts);
|
||||||
|
|
||||||
|
using(System.IO.Stream s = req.GetRequestStream()) {
|
||||||
|
using(System.IO.StreamWriter sw = new System.IO.StreamWriter(s)) {
|
||||||
|
sw.Write(bodyStr);
|
||||||
}
|
}
|
||||||
} catch(ApiException ex) {
|
}
|
||||||
error = true;
|
|
||||||
SMSReponse resp = JsonConvert.DeserializeObject<SMSReponse>((String) ex.ErrorContent);
|
try {
|
||||||
if(resp != null && resp.Etat != null && resp.Etat.Etat != null && resp.Etat.Etat.Count > 0) {
|
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
|
||||||
SMSReponseEtatEtat eta = resp.Etat.Etat[0];
|
using(var stream = resp.GetResponseStream()) {
|
||||||
if(eta.Code != null && eta.Code == 0 && eta.Tel != null) {
|
var reader = new StreamReader(stream);
|
||||||
|
OVHResponseBody rb = JsonConvert.DeserializeObject<OVHResponseBody>(reader.ReadToEnd().Trim());
|
||||||
|
if(rb.validReceivers.Length > 0 && rb.validReceivers[0] != null && rb.validReceivers[0].Equals(stat.Mobile)) {
|
||||||
stat.Status = "Envoyé";
|
stat.Status = "Envoyé";
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
stat.Status = eta.Message;
|
stat.Status = "Numéro de mobile invalide";
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
error = true;
|
resp.Close();
|
||||||
stat.Status = "Erreur technique";
|
} catch(WebException ex) {
|
||||||
|
error = true;
|
||||||
|
WebResponse resp = ex.Response;
|
||||||
|
using(var stream = resp.GetResponseStream()) {
|
||||||
|
var reader = new StreamReader(stream);
|
||||||
|
String result = reader.ReadToEnd().Trim();
|
||||||
|
stat.Status = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="EntityFramework" version="6.4.4" targetFramework="net48" />
|
<package id="EntityFramework" version="6.4.4" targetFramework="net48" />
|
||||||
<package id="EntityFramework.SqlServerCompact" version="6.4.4" targetFramework="net48" />
|
<package id="EntityFramework.SqlServerCompact" version="6.4.4" targetFramework="net48" />
|
||||||
<package id="iSendProSMS" version="1.1.3" targetFramework="net48" />
|
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net48" />
|
||||||
<package id="Microsoft.Office.Interop.Outlook" version="15.0.4797.1003" targetFramework="net48" />
|
<package id="Microsoft.Office.Interop.Outlook" version="15.0.4797.1003" targetFramework="net48" />
|
||||||
<package id="Microsoft.Office.Interop.Word" version="15.0.4797.1003" targetFramework="net48" />
|
<package id="Microsoft.Office.Interop.Word" version="15.0.4797.1003" targetFramework="net48" />
|
||||||
<package id="Microsoft.SqlServer.Compact" version="4.0.8876.1" targetFramework="net48" />
|
<package id="Microsoft.SqlServer.Compact" version="4.0.8876.1" targetFramework="net48" />
|
||||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
|
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
|
||||||
<package id="RestSharp.Net2" version="1.1.11" targetFramework="net48" />
|
|
||||||
</packages>
|
</packages>
|
Loading…
x
Reference in New Issue
Block a user