Exemplo n.º 1
0
 /// <summary>
 /// To the model.
 /// </summary>
 /// <returns>IssueFilter.</returns>
 public IssueFilter ToModel()
 {
     var model = new IssueFilter();
     model.Query = Query;
     model.HasDeadline = HasDeadline;
     model.IsActualDeadline = IsActualDeadline;
     model.Types = new HashSet<IssueType>(Types.Where(t => t.IsChecked).Select(t => t.IssueType));
     model.Statuses = new HashSet<IssueStatus>(Statuses.Where(t => t.IsChecked).Select(t => t.IssueStatus));
     model.Priorities = new HashSet<int>(Priorities.Where(t => t.IsChecked).Select(t => t.Priority));
     return model;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the model.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="filter">The filter.</param>
 public void SetModel(IssueFilter model, IssueFilter filter)
 {
     Types.Clear();
     Statuses.Clear();
     Priorities.Clear();
     foreach (
         TypeViewModel type in model.Types.Select(t => new TypeViewModel(Parent, t, filter.Types.Contains(t))))
     {
         Types.Add(type);
     }
     foreach (
         StatusViewModel status in
             model.Statuses.Select(t => new StatusViewModel(Parent, t, filter.Statuses.Contains(t))))
     {
         Statuses.Add(status);
     }
     foreach (
         PriorityViewModel priority in
             model.Priorities.Select(t => new PriorityViewModel(Parent, t, filter.Priorities.Contains(t))))
     {
         Priorities.Add(priority);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the full filter.
 /// </summary>
 /// <returns>IssueFilter.</returns>
 public IssueFilter GetFullFilter()
 {
     var filter = new IssueFilter();
     filter.Priorities = new HashSet<int>(GetPriorities());
     filter.Statuses = new HashSet<IssueStatus>(GetStatuses());
     filter.Types = new HashSet<IssueType>(GetTypes());
     return filter;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the issues.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>IEnumerable{Issue}.</returns>
 public IEnumerable<Issue> GetIssues(IssueFilter filter)
 {
     if (filter.HasQuery)
     {
         return Document.Issues.Values.Where(
             i => filter.Types.Contains(i.Type) &&
                  filter.Statuses.Contains(i.Status) &&
                  filter.Priorities.Contains(i.Priority) &&
                  Regex.IsMatch(i.Summary.ToLower(), filter.Query.ToLower()));
     }
     return Document.Issues.Values.Where(
         i => filter.Types.Contains(i.Type) &&
              filter.Statuses.Contains(i.Status) &&
              filter.Priorities.Contains(i.Priority));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the default filter.
 /// </summary>
 /// <returns>IssueFilter.</returns>
 public IssueFilter GetDefaultFilter()
 {
     var filter = new IssueFilter();
     filter.Priorities = new HashSet<int>(GetPriorities());
     filter.Statuses =
         new HashSet<IssueStatus>(new[] {IssueStatus.Open, IssueStatus.InProgress, IssueStatus.Resolved});
     filter.Types = new HashSet<IssueType>(GetTypes());
     return filter;
 }