private void TableView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            FacturesClient fc = new FacturesClient();
            if (DgFactures.VisibleRowCount == 0) return;
            int rowHandle = DgFactures.View.FocusedRowHandle;
            if (rowHandle >= 0)
            {

                OrderClient oc = new OrderClient();
                Order ordre = oc.GetOrderById(Convert.ToInt32(DgFactures.GetCellValue(rowHandle, "OrderID")));
                FacturesClient factureClient = new FacturesClient();
                Facture facture = factureClient.GetFactureByOrdre(ordre);
                if (ordre.Status == 10) {PrintBtn.IsEnabled = false;  PrintProBtn.IsEnabled = true;}
                if (ordre.Status == 0) {PrintProBtn.IsEnabled = false; PrintBtn.IsEnabled = true;}

                //////////////////////

                if (ordre.OrderDate != null) DtFactureDate.DateTime = (DateTime)ordre.OrderDate;
                CbCustomerAddress.Text = ordre.Customer.Address;
                CbSecurityNum.Text = ordre.Customer.RC;       // a revoir
                CbRs.Text = ordre.Customer.CompanyName;
                NumTxtBox.Text = facture.FactureNum.ToString();
                Calculate(ordre);
                Afficher();
            }
        }
        private void PrintProBtn_Click(object sender, RoutedEventArgs e)
        {
            if (DgFactures.VisibleRowCount == 0) return;
            int rowHandle = DgFactures.View.FocusedRowHandle;
            if (rowHandle >= 0)
            {
                OrderClient oc = new OrderClient();
                Order ordre = oc.GetOrderById(Convert.ToInt32(DgFactures.GetCellValue(rowHandle, "OrderID")));

                /* la fcture dans la base de données */

                var factureClient = new FacturesClient();
                var facture = factureClient.GetFactureByOrdre(ordre);

                var settingsClient = new SettingsClient();
                var settings = settingsClient.GetSetting();

                var factureCase = new FactureCase
                {
                    Order = ordre,
                    TotalHt = _total,
                    Ttc = _ttc,
                    Tva = _tva,
                    Timbre = _timbre,
                    Numbre = facture.FactureNum.ToString(),
                    Facture = facture
                };

                //var report = new InvoiceReport(factureCase);

                //if (settings.Logo != null) report.Logo = Validator.ConvertByteArrayToImage(settings.Logo);

                //report.PayMode = facture.TypePayment;
                //report.SetSettings();
                //PrintHelper.ShowPrintPreview(null, report).WindowState = WindowState.Maximized;

                /* fin de l'impression de la facture */

                /* debut de modifiction de l'après impression de la facture */

                LoadGridFact();

                /* fin de modifiction de l'après impression de la facture */
            }
        }