private void ProviderTableView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;
            int rowHandle = ProviderGridControl.View.FocusedRowHandle;
            if (rowHandle < 0) return;
             SuppliersManager suppliersManager=new SuppliersManager();
            string companyName = ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString();
            _getProvider = suppliersManager.GetProviderByName(companyName);

            if (_getProvider == null) return;
            LoadPurchasesOfProvider(_getProvider);
        }
        private void ProviderTableView_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;
            int rowHandle = ProviderGridControl.View.FocusedRowHandle;
            if (rowHandle < 0) return;
            SuppliersManager suppliersManager = new SuppliersManager();
            Provider provider = suppliersManager.GetProviderByName(ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString());

            if (provider == null) return;
            LoadProviderFields(provider);
        }
        private void DeleteSupplierBtn_Click(object sender, RoutedEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;

            if (
                DXMessageBox.Show(this, "Êtes-vous sûr de vouloir supprimer ce fournisseur?", "Confirmation",
                    MessageBoxButton.YesNo) == MessageBoxResult.No) return;

            int rowHandle = ProviderGridControl.View.FocusedRowHandle;

            SuppliersManager suppliersManager = new SuppliersManager();
            Provider provider =
                suppliersManager.GetProviderByName(ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString());

            if (provider == null) return;
            suppliersManager.DesactivateProvider(provider);
            RefreshBtn_OnClick(null, null);
        }
        private void EditSupplierBtn_Click(object sender, RoutedEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;

            if (
                DXMessageBox.Show(this, "Êtes-vous sûr de vouloir modifier ce fournisseur?", "Confirmation",
                    MessageBoxButton.YesNo) == MessageBoxResult.No) return;

            int rowHandle = ProviderGridControl.View.FocusedRowHandle;
            var suppliersManager = new SuppliersManager();
            var provider =
                suppliersManager.GetProviderByName(ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString());

            if (provider == null) return;

            var image = ImageEdit1.Source as BitmapImage;
            byte[] photo = ImageToByteArray(image);

            string comanyName = CompanyTxtBox.Text;
            string contactTitle = TitleContactTxtBox.Text;
            string contactName = NameContactTxtBox.Text;
            string address = AdresseTxtBox.Text;
            string country = CountryTxtBox.Text;
            string region = RegionTxtBox.Text;
            string city = CityTxtBox.Text;
            string postalCode = ZipCodeTxtBox.Text;
            string homePage = WebSiteTxtBox.Text;
            string email = EmailTxtBox.Text;
            string rC = RcTxtBox.Text;
            string nF = NsTxtBox.Text;
            string nIs = NisTxtBox.Text;
            string aI = AiTxtBox.Text;
            string phone = TelephonTxtBox.Text;
            string fax = FaxTxtBox.Text;
            const int status = 0;

            String result = suppliersManager.UpdateProvider(provider, comanyName, contactTitle, contactName, address,
                country, region, city, postalCode, phone, homePage, email, fax, rC, nF, nIs, aI, status, photo);
            DXMessageBox.Show(this, result);
            RefreshBtn_OnClick(null, null);
        }