// Call this when a device (Box) has been selected in the list of discovered devices public static bool SubmitTicket(string aInstallerVersion, string aProductName, string aEntryPoint, string aFirstName, string aLastName, string aEmail, string aPhoneNumber, string aContactNotes, string aFaultDescription, Diagnostics aDiagnostics, Box aBox, out string aSubmissionReport, out string aTicketXmlData) { // get the test results from Diagnostics (a List of Tests) while (!aDiagnostics.AllComplete()) { System.Threading.Thread.Sleep(1000); } ListOfTestResource testList = new ListOfTestResource(); var testResults = aDiagnostics.Results(); foreach (TestResult result in testResults) { TestResourceResult passFailWarn; switch (result.result) { case "PASS": passFailWarn = TestResourceResult.Pass; break; case "WARN": passFailWarn = TestResourceResult.Warning; break; default: case "FAIL": passFailWarn = TestResourceResult.Fail; break; } CreateTest(testList, result.title, passFailWarn, result.description, result.startTime, result.endTime, result.content); } // Get the other (non-test) stuff (a List of Categories) ListOfCategoryResource categoryList = new ListOfCategoryResource(); var info = new DiagnosticInfo(aBox); var categoryDeviceInfo = Ticket.CreateCategory(categoryList, "DeviceInfo"); Ticket.CreateItem(categoryDeviceInfo, "All Device Info", info.DeviceInfo); var categorySystemInfo = Ticket.CreateCategory(categoryList, "SystemInfo"); Ticket.CreateItem(categorySystemInfo, "All System Info", info.SystemInfo); var categoryUserLog = Ticket.CreateCategory(categoryList, "UserLog"); Ticket.CreateItem(categoryUserLog, "Full UserLog", info.UserLog); return(SubmitTicket(aInstallerVersion, aProductName, aEntryPoint, aFirstName, aLastName, aEmail, aPhoneNumber, aContactNotes, aFaultDescription, info.ProductId, info.SoftwareVersion, info.MacAddress, categoryList, testList, out aSubmissionReport, out aTicketXmlData)); }
private static CategoryResource CreateCategory(ListOfCategoryResource CategoryList, string aTitle) { CategoryResource category = new CategoryResource { Title = aTitle }; Assert.Check(category.Valid()); CategoryList.Categories.Add(category); return(category); }
private InstallerReportResource CreateInstallerReport(string aEntryPoint, ListOfCategoryResource aListOfCategory, ListOfTestResource aListOfTest) { InstallerReportResource installerReport = new InstallerReportResource { EntryPoint = aEntryPoint, Information = aListOfCategory, Tests = aListOfTest }; Assert.Check(installerReport.Valid()); return(installerReport); }
public static void Main(string[] args) { ListOfTestResource testList = new ListOfTestResource(); Ticket.CreateTest(testList, 0, "Test1", TestResourceResult.Pass, "Result1", "blah blah blah1"); Ticket.CreateTest(testList, 1, "Test2", TestResourceResult.Fail, "Result2", "blah blah blah2"); Ticket.CreateTest(testList, 2, "Test3", TestResourceResult.Warning, "Result3", "blah blah blah3"); ListOfCategoryResource categoryList = new ListOfCategoryResource(); var category1 = Ticket.CreateCategory(categoryList, "Audio"); Ticket.CreateItem(category1, "Item1", "item1-1 info..."); Ticket.CreateItem(category1, "Item2", "item1-2 info..."); Ticket.CreateItem(category1, "Item3", "item1-3 info..."); Ticket.CreateItem(category1, "Item4", "item1-4 info..."); CategoryResource category2 = Ticket.CreateCategory(categoryList, "Network Connection"); Ticket.CreateItem(category2, "Item1", "item2-1 info..."); Ticket.CreateItem(category2, "Item2", "item2-2 info..."); Ticket.CreateItem(category2, "Item3", "item2-3 info..."); Ticket.CreateItem(category2, "Item4", "item2-4 info..."); Ticket ticket = new Ticket("Eamonn", "Brady", "*****@*****.**", "01413035414", "UTC", "Any time between 12 and 1pm", "Win7", "01010101", "Kiko DSM", "3.7.1", "00:26:0f:21:b9:67", "It's broke!", "1.0.0", "Network Audio", categoryList, testList); if (ticket.Valid()) { string response; if (ticket.Submit(out response)) { Console.WriteLine("Ticket posted successfully!"); } else { Console.WriteLine("Ticket post FAILED!!!"); } } else { Console.WriteLine("Ticket is INVALID!!!"); Console.WriteLine("\n\n\n\n" + ticket.ValidationInfo()); } Thread.Sleep(3000); }
public Ticket(string aInstallerVersion, string aOperatingSystem, string aTimeZoneId, string aProductName, string aEntryPoint, string aFirstName, string aLastName, string aEmail, string aPhoneNumber, string aContactNotes, string aFaultDescription, string aProductId, string aProductFirmware, string aProductMacAddress, ListOfCategoryResource aListOfCategory, ListOfTestResource aListOfTest) { // Create the Ticket iTicketData = new TicketRequestResource { InstallerVersion = aInstallerVersion, TimeZoneId = aTimeZoneId, OperatingSystem = aOperatingSystem, ProductName = aProductName, FirstName = aFirstName, LastName = aLastName, Email = aEmail, PhoneNumber = aPhoneNumber, FaultDescription = aFaultDescription, ContactNotes = aContactNotes, ProductId = aProductId, ProductFirmware = aProductFirmware, ProductMacAddress = aProductMacAddress, InstallerReport = CreateInstallerReport(aEntryPoint, aListOfCategory, aListOfTest) }; Assert.Check(iTicketData.Valid()); }
public static bool SubmitTicket(string aInstallerVersion, string aProductName, string aEntryPoint, string aFirstName, string aLastName, string aEmail, string aPhoneNumber, string aContactNotes, string aFaultDescription, string aProductId, string aSoftwareVersion, string aMacAddress, ListOfCategoryResource aCategoryList, ListOfTestResource aTestList, out string aSubmissionReport, out string aTicketXmlData) { string timeZoneId = System.TimeZoneInfo.Local.Id; string operatingSystem = Linn.SystemInfo.VersionString; Ticket ticket = new Ticket(aInstallerVersion, operatingSystem, timeZoneId, aProductName, aEntryPoint, aFirstName, aLastName, aEmail, aPhoneNumber, aContactNotes, aFaultDescription, aProductId, aSoftwareVersion, aMacAddress, aCategoryList, aTestList); aSubmissionReport = ""; aTicketXmlData = ""; bool success = ticket.Submit(out aSubmissionReport); aTicketXmlData = ticket.iTicketXmlData; return(success); }