Bläddra i källkod

Removed unnecessary Console.WriteLine calls
Prepared for DigitalForm.ActiveLayout aggregates

Frank van den Bos 2 år sedan
förälder
incheckning
404a6526e2

+ 2 - 2
InABox.Core/CoreUtils.cs

@@ -2045,7 +2045,7 @@ namespace InABox.Core
                         //compare the values
                         //compare the values
                         if (!CompareValues(name, value1, value2, results))
                         if (!CompareValues(name, value1, value2, results))
                         {
                         {
-                            Console.WriteLine("Property Name {0}", propertyInfo.Name);
+                            //Console.WriteLine("Property Name {0}", propertyInfo.Name);
                             areObjectsEqual = false;
                             areObjectsEqual = false;
                         }
                         }
                     }
                     }
@@ -2053,7 +2053,7 @@ namespace InABox.Core
                     //we have to iterate through all items and compare values
                     //we have to iterate through all items and compare values
                     else if (IsEnumerableType(propertyInfo.PropertyType))
                     else if (IsEnumerableType(propertyInfo.PropertyType))
                     {
                     {
-                        Console.WriteLine("Property Name {0}", propertyInfo.Name);
+                        //Console.WriteLine("Property Name {0}", propertyInfo.Name);
                         if (!CompareEnumerations(name, value1, value2, ignorePropertiesList, results))
                         if (!CompareEnumerations(name, value1, value2, ignorePropertiesList, results))
                             areObjectsEqual = false;
                             areObjectsEqual = false;
                     }
                     }

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

@@ -8,6 +8,36 @@ using TextFieldParserStandard;
 
 
 namespace InABox.Core
 namespace InABox.Core
 {
 {
+    // public abstract class DigitalFormsCount : CoreAggregate<DigitalForm, DigitalFormLayout, Guid>
+    // {
+    //     public override Expression<Func<DigitalFormLayout, Guid>> Aggregate => x => x.ID;
+    //
+    //     public override Filter<DigitalFormLayout> Filter => 
+    //         new Filter<DigitalFormLayout>(x => x.Type).IsEqualTo(DFLayoutType.Mobile)
+    //             .And(x=>x.Active).IsEqualTo(true);
+    //
+    //     public override Dictionary<Expression<Func<DigitalFormLayout, object>>, Expression<Func<DigitalForm, object>>> Links =>
+    //         new Dictionary<Expression<Func<DigitalFormLayout, object>>, Expression<Func<DigitalForm, object>>>()
+    //         {
+    //             { DigitalFormLayout => DigitalFormLayout.Form.ID, DigitalForm => DigitalForm.ID }
+    //         };
+    //
+    //     public override AggregateCalculation Calculation => AggregateCalculation.Count;
+    // }
+    //
+    // public class ActiveMobileFormsCount : DigitalFormsCount
+    // {
+    //     public override Filter<DigitalFormLayout> Filter => 
+    //         new Filter<DigitalFormLayout>(x => x.Type).IsEqualTo(DFLayoutType.Mobile)
+    //             .And(x=>x.Active).IsEqualTo(true);
+    // }
+    //
+    // public class ActiveFormsCount : DigitalFormsCount
+    // {
+    //     public override Filter<DigitalFormLayout> Filter => 
+    //         new Filter<DigitalFormLayout>(x=>x.Active).IsEqualTo(true);
+    // }
+    
     [UserTracking("Digital Forms")]
     [UserTracking("Digital Forms")]
     public class DigitalForm : Entity, IRemotable, IPersistent, ILicense<DigitalFormsLicense>//, IDuplicatable
     public class DigitalForm : Entity, IRemotable, IPersistent, ILicense<DigitalFormsLicense>//, IDuplicatable
     {
     {
@@ -47,6 +77,14 @@ namespace InABox.Core
 
 
         [NullEditor]
         [NullEditor]
         public string Report { get; set; }
         public string Report { get; set; }
+        
+        // [NullEditor]
+        // [Aggregate(typeof(ActiveFormsCount))]
+        // public int ActiveForms { get; set; }
+        //
+        // [NullEditor]
+        // [Aggregate(typeof(ActiveMobileFormsCount))]
+        // public int ActiveMobileForms { get; set; }
 
 
         public IEntityDuplicator GetDuplicator()
         public IEntityDuplicator GetDuplicator()
         {
         {

+ 7 - 1
InABox.Core/DigitalForms/Forms/DigitalFormLink.cs

@@ -27,10 +27,16 @@ namespace InABox.Core
         [EditorSequence(6)]
         [EditorSequence(6)]
         [CheckBoxEditor(Editable = Editable.Hidden)]
         [CheckBoxEditor(Editable = Editable.Hidden)]
         public bool Active { get; set; }
         public bool Active { get; set; }
-
+        
         [NullEditor]
         [NullEditor]
         public DigitalFormGroupLink Group { get; set; }
         public DigitalFormGroupLink Group { get; set; }
 
 
+        // [NullEditor]
+        // public int ActiveFormsCount { get; set; }
+        //
+        // [NullEditor]
+        // public int ActiveMobileFormsCount { get; set; }
+        
         protected override void Init()
         protected override void Init()
         {
         {
             base.Init();
             base.Init();

+ 5 - 5
InABox.Mobile/Shared/Bluetooth.cs

@@ -110,10 +110,10 @@ namespace InABox.Mobile
         private async Task<bool> UnlockDevice(IDevice idevice, String key)
         private async Task<bool> UnlockDevice(IDevice idevice, String key)
         {
         {
             bool result = false;
             bool result = false;
-            Console.WriteLine(String.Format("** Found Device: {0} {1}", idevice.Name, idevice.Rssi));
+            //Console.WriteLine(String.Format("** Found Device: {0} {1}", idevice.Name, idevice.Rssi));
             if (idevice.Rssi < -65)
             if (idevice.Rssi < -65)
             {
             {
-                Console.WriteLine(String.Format("** Device RSSI is too low: {0}", idevice.Rssi));
+                //Console.WriteLine(String.Format("** Device RSSI is too low: {0}", idevice.Rssi));
                 return false;
                 return false;
             }
             }
             try
             try
@@ -123,18 +123,18 @@ namespace InABox.Mobile
                 IService service = await idevice.GetServiceAsync(Guid.Parse("3317F54C-1C7E-EBE7-026E-3C819FD35476"));
                 IService service = await idevice.GetServiceAsync(Guid.Parse("3317F54C-1C7E-EBE7-026E-3C819FD35476"));
                 if (service != null)
                 if (service != null)
                 {
                 {
-                    Console.WriteLine("** Found Service 3317F54C-1C7E-EBE7-026E-3C819FD35476");
+                    //Console.WriteLine("** Found Service 3317F54C-1C7E-EBE7-026E-3C819FD35476");
                     ICharacteristic chr = await service.GetCharacteristicAsync(Guid.Parse("20852B39-4455-EE15-089B-D1629FE76927"));
                     ICharacteristic chr = await service.GetCharacteristicAsync(Guid.Parse("20852B39-4455-EE15-089B-D1629FE76927"));
                     if (chr != null)
                     if (chr != null)
                     {
                     {
-                        Console.WriteLine("** Found Characteristic 20852B39-4455-EE15-089B-D1629FE76927");
+                        //Console.WriteLine("** Found Characteristic 20852B39-4455-EE15-089B-D1629FE76927");
                         //var data = await chr.ReadAsync();
                         //var data = await chr.ReadAsync();
                         //Console.WriteLine("- Found Data: " + String.Join("-", data.Select(x => String.Format("{0:X2}", x))));
                         //Console.WriteLine("- Found Data: " + String.Join("-", data.Select(x => String.Format("{0:X2}", x))));
                         var newdata = Encoding.ASCII.GetBytes(key);
                         var newdata = Encoding.ASCII.GetBytes(key);
                         bool bWrite = await chr.WriteAsync(newdata);
                         bool bWrite = await chr.WriteAsync(newdata);
                         if (bWrite)
                         if (bWrite)
                         {
                         {
-                            Console.WriteLine("** Wrote Data " + String.Join("-", newdata.Select(x => String.Format("{0:X2}", x))));
+                            //Console.WriteLine("** Wrote Data " + String.Join("-", newdata.Select(x => String.Format("{0:X2}", x))));
                             //var confdata = await chr.ReadAsync();
                             //var confdata = await chr.ReadAsync();
                             //Console.WriteLine("- Read Data: " + String.Join("-", confdata.Select(x => String.Format("{0:X2}", x))));
                             //Console.WriteLine("- Read Data: " + String.Join("-", confdata.Select(x => String.Format("{0:X2}", x))));
                             result = true;
                             result = true;