فهرست منبع

Added SupplierLink property to Product Links
Fixed an error with Product Images

frogsoftware 1 سال پیش
والد
کامیت
76db9cf768

+ 1 - 1
prs.classes/Entities/Product/Product.cs

@@ -82,7 +82,7 @@ namespace Comal.Classes
         }
         [LookupDefinition(typeof(SupplierProductLookup))]
         [EditorSequence("Pricing", 2)]
-        public SupplierProductLink Supplier { get; set; }
+        public ProductSupplierLink Supplier { get; set; }
 
         [CheckBoxEditor]
         [EditorSequence("Pricing", 3)]

+ 2 - 0
prs.classes/Entities/Product/ProductLink.cs

@@ -29,6 +29,8 @@ namespace Comal.Classes
         public ProductUOMLink Units { get; set; }
 
         public ProductGroupLink Group { get; set; }
+        
+        public ProductSupplierLink Supplier { get; set; }
 
         [NullEditor]
         [RequiredColumn]

+ 3 - 5
prs.classes/Entities/Supplier/SupplierProductLink.cs → prs.classes/Entities/Supplier/ProductSupplierLink.cs

@@ -3,16 +3,14 @@ using InABox.Core;
 
 namespace Comal.Classes
 {
-    public class SupplierProductLink : EntityLink<SupplierProduct>
+    
+    public class ProductSupplierLink : EntityLink<SupplierProduct>
     {
         [LookupEditor(typeof(SupplierProduct), "SupplierLink.Code", "SupplierLink.Name")]
         public override Guid ID { get; set; }
 
         public SupplierLink SupplierLink { get; set; }
-
-        [NullEditor]
-        public ProductLink ProductLink { get; set; }
-
+        
         [CodeEditor(Visible = Visible.Default, Editable = Editable.Hidden)]
         public string SupplierCode { get; set; }
 

+ 4 - 1
prs.classes/Entities/Supplier/SupplierLink.cs

@@ -8,10 +8,13 @@ namespace Comal.Classes
         [CodePopupEditor(typeof(Supplier))]
         public override Guid ID { get; set; }
 
-        [CodeEditor(Visible = Visible.Default)]
+        [CodeEditor(Visible = Visible.Default, Editable=Editable.Disabled)]
         public string Code { get; set; }
 
         [TextBoxEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
         public string Name { get; set; }
+        
+        [EditorSequence(6)]
+        public SupplierCategoryLink Category { get; set; }
     }
 }

+ 13 - 9
prs.desktop/Panels/Products/Master List/ProductsPanel.xaml.cs

@@ -145,15 +145,19 @@ namespace PRSDesktop
                         if (row != null)
                         {
                             var id = row.Get<Document, Guid>(x => x.ID);
-                            var ms = new MemoryStream(row.Get<Document, byte[]>(x => x.Data));
-                            var bmp = new Bitmap(ms);
-                            Dispatcher.BeginInvoke(
-                                new Action<Guid>(o =>
-                                {
-                                    if (id.Equals(imageid))
-                                        ProductImage.Source = bmp.AsBitmapImage(false);
-                                }), id
-                            );
+                            var data = row.Get<Document, byte[]>(x => x.Data);
+                            if (data?.Any() == true)
+                            {
+                                var ms = new MemoryStream(data);
+                                var bmp = new Bitmap(ms);
+                                Dispatcher.BeginInvoke(
+                                    new Action<Guid>(o =>
+                                    {
+                                        if (id.Equals(imageid))
+                                            ProductImage.Source = bmp.AsBitmapImage(false);
+                                    }), id
+                                );
+                            }
                         }
                     }
                 );