private void btnSupp_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (MotifDataGrid.SelectedItem != null && memberuser.SuppressionAdministrateur == true)
         {
             SVC.MotifVisite SelectMedecin = MotifDataGrid.SelectedItem as SVC.MotifVisite;
             if (MotifDataGrid.SelectedItem != null)
             {
                 proxy.DeleteMotifVisite(SelectMedecin);
                 MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
             }
             else
             {
                 MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.Opérationéchouée, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
         else
         {
             MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.Opérationéchouée, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     catch (Exception ex)
     {
         MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 private void txtRecherche_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         TextBox         t      = (TextBox)sender;
         string          filter = t.Text;
         ICollectionView cv     = CollectionViewSource.GetDefaultView(MotifDataGrid.ItemsSource);
         if (filter == "")
         {
             cv.Filter = null;
         }
         else
         {
             cv.Filter = o =>
             {
                 SVC.MotifVisite p = o as SVC.MotifVisite;
                 if (t.Name == "txtId")
                 {
                     return(p.Id == Convert.ToInt32(filter));
                 }
                 return(p.Motif.ToUpper().StartsWith(filter.ToUpper()));
             };
         }
     }
     catch (Exception ex)
     {
         MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Beispiel #3
0
        public AjouterMotifVisite(SVC.ServiceCliniqueClient proxyrecu, ICallback callbackrecu, SVC.MotifVisite motifrecu, SVC.Membership memberrecu)
        {
            try
            {
                InitializeComponent();
                callback   = callbackrecu;
                proxy      = proxyrecu;
                special    = motifrecu;
                membership = memberrecu;
                proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

                proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);
                if (special != null)
                {
                    MotifGrid.DataContext = special;
                    f.Content             = "Modifier motif de visite";
                }
                else
                {
                    btnCreer.IsEnabled = false;
                    f.Content          = "Créer Motif de Visite";
                }
                title = this.Title;
                //     titlebrush = this.WindowTitleBrush;
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #4
0
 private void btnCreer_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (membership.CréationAdministrateur == true && special == null)
         {
             SVC.MotifVisite pa = new SVC.MotifVisite
             {
                 Motif = txMotif.Text.Trim(),
             };
             proxy.InsertMotifVisiteAsync(pa);
             MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
             btnCreer.IsEnabled = false;
         }
         else
         {
             if (membership.CréationAdministrateur == true && special != null)
             {
                 proxy.UpdateMotifVisiteAsync(special);
                 MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
             }
             else
             {
                 MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.Opérationéchouée, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        private void ClientsDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (memberuser.ModificationAdministrateur == true)
                {
                    SVC.MotifVisite    SelectMedecin = MotifDataGrid.SelectedItem as SVC.MotifVisite;
                    AjouterMotifVisite CLSession     = new AjouterMotifVisite(proxy, callback, SelectMedecin, memberuser);

                    CLSession.Show();
                }
                else
                {
                    MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.Opérationéchouée, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #6
0
        private void btnCreer_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bool RendezVousResult   = false;
                bool SalleAttenteResult = false;
                /*dans la salle d'attente button in datagrid rendez vous        */
                if (interf == 1 && UserMembership.CréationSalleAttente == true && txtFonction.SelectedItem != null && txtArrivée.Text != "" && txtMedecin.SelectedItem != null)
                {
                    using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                    {
                        rendezvous.Confirm = true;
                        SVC.Medecin       SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                        SVC.MotifVisite   SelectMotif   = txtFonction.SelectedItem as SVC.MotifVisite;
                        SVC.SalleDattente sl            = new SVC.SalleDattente
                        {
                            Nom               = rendezvous.Nom,
                            Prénom            = rendezvous.Prénom,
                            Arrivée           = TimeSpan.Parse(txtArrivée.Text),
                            Rdv               = rendezvous.RendezVousD,
                            DateRendez        = rendezvous.Date,
                            DateArrivée       = DateSalleAttente,
                            DateDeNaissance   = PatientSalleDattente.DateDeNaissance,
                            Age               = Convert.ToInt16(DateTime.Now.Date.Year - (PatientSalleDattente.DateDeNaissance).Value.Year),
                            Commentaire       = txtCommentaire.Text,
                            NomMedecin        = SelectMedecin.Nom,
                            PrénomMedecin     = SelectMedecin.Prénom,
                            NuméroRendezVous  = rendezvous.NuméroRendezVous,
                            CodePatient       = rendezvous.CodePatient,
                            Quit              = false,
                            Motif             = SelectMotif.Motif,
                            MedecinSalle      = false,
                            NumFilleAttente   = 0,
                            FinDeConsultation = false,
                            CodeMedecin       = SelectMedecin.Id,
                        };
                        proxy.UpdateRendezVous(rendezvous);
                        RendezVousResult = true;
                        proxy.InsertSalleDatente(sl);
                        SalleAttenteResult = true;
                        if (RendezVousResult && SalleAttenteResult)
                        {
                            ts.Complete();
                            MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Properties.Resources.OperationSuccées, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                        else
                        {
                            MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(GestionClinique.Properties.Resources.Opérationéchouée, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    proxy.AjouterSalleAtentefRefresh();
                    proxy.AjouterRendezVOUSfRefresh();
                }
                else
                {
                    if (interf == 2 && UserMembership.CréationSalleAttente == true && txtFonction.SelectedItem != null && txtArrivée.Text != "" && txtMedecin.SelectedItem != null)
                    {
                        using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                        {
                            if (PatientSalleDattente != null)
                            {
                                SVC.Medecin       SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                                SVC.Patient       selectpatient = PatientSalleDattente;// txtPatient.SelectedItem as SVC.Patient;
                                SVC.MotifVisite   SelectMotif   = txtFonction.SelectedItem as SVC.MotifVisite;
                                SVC.SalleDattente sl            = new SVC.SalleDattente
                                {
                                    Nom               = selectpatient.Nom,
                                    Prénom            = selectpatient.Prénom,
                                    Arrivée           = TimeSpan.Parse(txtArrivée.Text),
                                    Rdv               = TimeSpan.Parse(txtArrivée.Text),
                                    DateRendez        = DateSalleAttente,
                                    DateArrivée       = DateSalleAttente,
                                    DateDeNaissance   = selectpatient.DateDeNaissance,
                                    Age               = Convert.ToInt16(DateTime.Now.Date.Year - (selectpatient.DateDeNaissance).Value.Year),
                                    Commentaire       = txtCommentaire.Text,
                                    NomMedecin        = SelectMedecin.Nom,
                                    PrénomMedecin     = SelectMedecin.Prénom,
                                    NuméroRendezVous  = "Sans Rendez Vous",
                                    CodePatient       = selectpatient.Id,
                                    Quit              = false,
                                    Motif             = SelectMotif.Motif,
                                    MedecinSalle      = false,
                                    NumFilleAttente   = 0,
                                    FinDeConsultation = false,
                                    CodeMedecin       = SelectMedecin.Id,
                                };

                                proxy.InsertSalleDatente(sl);
                                SalleAttenteResult = true;
                            }
                            else
                            {
                                SVC.Medecin       SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                                SVC.Patient       selectpatient = proxy.GetAllPatient().Find(n => (n.Nom + " " + n.Prénom).Trim() == accbStates.Text.Trim());
                                SVC.MotifVisite   SelectMotif   = txtFonction.SelectedItem as SVC.MotifVisite;
                                SVC.SalleDattente sl            = new SVC.SalleDattente
                                {
                                    Nom               = selectpatient.Nom,
                                    Prénom            = selectpatient.Prénom,
                                    Arrivée           = TimeSpan.Parse(txtArrivée.Text),
                                    Rdv               = TimeSpan.Parse(txtArrivée.Text),
                                    DateRendez        = DateSalleAttente,
                                    DateArrivée       = DateSalleAttente,
                                    DateDeNaissance   = selectpatient.DateDeNaissance,
                                    Age               = Convert.ToInt16(DateTime.Now.Date.Year - (selectpatient.DateDeNaissance).Value.Year),
                                    Commentaire       = txtCommentaire.Text,
                                    NomMedecin        = SelectMedecin.Nom,
                                    PrénomMedecin     = SelectMedecin.Prénom,
                                    NuméroRendezVous  = "Sans Rendez Vous",
                                    CodePatient       = selectpatient.Id,
                                    Quit              = false,
                                    Motif             = SelectMotif.Motif,
                                    CodeMedecin       = SelectMedecin.Id,
                                    MedecinSalle      = false,
                                    NumFilleAttente   = 0,
                                    FinDeConsultation = false,
                                };

                                proxy.InsertSalleDatente(sl);
                                SalleAttenteResult = true;
                            }



                            if (SalleAttenteResult)
                            {
                                ts.Complete();
                                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(GestionClinique.Properties.Resources.OperationSuccées, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                            }
                            else
                            {
                                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(GestionClinique.Properties.Resources.Opérationéchouée, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                            }
                        }
                        proxy.AjouterSalleAtentefRefresh();
                    }
                    else
                    {
                        if (interf == 3 && UserMembership.ModificationSalleAttente == true && txtFonction.SelectedItem != null && txtArrivée.Text != "" && txtMedecin.SelectedItem != null)
                        {
                            using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                            {
                                SVC.Medecin     SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                                SVC.Patient     selectpatient = txtPatient.SelectedItem as SVC.Patient;
                                SVC.MotifVisite SelectMotif   = txtFonction.SelectedItem as SVC.MotifVisite;

                                SalleAttenteP.Age         = Convert.ToInt16(DateTime.Now.Date.Year - (selectpatient.DateDeNaissance).Value.Year);
                                SalleAttenteP.Arrivée     = TimeSpan.Parse(txtArrivée.Text);
                                SalleAttenteP.CodePatient = selectpatient.Id;
                                SalleAttenteP.Commentaire = txtCommentaire.Text;
                                //  SalleAttenteP.DateArrivée = DateTime.Now;

                                SalleAttenteP.DateDeNaissance = selectpatient.DateDeNaissance;
                                SalleAttenteP.Motif           = SelectMotif.Motif;
                                SalleAttenteP.Nom             = selectpatient.Nom;
                                SalleAttenteP.Prénom          = selectpatient.Prénom;

                                SalleAttenteP.NomMedecin    = SelectMedecin.Nom;
                                SalleAttenteP.PrénomMedecin = SelectMedecin.Prénom;
                                SalleAttenteP.CodeMedecin   = SelectMedecin.Id;

                                /*Rdv+DateRendez+NuméroRendezVous+Quit+MedecinSalle+NumFilleAttente+TempsChezMedecin
                                 * +TempsQuitMededcinSalle+FinDeConsultation */
                                proxy.UpdateSalleDattente(SalleAttenteP);
                                SalleAttenteResult = true;

                                if (SalleAttenteResult)
                                {
                                    ts.Complete();
                                    MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(GestionClinique.Properties.Resources.OperationSuccées, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                }
                                else
                                {
                                    MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(GestionClinique.Properties.Resources.Opérationéchouée, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                }
                            }
                            proxy.AjouterSalleAtentefRefresh();
                        }
                    }
                }
            } catch (Exception ex)
            {
                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #7
0
        private void btnCreer_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                /****************prendez rendez vous dans la page des rendez vous************************/
                if (MemberUser.CréationRendezVous == true /*&& txtPatient.SelectedItem != null*/ && rendezVousP.Nom == null && rendezVousP.Prénom == null && RendezInterface == 1 && accbStates.Text.Trim() != "" && txtFonction.SelectedItem != null)
                {
                    //   SVC.Patient Selectpatient = txtPatient.SelectedItem as SVC.Patient;
                    SVC.Patient Selectpatient = proxy.GetAllPatientNomPrenom(accbStates.Text.Trim());

                    SVC.Medecin SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                    rendezVousP.Nom              = Selectpatient.Nom;
                    rendezVousP.Prénom           = Selectpatient.Prénom;
                    rendezVousP.Adresse          = Selectpatient.Adresse;
                    rendezVousP.PrisPar          = MemberUser.UserName;
                    rendezVousP.Email            = Selectpatient.Email;
                    rendezVousP.Téléphone        = Selectpatient.Téléphone;
                    rendezVousP.NuméroRendezVous = (rendezVousP.Date).Value.ToString("ddMMyyyy") + ((rendezVousP.RendezVousD).Value).ToString(@"hhmm") + Selectpatient.Id.ToString();//"HH:mm"
                    rendezVousP.CodePatient      = Selectpatient.Id;
                    rendezVousP.MedecinNom       = SelectMedecin.Nom;
                    rendezVousP.CodeMedecin      = SelectMedecin.Id;
                    rendezVousP.MedecinPrénom    = SelectMedecin.Prénom;
                    rendezVousP.Confirm          = false;
                    //  MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show("INTERFACE 1", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);

                    if (MemberUser.ImpressionRendezVous == true && ChImprimerTicket.IsChecked == true)
                    {
                        proxy.InsertRendez(rendezVousP);
                        ImpressionTicket clsho = new ImpressionTicket(proxy, rendezVousP);
                        clsho.Show();
                        MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        if (ChImprimerTicket.IsChecked == false && MemberUser.ImpressionRendezVous == true)
                        {
                            proxy.InsertRendez(rendezVousP);
                            MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                        else
                        {
                            proxy.InsertRendez(rendezVousP);
                            MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                    }
                    btnCreer.IsEnabled = false;
                    // proxy.AjouterSalleAtentefRefresh();
                    proxy.AjouterRendezVOUSfRefresh();
                    this.Close();
                }
                else
                {
                    if (MemberUser.ModificationRendezVous == true && txtPatient.SelectedItem != null && rendezVousP.Id != 0 && txtMedecin.SelectedItem != null && txtFonction.SelectedItem != null)
                    {
                        using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                        {
                            SVC.Patient     Selectpatient = txtPatient.SelectedItem as SVC.Patient;
                            SVC.MotifVisite selectedmotif = txtFonction.SelectedItem as SVC.MotifVisite;
                            rendezVousP.Motif   = selectedmotif.Motif;
                            rendezVousP.Adresse = Selectpatient.Adresse;
                            rendezVousP.Nom     = Selectpatient.Nom;
                            rendezVousP.Email   = Selectpatient.Email;
                            rendezVousP.Date    = txtDate.SelectedDate;
                            rendezVousP.Prénom  = Selectpatient.Prénom;
                            SVC.Medecin SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                            rendezVousP.MedecinNom        = SelectMedecin.Nom;
                            rendezVousP.MedecinPrénom     = SelectMedecin.Prénom;
                            rendezVousP.CodePatient       = Selectpatient.Id;
                            rendezVousP.SpécialitéMedecin = SelectMedecin.SpécialitéMedecin;
                            rendezVousP.CodeMedecin       = SelectMedecin.Id;
                            rendezVousP.RendezVousD       = TimeSpan.Parse(txtHoraire.Text);
                            rendezVousP.RendezVousF       = SelectMedecin.TempsVisite;
                            rendezVousP.Téléphone         = Selectpatient.Téléphone;
                            rendezVousP.Confirm           = ComboPresent.IsChecked;
                            /********************/



                            /*****************/
                            proxy.UpdateRendezVous(rendezVousP);
                            ts.Complete();
                            MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                        proxy.AjouterRendezVOUSfRefresh();
                        proxy.AjouterSalleAtentefRefresh();
                        this.Close();
                    }
                    else
                    {
                        /*******************************prendez rendez vous dans home.xaml + dans mainwindow c-a-d ni heure ni jours*****************************************************/
                        if (MemberUser.CréationRendezVous == true /*&& txtPatient.SelectedItem != null*/ && rendezVousP.Id == 0 && txtMedecin.SelectedItem != null && RendezInterface == 3 && accbStates.Text.Trim() != "" && txtFonction.SelectedItem != null)
                        {
                            //     SVC.Patient Selectpatient = txtPatient.SelectedItem as SVC.Patient;
                            SVC.Patient Selectpatient = proxy.GetAllPatient().Find(n => (n.Nom + " " + n.Prénom).Trim() == accbStates.Text.Trim());

                            SVC.Medecin SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;

                            rendezVousP.Nom               = Selectpatient.Nom;
                            rendezVousP.Prénom            = Selectpatient.Prénom;
                            rendezVousP.Adresse           = Selectpatient.Adresse;
                            rendezVousP.PrisPar           = MemberUser.UserName;
                            rendezVousP.Email             = Selectpatient.Email;
                            rendezVousP.Téléphone         = Selectpatient.Téléphone;
                            rendezVousP.MedecinNom        = SelectMedecin.Nom;
                            rendezVousP.MedecinPrénom     = SelectMedecin.Prénom;
                            rendezVousP.Date              = txtDate.SelectedDate;
                            rendezVousP.SpécialitéMedecin = SelectMedecin.SpécialitéMedecin;
                            rendezVousP.NuméroRendezVous  = (txtDate.SelectedDate).Value.ToString("ddMMyyyy") + (TimeSpan.Parse(txtHoraire.Text)).ToString(@"hhmm") + Selectpatient.Id.ToString();//"HH:mm"
                            rendezVousP.CodePatient       = Selectpatient.Id;
                            rendezVousP.CodeMedecin       = SelectMedecin.Id;
                            rendezVousP.RendezVousD       = TimeSpan.Parse(txtHoraire.Text);
                            rendezVousP.RendezVousF       = SelectMedecin.TempsVisite;
                            rendezVousP.Confirm           = false;
                            if (MemberUser.ImpressionRendezVous == true && ChImprimerTicket.IsChecked == true)
                            {
                                proxy.InsertRendez(rendezVousP);
                                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);

                                ImpressionTicket clsho = new ImpressionTicket(proxy, rendezVousP);
                                clsho.Show();
                            }
                            else
                            {
                                if (ChImprimerTicket.IsChecked == false && MemberUser.ImpressionRendezVous == true)
                                {
                                    proxy.InsertRendez(rendezVousP);
                                    MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                }
                                else
                                {
                                    proxy.InsertRendez(rendezVousP);
                                    MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                }
                            }
                            proxy.AjouterRendezVOUSfRefresh();
                            this.Close();
                            //  proxy.AjouterSalleAtentefRefresh();
                        }
                        else
                        {/******************rendez datagrid existe dans rendezvous.xaml date ok***************************/
                            if (MemberUser.CréationRendezVous == true /* && rendezVousP.Nom == null && rendezVousP.Prénom == null*/ && RendezInterface == 2 && txtFonction.SelectedItem != null)
                            {
                                SVC.Patient Selectpatient = new SVC.Patient();
                                if (NomPrenoRendezVousnull == true && accbStates.Text.Trim() != "")
                                {
                                    Selectpatient = proxy.GetAllPatient().Find(n => (n.Nom + " " + n.Prénom).Trim() == accbStates.Text.Trim());
                                    SVC.Medecin SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;

                                    rendezVousP.Nom           = Selectpatient.Nom;
                                    rendezVousP.Prénom        = Selectpatient.Prénom;
                                    rendezVousP.Adresse       = Selectpatient.Adresse;
                                    rendezVousP.PrisPar       = MemberUser.UserName;
                                    rendezVousP.Email         = Selectpatient.Email;
                                    rendezVousP.Téléphone     = Selectpatient.Téléphone;
                                    rendezVousP.MedecinNom    = SelectMedecin.Nom;
                                    rendezVousP.MedecinPrénom = SelectMedecin.Prénom;

                                    rendezVousP.NuméroRendezVous = (rendezVousP.Date).Value.ToString("ddMMyyyy") + ((rendezVousP.RendezVousD).Value).ToString(@"hhmm") + Selectpatient.Id.ToString();//"HH:mm"
                                    rendezVousP.CodePatient      = Selectpatient.Id;
                                    rendezVousP.CodeMedecin      = SelectMedecin.Id;
                                    rendezVousP.Confirm          = false;
                                    if (MemberUser.ImpressionRendezVous == true && ChImprimerTicket.IsChecked == true)
                                    {
                                        proxy.InsertRendez(rendezVousP);
                                        MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);

                                        ImpressionTicket clsho = new ImpressionTicket(proxy, rendezVousP);
                                        clsho.Show();
                                    }
                                    else
                                    {
                                        if (ChImprimerTicket.IsChecked == false && MemberUser.ImpressionRendezVous == true)
                                        {
                                            proxy.InsertRendez(rendezVousP);
                                            MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                        }
                                        else
                                        {
                                            proxy.InsertRendez(rendezVousP);
                                            MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                        }
                                    }
                                    proxy.AjouterRendezVOUSfRefresh();
                                    //  proxy.AjouterSalleAtentefRefresh();
                                    btnCreer.IsEnabled = false;
                                    this.Close();
                                }
                                else
                                {
                                    if (NomPrenoRendezVousnull == false)
                                    {
                                        Selectpatient = txtPatient.SelectedItem as SVC.Patient;
                                    }
                                }

                                //
                            }
                            else
                            {
                                /***************rendez vous dans listepatienthome c-a-d**************************************/
                                if (MemberUser.CréationRendezVous == true && txtPatient.SelectedItem != null && /* rendezVousP.Nom == null && rendezVousP.Prénom == null &&*/ RendezInterface == 4 && txtMedecin.SelectedItem != null && txtDate.SelectedDate != null && txtHoraire.Text != "" && txtFonction.SelectedItem != null)
                                {
                                    SVC.Patient Selectpatient = txtPatient.SelectedItem as SVC.Patient;
                                    SVC.Medecin selectmedecin = txtMedecin.SelectedItem as SVC.Medecin;
                                    rendezVousP.Nom              = Selectpatient.Nom;
                                    rendezVousP.Prénom           = Selectpatient.Prénom;
                                    rendezVousP.Adresse          = Selectpatient.Adresse;
                                    rendezVousP.PrisPar          = MemberUser.UserName;
                                    rendezVousP.Email            = Selectpatient.Email;
                                    rendezVousP.Téléphone        = Selectpatient.Téléphone;
                                    rendezVousP.RendezVousD      = TimeSpan.Parse(txtHoraire.Text);
                                    rendezVousP.Date             = txtDate.SelectedDate;
                                    rendezVousP.NuméroRendezVous = (txtDate.SelectedDate).Value.ToString("ddMMyyyy") + ((rendezVousP.RendezVousD).Value).ToString(@"hhmm") + Selectpatient.Id.ToString();//"HH:mm"
                                    rendezVousP.CodePatient      = Selectpatient.Id;
                                    rendezVousP.MedecinNom       = selectmedecin.Nom;
                                    rendezVousP.MedecinPrénom    = selectmedecin.Prénom;
                                    rendezVousP.CodeMedecin      = selectmedecin.Id;
                                    rendezVousP.RendezVousF      = rendezVousP.RendezVousD + selectmedecin.TempsVisite;
                                    rendezVousP.Confirm          = false;
                                    if (MemberUser.ImpressionRendezVous == true && ChImprimerTicket.IsChecked == true)
                                    {
                                        proxy.InsertRendez(rendezVousP);
                                        ImpressionTicket clsho = new ImpressionTicket(proxy, rendezVousP);
                                        clsho.Show();
                                        MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                    }
                                    else
                                    {
                                        if (ChImprimerTicket.IsChecked == false && MemberUser.ImpressionRendezVous == true)
                                        {
                                            proxy.InsertRendez(rendezVousP);
                                            MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                        }
                                        else
                                        {
                                            proxy.InsertRendez(rendezVousP);
                                            MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                        }
                                    }
                                    proxy.AjouterRendezVOUSfRefresh();
                                    //  proxy.AjouterSalleAtentefRefresh();
                                    btnCreer.IsEnabled = false;
                                    this.Close();
                                }
                                else
                                {
                                    MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.Opérationéchouée, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }