aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.BugReporter
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-05-08 17:01:22 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-05-08 17:01:22 +0300
commit113eaf4d8a37e212b8528d41e400b346ce9f51d2 (patch)
tree757df6c19de09061fad3b5a0b3954f0bbc98747b /Software/Visual_Studio/Utilities/Tango.BugReporter
parentcdba3267d2a47b3bff8cf3ec0219223e36e234ff (diff)
downloadTango-113eaf4d8a37e212b8528d41e400b346ce9f51d2.tar.gz
Tango-113eaf4d8a37e212b8528d41e400b346ce9f51d2.zip
Added improvements to stubs UI.
Implemented Bug Reporter engine!
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.BugReporter')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/App.config14
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/Program.cs258
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/Properties/AssemblyInfo.cs36
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/Tango.BugReporter.csproj90
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/bug.pngbin0 -> 1045 bytes
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/packages.config5
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/task.pngbin0 -> 1042 bytes
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BugReporter/twine-logo.jpgbin0 -> 3761 bytes
8 files changed, 403 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/App.config b/Software/Visual_Studio/Utilities/Tango.BugReporter/App.config
new file mode 100644
index 000000000..b93a07aa7
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/App.config
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
+ </startup>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/Program.cs b/Software/Visual_Studio/Utilities/Tango.BugReporter/Program.cs
new file mode 100644
index 000000000..b9b1897b1
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/Program.cs
@@ -0,0 +1,258 @@
+using MigraDoc.DocumentObjectModel;
+using MigraDoc.DocumentObjectModel.Shapes.Charts;
+using MigraDoc.DocumentObjectModel.Tables;
+using MigraDoc.Rendering;
+using PdfSharp.Drawing;
+using PdfSharp.Pdf;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Helpers;
+using Tango.TFS;
+
+namespace Tango.BugReporter
+{
+ class Program
+ {
+ private static List<Color> _colors = new List<Color>()
+ {
+ Colors.Crimson,
+ Colors.Coral,
+ Colors.Khaki,
+ Colors.Wheat,
+ Colors.PaleGreen,
+ Colors.PaleTurquoise,
+ Colors.CadetBlue,
+ Colors.Lavender,
+ Colors.SlateBlue,
+ Colors.LightSteelBlue,
+ Colors.PowderBlue,
+ Colors.Silver,
+ Colors.SlateGray,
+ };
+
+ static void Main(string[] args)
+ {
+ String startPath = AssemblyHelper.GetCurrentAssemblyFolder();
+
+ ITeamFoundationServiceClient tfs = new TeamFoundationServiceClient("https://twinetfs.visualstudio.com/DefaultCollection", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa");
+ var project = tfs.GetProject("Tango").Result;
+
+ var allItems = tfs.GetAllWorkItems(project).Result.OrderByDescending(x => x.Type).OrderBy(x => x.Severity).ToList();
+ var activeItems = allItems.Where(x => x.State == State.Active || x.State == State.New).ToList();
+ var resolvedItems = allItems.Where(x => x.State == State.Resolved).ToList();
+
+ Document document = new Document();
+ document.Info.Title = "Tango Bug Report";
+ document.Info.Author = "Twine Solutions LTD";
+
+ document.DefaultPageSetup.TopMargin = 5;
+ document.DefaultPageSetup.RightMargin = 5;
+ document.DefaultPageSetup.LeftMargin = 5;
+
+ Style style = document.Styles["Normal"];
+ style.Font.Size = 7;
+
+ var section = document.AddSection();
+ section.PageSetup.PageFormat = PageFormat.A4;
+
+
+
+ var headParagraph = section.AddParagraph();
+ headParagraph.Format.Alignment = ParagraphAlignment.Left;
+ headParagraph.Format.Font.Size = 16;
+ headParagraph.Format.Font.Bold = true;
+ headParagraph.Format.SpaceBefore = "8mm";
+ headParagraph.Format.SpaceAfter = "5mm";
+ headParagraph.Format.RightIndent = "5mm";
+ headParagraph.Format.Font.Color = Colors.DimGray;
+
+ var img = headParagraph.AddImage(Path.Combine(startPath, "twine-logo.jpg"));
+ headParagraph.AddSpace(5);
+ var t = headParagraph.AddText(" Twine Solutions VSTS Report");
+
+ var pp = section.AddParagraph(String.Format("This report was generated on {0}. Below you can find a daily summery of the Tango project, work items state and urgency.", DateTime.Now.ToShortDateString()));
+ pp.Format.LeftIndent = "2cm";
+
+ AddTable(section, "All Active Items", activeItems);
+
+ section.AddPageBreak();
+
+ AddTable(section, "Created Today", activeItems.Where(x => x.CreatedDate.Date == DateTime.Now.Date));
+
+ section.AddPageBreak();
+
+ AddTable(section, "Resolved Today", resolvedItems.Where(x => x.ResolvedDate.Date == DateTime.Now.Date));
+
+ section.AddPageBreak();
+
+ AddChart(section, ChartType.Column2D, "Items Per Member", activeItems.GroupBy(x => x.AssignedTo), nameof(TeamMember.DisplayName));
+
+ section.AddPageBreak();
+
+ AddChart(section, ChartType.Bar2D, "Items Per Area", activeItems.GroupBy(x => x.Area.Name), null);
+
+ section.AddPageBreak();
+
+ foreach (var g in activeItems.GroupBy(x => x.Area.Name))
+ {
+ AddTable(section, g.Key + " Items", g);
+
+ section.AddPageBreak();
+ }
+
+ var group = activeItems.GroupBy(x => x.AssignedTo);
+
+ var file = PathHelper.GetTempFilePath();
+
+ PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.None);
+ pdfRenderer.Document = document;
+ pdfRenderer.RenderDocument();
+ pdfRenderer.PdfDocument.Save(file);
+
+ ITeamFoundationEmailClient emailClient = new TeamFoundationEmailClient(new System.Net.NetworkCredential("roy@twine-s.com", "Maya2018"));
+
+ Email mail = new Email();
+ mail.Attachments.Add(new Attachment() { FilePath = file, Name = "VSTS-REPORT.pdf" });
+ mail.From = project.Members.SingleOrDefault(x => x.DisplayName.Contains("Roy"));
+ mail.To.Add(mail.From);
+ mail.Subject = "VSTS Daily Report";
+ mail.Body = "Attached is a daily report containing Tango project work items.";
+
+ emailClient.Send(mail).Wait();
+
+ PathHelper.TryDeleteFile(file);
+ }
+
+ private static Chart AddChart<T>(Section section, ChartType chartType, String header, IEnumerable<IGrouping<T, WorkItem>> workItemGroups, String propName)
+ {
+ var headParagraph = section.AddParagraph(header);
+ headParagraph.Format.Alignment = ParagraphAlignment.Left;
+ headParagraph.Format.Font.Size = 16;
+ headParagraph.Format.Font.Bold = true;
+ headParagraph.Format.SpaceBefore = "8mm";
+ headParagraph.Format.SpaceAfter = "5mm";
+
+ Chart chart = section.AddChart(chartType);
+ chart.Width = section.Document.DefaultPageSetup.PageWidth - 5;
+ chart.Height = "10cm";
+
+ workItemGroups = workItemGroups.OrderByDescending(x => x.Count());
+
+ Series series = chart.SeriesCollection.AddSeries();
+ series.Add(workItemGroups.Select(x => (double)x.Count()).ToArray());
+
+ XSeries xseries = chart.XValues.AddXSeries();
+
+ if (propName != null)
+ {
+ xseries.Add(workItemGroups.Select(x => x.Key.GetType().GetProperty(propName, BindingFlags.Public | BindingFlags.Instance).GetValue(x.Key).ToString()).ToArray());
+ }
+ else
+ {
+ xseries.Add(workItemGroups.Select(x => x.Key.ToString()).ToArray());
+ }
+
+ var elements = series.Elements.Cast<Point>().ToArray();
+
+ for (int i = 0; i < elements.Length; i++)
+ {
+ elements[i].FillFormat.Color = _colors[i];
+ }
+
+ chart.XAxis.MajorTickMark = TickMarkType.Outside;
+ chart.XAxis.Title.Caption = propName;
+ chart.YAxis.MajorTickMark = TickMarkType.Outside;
+ chart.YAxis.HasMajorGridlines = true;
+ chart.PlotArea.LineFormat.Color = Colors.White;
+ chart.PlotArea.LineFormat.Width = 1;
+ chart.PlotArea.LineFormat.Visible = true;
+ return chart;
+ }
+
+ private static Table AddTable(Section section, String header, IEnumerable<WorkItem> workItems)
+ {
+ String startPath = AssemblyHelper.GetCurrentAssemblyFolder();
+
+ var headParagraph = section.AddParagraph(header);
+ headParagraph.Format.Alignment = ParagraphAlignment.Left;
+ headParagraph.Format.Font.Size = 16;
+ headParagraph.Format.Font.Bold = true;
+ headParagraph.Format.SpaceBefore = "8mm";
+ headParagraph.Format.SpaceAfter = "5mm";
+
+
+ var table = section.AddTable();
+
+ table.Borders.Color = Colors.Black;
+ table.Borders.Width = 0.25;
+ table.Borders.Left.Width = 0.5;
+ table.Borders.Right.Width = 0.5;
+ table.Rows.LeftIndent = 0;
+
+ table.BottomPadding = "2mm";
+ table.TopPadding = "2mm";
+ table.LeftPadding = "2mm";
+ table.RightPadding = "2mm";
+
+
+ // Before you can add a row, you must define the columns
+ table.AddColumn("1cm");
+ table.AddColumn();
+ table.AddColumn("4cm");
+ table.AddColumn();
+ table.AddColumn();
+ table.AddColumn();
+ table.AddColumn("1.5cm");
+ table.AddColumn("1.5cm");
+ table.AddColumn("1.5cm");
+
+ // Create the header of the table
+ Row row = table.AddRow();
+ row.HeadingFormat = true;
+ row.Shading.Color = Colors.Gainsboro;
+ row.Cells[0].AddParagraph("Work Item");
+ row.Cells[1].AddParagraph("Created Date");
+ row.Cells[2].AddParagraph("Title");
+ row.Cells[3].AddParagraph("Area");
+ row.Cells[4].AddParagraph("Created By");
+ row.Cells[5].AddParagraph("Assigned To");
+ row.Cells[6].AddParagraph("Severity");
+ row.Cells[7].AddParagraph("Priority");
+ row.Cells[8].AddParagraph("State");
+
+ foreach (var item in workItems)
+ {
+ Row r = table.AddRow();
+ var image = r.Cells[0].AddImage(Path.Combine(startPath, item.Type == WorkItemType.Bug ? "bug.png" : "task.png"));
+ image.Width = 15;
+ image.Height = 15;
+ r.Cells[1].AddParagraph(item.CreatedDate.ToShortDateString());
+
+ var linkParagraph = r.Cells[2].AddParagraph();
+ var link = linkParagraph.AddHyperlink(String.Format("https://twinetfs.visualstudio.com/DefaultCollection/Tango/_queries?id={0}&_a=edit", item.ID), HyperlinkType.Web);
+ link.AddFormattedText(item.Title);
+
+ r.Cells[3].AddParagraph(item.Area.Name);
+ r.Cells[4].AddParagraph(item.CreatedBy.DisplayName);
+ r.Cells[5].AddParagraph(item.AssignedTo.DisplayName);
+ var p = r.Cells[6].AddParagraph(item.Severity.ToString());
+
+ if (item.Severity == Severity.Critical || item.Severity == Severity.High)
+ {
+ p.Format.Font.Color = Colors.Red;
+ }
+
+ r.Cells[7].AddParagraph(item.Priority.ToDescription());
+ r.Cells[8].AddParagraph(item.State.ToString());
+ }
+
+ return table;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.BugReporter/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..0d86baa04
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tango.BugReporter")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tango.BugReporter")]
+[assembly: AssemblyCopyright("Copyright © 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c8f14d59-b18d-469c-8b1b-2d23072ed16a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/Tango.BugReporter.csproj b/Software/Visual_Studio/Utilities/Tango.BugReporter/Tango.BugReporter.csproj
new file mode 100644
index 000000000..e0450c4bf
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/Tango.BugReporter.csproj
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{C8F14D59-B18D-469C-8B1B-2D23072ED16A}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>Tango.BugReporter</RootNamespace>
+ <AssemblyName>Tango.BugReporter</AssemblyName>
+ <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="MigraDoc.DocumentObjectModel, Version=1.32.4334.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.DocumentObjectModel.dll</HintPath>
+ </Reference>
+ <Reference Include="MigraDoc.Rendering, Version=1.32.4334.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.Rendering.dll</HintPath>
+ </Reference>
+ <Reference Include="MigraDoc.RtfRendering, Version=1.32.4334.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.RtfRendering.dll</HintPath>
+ </Reference>
+ <Reference Include="PdfSharp, Version=1.32.3057.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\PdfSharp.dll</HintPath>
+ </Reference>
+ <Reference Include="PdfSharp.Charting, Version=1.32.3057.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\PdfSharp.Charting.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.TFS\Tango.TFS.csproj">
+ <Project>{998f8471-dc1b-41b6-9d96-354e1b4e7a32}</Project>
+ <Name>Tango.TFS</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="bug.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="task.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="twine-logo.jpg">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/bug.png b/Software/Visual_Studio/Utilities/Tango.BugReporter/bug.png
new file mode 100644
index 000000000..5565739f6
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/bug.png
Binary files differ
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/packages.config b/Software/Visual_Studio/Utilities/Tango.BugReporter/packages.config
new file mode 100644
index 000000000..8181da7e7
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="PDFsharp" version="1.32.3057.0" targetFramework="net46" />
+ <package id="PDFsharp-MigraDoc-GDI" version="1.32.4334.0" targetFramework="net46" />
+</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/task.png b/Software/Visual_Studio/Utilities/Tango.BugReporter/task.png
new file mode 100644
index 000000000..ec611d786
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/task.png
Binary files differ
diff --git a/Software/Visual_Studio/Utilities/Tango.BugReporter/twine-logo.jpg b/Software/Visual_Studio/Utilities/Tango.BugReporter/twine-logo.jpg
new file mode 100644
index 000000000..56d8702c5
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BugReporter/twine-logo.jpg
Binary files differ