Configuration de l'installateur + Amélioration envoi de mail et publipostage et fenêtre de configuration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Hermes.Model;
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace Hermes {
|
||||
@@ -14,5 +15,45 @@ namespace Hermes {
|
||||
e.Cancel = true;
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
public void LoadPreferences() {
|
||||
if(dbContext.Preferences.Local.Count > 0) {
|
||||
Preferences pref = dbContext.Preferences.Local[0];
|
||||
villeTextBox.Text = pref.Ville;
|
||||
villeCPTextBox.Text = pref.VilleCP;
|
||||
cleApiISendProTextBox.Text = pref.SmsApiKey;
|
||||
}
|
||||
}
|
||||
|
||||
public void Enregistrer_Click(object sender, RoutedEventArgs e) {
|
||||
if(String.IsNullOrWhiteSpace(villeCPTextBox.Text) || String.IsNullOrWhiteSpace(villeTextBox.Text)) {
|
||||
MessageBox.Show("La saisie d'information sur la commune est obligatoire.", "Saisie obligatoire", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if(dbContext.Preferences.Local.Count == 0) {
|
||||
Preferences pref = new Preferences();
|
||||
pref.Ville = villeTextBox.Text;
|
||||
pref.VilleCP = villeCPTextBox.Text;
|
||||
pref.SmsApiKey = cleApiISendProTextBox.Text;
|
||||
dbContext.Preferences.Add(pref);
|
||||
} else {
|
||||
Preferences pref = dbContext.Preferences.Local[0];
|
||||
pref.Ville = villeTextBox.Text;
|
||||
pref.VilleCP = villeCPTextBox.Text;
|
||||
pref.SmsApiKey = cleApiISendProTextBox.Text;
|
||||
}
|
||||
|
||||
dbContext.SaveChanges();
|
||||
Close();
|
||||
}
|
||||
|
||||
public void Annuler_Click(object sender, RoutedEventArgs e) {
|
||||
if(dbContext.Preferences.Local.Count == 0) {
|
||||
MessageBox.Show("La saisie d'information sur la commune est obligatoire.", "Saisie obligatoire", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user