Exemplo n.º 1
0
 private void txtRecherchenOM_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         TextBox         t      = (TextBox)sender;
         string          filter = t.Text;
         ICollectionView cv     = CollectionViewSource.GetDefaultView(PatientDataGrid.ItemsSource);
         if (filter == "")
         {
             cv.Filter = null;
         }
         else
         {
             cv.Filter = o =>
             {
                 SVC.Visite p = o as SVC.Visite;
                 if (t.Name == "txtId")
                 {
                     return(p.NomPatient == filter);
                 }
                 return(p.NomPatient.ToUpper().Contains(filter.ToUpper()));
             };
         }
     }catch (Exception ex)
     {
         MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemplo n.º 2
0
        private void txtPatientconsultation_TextChanged(object sender, TextChangedEventArgs e)
        {
            try
            {
                TextBox         t      = (TextBox)sender;
                string          filter = t.Text;
                ICollectionView cv     = CollectionViewSource.GetDefaultView(PatientDataGrid.ItemsSource);

                if (filter == "")
                {
                    cv.Filter = null;
                }
                else
                {
                    cv.Filter = o =>
                    {
                        SVC.Visite p = o as SVC.Visite;
                        if (t.Name == "txtId")
                        {
                            return(p.Id == Convert.ToInt32(filter));
                        }
                        return(p.NomPatient.ToUpper().Contains(filter.ToUpper()));
                    };
                }
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        private void btnListeVersement_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MemberUser.ImressionCaisse == true && PatientDataGrid.SelectedItem != null)
                {
                    SVC.Visite SelectMedecin = PatientDataGrid.SelectedItem as SVC.Visite;
                    if (SelectMedecin.CodePatient == 0)
                    {
                        var patient = (proxy.GetAllPatient()).Find(n => n.cle == SelectMedecin.cle);

                        VersementPatient cl = new VersementPatient(proxy, MemberUser, callback, patient, SelectMedecin, true);
                        cl.Show();
                    }
                    else
                    {
                        var patient         = (proxy.GetAllPatient()).Find(n => n.Id == SelectMedecin.CodePatient);
                        VersementPatient cl = new VersementPatient(proxy, MemberUser, callback, patient, SelectMedecin, false);
                        cl.Show();
                    }
                }
                else
                {
                    MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.MessageBoxPrivilége, 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);
            }
        }
        public VersementPatient(SVC.ServiceCliniqueClient proxyrecu, SVC.Membership membershiprecu, ICallback callbackrecu, SVC.Patient fournrecu, SVC.Visite visiterecu, bool valeurbool)
        {
            try
            {
                InitializeComponent();
                proxy         = proxyrecu;
                callback      = callbackrecu;
                MemberUser    = membershiprecu;
                PatientR      = fournrecu;
                VisiteAregler = visiterecu; //Convert.ToString(VisiteApayer.Id) + Convert.ToString(DateTime.Now.TimeOfDay)
                                            // cléfiltre =  Convert.ToString(VisiteAregler.Id) + Convert.ToString(DateTime.Now.TimeOfDay) ;
                //  if (valeurbool==false)
                //  {
                depaiemlist = (proxy.GetAllDepeiment()).Where(n => n.cle == VisiteAregler.cle).ToList();
                // }else
                // {
                //      SVC.Depeiment soldededepart= (proxy.GetAllDepeiment()).Find(n => n.cle == PatientR.cle);
                //     depaiemlist.Add(soldededepart);
                // }
                labelFournisseur.Content = fournrecu.Id + " " + fournrecu.Nom + " " + fournrecu.Prénom;
                // var okmultiple = (proxy.GetAllDepeiementMultiple()).Find(n => n.cleVisite == VisiteAregler.cle);
                var okmultiple = (proxy.GetAllDepeiementMultiple()).FindAll(n => n.cleVisite == VisiteAregler.cle);

                if (okmultiple.Count > 0)
                {
                    foreach (SVC.DepeiementMultiple itemmultiple in okmultiple)
                    {
                        DepeimentMultiple = proxy.GetAllDepeiment().Find(n => n.CleMultiple == itemmultiple.cleMultiple);
                        if (!depaiemlist.Contains(DepeimentMultiple) && DepeimentMultiple.Multiple == true)
                        {
                            depaiemlist.Add(DepeimentMultiple);
                        }
                    }


                    FournDataGrid.ItemsSource = depaiemlist;
                }
                else
                {
                    FournDataGrid.ItemsSource = depaiemlist;
                }

                callbackrecu.InsertDepaiemCallbackevent += new ICallback.CallbackEventHandler32(callbackrecu_Refresh);
                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);
            }
        }
        public ImpressionOneVisite(SVC.ServiceCliniqueClient proxyrecu, SVC.Visite constanterecu)
        {
            try
            {
                InitializeComponent();
                var people = new List <SVC.Visite>();
                people.Add(constanterecu);
                proxy = proxyrecu;
                // datable = datatablerecu;


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

                reportViewer1.LocalReport.LoadReportDefinition(MyRptStream);
                // reportViewer1.LocalReport.ReportPath = "../../Patient/ReportOnePatient.rdlc";

                ReportDataSource rds = new ReportDataSource();
                rds.Name  = "DataSet1";//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>();
                selpara.Add((proxy.GetAllParamétre()));
                this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", selpara));


                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);
            }
        }
        private void btnSupp_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MemberUser.SuppréssionCaisse == true && FournDataGrid.SelectedItem != null)
                {
                    try
                    {
                        SVC.Depeiment selectdepaief = FournDataGrid.SelectedItem as SVC.Depeiment;

                        if (selectdepaief.Multiple == false)
                        {
                            bool SupDepaif    = false;
                            bool SupDepanse   = false;
                            bool UpdateRecouf = false;

                            var depense = (proxy.GetAllDepense()).Find(n => n.cle == selectdepaief.cle && n.Crédit == true && n.MontantCrédit == selectdepaief.montant);
                            var Recouf  = (proxy.GetAllVisiteByVisite(selectdepaief.CodePatient.Value)).Find(n => n.cle == selectdepaief.cle);

                            using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                            {
                                /*suprimez l'écriture de depaief*/
                                proxy.DeleteDepeiment(selectdepaief);
                                SupDepaif = true;
                                // MessageBoxResult result11 = Xceed.Wpf.Toolkit.MessageBox.Show("paiement succées", "Medicus", MessageBoxButton.OK, MessageBoxImage.Information);
                                /*  suprimez l'écriture de depanse*/
                                proxy.DeleteDepense(depense);
                                SupDepanse = true;
                                // MessageBoxResult result1g1 = Xceed.Wpf.Toolkit.MessageBox.Show("Deletedepense succées", "Medicus", MessageBoxButton.OK, MessageBoxImage.Information);
                                /*  update recouf c-a-d enlevez le montant */
                                Recouf.Reste     = Recouf.Reste + selectdepaief.montant;
                                Recouf.Versement = Recouf.Versement - selectdepaief.montant;
                                if (Recouf.Reste != 0)
                                {
                                    Recouf.Soldé = false;
                                }
                                proxy.UpdateVisite(Recouf);
                                UpdateRecouf = true;
                                //   MessageBoxResult result1g1d = Xceed.Wpf.Toolkit.MessageBox.Show("Visite yes", "Medicus", MessageBoxButton.OK, MessageBoxImage.Information);

                                if (SupDepaif == true && SupDepanse == true && UpdateRecouf == true)
                                {
                                    ts.Complete();
                                    MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                }
                            }
                            proxy.AjouterDepenseRefresh();
                            proxy.AjouterSoldeVisiteRefresh();
                            proxy.AjouterTransactionPaiementRefresh();
                        }
                        else
                        {
                            if (selectdepaief.Multiple == true)
                            {
                                bool SuppDepeiement          = false;
                                bool SupDepense              = false;
                                bool SupDepeiementMultiple   = false;
                                bool UpdateVisite            = false;
                                List <SVC.Visite> listvisite = new List <SVC.Visite>();
                                MessageBoxResult  result     = Xceed.Wpf.Toolkit.MessageBox.Show("Attention ! Vous allez supprimez un versement multiple qui va affecter d'autres enregistrements !veuillez confirmez votre choix", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.YesNo, MessageBoxImage.Question);
                                if (result == MessageBoxResult.Yes)
                                {
                                    var depense         = (proxy.GetAllDepense()).Find(n => n.cle == selectdepaief.cle && n.Crédit == true && n.MontantCrédit == selectdepaief.montant);
                                    var depeiememultipl = (proxy.GetAllDepeiementMultiple()).Where(n => n.cleMultiple == selectdepaief.CleMultiple).ToList();
                                    foreach (SVC.DepeiementMultiple itemmultiple in depeiememultipl)
                                    {
                                        SVC.Visite selectedvisite = proxy.GetAllVisiteByVisite(itemmultiple.CodePatient.Value).Find(n => n.cle == itemmultiple.cleVisite);

                                        if (!listvisite.Contains(selectedvisite))
                                        {
                                            listvisite.Add(selectedvisite);
                                        }
                                    }


                                    using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                                    {
                                        proxy.DeleteDepeiment(selectdepaief);
                                        SuppDepeiement = true;
                                        proxy.DeleteDepense(depense);
                                        SupDepense = true;
                                        for (int i = depeiememultipl.Count - 1; i >= 0; i--)/*deux critére 1er connécté plus le parcour de la liste*/
                                        {
                                            var        itemvisite           = depeiememultipl.ElementAt(i);
                                            SVC.Visite updatevisiteselected = listvisite.Find(n => n.cle == itemvisite.cleVisite);

                                            UpdateVisite = false;
                                            updatevisiteselected.Reste     = updatevisiteselected.Reste + itemvisite.montant;
                                            updatevisiteselected.Versement = updatevisiteselected.Versement - itemvisite.montant;
                                            if (updatevisiteselected.Reste != 0)
                                            {
                                                updatevisiteselected.Soldé = false;
                                            }
                                            proxy.UpdateVisite(updatevisiteselected);
                                            UpdateVisite          = true;
                                            SupDepeiementMultiple = false;
                                            proxy.DeleteDepeiementMultiple(itemvisite);
                                            SupDepeiementMultiple = true;
                                        }
                                        if (SuppDepeiement == true && SupDepense == true && UpdateVisite == true && SupDepeiementMultiple == true)
                                        {
                                            ts.Complete();
                                            MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                                        }
                                        else
                                        {
                                            MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OpérationéchouéeTransaction, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                        }
                                    }
                                    proxy.AjouterDepenseRefresh();
                                    proxy.AjouterSoldeVisiteRefresh();
                                    proxy.AjouterTransactionPaiementRefresh();
                                }
                            }
                        }
                    }
                    catch (FaultException ex)
                    {
                        MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, 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);
            }
        }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
0
        public void rempliridsivisite(SVC.Patient pa)
        {
            try {
                if (txtCrédit.Text != "")
                {
                    var found = (proxy.GetAllPatient()).Find(n => n.Nom.Trim() == pa.Nom.Trim() && n.Prénom.Trim() == pa.Prénom.Trim());
                    /***********************************************/
                    if (found.Solde != 0)
                    {
                        bool interfaceVisite = false;
                        using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
                        {
                            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       = found.Nom,
                                PrénomPatient    = found.Prénom,
                                Montant          = found.Solde,
                                Versement        = 0,
                                Reste            = found.Solde,
                                Soldé            = false,
                                //  CodePatient = 0,
                                CodePatient     = found.Id,
                                IdCas           = 0,
                                IdMotif         = 0,
                                ModeFacturation = 0,
                                //   cle = "Ancien Solde" + 0,
                                cle = "Ancien Solde" + found.Id,
                            };

                            cas.VisiteParNom    = member.UserName + " " + "User";
                            cas.VisiteParPrénom = member.Prénom + " " + "User";
                            cas.CodeMedecin     = 1987;

                            proxy.InsertVisite(cas);
                            interfaceVisite = true;
                            if (interfaceVisite == true)
                            {
                                ts.Complete();
                                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.OperationSuccées, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Information);
                            }
                            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 result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }
Exemplo n.º 9
0
        /*  private void PatientCombo_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
         * {
         *    try
         *    {
         *   PatientCombo.ItemsSource = proxy.GetAllPatient().OrderBy(x => x.Nom);
         *    }
         *    catch (Exception ex)
         *    {
         *        MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
         *
         *    }
         *
         * }*/

        private void BTNCALCUL_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                visitecredit = new List <SVC.Visite>();
                var listevisitecode = (from ta in proxy.GetAllVisiteAll()
                                       where ta.CodePatient != 0
                                       select ta.CodePatient).Distinct();

                foreach (int itemcode in listevisitecode)
                {
                    SVC.Visite newvisite = new SVC.Visite();
                    newvisite.Montant   = 0;
                    newvisite.Versement = 0;
                    newvisite.Reste     = 0;
                    //   newvisite.cle = "";
                    foreach (SVC.Visite itemvisite in proxy.GetAllVisiteAll())
                    {
                        if (itemcode == itemvisite.CodePatient && itemcode != 0)
                        {
                            newvisite.CodePatient = itemcode;
                            // if(itemcode==0)

                            /*{
                             *  newvisite.NomPatient = " Total Ancien solde";
                             *  newvisite.PrénomPatient = "Du cabinet";
                             * }
                             * else
                             * {*/
                            newvisite.NomPatient    = itemvisite.NomPatient;
                            newvisite.PrénomPatient = itemvisite.PrénomPatient;
                            //  }
                            newvisite.cle       = itemvisite.cle;
                            newvisite.Montant   = newvisite.Montant + itemvisite.Montant;
                            newvisite.Versement = newvisite.Versement + itemvisite.Versement;
                            newvisite.Reste     = newvisite.Reste + itemvisite.Reste;
                        }
                    }
                    visitecredit.Add(newvisite);
                }
                List <SVC.Visite> listcle = proxy.GetAllVisiteAll().Where(n => n.CodePatient == 0 && n.cle != "").ToList();

                foreach (SVC.Visite itemcle in listcle)
                {
                    SVC.Visite newvisite = new SVC.Visite();
                    newvisite.Montant   = 0;
                    newvisite.Versement = 0;
                    newvisite.Reste     = 0;



                    newvisite.CodePatient = itemcle.CodePatient;


                    newvisite.NomPatient    = "Ancien Solde " + itemcle.NomPatient;
                    newvisite.PrénomPatient = itemcle.PrénomPatient;

                    newvisite.Montant   = newvisite.Montant + itemcle.Montant;
                    newvisite.Versement = newvisite.Versement + itemcle.Versement;
                    newvisite.Reste     = newvisite.Reste + itemcle.Reste;
                    visitecredit.Add(newvisite);
                }


                PatientDataGrid.ItemsSource = visitecredit;
                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)));

                btnSolde.IsEnabled  = false;
                interfaceimpression = 1;
            }
            catch (Exception ex)
            {
                MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 10
0
 private void btnSolde_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (MemberUser.CréationCaisse == true && PatientDataGrid.SelectedItem != null && PatientDataGrid.SelectedItems.Count == 1)
         {
             SVC.Visite SelectMedecin = PatientDataGrid.SelectedItem as SVC.Visite;
             if (SelectMedecin.Reste != 0)
             {
                 AjouterTransaction bn = new AjouterTransaction(proxy, MemberUser, callback, null, 3, SelectMedecin, null);
                 bn.Show();
             }
             else
             {
                 MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Facture déja soldé", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
             }
         }
         else
         {
             if (MemberUser.CréationCaisse == true && PatientDataGrid.SelectedItem != null && PatientDataGrid.SelectedItems.Count > 1)
             {
                 List <SVC.Visite> selectedreste = PatientDataGrid.SelectedItems.OfType <SVC.Visite>().ToList();
                 if (DetectPatientInLIST(selectedreste))
                 {
                     List <SVC.Visite> Realselectedvisitewithreste = new List <SVC.Visite>();
                     foreach (SVC.Visite item in selectedreste)
                     {
                         if (item.Reste != 0)
                         {
                             Realselectedvisitewithreste.Add(item);
                         }
                     }
                     if (Realselectedvisitewithreste.Count == 1)
                     {
                         AjouterTransaction bn = new AjouterTransaction(proxy, MemberUser, callback, null, 3, Realselectedvisitewithreste.First(), null);
                         bn.Show();
                     }
                     else
                     {
                         if (Realselectedvisitewithreste.Count > 1)
                         {
                             AjouterTransaction bn = new AjouterTransaction(proxy, MemberUser, callback, null, 4, null, Realselectedvisitewithreste);
                             bn.Show();
                         }
                         else
                         {
                             MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.MessageBoxPrivilége, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                         }
                     }
                 }
                 else
                 {
                     MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show("Vous devez selectionnez les visites d'un même patient", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                 }
             }
             else
             {
                 MessageBoxResult resultc1 = Xceed.Wpf.Toolkit.MessageBox.Show(Medicus.Properties.Resources.MessageBoxPrivilége, 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);
     }
 }
Exemplo n.º 11
0
        public void AddRefresh(SVC.Visite listmembership, int oper)
        {
            try
            {
                if (medecinsession == false)
                {
                    var LISTITEM11 = PatientDataGrid.ItemsSource as IEnumerable <SVC.Visite>;
                    List <SVC.Visite> LISTITEM0 = LISTITEM11.ToList();

                    if (oper == 1)
                    {
                        LISTITEM0.Add(listmembership);
                    }
                    else
                    {
                        if (oper == 2)
                        {
                            var objectmodifed = LISTITEM0.Find(n => n.Id == listmembership.Id);
                            //objectmodifed = listmembership;
                            var index = LISTITEM0.IndexOf(objectmodifed);
                            if (index != -1)
                            {
                                LISTITEM0[index] = listmembership;
                            }
                        }
                        else
                        {
                            if (oper == 3)
                            {
                                //    MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show("Supp rendezvous :"+ listmembership.Id.ToString(), Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                var deleterendez = LISTITEM0.Where(n => n.Id == listmembership.Id).First();
                                LISTITEM0.Remove(deleterendez);
                            }
                        }
                    }



                    PatientDataGrid.ItemsSource = LISTITEM0;
                    txtAchat.Text       = Convert.ToString((LISTITEM0).AsEnumerable().Sum(o => o.Montant));
                    TxtVersement.Text   = Convert.ToString((LISTITEM0).AsEnumerable().Sum(o => o.Versement));
                    txtFournisseur.Text = Convert.ToString((LISTITEM0).AsEnumerable().Sum(o => o.Reste));
                }
                else
                {
                    if (listmembership.CodeMedecin == SELECTEDMEDECIN.Id)
                    {
                        var LISTITEM11 = PatientDataGrid.ItemsSource as IEnumerable <SVC.Visite>;
                        List <SVC.Visite> LISTITEM0 = LISTITEM11.ToList();

                        if (oper == 1)
                        {
                            LISTITEM0.Add(listmembership);
                        }
                        else
                        {
                            if (oper == 2)
                            {
                                var objectmodifed = LISTITEM0.Find(n => n.Id == listmembership.Id);
                                objectmodifed = listmembership;
                            }
                            else
                            {
                                if (oper == 3)
                                {
                                    //    MessageBoxResult resultc10 = Xceed.Wpf.Toolkit.MessageBox.Show("Supp rendezvous :"+ listmembership.Id.ToString(), Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Error);
                                    var deleterendez = LISTITEM0.Where(n => n.Id == listmembership.Id).First();
                                    LISTITEM0.Remove(deleterendez);
                                }
                            }
                        }


                        PatientDataGrid.ItemsSource = LISTITEM0;

                        txtAchat.Text = Convert.ToString((LISTITEM0).AsEnumerable().Sum(o => o.Montant));

                        TxtVersement.Text   = Convert.ToString((LISTITEM0.Where(n => n.CodeMedecin == SELECTEDMEDECIN.Id)).AsEnumerable().Sum(o => o.Versement));
                        txtFournisseur.Text = Convert.ToString((LISTITEM0.Where(n => n.CodeMedecin == SELECTEDMEDECIN.Id)).AsEnumerable().Sum(o => o.Reste));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }