Browse Source

Fixed ForeignCurrencyPrice Editor on ProductSupplierGrid

frogsoftware 11 tháng trước cách đây
mục cha
commit
2c9c8a70ec

+ 13 - 1
prs.desktop/Panels/Products/Master List/ProductSuppliersControl.cs

@@ -19,7 +19,7 @@ namespace PRSDesktop
         public ProductSuppliersControl()
         {
             ColumnsTag = "ProductSupplier";
-
+            
             HiddenColumns.Add(x => x.URL);
             ActionColumns.Add(new DynamicImageColumn(URLImage, URLAction) { Position = DynamicActionColumnPosition.Start });
 
@@ -135,6 +135,18 @@ namespace PRSDesktop
             return base.GetEditor(item, column);
         }
 
+        protected override void DoReconfigureEditors(DynamicEditorGrid grid, SupplierProduct[] items)
+        {
+            base.DoReconfigureEditors(grid, items);
+            var fcp = grid.FindEditor(nameof(SupplierProduct.ForeignCurrencyPrice));
+            var tp = grid.FindEditor(nameof(SupplierProduct.TradePrice));
+            if (fcp != null & tp != null)
+            {
+                fcp.SetEnabled(items.All(x=>x.SupplierLink.Currency.ID != Guid.Empty));
+                tp.SetEnabled(items.All(x=>x.SupplierLink.Currency.ID == Guid.Empty));
+            }
+        }
+
         protected override void DoAdd(bool OpenEditorOnDirectEdit = false)
         {
             if (Product.ID == Guid.Empty)