public static void SendEmail(MailMessage message) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_APPNAME); if (Config.SMTP_Server != "") { SmtpClient smtp = new SmtpClient(Config.SMTP_Server); try { smtp.Send(message); } catch (Exception ex) { Log.Error(ex, Common.LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8); throw new ApplicationException("Cannot Send Email"); } } else { // TODO(crhodes): Something about no SMTP throw new ApplicationException("SMTP Server not configured"); } Log.APPLICATION("Exit", Common.LOG_APPNAME, startTicks); }
internal static void Add_TP_WorkItemTypes(XlHlp.XlLocation insertAt) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Team Project"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Name"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Count"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "FieldCount"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LastCreateDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LastChangedDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LastRevisedDate"); // TODO(crhodes) // Since we now can pass in a CellFormatSpecification, might be able to go back to just using insertAt.AddOffsetColumn insertAt.AddOffsetColumnX(); CellFormatSpecification lucidia7 = insertAt.CreateCellFormat("lucidia7", fontSize: 7); lucidia7.Font.Name = "Lucida Sans Typewriter"; XlHlp.AddColumnHeaderToSheetX(insertAt.workSheet, insertAt.RowCurrent, insertAt.ColumnOffset, 180, "Transitions", lucidia7); insertAt.IncrementRows(); Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); }
internal static StringBuilder DisplayAllStructuredTriviaVB(string fileNameAndPath) { Int64 startTicks = Log.APPLICATION($"Enter ({fileNameAndPath})", Common.LOG_APPNAME); StringBuilder sb = new StringBuilder(); var sourceCode = ""; using (var sr = new StreamReader(fileNameAndPath)) { sourceCode = sr.ReadToEnd(); } var tree = VB.VisualBasicSyntaxTree.ParseText(sourceCode); //var walker = new VNC.CodeAnalysis.SyntaxWalkers.VB.AllStructuredTrivia(); var walker = new VNC.CodeAnalysis.SyntaxWalkers.VB.VisitAll(SyntaxWalkerDepth.StructuredTrivia); walker.Messages = sb; walker.Visit(tree.GetRoot()); var crc32 = walker.GetCRC32(); sb.AppendFormat("CRC32:({0})", crc32); Log.APPLICATION("Exit", Common.LOG_APPNAME, startTicks); return(sb); }
internal static string ParseQueryTokens( string tokenizedQuery, Options_AZDO_TFS options, Project project) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); string query = tokenizedQuery; if (project != null) { query = query.Replace("@PROJECT", String.Format("{0}", project.Name)); } query = query.Replace("@STARTDATE", options.StartDate.ToShortDateString()); query = query.Replace("@ENDDATE", options.EndDate.ToShortDateString()); if (options.WorkItemTypes.Count > 0) { query += GetWorkItemTypesFilter(options); } // NOTE(crhodes) // Have moved to startDate and endDate. No one should be using GoBackDays, but check in Excel Template file (query). //query = query.Replace("@goBackDays", options.GoBackDays.ToString()); Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(query); }
internal static void Add_TP_Shelvesets( XlHlp.XlLocation insertAt, Options_AZDO_TFS options, Shelveset[] shelvesets) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); try { foreach (Shelveset item in shelvesets) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), item.OwnerDisplayName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), item.OwnerName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), item.Name); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), item.CreationDate.ToString()); //ExcelHlp.AddContentToCell(insertAt.AddOffsetColumn(), item.DisplayName); //ExcelHlp.AddContentToCell(insertAt.AddOffsetColumn(), item.QualifiedName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), item.CheckinNote.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), item.Comment); insertAt.IncrementRows(); } } catch (Exception ex) { string msg = string.Format("{0} - {1}", "TP", ex.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), msg); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); }
internal static int Add_TestResolutionStates( Excel.XlLocation insertAt, Options_AZDO_TFS options, ITestManagementTeamProject testManagementTeamProject) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); int itemCount = 0; IEnumerable <ITestResolutionState> testResolutionStates = testManagementTeamProject.TestResolutionStates.Query(); int totalItems = testResolutionStates.Count(); XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testResolutionStates"); foreach (ITestResolutionState testResolutionState in testManagementTeamProject.TestResolutionStates.Query()) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResolutionState.Id}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResolutionState.Name}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResolutionState.Project.TeamProjectName}"); insertAt.IncrementRows(); itemCount++; //ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }
internal static void Add_TP_Workspaces( XlHlp.XlLocation insertAt, Options_AZDO_TFS options, Workspace[] workSpaces) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); foreach (Workspace workspace in workSpaces) { insertAt.ClearOffsets(); // Keep in same order with headers, supra. XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), workspace.Computer); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), workspace.Name); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), workspace.OwnerDisplayName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), workspace.OwnerName); //ExcelHlp.AddContentToCell(rngOutput.Offset[currentRow, col++], workspace.DisambiguatedDisplayName); //ExcelHlp.AddContentToCell(rngOutput.Offset[currentRow, col++], workspace.DisplayName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), workspace.LastAccessDate.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), workspace.Comment); //ExcelHlp.AddContentToCell(rngOutput.Offset[XlLocation.Rows, col++], workspace.QualifiedName); insertAt.IncrementRows(); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); }
private string GetTeamProjectsFilter(Options_AZDO_TFS options) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); StringBuilder filter = new StringBuilder(); if (options.TeamProjects.Count == 1) { filter.Append(" AND [System.TeamProject] == " + $"{ options.TeamProjects[0].WrapInSngQuotes() }"); } else { filter.Append(" AND [System.TeamProject] in ("); if (options.TeamProjects.Count >= 1) { filter.Append('\'').Append(options.TeamProjects[0]).Append('\''); } if (options.TeamProjects.Count > 1) { for (int i = 1; i < options.TeamProjects.Count; i++) { //filter.Append($", '{options.TeamProjects[i]}'"); filter.Append(", '").Append(options.TeamProjects[i]).Append('\''); } } filter.Append(')'); } Log.APPLICATION($"Exit ({filter})", Common.LOG_CATEGORY, startTicks); return(filter.ToString()); }
internal static void Add_TP_Developers( XlHlp.XlLocation insertAt, Options_AZDO_TFS options, string teamProjectName, SortedDictionary <string, int> developers, SortedDictionary <string, DateTime> developersLatestDate, SortedDictionary <string, DateTime> developersEarliestDate) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); foreach (string developer in developers.Keys) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), teamProjectName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), developer); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), developers[developer].ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), developersEarliestDate[developer].ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), developersLatestDate[developer].ToString()); insertAt.IncrementRows(); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); }
internal static int Add_Queries( Excel.XlLocation insertAt, Options_AZDO_TFS options, ITestManagementTeamProject testManagementTeamProject) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); int itemCount = 0; int totalItems = testManagementTeamProject.Queries.Count; XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } Queries"); foreach (ITestCaseQuery query in testManagementTeamProject.Queries) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), query.Name); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), query.Owner); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), query.QueryText); insertAt.IncrementRows(); itemCount++; AZDOHelper.ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }
public static void ProcessCreateWorkSheetTeamProjectCollection(ProcessCreateWorksheetCommandSections command, string teamProjectCollectionUri, Options_AZDO_TFS options) { long startTicks = Log.APPLICATION($"Enter ({command.Method.Name})", Common.PROJECT_NAME); try { SpeedUpStart(); Common.PriorStatusBar = Globals.ThisAddIn.Application.StatusBar.ToString(); command(teamProjectCollectionUri, options); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { SpeedUpEnd(); Globals.ThisAddIn.Application.StatusBar = Common.PriorStatusBar; } Log.APPLICATION($"Exit ({command.Method.Name})", Common.PROJECT_NAME, startTicks); }
public static void ProcessCreateWorkSheet(ProcessCreateWorksheetCommand command, Options_AZDO_TFS options) { long startTicks = Log.APPLICATION($"Enter ({command.Method.Name})", Common.PROJECT_NAME); XlHlp.DisplayInWatchWindow(string.Format("{0} {1}", MethodBase.GetCurrentMethod().Name, command.Method.Name)); try { SpeedUpStart(); Common.PriorStatusBar = Globals.ThisAddIn.Application.StatusBar.ToString(); command(options); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { SpeedUpEnd(); Globals.ThisAddIn.Application.StatusBar = Common.PriorStatusBar; } Log.APPLICATION($"Exit ({command.Method.Name})", Common.PROJECT_NAME, startTicks); }
internal static void Add_TP_WorkItemFields(XlHlp.XlLocation insertAt) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Team Project"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "WIT Name"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Name"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "FieldType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "SystemType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 6, "Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "IsComputed"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "IsCoreField"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "IsEditable"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "IsIdentity"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "IsIndexed"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "IsQueryable"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "ReferenceName"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "ReportingAttributes.Name"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "ReportingAttributes.ReferenceName"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Usage"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "FieldNameType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 60, "AllowedValues"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 60, "ProhibitedValues"); insertAt.IncrementRows(); Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); }
public static void GetHelpOnTopic(string helpTopic) { Int64 startTicks = Log.APPLICATION($"Enter ()", Common.LOG_APPNAME); switch (helpTopic) { case "DatabaseExpandTemplate": MessageBox.Show("Display Help On " + helpTopic); break; case "InstanceExpandTemplate": MessageBox.Show("Display Help On " + helpTopic); break; case "Servers": MessageBox.Show("Display Help On " + helpTopic); break; case "SnapShotControlsTemplate": MessageBox.Show("Display Help On " + helpTopic); break; default: MessageBox.Show("Default Display Help On " + helpTopic); break; } Log.APPLICATION("Exit", Common.LOG_APPNAME, startTicks); }
internal static int Add_TestVariables( Excel.XlLocation insertAt, Options_AZDO_TFS options, ITestManagementTeamProject testManagementTeamProject) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); int itemCount = 0; string query = String.Format( "SELECT *" + " FROM TestVariable"); IEnumerable <ITestVariable> testVariables = testManagementTeamProject.TestVariables.Query(); int totalItems = testVariables.Count(); XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testVariables"); foreach (ITestVariable testVariable in testVariables) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Id}"); StringBuilder allowedValues = new StringBuilder(); foreach (var item in testVariable.AllowedValues) { if (allowedValues.Length == 0) { allowedValues.Append($"{item.Value}"); } else { allowedValues.Append($"; {item.Value}"); } } XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{allowedValues}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Description}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Name}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testVariable.Revision}"); insertAt.IncrementRows(); itemCount++; AZDOHelper.ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }
internal static void CreateWS_All_TPC_LastChangeset(Options_AZDO_TFS options, VersionControlServer versionControlServer) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); try { XlHlp.XlLocation insertAt = CreateNewWorksheet(string.Format("{0}_{1}", "All_TPC", "LastChangeset"), options); XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Last Changeset All TeamProjects", AzureDevOpsExplorer.Presentation.Views.Server.TfsTeamProjectCollection.Name); insertAt.MarkStart(XlHlp.MarkType.GroupTable); Header_VersionControlServer.Add_Changesets(insertAt); //Body_VersionControlServer.Add_Changesets(insertAt, options, versionControlServer); foreach (var teamProjectName in options.TeamProjects) { insertAt.ClearOffsets(); long loopTicks = Log.Trace($"Processing {teamProjectName}", Common.PROJECT_NAME); TeamProject teamProject = VNCTFS.Helper.Get_TeamProject(versionControlServer, teamProjectName.Trim()); if (teamProject != null) { Globals.ThisAddIn.Application.StatusBar = $"Processing {teamProject.Name}"; Body_VersionControlServer.Add_TP_Changesets(insertAt, options, Presentation.Views.Server.VersionControlServer, teamProject); AZDOHelper.ProcessLoopDelay(options); } else { XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), teamProjectName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "No VCS Project"); insertAt.IncrementRows(); } Log.Trace($"EndProcessing {teamProjectName}", Common.PROJECT_NAME, loopTicks); } insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tbl_{0}", insertAt.workSheet.Name)); insertAt.Group(insertAt.OrientVertical, hide: true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); }
public static void SendFeedback() { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_APPNAME); var win1 = new User_Interface.Windows.ProvideFeedback(); win1.Show(); Log.APPLICATION("Exit", Common.LOG_APPNAME, startTicks); }
internal static int Add_TestSuites( Excel.XlLocation insertAt, Options_AZDO_TFS options, ITestManagementTeamProject testManagementTeamProject) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); int itemCount = 0; //string query = String.Format( // "SELECT [System.Id], [System.Title]" // + " FROM WorkItems" // + " WHERE [System.WorkItemType] = 'Test Suite'" // + " AND [Team Project] = '{0}'", testManagementTeamProject.TeamProjectName); string query = String.Format( "SELECT *" + " FROM TestSuite" ); ITestSuiteCollection testSuites = testManagementTeamProject.TestSuites.Query(query); int totalItems = testSuites.Count; XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testSuites"); foreach (var testSuite in testSuites) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Id}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Title}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Description}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.State}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.LastUpdated}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.LastUpdatedByName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.TestCaseCount}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.TestSuiteType}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.AllTestCases.Count}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Revision}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Plan.Id}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSuite.Plan.Name}"); insertAt.IncrementRows(); itemCount++; AZDOHelper.ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }
internal static void ProcessItemDelay(Options_AZDO_TFS options) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); if (options.EnableDelays && options.ItemDelaySeconds > 0) { Thread.Sleep(Convert.ToInt16(options.ItemDelaySeconds * 1000)); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); }
private XlHlp.XlLocation CreateNewWorksheet(string sheetName, Options_AZDO_TFS options, [CallerMemberName] string callerName = "") { Int64 startTicks = Log.APPLICATION($"Begin: sheetName: {sheetName}", Common.PROJECT_NAME); string safeSheetName = XlHlp.SafeSheetName(sheetName); Worksheet ws = XlHlp.NewWorksheet(safeSheetName, beforeSheetName: "FIRST"); XlHlp.XlLocation insertAt = new XlHlp.XlLocation(ws, options.StartingRow, options.StartingColumn, options.OrientOutputVertically); XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Date Run", DateTime.Now.ToString()); XlHlp.DisplayInWatchWindow("End", startTicks); if (!options.FormatSpecs.IsInitialized) { options.FormatSpecs.Initialize(insertAt); } using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog()) { string strOutputFile = null; try { saveFileDialog.FileName = "AzureDevOpsExplorer.xlsx"; //saveFileDialog.InitialDirectory = startingFolder; if (System.Windows.Forms.DialogResult.Cancel == saveFileDialog.ShowDialog()) { Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); return(insertAt); } else { strOutputFile = saveFileDialog.FileName; } if (string.IsNullOrEmpty(strOutputFile)) { Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); return(insertAt); } Globals.ThisAddIn.Application.ActiveWorkbook.SaveAs(strOutputFile); } catch (Exception ex) { MessageBox.Show(ex.Message); } } Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); return(insertAt); }
internal static int Add_TestResults( Excel.XlLocation insertAt, Options_AZDO_TFS options, ITestManagementTeamProject testManagementTeamProject) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); int itemCount = 0; string query = String.Format( "SELECT *" + " FROM TestResult" + " WHERE [DateCreated] > '1/1/2021'"); ITestCaseResultCollection testCaseResults = testManagementTeamProject.TestResults.Query(query); int totalItems = testCaseResults.Count; int[] associatedWIs = testCaseResults.QueryAssociatedWorkItems(); XlHlp.DisplayInWatchWindow($"Processing ({ totalItems }) testCaseResults"); foreach (ITestResult testResult in testCaseResults) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName); // IAttachmentOwner XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Attachments.Count}"); // ITestResult XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.CollectorsEnabled.Count}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Comment}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.DateCreated}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.DateStarted}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.DateCompleted}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Duration}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.ErrorMessage}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testResult.Outcome}"); insertAt.IncrementRows(); itemCount++; AZDOHelper.ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }
internal static int Add_TestEnvironments( Excel.XlLocation insertAt, Options_AZDO_TFS options, ITestManagementTeamProject testManagementTeamProject) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); int itemCount = 0; string query = String.Format( "SELECT *" + " FROM TestEnvironment"); var testEnvironments = testManagementTeamProject.TestEnvironments.Query(); var totalItems = testEnvironments.Count(); XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testEnvironments"); foreach (ITestEnvironment testEnvironment in testEnvironments) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testEnvironment.Id.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Name}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.ControllerDisplayName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.ControllerEnvironmentId}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.ControllerName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.DateCreated}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Description}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.DisplayName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.EnvironmentType}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Error}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.InvalidProperties.Count()}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.IsDirty}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.LabEnvironmentUri}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.LabServerUri}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.MachineRoles.Count}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.Owner}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.TeamProject.TeamProjectName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testEnvironment.TestController.Name}"); insertAt.IncrementRows(); itemCount++; //ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }
//public Boolean RetrieveRevisions { get; set; } #endregion #region Public Methods /// <summary> /// Maybe this should be PrepareQuery /// </summary> /// <param name="options"></param> /// <param name="projectName"></param> public void ReplaceQueryTokens( Options_AZDO_TFS options, string projectName = null) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); Query = QueryWithTokens; //if ((options.WorkItemQuerySpec.Fields?.Count ?? 0) > 0) //{ Query = Query.Replace("@FIELDS", GetFieldsToRetrieve(options)); //} //else //{ // Query = Query.Replace("@FIELDS", "[System.Id]"); //} // TODO(crhodes) // Until we better think through how to handle looping delays across Projects // Support both the @PROJECT token and TeamProjectFilter //if ((options.TeamProjects?.Count ?? 0) > 0) //{ // Query += GetTeamProjectsFilter(options); //} //else if (projectName != null) //{ // Query = Query.Replace("@PROJECT", $"{projectName}"); //} if (Query.Contains("@PROJECT") && projectName != null) { Query = Query.Replace("@PROJECT", $"{projectName}"); } else { if ((options.TeamProjects?.Count ?? 0) > 0) { Query += GetTeamProjectsFilter(options); } } Query = Query.Replace("@STARTDATE", options.StartDate.ToShortDateString()); Query = Query.Replace("@ENDDATE", options.EndDate.ToShortDateString()); if ((options.WorkItemTypes?.Count ?? 0) > 0) { Query += GetWorkItemTypesFilter(options); } Log.APPLICATION($"Exit ({Query})", Common.LOG_CATEGORY, startTicks); }
internal static void Add_TP_WorkItemDetails(XlHlp.XlLocation insertAt, Options_AZDO_TFS options) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Project"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Type"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Title"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "CreatedBy"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "CreatedDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "ChangedBy"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "ChangedDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "AuthorizedDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "RevisedDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Rev"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Revision"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "State"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Reason"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Tags"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "AreaPath"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "IterationPath"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "RelatedLinkCount"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "ExternalLinkCount"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "HyperLinkCount"); // NOTE(crhodes) // The Query can specify additional fields to display // They are added to the query to avoid a round trip if accessed // after the result set is returned. // Add Headers for any requested if ((options.WorkItemQuerySpec.Fields?.Count ?? 0) > 0) { foreach (string field in options.WorkItemQuerySpec.Fields) { XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, field); } } insertAt.IncrementRows(); Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); }
internal static void Add_TP_Iterations(XlHlp.XlLocation insertAt) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Team Project"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Iteration"); // TODO(crhodes) // This can have a variable number of columns. Not sure how to label them. insertAt.IncrementRows(); Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); }
internal static void Add_TP_WorkItem_Links(XlHlp.XlLocation insertAt) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "ArtifactLinkType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "BaseType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "Comment"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsLocked"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsNew"); insertAt.IncrementRows(); Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); }
internal static void Add_TP_WorkItem_WorkItemLinks(XlHlp.XlLocation insertAt) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Source.Type"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "Source.Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Source.State"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Source.Title"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Target.Type"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "Target.Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Target.State"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Target.Title"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Target.Created"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Target.CreatedBy"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Link Source.Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Link Target.Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "AddedBy"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "AddedDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 18, "ArtifactLinkType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 12, "BaseType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "ChangedDate"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Comment"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsLocked"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsNew"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "LinkTypeEnd.Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LinkTypeEnd.ImmutableName"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LinkTypeEnd.IsForwardLink"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 60, "LinkTypeEnd.LinkType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LinkTypeEnd.Name"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "LinkTypeEnd.OppositeEnd.Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LinkTypeEnd.OppostieEnd.ImmutableName"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LinkTypeEnd.OppostieEnd.IsForwardLink"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 60, "LinkTypeEnd.OppostieEnd.LinkType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LinkTypeEnd.OppositeEnd.Name"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "RemovedBy"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "RemovedDate"); insertAt.IncrementRows(); Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); }
internal static int Add_TestCases(Excel.XlLocation insertAt, Options_AZDO_TFS options, ITestManagementTeamProject testManagementTeamProject) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); int count = 0; string query = String.Format( "SELECT [System.Id], [System.Title]" + " FROM WorkItems" + " WHERE [System.WorkItemType] = 'Test Case'" + " AND [Team Project] = '{0}'", testManagementTeamProject.TeamProjectName); //string query = String.Format( // "SELECT *" // + " FROM TestCase"); // NOTE(\) // Seems like all fields get populated. //int countQueries = testManagementTeamProject.Queries.Count; foreach (var testCase in testManagementTeamProject.TestCases.Query(query)) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testManagementTeamProject.TeamProjectName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.Id.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.Title); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.Description); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.DateCreated.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.DateModified.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.Revision.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.State); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.Links.Count.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.TestSuiteEntry.Id.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), testCase.TestSuiteEntry.Title); insertAt.IncrementRows(); count++; } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(count); }
internal static void Add_TP_WorkItemFieldValues(XlHlp.XlLocation insertAt) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "Id"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 45, "Name"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 45, "ReferenceName"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "OriginalValue"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Value"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "FieldType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "SystemType"); insertAt.IncrementRows(); Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); }
internal static StringBuilder ParseCSDepthNode(string sourceCode) { Int64 startTicks = Log.APPLICATION($"Enter ({sourceCode})", Common.LOG_APPNAME); StringBuilder sb = new StringBuilder(); SyntaxTree tree = CS.CSharpSyntaxTree.ParseText(sourceCode); var walker = new VNC.CodeAnalysis.SyntaxWalkers.CS.VisitAll(SyntaxWalkerDepth.Node); walker.Messages = sb; walker.Visit(tree.GetRoot()); Log.APPLICATION("Exit", Common.LOG_APPNAME, startTicks); return(sb); }