Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash Frost committed Apr 11, 2020
1 parent 85af551 commit 168fb55
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions AttestationsGenerator/AttestationsGenerator.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public MainWindow()

private void Button_Click(object sender, RoutedEventArgs e)
{
if (Profiles_ComboBox.Items.Count == 0)
{
MessageBox.Show("Veuillez charger un fichier profiles.json avec des profiles remplis avant de générer une attestation.", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.FileName = "attestation-deplacement-fr-" + DateTime.Now.ToString("dd-MM-yyyy-HH-mm") + ".pdf";
saveFileDialog.Filter = "Fichier PDF | *.pdf";
Expand Down Expand Up @@ -154,6 +159,12 @@ private Boolean loadProfilesFile()
Profiles_ComboBox.Items.Clear();
foreach (Profile profile in profiles)
{
if (Profiles_ComboBox.Items.Contains(profile.Fullname))
{
Profiles_ComboBox.Items.Clear();
MessageBox.Show("Vous ne pouvez pas avoir plusieurs profiles avec le même nom et le même prénom.", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
return false;
}
Profiles_ComboBox.Items.Add(profile.Fullname);
}
if (Profiles_ComboBox.Items.Count > 0)
Expand Down

0 comments on commit 168fb55

Please sign in to comment.