Browse Source

Merge remote-tracking branch 'origin/frank' into entitylinks

# Conflicts:
#	InABox.Core/DigitalForms/Forms/DigitalForm.cs
#	InABox.Core/DigitalForms/Forms/EntityForm.cs
Kenric Nugteren 1 year ago
parent
commit
b86e18a391

+ 5 - 0
InABox.Core/DigitalForms/Forms/DigitalForm.cs

@@ -72,7 +72,11 @@ namespace InABox.Core
         [EditorSequence(5)]
         public bool Secure { get; set; }
 
+        [CheckBoxEditor]
         [EditorSequence(6)]
+        public bool Final { get; set; }
+        
+        [EditorSequence(7)]
         public DigitalFormGroupLink Group { get; set; }
 
         [NullEditor]
@@ -99,6 +103,7 @@ namespace InABox.Core
             base.Init();
             Active = true;
             Secure = false;
+            Final = false;
         }
 
         public override string ToString()

+ 4 - 0
InABox.Core/DigitalForms/Forms/DigitalFormLink.cs

@@ -26,6 +26,10 @@ namespace InABox.Core
 
         [EditorSequence(6)]
         [CheckBoxEditor(Editable = Editable.Hidden)]
+        public bool Final { get; set; }
+
+        [EditorSequence(7)]
+        [CheckBoxEditor(Editable = Editable.Hidden)]
         public bool Active { get; set; }
         
         [NullEditor]

+ 23 - 6
InABox.Core/DigitalForms/Forms/EntityForm.cs

@@ -35,6 +35,7 @@ namespace InABox.Core
         public string Description { get; set; }
 
         [NullEditor]
+        [EntityRelationship(DeleteAction.Cascade)]
         public TParentLink Parent { get; set; }
 
         [NullEditor]
@@ -42,6 +43,7 @@ namespace InABox.Core
         public QAFormLink QAForm { get; set; }
 
         [EditorSequence(1)]
+        [EntityRelationship(DeleteAction.Cascade)]
         public DigitalFormLink Form { get; set; }
 
         [NullEditor]
@@ -57,11 +59,26 @@ namespace InABox.Core
         [NullEditor]
         [Obsolete("Being Replaced by FormCompleted", true)]
         public DateTime QACompleted { get; set; }
-
+        
         [EditorSequence(2)]
+        [Caption("Started")]
+        [DateTimeEditor]
+        public DateTime FormStarted { get; set; }
+
+        [EditorSequence(3)]
         [Caption("Completed")]
         [DateTimeEditor]
         public DateTime FormCompleted { get; set; }
+        
+        [EditorSequence(4)]
+        [Caption("Processed")]
+        [DateTimeEditor]
+        public DateTime FormProcessed { get; set; }
+        
+        [EditorSequence(5)]
+        [Caption("Cancelled")]
+        [DateTimeEditor]
+        public DateTime FormCancelled { get; set; }
 
         [NullEditor]
         [Obsolete("Being Replaced by FormCompletedBy")]
@@ -71,10 +88,10 @@ namespace InABox.Core
         [Caption("User")]
         public UserLink FormCompletedBy { get; set; }
 
-        [EditorSequence(4)]
-        [CheckBoxEditor]
+        [NullEditor]
+        [Obsolete("Replaced with Status", true)]
         public bool Processed { get; set; }
-
+        
         [NullEditor]
         public Location Location { get; set; }
 
@@ -91,7 +108,7 @@ namespace InABox.Core
             return Parent.ID;
         }
 
-        public DateTime FormStarted { get; set; }
+        [DurationEditor(Visible=Visible.Optional, Editable = Editable.Hidden)]
         public TimeSpan FormOpen { get; set; }
 
         [NullEditor]
@@ -103,7 +120,7 @@ namespace InABox.Core
             Description = "";
             FormStarted = DateTime.MinValue;
             FormOpen = TimeSpan.Zero;
-            Processed = false;
+            CoreUtils.SetPropertyValue(this, "Processed", false);
         }
     }
 }

+ 4 - 1
InABox.Core/DigitalForms/Forms/IDigitalFormInstance.cs

@@ -2,12 +2,15 @@
 
 namespace InABox.Core
 {
+    
     public interface IBaseDigitalFormInstance : IEntity
     {
         DigitalFormLink Form { get; set; }
         DateTime FormStarted { get; set; }
-        DateTime FormCompleted { get; set; }
         TimeSpan FormOpen { get; set; }
+        DateTime FormCompleted { get; set; }
+        DateTime FormProcessed { get; set; }
+        DateTime FormCancelled { get; set; }
     }
     
     public interface ICoreDigitalFormInstance : IBaseDigitalFormInstance

+ 4 - 0
InABox.Core/Entity.cs

@@ -24,6 +24,10 @@ namespace InABox.Core
         Guid Deleted { get; set; }
 
         bool IsChanged();
+
+        void CommitChanges();
+        void CancelChanges();
+
     }
 
     public interface ITaxable

+ 7 - 4
InABox.Mobile/InABox.Mobile.Shared/DataModels/CoreRepository.cs

@@ -51,7 +51,9 @@ namespace InABox.Mobile
     {
         readonly MultiQuery _query = new();
         
-        protected Func<Filter<TEntity>> BaseFilter { get; set; }
+        protected Func<Filter<TEntity>> Filter { get; set; }
+
+        protected virtual Filter<TEntity> BaseFilter() => null;
         
         public IModelHost Host { get; set; }
         
@@ -60,7 +62,7 @@ namespace InABox.Mobile
         public String FileName { get; set; }
 
         
-        protected CoreRepository(IModelHost host, Func<Filter<TEntity>> baseFilter)
+        protected CoreRepository(IModelHost host, Func<Filter<TEntity>> filter)
         {
             _items = new CoreObservableCollection<TItem>();   
             BindingBase.EnableCollectionSynchronization(_items, null, 
@@ -75,7 +77,7 @@ namespace InABox.Mobile
             
             Reset();
             Host = host;
-            BaseFilter = baseFilter;
+            Filter = filter;
         }
         
         #region INotifyPropertyChanged
@@ -140,7 +142,8 @@ namespace InABox.Mobile
         protected Filter<TEntity> EffectiveFilter()
         {
             var filters = new Filters<TEntity>();
-            filters.Add(BaseFilter?.Invoke());
+            filters.Add(BaseFilter());
+            filters.Add(Filter?.Invoke());
             filters.Add(SelectedFilter);
             var result = filters.Combine();
             return result;

+ 2 - 1
InABox.Mobile/InABox.Mobile.Shared/DataModels/Shell.cs

@@ -51,7 +51,8 @@ namespace InABox.Mobile
 
         public virtual void Save(string auditmessage)
         {
-            new Client<TEntity>().Save(_entity, auditmessage);
+            if (_entity != null)
+                new Client<TEntity>().Save(_entity, auditmessage);
         }
 
         public void Cancel()