public IReadOnlyList <TodoItem> GetTodoItems(string database = null, ITodoPattern pattern = null, bool includeSystemDatabases = false) { IReadOnlyList <string> databases = database != null ? new[] { database } : this.GetDatabases(includeSystemDatabases); IReadOnlyList <ITodoPattern> patterns = pattern != null ? new[] { pattern } : this.GetTodoPatterns(); return(GetTodoItems(databases, patterns)); }
/// <summary> /// Groups the results by a flat list /// </summary> /// <param name="todoPattern">ITodoPattern filter</param> public void BindFlatListData(ITodoPattern todoPattern) { var data = GetRoutineDataRecords(_view.Database.Name, todoPattern); _view.LoadResultsInFlatList(data); _view.ApplyFilter(_view.SearchText); _view.ClearSelectedResults(); }
/// <summary> /// Gets data from the source provider /// </summary> public List <RoutineDataRecord> GetDataRecords(string databaseName, ITodoPattern searchPattern) { var todoItems = _todoExplorerManager.GetTodoItems(databaseName, searchPattern); var dataRecords = todoItems.Select(t => new RoutineDataRecord { Id = t.RoutineId, Schema = t.RoutineSchema, Name = t.RoutineName, Definition = t.Text, Tag = t.Pattern, Type = GetDataRoutineType(t.RoutineType), CommentIndex = t.TextIndex, TodoItem = t }).ToList(); return(dataRecords); }
/// <summary> /// Binds the treeview from data source /// </summary> /// <param name="groupByItemType">Layout stlye</param> /// <param name="todoPattern">ITodoPattern filter</param> public void BindTreeviewData(GroupByItemType groupByItemType, ITodoPattern todoPattern) { var data = GetRoutineDataRecords(_view.Database.Name, todoPattern); switch (groupByItemType) { case GroupByItemType.Unknown: case GroupByItemType.ObjectType: _view.LoadResultsByObjectType(data); break; case GroupByItemType.CommentType: _view.LoadResultsByCommentType(data); break; default: _view.LoadResultsByObjectType(data); break; } }
public List <RoutineDataRecord> GetRoutineDataRecords(string database, ITodoPattern searchPattern) { this.DataRecords = _dataService.GetDataRecords(database, searchPattern); return(this.DataRecords); }
public List <RoutineDataRecord> GetDataRecords(string databaseName, ITodoPattern todoPattern) { var dataRecords = new List <RoutineDataRecord> { new RoutineDataRecord { Id = 1000, Schema = "HumanResources", Name = "proc_Employees_List", Definition = "--TODO: change here!", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>TODO)(.*)", Title = "TODO", Id = 1 }, CommentIndex = 1, Type = RoutineType.StoredProcedure }, new RoutineDataRecord { Id = 2000, Schema = "HumanResources", Name = "proc_Employees_Get", Definition = "--BUG: and here!", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>BUG)(.*)", Title = "BUG", Id = 4 }, CommentIndex = 2, Type = RoutineType.StoredProcedure }, new RoutineDataRecord { Id = 2000, Schema = "HumanResources", Name = "proc_Employees_Get", Definition = "--TODO: change the where condition with a better key.", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>TODO)(.*)", Title = "TODO", Id = 1 }, CommentIndex = 3, Type = RoutineType.StoredProcedure }, new RoutineDataRecord { Id = 4000, Schema = "Sales", Name = "proc_Orders_Add", Definition = "--HACK: this is a workaround and it should be changed in next release.", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>HACK)(.*)", Title = "HACK", Id = 2 }, CommentIndex = 4, Type = RoutineType.StoredProcedure }, new RoutineDataRecord { Id = 5000, Schema = "Sales", Name = "proc_OrderDetails_ListByOrderId", Definition = "--TODO: missing business logic.", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>TODO)(.*)", Title = "TODO", Id = 1 }, CommentIndex = 5, Type = RoutineType.StoredProcedure }, new RoutineDataRecord { Id = 14000, Schema = "HumanResources", Name = "udf_Employees_Get", Definition = "--TODO: Add that information.", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>TODO)(.*)", Title = "TODO", Id = 1 }, CommentIndex = 6, Type = RoutineType.Function }, new RoutineDataRecord { Id = 15000, Schema = "Sales", Name = "udf_Orders_Recompute", Definition = "--HACK: Added a hardcoded constraint. This should be improved.", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>HACK)(.*)", Title = "HACK", Id = 2 }, CommentIndex = 7, Type = RoutineType.Function }, new RoutineDataRecord { Id = 15000, Schema = "Sales", Name = "udf_Orders_Recompute", Definition = "--ASK: What to do.. What to do?", Tag = new TodoPattern { SearchPattern = @"(?<=\W|^)(?<TAG>ASK)(.*)", Title = "ASK", Id = 3 }, CommentIndex = 8, Type = RoutineType.Function }, }; if (todoPattern != null) { return(dataRecords.Where(t => t.Tag.Id == todoPattern.Id).ToList()); } return(dataRecords); }