Switch to using string instead of bool for checkbox values

This commit is contained in:
2020-08-03 21:34:09 -04:00
parent b1bff76159
commit cb1b6c6e47
10 changed files with 62 additions and 15 deletions
+13 -5
View File
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace LeafWeb.WebCms.Models
{
@@ -57,10 +58,17 @@ namespace LeafWeb.WebCms.Models
public string phips2 { get; set; }
[Display(Name = "Show Only Successfully Completed")]
public bool? compl { get; set; }
[UIHint("Checkbox")]
public string compl { get; set; }
public bool ShowOnlySuccessfullyCompleted => !string.IsNullOrEmpty(compl);
[Display(Name = "Only my data")]
public bool? usr { get; set; }
[UIHint("Checkbox")]
public string usr { get; set; }
public bool OnlyUserData => !string.IsNullOrEmpty(usr);
public bool HasExtendedParameters =>
!(
@@ -74,12 +82,12 @@ namespace LeafWeb.WebCms.Models
&& string.IsNullOrEmpty(pari)
&& string.IsNullOrEmpty(tleaf)
&& string.IsNullOrEmpty(phips2)
&& !(compl.HasValue && compl.Value)
&& string.IsNullOrEmpty(compl)
);
public bool HasParameters =>
HasExtendedParameters
|| !string.IsNullOrEmpty(q)
|| usr.HasValue && usr.Value;
|| !string.IsNullOrEmpty(usr);
}
}