Correction de la fonction de publipostage
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Hermes {
|
||||
private ModelContext dbContext = null;
|
||||
private CitoyenModal citoyenModal = new CitoyenModal();
|
||||
private PreferencesModal preferencesModal = new PreferencesModal();
|
||||
private SmsWindow smsModal = new SmsWindow();
|
||||
private CollectionViewSource citoyenCollectionViewSource = null;
|
||||
private bool isEnabledFilter = false;
|
||||
|
||||
@@ -28,6 +29,7 @@ namespace Hermes {
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||
citoyenModal.Owner = this;
|
||||
preferencesModal.Owner = this;
|
||||
smsModal.Owner = this;
|
||||
dbContext.CitoyenSet.Load();
|
||||
dbContext.Preferences.Load();
|
||||
citoyenCollectionViewSource = (CollectionViewSource) this.FindResource("citoyenCollectionViewSource");
|
||||
@@ -68,17 +70,44 @@ namespace Hermes {
|
||||
}
|
||||
}
|
||||
|
||||
private void Sms_Click(object sender, RoutedEventArgs e) {
|
||||
if(dgCitoyens.SelectedItems.Count > 0) {
|
||||
MessageBoxResult result = MessageBox.Show("Voulez-vous envoyer un SMS à ces citoyens ?", "Envoi de SMS", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if(result == MessageBoxResult.Yes) {
|
||||
bool noTel = false;
|
||||
foreach(Citoyen citoyen in dgCitoyens.SelectedItems) {
|
||||
if(String.IsNullOrWhiteSpace(citoyen.TelPort)) {
|
||||
noTel = true;
|
||||
}
|
||||
}
|
||||
if(noTel) {
|
||||
MessageBox.Show("Certains des citoyens sélectionnés ne disposent pas d'un numéro de mobile", "Envoi de SMS", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
smsModal.ShowDialog();
|
||||
}
|
||||
} else {
|
||||
MessageBox.Show("Aucun citoyen sélectionné", "Envoi de SMS", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Courriel_Click(object sender, RoutedEventArgs e) {
|
||||
if(dgCitoyens.SelectedItems.Count > 0) {
|
||||
MessageBoxResult result = MessageBox.Show("Voulez-vous envoyer un courriel à ces citoyens ?", "Envoi de courriel", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if(result == MessageBoxResult.Yes) {
|
||||
bool noMail = false;
|
||||
List<string> mails = new List<string>();
|
||||
foreach(Citoyen citoyen in dgCitoyens.SelectedItems) {
|
||||
if(!String.IsNullOrWhiteSpace(citoyen.Mail)) {
|
||||
mails.Add(citoyen.Mail);
|
||||
mails.Add(citoyen.Mail);
|
||||
} else {
|
||||
noMail = true;
|
||||
}
|
||||
}
|
||||
if(mails.Count > 0) {
|
||||
if(noMail) {
|
||||
MessageBox.Show("Certains des citoyens sélectionnés ne disposent pas d'une adresse E-Mail", "Envoi de courriel", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
|
||||
Microsoft.Office.Interop.Outlook.MailItem mailItem = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
|
||||
foreach(string mail in mails) {
|
||||
@@ -93,7 +122,7 @@ namespace Hermes {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageBox.Show("Aucun citoyen sélectionné", "Suppression", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
MessageBox.Show("Aucun citoyen sélectionné", "Envoi de courriel", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user