Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
68245f71d7 | |||
6e097ba621 | |||
e521a17d65 | |||
9055f65471 | |||
d51eb5f0d2 | |||
99114085d0 | |||
b6882f0088 | |||
4dff0306c3 | |||
b456708d48 |
@ -230,6 +230,40 @@
|
||||
<ItemGroup>
|
||||
<SplashScreen Include="hermes_splash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="doc\img\main.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="doc\img\add.png" />
|
||||
<Resource Include="doc\img\first_launch_1.png" />
|
||||
<Resource Include="doc\img\first_launch_2.png" />
|
||||
<Resource Include="doc\img\list_1.png" />
|
||||
<Resource Include="doc\img\list_2.png" />
|
||||
<Resource Include="doc\img\menu_display.png" />
|
||||
<Resource Include="doc\img\menu_edit.png" />
|
||||
<Resource Include="doc\img\menu_file.png" />
|
||||
<Resource Include="doc\img\menu_tools.png" />
|
||||
<Resource Include="doc\img\smartscreen_1.png" />
|
||||
<Resource Include="doc\img\smartscreen_2.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="doc\img\publi_1.png" />
|
||||
<Resource Include="doc\img\publi_2.png" />
|
||||
<Resource Include="doc\img\publi_3.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="doc\img\ovh_1.png" />
|
||||
<Resource Include="doc\img\ovh_2.png" />
|
||||
<Resource Include="doc\img\ovh_3.png" />
|
||||
<Resource Include="doc\img\ovh_4.png" />
|
||||
<Resource Include="doc\img\ovh_5.png" />
|
||||
<Resource Include="doc\img\ovh_6.png" />
|
||||
<Resource Include="doc\img\ovh_7.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="doc\img\sms_1.png" />
|
||||
<Resource Include="doc\img\sms_2.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
@ -154,12 +154,6 @@
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_5FE7F4CD40C5D5EAEC6A24FAE0548A1E"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_EDA497A114444E23814EEE023731C727"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
@ -193,6 +187,12 @@
|
||||
"OwnerKey" = "8:_19F88EB0C5E322CF5572D8C5A094E0A2"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_5FE7F4CD40C5D5EAEC6A24FAE0548A1E"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
}
|
||||
"Configurations"
|
||||
{
|
||||
@ -812,15 +812,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:Hermes"
|
||||
"ProductCode" = "8:{2F4EE848-55DE-4984-B2BF-B6CC88401417}"
|
||||
"PackageCode" = "8:{251B34BB-BC8A-4537-B4CA-14054A145302}"
|
||||
"ProductCode" = "8:{3B44B09A-1491-4CE0-A6A5-ABD54F4C14F8}"
|
||||
"PackageCode" = "8:{618674BD-7E73-4707-ABF3-4183A348D565}"
|
||||
"UpgradeCode" = "8:{A8FB75F3-57A5-4B7D-A0AE-9E87F69529B0}"
|
||||
"AspNetVersion" = "8:2.0.50727.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:0.9.3"
|
||||
"ProductVersion" = "8:1.0.0"
|
||||
"Manufacturer" = "8:Aztrom"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
|
@ -17,6 +17,7 @@
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="90"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="20"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Menu Grid.Row="0" Background="White">
|
||||
<MenuItem Header="Fichier">
|
||||
@ -125,5 +126,21 @@
|
||||
<DataGridTextColumn Header="Date de modification" Visibility="{Binding Source={x:Reference dateModificationViewCheckBox}, Path=IsChecked, Converter={StaticResource Bool2VisibilityConv}}" Binding="{Binding DateModification, StringFormat='dd/MM/yyyy HH:mm'}" Width="*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StatusBar Grid.Row="3">
|
||||
<StatusBarItem Margin="0,0,30,0">
|
||||
<TextBlock>
|
||||
<Run Text="Affichés : "/>
|
||||
<Run Text="{Binding ElementName=dgCitoyens, Path=Items.Count, Mode=OneWay}"/>
|
||||
<Run Text=" éléments"/>
|
||||
</TextBlock>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock>
|
||||
<Run Text="Sélectionnés : "/>
|
||||
<Run Text="{Binding ElementName=dgCitoyens, Path=SelectedItems.Count, Mode=OneWay}"/>
|
||||
<Run Text=" éléments"/>
|
||||
</TextBlock>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -257,7 +257,12 @@ namespace Hermes {
|
||||
sb.AppendLine($"\"{civilite}\";\"{nom}\";\"{nomNaissance}\";\"{prenom}\";\"{profession}\";\"{typeResidence}\";\"{mail}\";\"{tel}\";\"{telPort}\";\"{quartier}\";\"{batiment}\";\"{numeroBatiment}\";\"{adresseLocale}\";\"{cpLocal}\";{villeLocale};\"{adressePrincipale}\";\"{cpPrincipal}\";\"{villePrincipale}\";\"{adresseSecondaire}\";\"{cpSecondaire}\";\"{villeSecondaire}\"");
|
||||
}
|
||||
|
||||
File.WriteAllText(csvPath, sb.ToString(), Encoding.GetEncoding("ISO-8859-1"));
|
||||
try {
|
||||
File.WriteAllText(csvPath, sb.ToString(), Encoding.GetEncoding("ISO-8859-1"));
|
||||
} catch(Exception) {
|
||||
MessageBox.Show("Erreur lors de la préparation des données pour le publipostage.", "Publipostage", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Document World|*.doc;*.docx;*.dotx|Tous les ficiers|*.*";
|
||||
@ -276,11 +281,14 @@ namespace Hermes {
|
||||
|
||||
private void Importer_Click(object sender, RoutedEventArgs e) {
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Fichiers de données|*.xls;*.xlsx;*.xlsm;*.csv";
|
||||
ofd.Filter = "Fichiers de données|*.csv|Tous les fichiers|*.*";
|
||||
if(ofd.ShowDialog() == true) {
|
||||
if(Path.GetExtension(ofd.FileName).ToLower().Equals(".csv")) {
|
||||
StreamReader reader = null;
|
||||
Cursor previousCursor = Mouse.OverrideCursor;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
try {
|
||||
StreamReader reader = File.OpenText(ofd.FileName);
|
||||
reader = File.OpenText(ofd.FileName);
|
||||
string csvHeader = reader.ReadLine();
|
||||
if(csvHeader == null) {
|
||||
return;
|
||||
@ -292,11 +300,20 @@ namespace Hermes {
|
||||
Citoyen citoyen = serializer.Deserialize(line);
|
||||
if(citoyen != null) {
|
||||
dbContext.CitoyenSet.Add(citoyen);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
MessageBox.Show("Erreur lors de l'import des données", "Importer", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
if(ex is IOException || ex is UnauthorizedAccessException) {
|
||||
MessageBox.Show("Impossible d'ouvrir le fichier. Il est possible qu'il soit déjà utilisé par un autre programme ou que le chemin d'accès soit incorrect.", "Importer", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
} else {
|
||||
MessageBox.Show("Erreur lors de l'import des données.", "Importer", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
} finally {
|
||||
Mouse.OverrideCursor = previousCursor;
|
||||
if(reader != null) {
|
||||
reader.Close();
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
} else {
|
||||
ImportWindow importWindow = new ImportWindow(this, ofd.FileName);
|
||||
@ -315,16 +332,27 @@ namespace Hermes {
|
||||
sfd.Filter = "Fichier CSV|*.csv";
|
||||
sfd.OverwritePrompt = true;
|
||||
if(sfd.ShowDialog() == true) {
|
||||
StreamWriter s = null;
|
||||
Cursor previousCursor = Mouse.OverrideCursor;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
try {
|
||||
StreamWriter s = File.CreateText(sfd.FileName);
|
||||
s = File.CreateText(sfd.FileName);
|
||||
CitoyensSerializer serializer = new CitoyensSerializer();
|
||||
s.WriteLine(serializer.GetCsvHeader());
|
||||
foreach(Citoyen citoyen in dgCitoyens.SelectedItems) {
|
||||
s.WriteLine(serializer.Serialize(citoyen));
|
||||
}
|
||||
s.Close();
|
||||
} catch(Exception) {
|
||||
MessageBox.Show("Erreur lors de l'export des données", "Exporter", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
} catch(Exception ex) {
|
||||
if(ex is IOException || ex is UnauthorizedAccessException) {
|
||||
MessageBox.Show("Impossible d'ouvrir ou de créer le fichier. Il est possible qu'il soit déjà utilisé par un autre programme ou que le chemin d'accès soit incorrect.", "Importer", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
} else {
|
||||
MessageBox.Show("Erreur lors de l'export des données.", "Exporter", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
} finally {
|
||||
Mouse.OverrideCursor = previousCursor;
|
||||
if(s != null) {
|
||||
s.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
// en utilisant '*', comme indiqué ci-dessous :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.9.3.0")]
|
||||
[assembly: AssemblyFileVersion("0.9.3.0")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: NeutralResourcesLanguage("fr-FR")]
|
||||
|
@ -26,7 +26,7 @@
|
||||
<GridViewColumn Header="Nom" DisplayMemberBinding="{Binding Nom}" Width="120"/>
|
||||
<GridViewColumn Header="Prénom" DisplayMemberBinding="{Binding Prenom}" Width="120"/>
|
||||
<GridViewColumn Header="Mobile" DisplayMemberBinding="{Binding Mobile}" Width="120"/>
|
||||
<GridViewColumn Header="Statut de l'envoi" DisplayMemberBinding="{Binding Status}" Width="290"/>
|
||||
<GridViewColumn Header="Statut de l'envoi" DisplayMemberBinding="{Binding Status}" Width="280"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
@ -10,6 +10,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Hermes {
|
||||
public partial class SmsWindow : Window {
|
||||
@ -81,6 +82,8 @@ namespace Hermes {
|
||||
annulerButton.IsEnabled = false;
|
||||
messageTextBox.IsEnabled = false;
|
||||
sending = true;
|
||||
Cursor previousCursor = Mouse.OverrideCursor;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
|
||||
|
||||
string query = $"https://eu.api.ovh.com/1.0/sms/{pref.ovhSmsServiceName}/jobs";
|
||||
@ -99,21 +102,21 @@ namespace Hermes {
|
||||
string ts = ((Int32) DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString();
|
||||
string signature = "$1$" + HashSHA1(pref.ovhSmsApplicationSecret + "+" + pref.ovhSmsConsumerKey + "+" + "POST" + "+" + query + "+" + bodyStr + "+" + ts);
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(query);
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/json";
|
||||
req.Headers.Add("X-Ovh-Application:" + pref.ovhSmsApplicationKey);
|
||||
req.Headers.Add("X-Ovh-Consumer:" + pref.ovhSmsConsumerKey);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(query);
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/json";
|
||||
req.Headers.Add("X-Ovh-Application:" + pref.ovhSmsApplicationKey);
|
||||
req.Headers.Add("X-Ovh-Consumer:" + pref.ovhSmsConsumerKey);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
|
||||
using(var stream = resp.GetResponseStream()) {
|
||||
var reader = new StreamReader(stream);
|
||||
@ -129,11 +132,24 @@ namespace Hermes {
|
||||
} 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;
|
||||
if(resp == null) {
|
||||
string errorMsg = ex.Message == null ? "" : ex.Message;
|
||||
stat.Status = $"Erreur de transmission : {errorMsg}";
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
using(var stream = resp.GetResponseStream()) {
|
||||
StreamReader reader = new StreamReader(stream);
|
||||
String result = reader.ReadToEnd().Trim();
|
||||
stat.Status = result;
|
||||
}
|
||||
} catch(Exception) {
|
||||
stat.Status = $"Erreur de transmission";
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
error = true;
|
||||
string errorMsg = ex.Message == null ? "" : ex.Message;
|
||||
stat.Status = $"Erreur de transmission : {errorMsg}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,9 +158,10 @@ namespace Hermes {
|
||||
annulerButton.IsEnabled = true;
|
||||
messageTextBox.IsEnabled = true;
|
||||
sending = false;
|
||||
Mouse.OverrideCursor = previousCursor;
|
||||
|
||||
if(error) {
|
||||
MessageBox.Show("Plusieurs envois se sont mal déroulés. Vérifiez la validité des numéros de téléphone.", "Envoi de SMS", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show("Plusieurs envois se sont mal déroulés. Certains numéros de téléphone ne sont peut-être pas valides.", "Envoi de SMS", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
doc/img/add.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
doc/img/first_launch_1.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
doc/img/first_launch_2.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
doc/img/list_1.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
doc/img/list_2.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
doc/img/main.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
doc/img/menu_display.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
doc/img/menu_edit.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
doc/img/menu_file.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
doc/img/menu_tools.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
doc/img/ovh_1.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
doc/img/ovh_2.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
doc/img/ovh_3.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
doc/img/ovh_4.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
doc/img/ovh_5.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
doc/img/ovh_6.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
doc/img/ovh_7.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
doc/img/publi_1.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
doc/img/publi_2.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
doc/img/publi_3.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
doc/img/smartscreen_1.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
doc/img/smartscreen_2.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
doc/img/sms_1.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
doc/img/sms_2.png
Normal file
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 68 KiB |