public bool IsPartiallySet() // Ar bent vienas (nuo arba iki) laukas nustatytas { if (IsDropDown) { return(DropDownValues != null); } switch (Type) { case InputType.Text: return(!String.IsNullOrEmpty(Text)); case InputType.Decimal: return(Price.Any(x => x.HasValue)); case InputType.Number: return(Number.Any(x => x.HasValue)); case InputType.DateTime: return(Date.Any(x => x != null)); case InputType.Checkbox: return(Bool.HasValue); } return(false); }
public RefineByBar RefineByBar() { var bar = new RefineByBar { ShowLocation = true, Filters = new List <RefineByFilters>() }; if (!string.IsNullOrEmpty(KeepTag) || !string.IsNullOrEmpty(Tag)) { var featured = new RefineByFilters { Label = "Featured events", Mandatory = false, Name = "tag", Items = new List <RefineByFilterItems> { new RefineByFilterItems { Label = KeepTag, Checked = !string.IsNullOrEmpty(Tag), Value = KeepTag } } }; bar.Filters.Add(featured); } var price = new RefineByFilters { Label = "Price", Mandatory = true, Name = "price", Items = new List <RefineByFilterItems> { new RefineByFilterItems { Label = "Paid", Checked = Price == null || Price.Any(p => p == "paid"), Value = "paid" }, new RefineByFilterItems { Label = "Free", Checked = Price == null || Price.Any(p => p == "free"), Value = "free" } } }; bar.Filters.Add(price); return(bar); }
public bool IsSet() // Ar abu (nuo ir iki) laukai nustatyti { switch (Type) { case InputType.Text: return(Text.Length > 0); case InputType.Decimal: return(!Price.Any(x => !x.HasValue)); case InputType.Number: return(!Number.Any(x => !x.HasValue)); case InputType.DateTime: return(!Date.Any(x => x is null)); case InputType.Checkbox: return(Bool.HasValue); } return(false); }