Ver código fonte

Fix to DF fields and Product dimensions sizing

Kenric Nugteren 2 anos atrás
pai
commit
ca4f6ef38e

+ 1 - 0
InABox.Core/DigitalForms/Layouts/Fields/DFLayoutEmbeddedImage/DFLayoutEmbeddedImageProperties.cs

@@ -30,6 +30,7 @@ namespace InABox.Core
                 }
                 catch (Exception e)
                 {
+                    Logger.Send(LogType.Error, "", $"Error in image data; invalid Base-64: {e.Message}");
                     return null;
                 }
             }

+ 3 - 3
InABox.Core/DigitalForms/Layouts/Fields/DFLayoutMultiSignaturePad/DFLayoutMultiSignaturePadProperties.cs

@@ -7,12 +7,12 @@ namespace InABox.Core
 {
     public class DFLayoutMultiSignaturePadProperties : DFLayoutFieldProperties<Dictionary<string, byte[]>>
     {
-        public override string FormatValue(object value)
+        public override string FormatValue(object? value)
         {
             return value != null ? "Yes" : "";
         }
 
-        public override object? ParseValue(object value)
+        public override object? ParseValue(object? value)
         {
             if (value is Dictionary<string, byte[]> dict)
                 return dict;
@@ -24,7 +24,7 @@ namespace InABox.Core
             {
                 if (Guid.TryParse(str, out var id))
                 {
-                    return new List<byte[]>();
+                    return new Dictionary<string, byte[]>();
                 }
                 values = Serialization.Deserialize<Dictionary<string, string>>(str);
             }

+ 15 - 0
InABox.Core/Dimensions/Dimensions.cs

@@ -66,6 +66,21 @@ namespace InABox.Core
         {
             base.Init();
             Unit = Activator.CreateInstance(typeof(TLink), new object[] { new Func<Entity>(LinkedEntity) }) as TLink;
+            Unit.PropertyChanged += (s, e) =>
+            {
+                if(e.PropertyName == "ID")
+                {
+                    DoPropertyChanged("Unit." + e.PropertyName, OriginalValues.GetValueOrDefault("Unit." + e.PropertyName), Unit.ID);
+                }
+                else if(e.PropertyName == "Formula")
+                {
+                    DoPropertyChanged("Unit." + e.PropertyName, OriginalValues.GetValueOrDefault("Unit." + e.PropertyName), Unit.Formula);
+                }
+                else if(e.PropertyName == "Format")
+                {
+                    DoPropertyChanged("Unit." + e.PropertyName, OriginalValues.GetValueOrDefault("Unit." + e.PropertyName), Unit.Format);
+                }
+            };
         }
         
         private bool bCalculating = false;

+ 6 - 1
InABox.DynamicGrid/DynamicOneToManyGrid.cs

@@ -125,12 +125,17 @@ namespace InABox.DynamicGrid
             // Don't need to do anything here
         }
 
+        protected virtual void OnDeleteItem(TMany item)
+        {
+            new Client<TMany>().Delete(item, typeof(TMany).Name + " Deleted by User");
+        }
+
         public void AfterSave(object item)
         {
             // First remove any deleted files
             foreach (var map in MasterList)
                 if (!Items.Contains(map))
-                    new Client<TMany>().Delete(map, typeof(TMany).Name + " Deleted by User");
+                    OnDeleteItem(map);
 
             foreach (var map in Items)
             {