internal Dictionary <string, DatabaseColumn> GetColumnsOfSection(Dictionary <string, DatabaseColumn> databaseColumns, DatabaseColumn.ColumnSectionEnum columnSection) { var sectionColumns = new Dictionary <string, DatabaseColumn>(); foreach (var databaseColumn in databaseColumns) { if (databaseColumn.Value.ColumnSection == columnSection) { sectionColumns.TryAdd(databaseColumn.Key, databaseColumn.Value); } } return(sectionColumns); }
internal static DatabaseColumn GetColumn(string columnLetters, string columnHeader) { bool editableByCommand = false; DatabaseColumn.ColumnSectionEnum columnSection = DatabaseColumn.ColumnSectionEnum.UnidentifiedSection; //TODO: figure out a better way of doing this var columns = GetIdentifierColumnsInfo(); if (columns.ContainsKey(columnHeader)) { editableByCommand = columns.GetValueOrDefault(columnHeader); columnSection = DatabaseColumn.ColumnSectionEnum.Identifiers; } else { columns = GetMemberInfoColumnsInfo(); if (columns.ContainsKey(columnHeader)) { editableByCommand = columns.GetValueOrDefault(columnHeader); columnSection = DatabaseColumn.ColumnSectionEnum.MemberInfo; } else { columns = GetRolesColumnsInfo(); if (columns.ContainsKey(columnHeader)) { editableByCommand = columns.GetValueOrDefault(columnHeader); columnSection = DatabaseColumn.ColumnSectionEnum.Roles; } else { columns = GetSignupColumnsInfo(); if (columns.ContainsKey(columnHeader)) { editableByCommand = columns.GetValueOrDefault(columnHeader); columnSection = DatabaseColumn.ColumnSectionEnum.Signup; } else { columns = GetActivityColumnsInfo(); if (columns.ContainsKey(columnHeader)) { editableByCommand = columns.GetValueOrDefault(columnHeader); columnSection = DatabaseColumn.ColumnSectionEnum.Activity; } else { columns = GetGearColumnsInfo(); if (columns.ContainsKey(columnHeader)) { editableByCommand = columns.GetValueOrDefault(columnHeader); columnSection = DatabaseColumn.ColumnSectionEnum.Gear; } } } } } } var column = new DatabaseColumn(columnLetters, columnHeader, editableByCommand, columnSection); return(column); }