private void outputGrantDifferencestToCell(ExcelRangeBase cell, List <GrantDifference> listOfGrantDifferences) { if (listOfGrantDifferences.Count == 0) { return; } // Missing string missingValues = String.Join(',', listOfGrantDifferences.Where(g => g.Difference == DIFFERENCE_MISSING).OrderBy(g => g.PrivilegeOrder(privilegeOrderDict)).ToList().Select(g => g.PrivilegeDisplayShort(privilegeNamesShortDict)).ToArray()); if (missingValues.Length > 0) { missingValues = String.Format("<<{0}", missingValues); } // Extra string extraValues = String.Join(',', listOfGrantDifferences.Where(g => g.Difference == DIFFERENCE_EXTRA).OrderBy(g => g.PrivilegeOrder(privilegeOrderDict)).ToList().Select(g => g.PrivilegeDisplayShort(privilegeNamesShortDict)).ToArray()); if (extraValues.Length > 0) { extraValues = String.Format(">>{0}", extraValues); } // Different string differentValues = String.Join(',', listOfGrantDifferences.Where(g => g.Difference == DIFFERENCE_DIFFERENT).OrderBy(g => g.PrivilegeOrder(privilegeOrderDict)).ToList().Select(g => g.PrivilegeDisplayShort(privilegeNamesShortDict)).ToArray()); if (differentValues.Length > 0) { differentValues = String.Format("~~{0}", differentValues); } string cellValue = String.Join("\n-and-\n", new string[] { missingValues, extraValues, differentValues }.Where(s => String.IsNullOrEmpty(s) == false)); cell.Value = cellValue; if (cellValue.ToString().Length > 12) { missingValues = String.Join('\n', listOfGrantDifferences.Where(g => g.Difference == DIFFERENCE_MISSING).OrderBy(g => g.PrivilegeOrder(privilegeOrderDict)).ToList().Select(g => g.PrivilegeDisplayLong).ToArray()); if (missingValues.Length > 0) { missingValues = String.Format("MISSING:\n{0}", missingValues); } extraValues = String.Join('\n', listOfGrantDifferences.Where(g => g.Difference == DIFFERENCE_EXTRA).OrderBy(g => g.PrivilegeOrder(privilegeOrderDict)).ToList().Select(g => g.PrivilegeDisplayLong).ToArray()); if (extraValues.Length > 0) { extraValues = String.Format("EXTRA:\n{0}", extraValues); } differentValues = String.Join('\n', listOfGrantDifferences.Where(g => g.Difference == DIFFERENCE_DIFFERENT).OrderBy(g => g.PrivilegeOrder(privilegeOrderDict)).ToList().Select(g => g.PrivilegeDisplayLong).ToArray()); if (differentValues.Length > 0) { differentValues = String.Format("DIFFERENT:\n{0}", differentValues); } cell.AddComment(String.Join("\n-and-\n", new string[] { missingValues, extraValues, differentValues }.Where(s => String.IsNullOrEmpty(s) == false)), "Snowflake"); cell.Comment.AutoFit = true; } }