Ejemplo n.º 1
0
        public Page(string u)
        {
            InitializeComponent();
            this.user = u;
            this.hideAllGrids();
            CPNNotification.Visibility  = Visibility.Hidden;
            CPoNNotification.Visibility = Visibility.Hidden;
            Int32 rdv = RDVS.NombreTotalPatient();

            TotalPatiente.Content = Convert.ToString(rdv);
            rdv = RDVS.NombreTotalPatientStatut("En attente");
            PatienteEnAttente.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientStatut("Effectué");
            ConsultationEffectuees.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientType("cpn");
            Prenatale.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientType("cpon");
            Postnatale.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientType("echo");
            Echographie.Content    = rdv.ToString();
            AcceuilGrid.Visibility = Visibility.Visible;
            if (DateTime.Today.Day.ToString() == "1")
            {
                CPNNotification.Visibility  = Visibility.Visible;
                CPoNNotification.Visibility = Visibility.Visible;
                RapportCPN.CreerRapport();
                RapportCPoN.CreerRapport();
            }
        }
Ejemplo n.º 2
0
        private void Accueil_Click(object sender, RoutedEventArgs e)
        {
            this.hideAllGrids();
            Int32 rdv = RDVS.NombreTotalPatient();

            TotalPatiente.Content = Convert.ToString(rdv);
            rdv = RDVS.NombreTotalPatientStatut("En attente");
            PatienteEnAttente.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientStatut("Effectué");
            ConsultationEffectuees.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientType("cpn");
            Prenatale.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientType("cpon");
            Postnatale.Content = rdv.ToString();
            rdv = RDVS.NombreTotalPatientType("echo");
            Echographie.Content    = rdv.ToString();
            AcceuilGrid.Visibility = Visibility.Visible;
        }
Ejemplo n.º 3
0
 private void deleteRDV_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DataRowView       dtr = (DataRowView)rdvDataGrid.SelectedItem;
         string            message, caption;
         MessageBoxButtons buttons = MessageBoxButtons.YesNo;
         DialogResult      result;
         DataRowView       row = (DataRowView)((System.Windows.Controls.Button)e.Source).DataContext;
         message = "Êtes-vous sûre de vouloir supprimer ce RDV ?";
         caption = "Suppression de RDV";
         result  = System.Windows.Forms.MessageBox.Show(message, caption, buttons);
         if (result == System.Windows.Forms.DialogResult.Yes)
         {
             RDVS.deleteRDV(dtr["id"].ToString());
             Int32 rdv = RDVS.NombreTotalPatient();
             TotalPatiente.Content = Convert.ToString(rdv);
             this.PageWindow_Loaded(sender, e);
         }
     }
     catch (Exception) { }
 }
Ejemplo n.º 4
0
        private void EnregistrerRDV_Click(object sender, RoutedEventArgs e)
        {
            RDVS r = new RDVS();

            try
            {
                if (!((bool)cpn1.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)autreType.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)echographie.IsChecked))
                {
                    System.Windows.MessageBox.Show("Veuillez choisir un type de CPN");
                    throw new Exception();
                }
                else if (((bool)cpn1.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)autreType.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)echographie.IsChecked))
                {
                    r.TypeRDV = "CPN1";
                }
                else if (((bool)cpn2.IsChecked) && !((bool)cpn1.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)autreType.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)echographie.IsChecked))
                {
                    r.TypeRDV = "CPN2";
                }
                else if (((bool)cpn3.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn1.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)autreType.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)echographie.IsChecked))
                {
                    r.TypeRDV = "CPN3";
                }
                else if (((bool)cpn4.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn1.IsChecked) && !((bool)autreType.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)echographie.IsChecked))
                {
                    r.TypeRDV = "CPN4";
                }
                else if (((bool)autreType.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)cpn1.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)echographie.IsChecked))
                {
                    r.TypeRDV = "Autre";
                }
                else if (((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)cpn1.IsChecked) && !((bool)autreType.IsChecked) && !((bool)echographie.IsChecked))
                {
                    r.TypeRDV = "CPoN1";
                }
                else if (((bool)cpon2.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)cpn1.IsChecked) && !((bool)echographie.IsChecked) && !((bool)autreType.IsChecked))
                {
                    r.TypeRDV = "CPoN2";
                }
                else if (((bool)echographie.IsChecked) && !((bool)cpn2.IsChecked) && !((bool)cpn3.IsChecked) && !((bool)cpn4.IsChecked) && !((bool)cpn1.IsChecked) && !((bool)cpon1.IsChecked) && !((bool)cpon2.IsChecked) && !((bool)autreType.IsChecked))
                {
                    r.TypeRDV = "Echographie";
                }
                else
                {
                    System.Windows.MessageBox.Show("Plusieurs champs sont séléctionner dans le type de CPN");
                    throw new Exception();
                }
                r.NomPatient    = NomPatientRDV.Text.Replace("'", "''");
                r.PrenomPatient = PrenomPatientRDV.Text.Replace("'", "''");
                r.Date          = (DateTime)dateRDV.SelectedDate;
                r.Duree         = comboBoxDureeHeure.SelectionBoxItem.ToString() + ":" + comboBoxDureeMinute.ToString();

                if (!(bool)enAttente.IsChecked && !(bool)effectue.IsChecked)
                {
                    System.Windows.MessageBox.Show("Veuillez choisir le statut du RDV");
                    throw new Exception();
                }
                else if ((bool)enAttente.IsChecked && !(bool)effectue.IsChecked)
                {
                    r.Statut = "En attente";
                }
                else if (!(bool)enAttente.IsChecked && (bool)effectue.IsChecked)
                {
                    r.Statut = "Effectué";
                }
                else if ((bool)enAttente.IsChecked && (bool)effectue.IsChecked)
                {
                    System.Windows.MessageBox.Show("Veuillez cocher un seul statut");
                    throw new Exception();
                }

                if (comboBoxHeureRDV.Text.Trim(' ') == "")
                {
                    System.Windows.MessageBox.Show("Veuillez saisir l'heure du RDV");
                    throw new Exception();
                }
                else
                {
                    r.Heure = comboBoxHeureRDV.SelectionBoxItem.ToString() + ":" + comboBoxMinuteRDV.SelectionBoxItem.ToString();
                }

                if ((comboBoxDureeHeure.SelectionBoxItem.ToString().Trim(' ').Equals("00")) && (comboBoxDureeMinute.SelectionBoxItem.ToString().Trim(' ').Equals("00")))
                {
                    System.Windows.MessageBox.Show(comboBoxDureeHeure.SelectionBoxItem.ToString().Trim(' ') + ":" + comboBoxDureeMinute.SelectionBoxItem.ToString().Trim(' '));
                    System.Windows.MessageBox.Show("Veuillez saisir la durée du RDV");
                    throw new Exception();
                }
                else
                {
                    r.Duree = comboBoxDureeHeure.SelectionBoxItem.ToString() + ":" + comboBoxDureeMinute.SelectionBoxItem.ToString();
                }

                int d = Convert.ToInt32(comboBoxDureeMinute.SelectionBoxItem) + Convert.ToInt32(comboBoxMinuteRDV.SelectionBoxItem);
                switch (d)
                {
                case 90:
                    r.HeureFin = Convert.ToString(Convert.ToInt32(comboBoxDureeHeure.SelectionBoxItem) + Convert.ToInt32(comboBoxHeureRDV.SelectionBoxItem) + 1) + ":30";
                    break;

                case 75:
                    r.HeureFin = Convert.ToString(Convert.ToInt32(comboBoxDureeHeure.SelectionBoxItem) + Convert.ToInt32(comboBoxHeureRDV.SelectionBoxItem) + 1) + ":15";
                    break;

                case 60:
                    r.HeureFin = Convert.ToString(Convert.ToInt32(comboBoxDureeHeure.SelectionBoxItem) + Convert.ToInt32(comboBoxHeureRDV.SelectionBoxItem) + 1) + ":00";
                    break;

                default:
                    string m = Convert.ToString(Convert.ToInt32(comboBoxDureeMinute.SelectionBoxItem) + Convert.ToInt32(comboBoxMinuteRDV.SelectionBoxItem));
                    r.HeureFin = Convert.ToString(Convert.ToInt32(comboBoxDureeHeure.SelectionBoxItem) + Convert.ToInt32(comboBoxHeureRDV.SelectionBoxItem)) + ":" + m;
                    break;
                }

                r.Description = descriptionRDV.Text.Replace("'", "''");
                if (this.type == "ajouter" && RDVS.RDVIsFree(r))
                {
                    if (NomPatientRDV.IsReadOnly)
                    {
                        r.IdPatient = this.id_patient;
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Veuillez choisir un patient");
                        throw new Exception();
                    }
                    RDVS.persistRDV(r);
                    RemplirRDVGrid.Visibility = Visibility.Hidden;
                    this.PageWindow_Loaded(sender, e);
                    ListeRDV.Visibility = Visibility.Visible;
                }

                else if (this.type == "modifier" && RDVS.RDVIsFree(r, this.id))
                {
                    if (NomPatientRDV.IsReadOnly)
                    {
                        r.IdPatient = this.id_patient;
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Veuillez choisir un patient");
                        throw new Exception();
                    }
                    r.Id = this.id;
                    RDVS.ModifyRDV(r);
                    RemplirRDVGrid.Visibility = Visibility.Hidden;
                    this.PageWindow_Loaded(sender, e);
                    ListeRDV.Visibility = Visibility.Visible;
                }
                Int32 rdv = RDVS.NombreTotalPatient();
                TotalPatiente.Content = Convert.ToString(rdv);
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Veuillez vérifier les champs du RDV");
            }
        }