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 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); }
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); }
private void btnCodeChurn_Click(object sender, RoutedEventArgs e) { long startTicks = XlHlp.DisplayInWatchWindow("Start"); Options_AZDO_TFS options = GetOptions(); try { RequestHandlers.SpeedUpStart(); //TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("http://WhateverServerUrl"); //IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer)); //VersionControlServer VsServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer)); //IBuildDetail build = buildServer.GetAllBuildDetails(new Uri("http://WhateverBuildUrl")); //List<IChangesetsummary> associatedChangesets = InformationNodeConverters.GetAssociatedChangesets(build); //foreach (IChangesetsummary changeSetData in associatedChangesets) //{ // Changeset changeSet = VsServer.GetChangeset(changeSetData.ChangesetId); // foreach (Change change in changeSet.Changes) // { // bool a = change.Item.IsContentDestroyed; // long b = change.Item.ContentLength; // } //} } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { RequestHandlers.SpeedUpEnd(); } }
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); }
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 DisplayLoopUpdates(long startTicks, Options_AZDO_TFS options, int totalItems, int itemCount) { if (itemCount % options.LoopUpdateInterval == 0) { XlHlp.DisplayInWatchWindow($"Completed {itemCount} out of {totalItems}", startTicks); } }
private void Get_TPC_Info() { long startTicks = XlHlp.DisplayInWatchWindow("Begin"); Options_AZDO_TFS options = GetOptions(); try { RequestHandlers.SpeedUpStart(); //// Get the Team Project Collections //ReadOnlyCollection<CatalogNode> projectCollectionNodes = VNCTFS.Helper.Get_TeamProjectCollectionNodes(AzureDevOpsExplorer.Presentation.Views.Server.ConfigurationServer); var tpcCatalogNode = AzureDevOpsExplorer.Presentation.Views.Server.TfsTeamProjectCollection.CatalogNode; CreateWS_TPC_Info(tpcCatalogNode, AzureDevOpsExplorer.Presentation.Views.Server.TfsTeamProjectCollection, false, options); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { RequestHandlers.SpeedUpEnd(); } XlHlp.DisplayInWatchWindow("End", 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 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); }
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); }
private void GetTestCaseInfo(TestCaseRequest request) { long startTicks = Log.EVENT_HANDLER("Enter", Common.PROJECT_NAME); try { RequestHandlers.SpeedUpStart(); char[] splitChars = { ',' }; int testCaseId = 0; Options_AZDO_TFS options = GetOptions(); foreach (string testCase in request.TestID.Split(splitChars, StringSplitOptions.None)) { if (int.TryParse(testCase, out testCaseId)) { CreateWS_TM_TestCaseInfo(testCaseId, request.TestSections, options); } AZDOHelper.ProcessLoopDelay(options); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { RequestHandlers.SpeedUpEnd(); } Log.EVENT_HANDLER("Exit", Common.PROJECT_NAME, startTicks); }
private void Get_TPC_Shelfsets() { Options_AZDO_TFS options = GetOptions(); options.OrientOutputVertically = true; // This sheet works better vertically. //ProcessCreateWorkSheetTeamProjectCollection(CreateWS_ShelveSets, teTeamProjectCollection.Text, options); MessageBox.Show("TBD - Not Implemented Yet"); }
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); }
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); }
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 XlHlp.XlLocation Add_BuildProcessTemplates(XlHlp.XlLocation insertAt, Options_AZDO_TFS options, IBuildServer buildServer, TeamProject teamProject) { return(ProcessAddSectionCommand_BuildServer(insertAt, buildServer, teamProject, "Build ProcessTemplates", Header_BuildServer.Add_BuildAgents, (insertAt, buildServer, teamProject) => Body_BuildServer.Add_BuildAgents(insertAt, options, buildServer, teamProject), "tblBPT_")); }
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); }
private void GetTeamProjectInfo(TeamProjectActionRequest request) { long startTicks = Log.EVENT_HANDLER("Enter", Common.PROJECT_NAME); Options_AZDO_TFS options = GetOptions(); var priorStatusBar = Globals.ThisAddIn.Application.StatusBar; try { Globals.ThisAddIn.Application.DisplayStatusBar = true; RequestHandlers.SpeedUpStart(); if (options.TeamProjects is null) { MessageBox.Show("No Team Project(s) selected, aborting"); } else { options.TeamProjects.Reverse(); foreach (string teamProjectName in options.TeamProjects) { try { Globals.ThisAddIn.Application.StatusBar = "Processing " + teamProjectName; CreateWS_TP(teamProjectName, request, options); Globals.ThisAddIn.Application.ActiveWorkbook.Save(); AZDOHelper.ProcessLoopDelay(options); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Globals.ThisAddIn.Application.StatusBar = priorStatusBar; RequestHandlers.SpeedUpEnd(); } Log.EVENT_HANDLER("Exit", Common.PROJECT_NAME, startTicks); }
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); }
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); }
public Options_AZDO_TFS GetOptions() { long startTicks = Log.VIEWMODEL("Enter", Common.PROJECT_NAME); Options_AZDO_TFS options = Options.Model; if (((QueriesViewModel)((Options)View).ucQueries.ViewModel).SelectedQuery != null) { Options.Model.WorkItemQuerySpec = ((QueriesViewModel)((Options)View).ucQueries.ViewModel).SelectedQuery.Model; } Log.VIEWMODEL("Exit", Common.PROJECT_NAME, startTicks); return(options); }
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 XlHlp.XlLocation Add_Info( XlHlp.XlLocation insertAt, Options_AZDO_TFS options, TfsTeamProjectCollection tpc, bool showDetails) { long startTicks = XlHlp.DisplayInWatchWindow(insertAt); XlHlp.AddLabeledInfo(insertAt.AddRow(), "Name:", tpc.Name); // HACK(crhodes) // Not sure why this is being called. Passing null is throwing exception. //insertAt = Section_WorkItemStore.Add_Info(insertAt, options, null); XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End"); return(insertAt); }
private void GetTeamProjectXML(TeamProjectActionRequest request) { long startTicks = Log.EVENT_HANDLER("Enter", Common.PROJECT_NAME); Options_AZDO_TFS options = GetOptions(); var priorStatusBar = Globals.ThisAddIn.Application.StatusBar; try { Globals.ThisAddIn.Application.DisplayStatusBar = true; RequestHandlers.SpeedUpStart(); foreach (string teamProjectName in options.TeamProjects) { try { Globals.ThisAddIn.Application.StatusBar = "Processing " + teamProjectName; Project project = AzureDevOpsExplorer.Presentation.Views.Server.WorkItemStore.Projects[teamProjectName]; Body_WorkItemStore.Get_TP_WorkItemTypesXML(options, project); //Globals.ThisAddIn.Application.ActiveWorkbook.Save(); AZDOHelper.ProcessLoopDelay(options); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Globals.ThisAddIn.Application.StatusBar = priorStatusBar; RequestHandlers.SpeedUpEnd(); } Log.EVENT_HANDLER("Exit", Common.PROJECT_NAME, startTicks); }
internal static int Add_TestConfigurations(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 TestConfiguration"); ITestConfigurationCollection testConfigurations = testManagementTeamProject.TestConfigurations.Query(query); int totalItems = testConfigurations.Count; XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testConfigurations"); foreach (ITestConfiguration testConfiguration in testConfigurations) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Id}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Name}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.AreaPath}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Description}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.IsDefault}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.LastUpdated}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.LastUpdatedByName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Revision}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.State}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testConfiguration.Values.Count}"); insertAt.IncrementRows(); itemCount++; //ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }
private static string GetTeamProjectsFilter(Options_AZDO_TFS options) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); string filter; if (options.TeamProjects.Count == 1) { filter = "AND ([System.TeamProject] == '${options.TeamProjects[0]}"; } else { filter = "AND ([System.TeamProject] in " + String.Join(",", options.TeamProjects); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(filter); }
internal static int Add_TestSettings( 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 TestSettings"); IEnumerable <ITestSettings> testSettings = testManagementTeamProject.TestSettings.Query(query); int totalItems = testSettings.Count(); XlHlp.DisplayInWatchWindow($"Processing ({ totalItems } testRuns"); foreach (ITestSettings testSetting in testSettings) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testManagementTeamProject.TeamProjectName}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Id}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.IsAutomated}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.LastUpdated}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.LastUpdatedBy}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.MachineRoles.Count}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Name}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Revision}"); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), $"{testSetting.Settings}"); insertAt.IncrementRows(); itemCount++; AZDOHelper.ProcessItemDelay(options); AZDOHelper.DisplayLoopUpdates(startTicks, options, totalItems, itemCount); } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); return(itemCount); }