Exemplo n.º 1
0
 private void btnImprimer_Click(object sender, RoutedEventArgs e)
 {
     try {
         if (memberuser.ImpressionRendezVous == true && RendezVousDataGrid.SelectedItem != null)
         {
             SVC.RendezVou    SelectMedecin = RendezVousDataGrid.SelectedItem as SVC.RendezVou;
             ImpressionTicket clsho         = new ImpressionTicket(proxy, SelectMedecin);
             clsho.Show();
         }
         else
         {
             if (memberuser.ImpressionRendezVous == true && RendezVousDataGrid.SelectedItem == null)
             {
                 List <SVC.RendezVou>      test1 = proxy.GetAllRendezVous(DateSaisieDébut.SelectedDate.Value, DateSaisieFin.SelectedDate.Value).ToList();
                 ImpressionListeRendezVous clsho = new ImpressionListeRendezVous(proxy, test1);
                 clsho.Show();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
     }
 }
Exemplo n.º 2
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);
            }
        }