Esempio n. 1
0
 private void btnSupp_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (MedecinsDataGrid.SelectedItem != null && sessionuser.SuppressionAdministrateur == true)
         {
             SVC.Medecin SelectMedecin = MedecinsDataGrid.SelectedItem as SVC.Medecin;
             if (SelectMedecin.UserName == "Administrateur")
             {
                 int nbrvisite = proxy.GetAllVisiteAll().Where(n => n.CodeMedecin == SelectMedecin.Id).Count();
                 if (nbrvisite == 0)
                 {
                     proxy.DeleteMedecinAsync(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.Stop);
                 }
             }
             else
             {
                 MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Session Administrateur suppression impossible", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
             }
         }
     }catch (Exception ex)
     {
         MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 2
0
        public ListePatientHome(SVC.ServiceCliniqueClient proxyrecu, SVC.Membership memberrecu, ICallback callbackrecu, List <SVC.Patient> patientrecu, SVC.Client clientrecu)
        {
            try
            {
                InitializeComponent();
                proxy = proxyrecu;


                memberuser = memberrecu;

                callback    = callbackrecu;
                localclient = clientrecu;
                PatientDataGrid.ItemsSource = patientrecu;
                var disponible = (proxy.GetAllMedecin()).Where(list1 => list1.UserName == memberuser.UserName).FirstOrDefault();
                if (disponible != null)
                {
                    MedecinEnCours = disponible;
                }
                proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

                proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);
            }
            catch (Exception ex)
            {
                HandleProxy();
            }
        }
Esempio n. 3
0
        public void loadmedecin(SVC.ServiceCliniqueClient proxyrecu)
        {
            Dispatcher.BeginInvoke(new Action(() => {
                var disponible = (proxyrecu.GetAllMedecin()).Where(list1 => list1.UserName == memberuser.UserName).FirstOrDefault();
                if (disponible != null)
                {
                    MedecinEnCours = (proxyrecu.GetAllMedecin()).Where(list1 => list1.UserName == memberuser.UserName).FirstOrDefault();
                }
            }), DispatcherPriority.SystemIdle);

            //   Thread.();
        }
        public ImpressionOneMedecin(SVC.ServiceCliniqueClient proxy1, SVC.Medecin SelectMedecin, SVC.Membership selectsession, List <ExclusionDay> selectexclusion)
        {
            try
            {
                InitializeComponent();

                proxy = proxy1;
                var people = new List <Medecin>();
                people.Add(SelectMedecin);
                var selmede = new List <Membership>();
                selmede.Add(selectsession);


                var selpara = new List <SVC.Param>();
                selpara.Add((proxy.GetAllParamétre()));
                //    var selexc = new List<ExclusionDay>();
                //   selexc.Add(selectexclusion);
                //Add datasets
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", people));
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSetOneMembership", selmede));
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ExclusionDayDataset", selectexclusion));
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", selpara));



                MemoryStream MyRptStream = new MemoryStream((Medicus.Properties.Resources.ReportOneMedecin), false);

                reportViewer1.LocalReport.LoadReportDefinition(MyRptStream);
                reportViewer1.LocalReport.EnableExternalImages = true;
                ReportParameter paramLogo = new ReportParameter();
                paramLogo.Name = "ImagePath";
                String photolocation = System.Environment.CurrentDirectory + "/Logo.png";

                paramLogo.Values.Add(@"file:///" + photolocation);
                reportViewer1.LocalReport.SetParameters(paramLogo);
                reportViewer1.RefreshReport();

                proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

                proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 5
0
        private void ClientsDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (MedecinsDataGrid.SelectedItem != null && sessionuser.ModificationAdministrateur == true)
                {
                    SVC.Medecin SelectMedecin = MedecinsDataGrid.SelectedItem as SVC.Medecin;


                    AjouterMedecin CLMedecin = new AjouterMedecin(SelectMedecin, proxy, sessionuser, callback);
                    CLMedecin.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 6
0
        /*******************************************/


        public Arrivée(SVC.ServiceCliniqueClient proxyrecu, SVC.Membership memberrecu, ICallback callbackrecu, SVC.RendezVou rendezvousrecu, SVC.Medecin medecinrecu, DateTime DateRecu, int interfacerecu, SVC.Patient patientrecu, SVC.SalleDattente salleattenterecu)
        {
            try
            {
                InitializeComponent();
                proxy                     = proxyrecu;
                UserMembership            = memberrecu;
                callback                  = callbackrecu;
                rendezvous                = rendezvousrecu;
                DateSalleAttente          = DateRecu;
                MedecinForSalleAttente    = medecinrecu;
                interf                    = interfacerecu;
                txtdateRendezVous.Content = DateRecu.ToLongDateString();

                /************ne pas oublié dans tout les interfaces*****************/

                callbackrecu.InsertPatientCallbackEvent += new ICallback.CallbackEventHandler7(callbackrecu_Refresh);
                proxy.InnerDuplexChannel.Faulted        += new EventHandler(InnerDuplexChannel_Faulted);

                proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);
                /*dans la salle d'attente button in datagrid rendez vous        */
                if (interf == 1)
                {
                    List <SVC.Medecin> testmedecin = proxy.GetAllMedecin().OrderBy(n => n.Nom).ToList();
                    txtMedecin.ItemsSource = testmedecin;
                    List <SVC.Medecin> tte = testmedecin.Where(n => n.Id == MedecinForSalleAttente.Id).OrderBy(n => n.Nom).ToList();
                    txtMedecin.SelectedItem = tte.First();

                    List <SVC.Patient> testmedecin1 = proxy.GetAllPatientBYID(rendezvous.CodePatient.Value).OrderBy(n => n.Nom).ToList();
                    txtPatient.ItemsSource = testmedecin1;
                    List <SVC.Patient> tte1 = testmedecin1.Where(n => n.Id == rendezvous.CodePatient).OrderBy(n => n.Nom).ToList();
                    txtPatient.SelectedItem = tte1.First();

                    txtArrivée.Text = Convert.ToString(DateTime.Now.TimeOfDay);

                    txtFonction.ItemsSource    = proxy.GetAllMotifVisite().OrderBy(n => n.Motif);
                    RendezVousGrid.DataContext = rendezvousrecu;
                    //  txtFonction.SelectedValue = rendezvousrecu.Motif.ToString();

                    PatientSalleDattente = tte1.First();
                    txtPatient.IsEnabled = false;
                    //  txtMedecin.IsEnabled = false;
                    btnPatient.IsEnabled  = false;
                    txtPatient.Visibility = Visibility.Visible;
                    accbStates.Visibility = Visibility.Collapsed;
                    auto = false;
                }
                else
                {/* 1-Arrivage dans liste home.xaml c-a-d patient connu
                  * 2-Arrivée sans rendez vous dans la salle d'attente patient non connu
                  */
                    if (interf == 2)
                    {
                        if (patientrecu != null)
                        {
                            PatientSalleDattente = patientrecu;
                            List <SVC.Medecin> testmedecin = proxy.GetAllMedecin().OrderBy(n => n.Nom).ToList();
                            txtMedecin.ItemsSource = testmedecin;
                            List <SVC.Medecin> tte = testmedecin.Where(n => n.Nom == PatientSalleDattente.SuiviParNom && n.Prénom == PatientSalleDattente.SuiviParPrénom).OrderBy(n => n.Nom).ToList();
                            txtMedecin.SelectedItem = tte.First();

                            List <SVC.Patient> testmedecin1 = proxy.GetAllPatientBYID(PatientSalleDattente.Id).OrderBy(n => n.Nom).ToList();
                            txtPatient.ItemsSource = testmedecin1;

                            List <SVC.Patient> tte1 = testmedecin1.Where(n => n.Id == PatientSalleDattente.Id).OrderBy(n => n.Nom).ToList();
                            txtPatient.SelectedItem = tte1.First();

                            txtArrivée.Text = Convert.ToString(DateTime.Now.TimeOfDay);

                            txtFonction.ItemsSource = proxy.GetAllMotifVisite().OrderBy(n => n.Motif);
                            txtPatient.IsEnabled    = false;
                            txtPatient.Visibility   = Visibility.Visible;
                            accbStates.Visibility   = Visibility.Collapsed;
                            auto = false;
                        }
                        else
                        {
                            List <SVC.Medecin> testmedecin = proxy.GetAllMedecin().OrderBy(n => n.Nom).ToList();
                            txtMedecin.ItemsSource = testmedecin;


                            txtArrivée.Text         = Convert.ToString(DateTime.Now.TimeOfDay);
                            txtFonction.ItemsSource = proxy.GetAllMotifVisite().OrderBy(n => n.Motif);


                            //  accbStates.ItemsSource = proxy.GetAllPatient();

                            /*  SVC.Patient obpa = new SVC.Patient();
                             * List<SVC.Patient> pa = new List<SVC.Patient>();
                             * pa.Add(obpa);
                             * accbStates.ItemsSource = pa;
                             * accbStates.DataContext = pa;*/
                            txtPatient.Visibility = Visibility.Collapsed;

                            auto = true;
                        }
                    }
                    else
                    {
                        if (interf == 3)
                        {
                            SalleAttenteP = salleattenterecu;
                            List <SVC.Medecin> testmedecin = proxy.GetAllMedecin().OrderBy(n => n.Nom).ToList();
                            txtMedecin.ItemsSource = testmedecin;
                            List <SVC.Medecin> tte = testmedecin.Where(n => n.Id == MedecinForSalleAttente.Id).OrderBy(n => n.Nom).ToList();
                            txtMedecin.SelectedItem = tte.First();

                            List <SVC.Patient> testmedecin1 = proxy.GetAllPatientBYID(patientrecu.Id).OrderBy(n => n.Nom).ToList();
                            txtPatient.ItemsSource = testmedecin1;
                            List <SVC.Patient> tte1 = testmedecin1.Where(n => n.Id == patientrecu.Id).OrderBy(n => n.Nom).ToList();
                            txtPatient.SelectedItem = tte1.First();

                            List <SVC.MotifVisite> testmotif = proxy.GetAllMotifVisite().OrderBy(n => n.Motif).ToList();
                            txtFonction.ItemsSource = testmotif;
                            //List<SVC.MotifVisite> ttemitif = testmotif.Where(n => n.Motif == salleattenterecu.Motif).ToList();
                            txtFonction.SelectedItem   = salleattenterecu.Motif;
                            txtArrivée.Text            = salleattenterecu.Arrivée.ToString();
                            RendezVousGrid.DataContext = SalleAttenteP;
                            txtPatient.Visibility      = Visibility.Visible;
                            accbStates.Visibility      = Visibility.Collapsed;
                            auto = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, GestionClinique.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 7
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);
            }
        }
Esempio n. 8
0
        private void btnCreer_Click(object sender, RoutedEventArgs e)
        {
            try {
                string      nommedecin;
                string      prénommedecin;
                int         codemedecin;
                SVC.Patient pa;
                if (Création == true && member.CréationPatient == true && txtMedecin.SelectedItem != null && txtDate.SelectedDate != null && SexeCombo.SelectedValuePath != null && EtatCivicCombo.SelectedValuePath != null)
                {
                    try {
                        SVC.Medecin SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                        if (SelectMedecin != null)
                        {
                            nommedecin    = SelectMedecin.Nom;
                            prénommedecin = SelectMedecin.Prénom;
                            codemedecin   = SelectMedecin.Id;
                        }
                        else
                        {
                            nommedecin    = "";
                            prénommedecin = "";
                            codemedecin   = 0;
                        }

                        /*****************transfert***********************/
                        serverfilepath = op.FileName;

                        filepath = "";
                        if (serverfilepath != "")
                        {
                            filepath = op.FileName;

                            serverfilepath = @"Patient\PhotoPatient\" + (txtNom.Text.Trim() + txtPrenom.Text.Trim()) + ".png";
                            byte[] buffer = null;

                            // read the file and return the byte[
                            using (FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read))
                            {
                                buffer = new byte[fs.Length];
                                fs.Read(buffer, 0, (int)fs.Length);
                            }
                            if (buffer != null)
                            {
                                proxy.UploadDocument(serverfilepath, buffer);
                            }
                        }
                        pa = new SVC.Patient
                        {
                            Nom             = txtNom.Text.Trim(),
                            Prénom          = txtPrenom.Text.Trim(),
                            Adresse         = txtAdresse.Text.Trim(),
                            Téléphone       = txtTelfixe.Text.Trim(),
                            EtatCiv         = EtatCivicCombo.SelectionBoxItem.ToString(),
                            Sexe            = SexeCombo.SelectionBoxItem.ToString(),
                            DateDeNaissance = txtDate.SelectedDate,
                            NuméroSS        = txtSS.Text.Trim(),
                            Assurance       = txtAssurance.Text.Trim(),
                            Fonction        = txtFonction.Text.Trim(),
                            Mobile          = txtTelPerso.Text.Trim(),
                            Remarques       = txtRemarque.Text.Trim(),
                            Email           = txtEmail.Text.Trim(),
                            SuiviParNom     = nommedecin,
                            SuiviParPrénom  = prénommedecin,
                            CheminPhoto     = serverfilepath,
                            cle             = txtNom.Text.Trim() + txtPrenom.Text.Trim() + DateTime.Now,
                            SuiviParCode    = codemedecin,
                            GroupeSanguin   = GroupeTXT.Text.Trim(),
                        };
                        if (DossierTXT.Text != "")
                        {
                            pa.Dossier = Convert.ToInt16(DossierTXT.Text);


                            /********************************************************/
                        }
                        else
                        {
                            pa.Dossier = 0;
                        }
                        if (txtRéf.Text != "")
                        {
                            pa.Ref = Convert.ToInt16(txtRéf.Text);


                            /********************************************************/
                        }
                        else
                        {
                            pa.Ref = 0;
                        }
                        if (txtCrédit.Text != "")
                        {
                            pa.Solde = Convert.ToDecimal(txtCrédit.Text);


                            /********************************************************/
                        }
                        else
                        {
                            pa.Solde = 0;
                        }
                        bool succéespatient = false;
                        bool succéesvisite  = false;
                        int  interfaceoper;
                        using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                        {
                            proxy.InsertPatient(pa);
                            interfaceoper  = 0;
                            succéespatient = true;
                            if (pa.Solde != 0)
                            {
                                interfaceoper = 1;
                                succéesvisite = true;
                                SVC.Visite cas = new SVC.Visite
                                {
                                    Motif            = "Ancien Solde",
                                    Interrogatoire   = "Ancien Solde",
                                    Examen           = "Ancien Solde",
                                    Conclusions      = "Ancien Solde",
                                    Date             = DateTime.Now,
                                    Datetime         = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second),
                                    CasTraite        = "Ancien Solde",
                                    NuméroRendezVous = "Ancien Solde",

                                    UserName      = member.UserName,
                                    NomPatient    = pa.Nom,
                                    PrénomPatient = pa.Prénom,

                                    Montant         = pa.Solde,
                                    Versement       = 0,
                                    Reste           = pa.Solde,
                                    Soldé           = false,
                                    CodePatient     = 0,
                                    IdCas           = 0,
                                    IdMotif         = 0,
                                    ModeFacturation = 0,
                                    cle             = pa.cle,
                                    VisiteParNom    = nommedecin,
                                    VisiteParPrénom = prénommedecin,
                                    CodeMedecin     = codemedecin,
                                };
                                proxy.InsertVisite(cas);
                            }
                            if (interfaceoper == 0 && succéespatient == true)
                            {
                                ts.Complete();
                                btnCreer.IsEnabled = false;
                                rempliridsivisite(pa);
                            }
                            else
                            {
                                if (interfaceoper == 1 && succéespatient == true && succéesvisite == true)
                                {
                                    ts.Complete();
                                }
                                else
                                {
                                    btnCreer.IsEnabled = false;

                                    MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.Opérationéchouée, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                }
                            }
                        }
                        if (interfaceoper == 0 && succéespatient == true)
                        {
                            proxy.AjouterPatientRefresh();
                            // proxy.AjouterSoldeVisiteRefresh();
                            MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                            this.Close();
                        }
                        else
                        {
                            if (interfaceoper == 1 && succéespatient == true && succéesvisite == true)
                            {
                                proxy.AjouterPatientRefresh();
                                proxy.AjouterSoldeVisiteRefresh();
                                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                this.Close();
                            }
                        }

                        /*      proxy.AjouterPatientRefresh();
                         * proxy.AjouterSoldeVisiteRefresh();*/
                    }
                    catch (Exception ex)
                    {
                        MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    try
                    {
                        if (Création == false && member.ModificationPatient == true && txtMedecin.SelectedItem != null && txtDate.SelectedDate != null && SexeCombo.SelectedValuePath != null && EtatCivicCombo.SelectedValuePath != null)
                        {
                            bool succesUpdatePatient = false;
                            bool succesUpdateVisite  = false;

                            SVC.Medecin SelectMedecin = txtMedecin.SelectedItem as SVC.Medecin;
                            if (SelectMedecin != null)
                            {
                                patient.SuiviParNom    = SelectMedecin.Nom;
                                patient.SuiviParPrénom = SelectMedecin.Prénom;
                                patient.SuiviParCode   = SelectMedecin.Id;
                            }
                            if (DossierTXT.Text != "")
                            {
                                patient.Dossier = Convert.ToInt16(DossierTXT.Text);


                                /********************************************************/
                            }
                            else
                            {
                                patient.Dossier = 0;
                            }
                            if (txtRéf.Text != "")
                            {
                                patient.Ref = Convert.ToInt16(txtRéf.Text);


                                /********************************************************/
                            }
                            else
                            {
                                patient.Ref = 0;
                            }
                            if (op.FileName != "")
                            {
                                serverfilepath = op.FileName;

                                filepath = "";
                                if (patient.CheminPhoto == "")
                                {
                                    if (serverfilepath != "")
                                    {
                                        filepath = op.FileName;

                                        serverfilepath = @"Patient\PhotoPatient\" + (txtNom.Text.Trim() + txtPrenom.Text.Trim()) + ".png";
                                        byte[] buffer = null;

                                        // read the file and return the byte[
                                        using (FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read))
                                        {
                                            buffer = new byte[fs.Length];
                                            fs.Read(buffer, 0, (int)fs.Length);
                                        }
                                        if (buffer != null)
                                        {
                                            proxy.UploadDocument(serverfilepath, buffer);
                                        }
                                        patient.CheminPhoto = serverfilepath;
                                    }
                                    else
                                    {
                                        patient.CheminPhoto = "";
                                    }
                                }
                                else
                                {
                                    if (serverfilepath == "")
                                    {
                                        patient.CheminPhoto = "";
                                    }
                                    else
                                    {
                                        filepath = op.FileName;

                                        serverfilepath = @"Patient\PhotoPatient\" + (txtNom.Text.Trim() + txtPrenom.Text.Trim()) + ".png";
                                        byte[] buffer = null;

                                        // read the file and return the byte[
                                        using (FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read))
                                        {
                                            buffer = new byte[fs.Length];
                                            fs.Read(buffer, 0, (int)fs.Length);
                                        }
                                        if (buffer != null)
                                        {
                                            proxy.UploadDocument(serverfilepath, buffer);
                                        }
                                        patient.CheminPhoto = serverfilepath;
                                    }
                                }
                            }
                            else
                            {
                                patient.CheminPhoto = "";
                            }

                            if (txtCrédit.Text != "")
                            {
                                patient.Solde = Convert.ToDecimal(txtCrédit.Text);
                            }
                            else
                            {
                                patient.Solde = 0;
                            }
                            patient.DateDeNaissance = txtDate.SelectedDate;
                            var found          = (proxy.GetAllVisiteByClepatient(patient.cle).Find(n => n.cle == patient.cle));
                            int interfaceModif = 3;

                            using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                            {
                                if (found != null)
                                {
                                    if (patient.Solde != 0)
                                    {
                                        found.Montant         = patient.Solde;
                                        found.Reste           = patient.Solde - found.Versement;
                                        found.VisiteParNom    = SelectMedecin.Nom;
                                        found.VisiteParPrénom = SelectMedecin.Prénom;
                                        found.CodeMedecin     = SelectMedecin.Id;

                                        proxy.UpdateVisite(found);
                                        interfaceModif     = 1;
                                        succesUpdateVisite = true;
                                        proxy.UpdatePatient(patient);

                                        succesUpdatePatient = true;
                                    }
                                    else
                                    {
                                        if (patient.Solde == 0)
                                        {
                                            if (found.Versement == 0)
                                            {
                                                proxy.DeleteVisite(found);
                                                interfaceModif     = 1;
                                                succesUpdateVisite = true;
                                                proxy.UpdatePatient(patient);

                                                succesUpdatePatient = true;
                                            }
                                            else
                                            {
                                                MessageBoxResult results = Xceed.Wpf.Toolkit.MessageBox.Show("Attention erreur dans le solde patient qui contient un versement", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (found == null)
                                    {
                                        if (patient.Solde != 0)
                                        {
                                            SVC.Visite cas = new SVC.Visite
                                            {
                                                Motif            = "Ancien Solde",
                                                Interrogatoire   = "Ancien Solde",
                                                Examen           = "Ancien Solde",
                                                Conclusions      = "Ancien Solde",
                                                Date             = DateTime.Now,
                                                Datetime         = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second),
                                                CasTraite        = "Ancien Solde",
                                                NuméroRendezVous = "Ancien Solde",

                                                UserName      = member.UserName,
                                                NomPatient    = patient.Nom,
                                                PrénomPatient = patient.Prénom,

                                                Montant         = patient.Solde,
                                                Versement       = 0,
                                                Reste           = patient.Solde,
                                                Soldé           = false,
                                                CodePatient     = 0,
                                                IdCas           = 0,
                                                IdMotif         = 0,
                                                ModeFacturation = 0,
                                                cle             = patient.cle,
                                                VisiteParNom    = SelectMedecin.Nom,
                                                VisiteParPrénom = SelectMedecin.Prénom,
                                                CodeMedecin     = SelectMedecin.Id,
                                            };
                                            proxy.InsertVisite(cas);
                                            interfaceModif     = 1;
                                            succesUpdateVisite = true;
                                            proxy.UpdatePatient(patient);

                                            succesUpdatePatient = true;
                                        }
                                        else
                                        {
                                            if (patient.Solde == 0)
                                            {
                                                interfaceModif = 0;
                                                proxy.UpdatePatient(patient);
                                                succesUpdatePatient = true;
                                            }
                                        }
                                    }
                                }
                                if (interfaceModif == 0 && succesUpdatePatient == true && succesUpdateVisite == false)
                                {
                                    ts.Complete();
                                }
                                else
                                {
                                    if (interfaceModif == 1 && succesUpdatePatient == true && succesUpdateVisite == true)
                                    {
                                        ts.Complete();
                                    }
                                    else
                                    {
                                        MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.Opérationéchouée, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                    }
                                }
                            }
                            if (interfaceModif == 0 && succesUpdatePatient == true && succesUpdateVisite == false)
                            {
                                // proxy.AjouterSoldeVisiteRefresh();
                                proxy.AjouterPatientRefresh();
                                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                this.Close();
                            }
                            else
                            {
                                if (interfaceModif == 1 && succesUpdatePatient == true && succesUpdateVisite == true)
                                {
                                    proxy.AjouterSoldeVisiteRefresh();
                                    proxy.AjouterPatientRefresh();
                                    MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                    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);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }
        public CertificatRapport(SVC.ServiceCliniqueClient proxyrecu, SVC.Membership memberrecu, ICallback callbackrecu)
        {
            try
            {
                InitializeComponent();
                Membership = memberrecu;
                proxy      = proxyrecu;
                var disponible = (proxy.GetAllMedecin()).Where(list1 => list1.UserName == Membership.UserName).FirstOrDefault();
                if (disponible == null)
                {
                    MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Vous devez avoir une session de medecin pour pouvoir faire cette opération", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
                }
                else
                {
                    medecin = disponible;
                    List <SVC.Medecin> listmededcin = new List <SVC.Medecin>();
                    listmededcin.Add(medecin);
                    /**********************certificat***********************/
                    List <RapportCertificat> listdetail = new List <RapportCertificat>();
                    RapportCertificat        detail     = new RapportCertificat
                    {
                        Asignature             = "Constantine",
                        DateExam               = DateTime.Now,
                        DateNaissancePatient   = DateTime.Now,
                        LieudeNaissancePatient = "Constantine Algerie",
                        Faitle           = DateTime.Now,
                        NomPrenomPatient = "Nom et Prénom du patient",
                        Pratique         = "La pratique en compétition du Triathlon et des disciplines enchaînées"
                    };
                    listdetail.Add(detail);
                    RapportCertificat detail1 = new RapportCertificat
                    {
                        Asignature             = "Constantine",
                        DateExam               = DateTime.Now,
                        DateNaissancePatient   = DateTime.Now,
                        LieudeNaissancePatient = "Constantine Algerie",
                        Faitle           = DateTime.Now,
                        NomPrenomPatient = "Nom et Prénom du patient",
                        Pratique         = "La pratique à l'entraînement uniquement du Triathlon et des disciplines enchaînées",
                    };
                    listdetail.Add(detail1);

                    GridMedecin.DataContext = detail;
                    RecapGrid.DataContext   = listdetail;
                    RecapGrid.ItemsSource   = listdetail;


                    MemoryStream MyRptStream = new MemoryStream((Medicus.Properties.Resources.CertificationMedical), false);
                    reportViewerCertificatMedical.LocalReport.LoadReportDefinition(MyRptStream);



                    this.reportViewerCertificatMedical.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", listmededcin));
                    this.reportViewerCertificatMedical.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", listdetail));

                    reportViewerCertificatMedical.LocalReport.EnableExternalImages = true;
                    ReportParameter paramLogo = new ReportParameter();
                    paramLogo.Name = "ImagePath";
                    String photolocation = System.Environment.CurrentDirectory + "/Logo.png";

                    paramLogo.Values.Add(@"file:///" + photolocation);
                    reportViewerCertificatMedical.LocalReport.SetParameters(paramLogo);
                    reportViewerCertificatMedical.RefreshReport();
                    /*********************************************************/
                    /***********************arret***************************************/

                    List <SVC.ArretDetravail> listdetailArretDetravail = new List <SVC.ArretDetravail>();
                    detailArretDetravail = new SVC.ArretDetravail
                    {
                        Asignature             = "Constantine",
                        DateDebutArret         = DateTime.Now,
                        DateNaissancePatient   = DateTime.Now,
                        LieudeNaissancePatient = "Constantine Algerie",
                        Faitle           = DateTime.Now,
                        NomPrenomPatient = "Nom et Prénom du patient",
                        autorisées       = true,
                        nonautorisées    = false,
                        compteurarret    = "000001",
                        Nbjour           = "7 jours",
                    };
                    listdetailArretDetravail.Add(detailArretDetravail);

                    SimpleButton.IsEnabled       = true;
                    GridMedecinArret.DataContext = detailArretDetravail;



                    MemoryStream MyRptStream1 = new MemoryStream((Medicus.Properties.Resources.ArretDeTravail), false);
                    reportViewerCertificatArret.LocalReport.LoadReportDefinition(MyRptStream1);
                    DateSaisieDébut.SelectedDate = DateTime.Now;
                    DateSaisieFin.SelectedDate   = DateTime.Now;


                    this.reportViewerCertificatArret.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", listmededcin));
                    this.reportViewerCertificatArret.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", listdetailArretDetravail));

                    reportViewerCertificatArret.LocalReport.EnableExternalImages = true;


                    reportViewerCertificatArret.LocalReport.SetParameters(paramLogo);
                    reportViewerCertificatArret.RefreshReport();
                    ArretDataGrid.ItemsSource         = proxy.GetAllArretDetravail();//.OrderBy(n=>n.)
                    proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

                    proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);

                    callbackrecu.InsertArretDetravailCallbackevent += new ICallback.CallbackEventHandler57(callbackrecu_Refresh);



                    /*************************************************************************/
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 10
0
        public ImpressionOrdonnance(SVC.ServiceCliniqueClient proxyrecu, List <SVC.OrdonnancePatient> OrdonnancePatientRecu, SVC.Patient PatientRecu, SVC.Medecin SelectMedecinListe, SVC.EnteteOrdonnace selectedEnteteOrdonnance, bool a4)
        {
            try
            {
                InitializeComponent();

                var people = new List <SVC.Patient>();
                people.Add(PatientRecu);
                proxy = proxyrecu;

                var Entetemededcin = new List <SVC.EnteteOrdonnace>();
                Entetemededcin.Add(selectedEnteteOrdonnance);
                if (a4 == false)
                {
                    MemoryStream MyRptStream = new MemoryStream((Medicus.Properties.Resources.Ordonnance), false);

                    reportViewer1.LocalReport.LoadReportDefinition(MyRptStream);
                }
                else
                {
                    if (a4 == true)
                    {
                        MemoryStream MyRptStream = new MemoryStream((Medicus.Properties.Resources.OrdonnanceA4), false);

                        reportViewer1.LocalReport.LoadReportDefinition(MyRptStream);
                    }
                }


                ReportDataSource rds = new ReportDataSource();
                rds.Name  = "DataSet2";//This refers to the dataset name in the RDLC file
                rds.Value = people;
                this.reportViewer1.LocalReport.DataSources.Add(rds);
                var       selpara    = new List <SVC.Param>();
                SVC.Param paramlocal = (proxy.GetAllParamétre());
                paramlocal.CheminLogo = "D/Logo.jpg";
                selpara.Add((paramlocal));

                var peoplemededcin = new List <SVC.Medecin>();
                peoplemededcin.Add(SelectMedecinListe);
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", selpara));
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet3", OrdonnancePatientRecu));
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet4", peoplemededcin));
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet5", Entetemededcin));
                if (proxy.GetAllParamétre().CheminLogo != "")
                {
                    if (proxy.DownloadDocumentIsHere(proxy.GetAllParamétre().CheminLogo.ToString()) == true)
                    {
                        reportViewer1.LocalReport.EnableExternalImages = true;

                        /*  var image = LoadImage(proxy.DownloadDocument(proxy.GetAllParamétre().CheminLogo.ToString()));
                         * JpegBitmapEncoder encoder = new JpegBitmapEncoder();
                         * Guid photoID = System.Guid.NewGuid();
                         *
                         * encoder.Frames.Add(BitmapFrame.Create((BitmapImage)image));
                         * using (var filestream = new FileStream(photolocation, FileMode.Create))
                         * encoder.Save(filestream);*/
                        String          photolocation = System.Environment.CurrentDirectory + "/Logo.png";
                        ReportParameter paramLogo     = new ReportParameter();
                        paramLogo.Name = "ImagePath";
                        //  paramLogo.Values.Add(@"file:///C:\Logo.png");
                        paramLogo.Values.Add(@"file:///" + photolocation);
                        reportViewer1.LocalReport.SetParameters(paramLogo);
                        // reportViewer1.LocalReport.SetParameters(parameter);
                    }
                }



                reportViewer1.RefreshReport();

                proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

                proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 11
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);
            }
        }
Esempio n. 12
0
        private void btnImprimer_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sessionuser.ImpressionAdministrateur == true)
                {
                    if (MedecinsDataGrid.SelectedItem != null && txtRechercheSpeci.Text == "" && txtRecherche.Text == "")
                    {
                        SVC.Medecin SelectMedecinDatagrid = MedecinsDataGrid.SelectedItem as SVC.Medecin;

                        List <ExclusionDay> tt = (from e1 in proxy.GetAllExclusionDay(SelectMedecinDatagrid.Nom, SelectMedecinDatagrid.Prénom)


                                                  select e1).ToList();
                        if (SelectMedecinDatagrid.UserName != null)
                        {
                            var itemm = (from e1 in proxy.GetAllMembership()

                                         where e1.UserName == SelectMedecinDatagrid.UserName

                                         select e1).First();

                            if (tt != null)
                            {
                                this.NavigationService.Navigate(new ImpressionOneMedecin(proxy, SelectMedecinDatagrid, itemm, tt));
                            }
                            else
                            {
                                this.NavigationService.Navigate(new ImpressionOneMedecin(proxy, SelectMedecinDatagrid, itemm, null));
                            }
                        }
                        else
                        {
                            if (SelectMedecinDatagrid.UserName == null && tt != null)
                            {
                                this.NavigationService.Navigate(new ImpressionOneMedecin(proxy, SelectMedecinDatagrid, null, tt));
                            }
                            else
                            {
                                if (SelectMedecinDatagrid.UserName == null && tt == null)
                                {
                                    this.NavigationService.Navigate(new ImpressionOneMedecin(proxy, SelectMedecinDatagrid, null, null));
                                }
                            }
                        }
                    }
                    else
                    {
                        if (txtRecherche.Text != "" && txtRechercheSpeci.Text == "")
                        {
                            List <Medecin> test = MedecinsDataGrid.ItemsSource as List <Medecin>;
                            var            t    = (from e1 in test

                                                   where e1.Nom.ToUpper().StartsWith(txtRecherche.Text.ToUpper())

                                                   select e1);

                            this.NavigationService.Navigate(new ImpresssionMedecin(proxy, t.ToList()));
                        }
                        else
                        {
                            if (txtRechercheSpeci.Text != "" && txtRecherche.Text == "")
                            {
                                List <Medecin> teste = MedecinsDataGrid.ItemsSource as List <Medecin>;
                                var            t     = (from e1 in teste

                                                        where e1.SpécialitéMedecin.ToUpper().StartsWith(txtRechercheSpeci.Text.ToUpper())

                                                        select e1);

                                this.NavigationService.Navigate(new ImpresssionMedecin(proxy, t.ToList()));
                            }
                            else
                            {
                                if (txtRechercheSpeci.Text == "" && txtRecherche.Text == "" && MedecinsDataGrid.SelectedItem == null)
                                {
                                    List <Medecin> test = MedecinsDataGrid.ItemsSource as List <Medecin>;


                                    this.NavigationService.Navigate(new ImpresssionMedecin(proxy, test));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 13
0
        private void btnFilter_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Boolean Value = false;

                if (DateVisiteDébut.SelectedDate != null && DateVisiteFin.SelectedDate != null)
                {
                    if (chVisiteRegler.IsChecked == true)
                    {
                        Value = true;
                    }
                    else
                    {
                        if (chVisitenONRegler.IsChecked == true)
                        {
                            Value = false;
                        }
                        else
                        {
                            //  Value = null;
                        }
                    }



                    if (MedecinCombo.SelectedItem == null && PatientCombo.SelectedItem == null)
                    {
                        PatientDataGrid.ItemsSource = (proxy.GetAllVisite(DateVisiteDébut.SelectedDate.Value, DateVisiteFin.SelectedDate.Value)).Where(n => n.Soldé == Value);

                        interfaceimpression = 3;
                    }
                    else
                    {
                        if (MedecinCombo.SelectedItem != null && PatientCombo.SelectedItem == null)
                        {
                            SVC.Medecin ValueFourn = MedecinCombo.SelectedItem as SVC.Medecin;
                            PatientDataGrid.ItemsSource = (proxy.GetAllVisiteByVisiteMedecin(ValueFourn.Id)).Where(n => n.Date >= DateVisiteDébut.SelectedDate.Value && n.Date <= DateVisiteFin.SelectedDate.Value && n.Soldé == Value);
                            //      MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show("patient combo vide " + Value.ToString(), Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                            interfaceimpression = 3;
                        }
                        else
                        {
                            if (MedecinCombo.SelectedItem == null && PatientCombo.SelectedItem != null)
                            {
                                SVC.Patient PatientSelected = PatientCombo.SelectedItem as SVC.Patient;
                                PatientDataGrid.ItemsSource = (proxy.GetAllVisite(DateVisiteDébut.SelectedDate.Value, DateVisiteFin.SelectedDate.Value)).Where(n => (n.CodePatient == PatientSelected.Id || n.cle == PatientSelected.cle) && n.Soldé == Value);
                                //     MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show("medecin combo vide " + Value.ToString(), Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                interfaceimpression = 2;
                            }
                            else
                            {
                                if (MedecinCombo.SelectedItem != null && PatientCombo.SelectedItem != null)
                                {
                                    SVC.Patient PatientSelected = PatientCombo.SelectedItem as SVC.Patient;
                                    SVC.Medecin ValueMedecin    = MedecinCombo.SelectedItem as SVC.Medecin;

                                    PatientDataGrid.ItemsSource = (proxy.GetAllVisite(DateVisiteDébut.SelectedDate.Value, DateVisiteFin.SelectedDate.Value)).Where(n => (n.CodePatient == PatientSelected.Id || n.cle == PatientSelected.cle) && n.Soldé == Value && n.CodeMedecin == ValueMedecin.Id);
                                    //      MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show("deux combo not vide " + Value.ToString(), Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                    interfaceimpression = 2;
                                }
                            }
                        }
                    }
                }
                var test = PatientDataGrid.ItemsSource as IEnumerable <SVC.Visite>;
                txtAchat.Text       = Convert.ToString((test).AsEnumerable().Sum(o => o.Montant));
                TxtVersement.Text   = Convert.ToString((test).AsEnumerable().Sum(o => o.Versement));
                txtFournisseur.Text = Convert.ToString(((test).AsEnumerable().Sum(o => o.Reste)));
            }catch (Exception ex)
            {
                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 14
0
        public ReglementPatient(SVC.ServiceCliniqueClient proxyrecu, SVC.Membership memberrecu, ICallback callbackrecu)
        {
            try
            {
                InitializeComponent();
                proxy      = proxyrecu;
                callback   = callbackrecu;
                MemberUser = memberrecu;
                var disponible = (proxy.GetAllMedecin()).Where(list1 => list1.UserName == MemberUser.UserName).FirstOrDefault();
                if (disponible == null)
                {
                    medecinsession = false;
                    DateVisiteDébut.SelectedDate = DateTime.Now;
                    DateVisiteFin.SelectedDate   = DateTime.Now;
                    PatientDataGrid.ItemsSource  = proxy.GetAllVisite(DateVisiteDébut.SelectedDate.Value, DateVisiteFin.SelectedDate.Value);
                    MedecinCombo.ItemsSource     = proxy.GetAllMedecin().OrderBy(x => x.Nom);
                    PatientCombo.ItemsSource     = proxy.GetAllPatient().OrderBy(x => x.Nom);


                    txtAchat.Text       = Convert.ToString((proxy.GetAllVisite(DateVisiteDébut.SelectedDate.Value, DateVisiteFin.SelectedDate.Value)).AsEnumerable().Sum(o => o.Montant));
                    TxtVersement.Text   = Convert.ToString((proxy.GetAllVisite(DateVisiteDébut.SelectedDate.Value, DateVisiteFin.SelectedDate.Value)).AsEnumerable().Sum(o => o.Versement));
                    txtFournisseur.Text = Convert.ToString(((proxy.GetAllVisite(DateVisiteDébut.SelectedDate.Value, DateVisiteFin.SelectedDate.Value)).AsEnumerable().Sum(o => o.Reste)));

                    callbackrecu.InsertVisiteCallbackEvent  += new ICallback.CallbackEventHandler13(callbackrecu_Refresh);
                    callbackrecu.InsertPatientCallbackEvent += new ICallback.CallbackEventHandler7(callbackrecufourn_Refresh);
                    callbackrecu.InsertMedecinCallbackEvent += new ICallback.CallbackEventHandler6(callbackrecuMedecin_Refresh);


                    proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

                    proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);
                }
                else
                {
                    SELECTEDMEDECIN = disponible;
                    medecinsession  = true;
                    DateVisiteDébut.SelectedDate = DateTime.Now;
                    DateVisiteFin.SelectedDate   = DateTime.Now;
                    PatientDataGrid.ItemsSource  = proxy.GetAllVisiteByVisiteMedecin(SELECTEDMEDECIN.Id).Where(n => n.Date >= DateVisiteDébut.SelectedDate && n.Date <= DateVisiteFin.SelectedDate);
                    List <SVC.Medecin> testmedecin = proxy.GetAllMedecin().OrderBy(n => n.Nom).ToList();
                    MedecinCombo.ItemsSource = testmedecin;
                    List <SVC.Medecin> tte = testmedecin.Where(n => n.UserName == MemberUser.UserName).ToList();
                    MedecinCombo.SelectedItem = tte.First();
                    PatientCombo.ItemsSource  = proxy.GetAllPatient().Where(n => n.SuiviParCode == SELECTEDMEDECIN.Id).OrderBy(x => x.Nom);

                    txtAchat.Text       = Convert.ToString((proxy.GetAllVisiteByVisiteMedecin(SELECTEDMEDECIN.Id).Where(n => n.Date >= DateVisiteDébut.SelectedDate && n.Date <= DateVisiteFin.SelectedDate)).AsEnumerable().Sum(o => o.Montant));
                    TxtVersement.Text   = Convert.ToString((proxy.GetAllVisiteByVisiteMedecin(SELECTEDMEDECIN.Id).Where(n => n.Date >= DateVisiteDébut.SelectedDate && n.Date <= DateVisiteFin.SelectedDate)).AsEnumerable().Sum(o => o.Versement));
                    txtFournisseur.Text = Convert.ToString(((proxy.GetAllVisiteByVisiteMedecin(SELECTEDMEDECIN.Id).Where(n => n.Date >= DateVisiteDébut.SelectedDate && n.Date <= DateVisiteFin.SelectedDate)).AsEnumerable().Sum(o => o.Reste)));

                    callbackrecu.InsertVisiteCallbackEvent  += new ICallback.CallbackEventHandler13(callbackrecu_Refresh);
                    callbackrecu.InsertPatientCallbackEvent += new ICallback.CallbackEventHandler7(callbackrecufourn_Refresh);
                    callbackrecu.InsertMedecinCallbackEvent += new ICallback.CallbackEventHandler6(callbackrecuMedecin_Refresh);
                    MedecinCombo.IsEnabled = false;

                    proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

                    proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed);
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }