private void EditSupplierBtn_Click(object sender, RoutedEventArgs e) { if (productId == -1) return; if (DXMessageBox.Show(this,"Êtes-vous sûr de vouloir modifier ce produit?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.No) return; ProductManger productManger = new ProductManger(); Product produit = productManger.GetProductById(productId); if (produit == null) return; var image = ImageEdit1.Source as BitmapImage; if (image != null) { BitmapImage bi = image; FileStream stream = bi.StreamSource as FileStream; if (stream != null) { var photoPath = stream.Name; produit.Photo = Validator.ConvertImageToByteArray(photoPath); } } string categoryName = CategorysCbx.Text; string subCategoryName = SubCategoryCbx.Text; string productName = ProductNameTxtBox.Text; string productMeasure = MeasureCbx.Text; string productType = ProductTypeCbx.Text; string productReference = ProductReferenceTxt.Text; int qteMin = (int)ProductQteMinSpin.Value; int qteMax = (int)ProductQteMaxSpin.Value; string productDesignation = ProductDesignationTxt.Text; string productRemarks = ProductRemarksTxt.Text; String result = productManger.UpdateProduct(produit,categoryName, subCategoryName, productName, productMeasure, productType, productReference, qteMin, qteMax, productDesignation, productRemarks); DXMessageBox.Show(this, result); RefreshBtn_OnClick(null, null); }