public override MetricFilter GetMetricFilter() { if (this.DataList == null || !this.DataList.Items.Any()) { // use the range filter for numeric sliders return(new NumericRangeFilter { ShortTitle = this.ShortTitle, MinValue = this.MinValue, MaxValue = this.MaxValue, Type = MetricFilterTypes.NumericRange.ToString() }); } else { // use the checkbox filter for data lists var filter = new CheckboxFilter { ShortTitle = this.ShortTitle, Type = MetricFilterTypes.Checkbox.ToString() }; var items = new List <MetricFilterOption>(); foreach (var item in this.DataList.AllItems) { items.Add(new MetricFilterOption { Text = item.Text, Value = item.Value }); } filter.DataList = items; return(filter); } }
private static void Main() { Console.Write("Reading config... "); Config config = GetConfig(); Console.WriteLine("done."); var filter = new CheckboxFilter { Property = "Test", Checkbox = new CheckboxFilter.CheckboxType { Equals = true } }; List <Page> pages = DataManager.QueryDatabase(config.DatabaseId, config.Token, filter); List <Task> tasks = pages.Select(p => new Task(p)).ToList(); Task task = tasks[0]; task.Name = "000. Trololo"; task.SetDay(DateTime.Today); DataManager.AddTaskToDatabase(task, config.DatabaseId, config.Token); }
public override MetricFilter GetMetricFilter() { var filter = new CheckboxFilter { ShortTitle = this.ShortTitle, Type = MetricFilterTypes.Checkbox.ToString() }; filter.DataList.Add(new MetricFilterOption { Text = "Yes", Value = 1 }); filter.DataList.Add(new MetricFilterOption { Text = "No", Value = 0 }); return(filter); }
public override MetricFilter GetMetricFilter() { var filter = new CheckboxFilter { ShortTitle = this.ShortTitle, Type = MetricFilterTypes.Checkbox.ToString() }; var items = new List <MetricFilterOption>(); foreach (var item in this.DataList.AllItems) { items.Add(new MetricFilterOption { Text = item.Text, Value = item.Value }); } filter.DataList = items; return(filter); }