public virtual IssueReport Parse(IssueTypes issueType) { string issueReportFileName; switch (issueType) { case IssueTypes.Errors: issueReportFileName = "errors.xml"; break; case IssueTypes.Warnings: issueReportFileName = "warnings.xml"; break; default: throw new IssueTypeNotSupportedException($"'{issueType}' issues type is not supported."); } var rawIssueReport = new XmlDocument(); rawIssueReport.LoadXml(issueReportFileName); var issueReport = new IssueReport { DateTime = new IssueReportDateTimeParser().Parse(rawIssueReport), Issues = new IssueReportIssueParser().Parse(rawIssueReport, issueType) }; return(issueReport); }
private async void BtnBasicClick(object sender, RoutedEventArgs args) { var issue = new IssueReport() { Title = "Sample Issue from locco-sampler", Description = "This issue is created automatically to test this library!", Stacktrace = @"2015-09-16 08:56:39,061 App.UI.MC.UF.SO.Load ERROR - System.Data.SqlClient.SqlException (0x80131904): The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. bei System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) bei System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) bei System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) bei System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) bei System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) bei System.Data.SqlClient.SqlDataReader.Read() bei System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) bei System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) bei System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) bei System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) bei System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) bei System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) ... ClientConnectionId:26a388a2-c9cf-4e6e-bd6f-9462674493e2" }; try { await _issueReportService.ReportIssueAsync(issue); MessageBox.Show("Issue has been successfully sent to backend!", "Success!"); } catch (ReportSendException e) { MessageBox.Show("Failed to send issue to backend: " + ExceptionUtil.ToErrorMessage(e), "Issue send error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public async Task SaveIssueReportAsync(IssueReport item, bool isNewItem = true) { try { var json = JsonConvert.SerializeObject(item); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = null; if (isNewItem) { response = await client.PostAsync("/api/IssueReports", content); } else { response = await client.PutAsync("/api/IssueReports", content); } if (response.IsSuccessStatusCode) { Debug.WriteLine(@"\tIssueReport succesfully saved"); } } catch (Exception ex) { Debug.WriteLine(@"\tError {0}", ex.Message); } }
async void ReportLogEvent(LogEvent logEvent, IEnumerable <string> lastMessages) { try { await reportingSemaphore.WaitAsync(); var context = GetPropertyValue(logEvent, "SourceContext"); context = context?.Trim('\"') ?? ""; var issueReport = new IssueReport() { Exception = ConvertExceptionToSerializableException(logEvent), OffendingLogLine = StripSensitiveInformation(logEvent.RenderMessage()), OffendingLogMessage = StripSensitiveInformation(logEvent.MessageTemplate.Text), RecentLogLines = lastMessages.ToArray(), Version = Program.GetCurrentVersion().ToString(), Context = context }; var response = await restClient.PostAsync <ReportResponse>( new Uri("https://shapeshifter.azurewebsites.net/api/github/report"), issueReport, new Dictionary <HttpRequestHeader, string>()); Log.Logger.Verbose("Reported the log entry {entryName} as {githubIssueLink}.", logEvent.MessageTemplate.Text, response.IssueUrl); } catch { //don't allow errors here to ruin everything. } finally { reportingSemaphore.Release(); } }
public async Task SendIssueReportAsync(IssueReport report) { var appId = _propertyProvider.GetProperty("locco.github.appId"); var accessToken = _propertyProvider.GetProperty("locco.github.token"); var repoOwner = _propertyProvider.GetProperty("locco.github.owner"); var repoName = _propertyProvider.GetProperty("locco.github.repository"); // Support default proxy var proxy = WebRequest.DefaultWebProxy; var httpClient = new HttpClientAdapter(() => HttpMessageHandlerFactory.CreateDefault(proxy)); var connection = new Connection(new ProductHeaderValue(appId), httpClient); if (proxy != null) { Log.Info(string.Format("Using proxy server '{0}' to connect to github!", proxy.GetProxy(new Uri("https://api.github.com/")))); } var client = new GitHubClient(connection) { Credentials = new Credentials(accessToken) }; // Creates a new GitHub Issue var newIssue = new NewIssue(report.Title) { Body = MarkdownReportUtil.CompileBodyMarkdown(report, 220000), }; newIssue.Labels.Add("bot"); var issue = await client.Issue.Create(repoOwner, repoName, newIssue); }
/// <summary> /// /// </summary> /// <param name="report"></param> /// <returns></returns> private static string CompileDescriptionMarkdown(IssueReport report) { return string.Format( @" **{0}** _reports:_ {1} ", report.Environment.User, MarkdownQuote(report.Description)); }
protected override async Task ExecuteAsync(object parameter) { var report = new IssueReport(IssueReport.TrackerTypes.SUPPORT, _globalService.PresetMagicianVersion, _globalFrontendService.ApplicationState.ActiveLicense.Customer.Email, FileLocations.LogFile, DataPersisterService.DefaultDataStoragePath); //await _uiVisualizerService.ShowDialogAsync<ReportIssueViewModel>(report); }
private async void OnListViewItemSelected(object sender, SelectedItemChangedEventArgs e) { IssueReport detail = e.SelectedItem as IssueReport; // DisplayAlert("Selected", detail.ProblemDescription, "OK"); await Navigation.PushAsync(new ReportIssueDetailPage(detail)); }
public void IssueReport_CanBeCreated() { //Given IssueReport issueReport; //When issueReport = new IssueReport(); //Then Assert.NotNull(issueReport); }
public async Task <ReportResponse> ReportIssue([FromBody] IssueReport issueReport) { await _reportLock.WaitAsync(); try { const string username = "******"; const string repository = "Shapeshifter"; var existingIssues = await _client.Issue.GetAllForRepository( username, repository, new RepositoryIssueRequest() { State = ItemStateFilter.All, Filter = IssueFilter.Created }); var issueTitle = issueReport.Exception != null ? issueReport.Exception.Name : issueReport.OffendingLogMessage; issueTitle = issueTitle.TrimEnd('.', ' ', '\n', '\r'); if (!string.IsNullOrWhiteSpace(issueReport.Context)) { var nameSplit = issueReport.Context.Split('.'); issueReport.Context = nameSplit[nameSplit.Length - 1]; issueTitle += " in " + issueReport.Context; } issueTitle += " on v" + issueReport.Version; var existingIssue = existingIssues.FirstOrDefault(x => x.Title == issueTitle) ?? await _client.Issue.Create( username, repository, new NewIssue(issueTitle) { Body = RenderIssueBody(issueReport) }); return(new ReportResponse() { IssueUrl = existingIssue.HtmlUrl }); } finally { _reportLock.Release(); } }
public void TestCompileBodyMarkdown() { IssueReport report = new IssueReport() { Title = "Unit Test Report", Description = "This is just a test from a unit test.", Stacktrace = "I am the stacktrace, me frend!", Environment = new EnvironmentDetail() { AppName = "huhu" } }; var markdown = MarkdownReportUtil.CompileBodyMarkdown(report, 1000); }
public virtual IssueReport Parse(IssueTypes issueType) { var issueInfoAndInstanceProvider = _issueInfoAndInstanceProviderRetriever.Retrieve(issueType); var rawIssueReport = _xmlDocumentFactory.Create(issueInfoAndInstanceProvider.ReportFileName); var issueReport = new IssueReport { DateTime = _issueReportDateTimeParser.Parse(rawIssueReport), Issues = _issueReportIssueParser.Parse(rawIssueReport, issueInfoAndInstanceProvider) }; return(issueReport); }
public async Task <string> ReportIssue([FromBody] IssueReport issueReport) { await _reportLock.WaitAsync(); try { const string username = "******"; const string repository = "Shapeshifter"; var existingIssues = await _client.Issue.GetAllForRepository( username, repository, new RepositoryIssueRequest() { Filter = IssueFilter.Created }); string issueTitle; if (issueReport.Exception != null) { issueTitle = issueReport.Exception.Name + " occured in " + issueReport.Exception.Context; } else { issueTitle = issueReport.OffendingLogMessage; } issueTitle = issueTitle.TrimEnd('.', ' ', '\n', '\r'); var existingIssue = existingIssues .Where(x => x.Title == issueTitle) .FirstOrDefault(x => x.State.Value == ItemState.Open || DateTime.UtcNow - x.CreatedAt >= TimeSpan.FromDays(3)); if (existingIssue == null) { existingIssue = await _client.Issue.Create( username, repository, new NewIssue(issueTitle) { Body = RenderIssueBody(issueReport) }); } return(existingIssue.HtmlUrl); } finally { _reportLock.Release(); } }
public virtual IssueReport Parse(IssueTypes issueType) { var issueInfoAndInstanceProvider = _issueInfoAndInstanceProviderRetriever.Retrieve(issueType); var rawIssueReport = new XmlDocument(); rawIssueReport.LoadXml(issueInfoAndInstanceProvider.ReportFileName); var issueReport = new IssueReport { DateTime = new IssueReportDateTimeParser().Parse(rawIssueReport), Issues = new IssueReportIssueParser().Parse(rawIssueReport, issueInfoAndInstanceProvider) }; return(issueReport); }
string RenderIssueBody(IssueReport issueReport) { var body = string.Empty; body += $"<b>Version:</b> {issueReport.Version}\n\n"; if (issueReport.Exception != null) { body += "<h1>Exception</h1>\n"; body += $"<b>Type:</b> {issueReport.Exception.Name}\n\n"; body += $"<b>Offending class:</b> {issueReport.Exception.Context}\n\n"; body += $"```\n{issueReport.Exception.StackTrace}\n```\n\n"; } if (issueReport.RecentLogLines != null && issueReport.RecentLogLines.Length > 0) { body += "<h1>Log</h1>\n"; if (issueReport.OffendingLogLine != null) { foreach (var line in issueReport.OffendingLogLine.Split('\n', '\r')) { if (string.IsNullOrEmpty(line.Trim())) { continue; } body += $"> {line}\n"; } body += "\n"; } foreach (var line in issueReport.RecentLogLines) { if (string.IsNullOrEmpty(line.Trim())) { continue; } body += $"> {line}\n"; } } return(body); }
public static string CompileBodyMarkdown(IssueReport report, int stackTraceMaxLenght) { var descriptionMd = CompileDescriptionMarkdown(report); var environmentMd = CompileEnvironmentMarkdown(report.Environment); var stacktraceMd = CompileStacktraceMarkdown(report.Stacktrace, stackTraceMaxLenght); var markdown = string.Format( @" ### Description {0} ### Environment {1} ### Stacktrace {2} ", descriptionMd, environmentMd, stacktraceMd); return markdown; }
public static void ReportCrash(Exception e) { var serviceLocator = ServiceLocator.Default; var globalFrontendService = serviceLocator.ResolveType <GlobalFrontendService>(); string email = ""; if (globalFrontendService.ApplicationState.ActiveLicense?.Customer != null && !string.IsNullOrWhiteSpace(globalFrontendService.ApplicationState.ActiveLicense?.Customer?.Email)) { email = globalFrontendService.ApplicationState.ActiveLicense.Customer.Email; } var uiVisualiserService = serviceLocator.ResolveType <IUIVisualizerService>(); var globalService = serviceLocator.ResolveType <GlobalService>(); var report = new IssueReport(IssueReport.TrackerTypes.CRASH, globalService.PresetMagicianVersion, email, FileLocations.LogFile, DataPersisterService.DefaultDataStoragePath); report.SetException(e); //uiVisualiserService.ShowDialogAsync<ReportIssueViewModel>(report).ConfigureAwait(false); }
static string RenderIssueBody(IssueReport issueReport) { var body = string.Empty; body += $"<b>Version:</b> {issueReport.Version}\n\n"; if (!string.IsNullOrEmpty(issueReport.Context)) { body += $"<b>Offending class:</b> {issueReport.Context}\n\n"; } if (issueReport.Exception != null) { body += "<h1>Exception</h1>\n"; body += $"<b>Type:</b> {issueReport.Exception.Name}\n\n"; body += $"<b>Message:</b> {issueReport.Exception.Message}\n\n"; body += $"```\n{issueReport.Exception.StackTrace}\n```\n\n"; } if (issueReport.RecentLogLines == null || issueReport.RecentLogLines.Length <= 0) { return(body); } body += "<h1>Log</h1>\n\n"; if (issueReport.OffendingLogLine != null) { body += ConvertLinesIntoCodeRegion( issueReport.OffendingLogLine.Split('\n', '\r')); } body += "<details><summary>Full log</summary><p>\n\n"; body += ConvertLinesIntoCodeRegion(issueReport.RecentLogLines); body += "\n</p></details>"; return(body); }
public async Task <ActionResult <IssueReport> > PostIssueReport(IssueReportViewModel issueReport) { var well = await _context.Wells.Where(a => a.WellName == issueReport.WellName).FirstOrDefaultAsync(); var insertData = new IssueReport { WellId = well.Id, ProblemDescription = issueReport.ProblemDescription, SolutionDescription = issueReport.SolutionDescription, NewActivatorSerialNumber = issueReport.NewActivatorSerialNumber, NewValveSerialNumber = issueReport.NewValveSerialNumber, IsChargeable = issueReport.IsChargeable, Photo = issueReport.ImageName, OldActivatorSerialNumber = well.ActivatorSerialNumber, OldValveSerialNumber = well.ValveSerialNumber, TimeForAlarm = issueReport.TimeForAlarm, ArrivalTime = issueReport.ArrivalTime, TimeToRepair = issueReport.TimeToRepair, CreatedAt = issueReport.CreatedAt, UpdatedAt = issueReport.CreatedAt }; well.ActivatorSerialNumber = string.IsNullOrEmpty(issueReport.NewActivatorSerialNumber) ? well.ActivatorSerialNumber : issueReport.NewActivatorSerialNumber; well.ValveSerialNumber = string.IsNullOrEmpty(issueReport.NewValveSerialNumber) ? well.ValveSerialNumber : issueReport.NewValveSerialNumber; well.UpdatedAt = DateTime.UtcNow; await _context.AddAsync(well); _context.Entry(well).State = EntityState.Modified; await _context.SaveChangesAsync(); _context.IssueReports.Add(insertData); await _context.SaveChangesAsync(); // return CreatedAtAction("GetIssueReport", new { id = issueReport.Id }, issueReport); return(Ok(issueReport)); }
public ReportIssueDetailPage(IssueReport detail) { InitializeComponent(); ProblemDescription.Text = detail.ProblemDescription; SolultionDescription.Text = detail.SolutionDescription; Well.Text = detail.WellName; NewActivator.Text = detail.NewActivatorSerialNumber; NewValve.Text = detail.NewValveSerialNumber; ImageName.Text = string.IsNullOrEmpty(detail.ImageName) ? "Ingen bild" : detail.ImageName; CreatedAt.Text = detail.CreatedAt.ToShortDateString(); if (!string.IsNullOrEmpty(detail.ImageName)) { // MediaFile file; string fileName = detail.ImageName; string containerPath = "https://lottingelundfiles.blob.core.windows.net/lovaphotos/"; Image.Source = containerPath + fileName; } }
public void PopulateGrid() { gridItems = null; gridIssueReportItems = null; TotalIssues = 0; TotalPullRequests = 0; List <Issue> strlist = new List <Issue>(); List <IssueReport> strReportlist = new List <IssueReport>(); strlist = GetIssues(); int nIndex = 0; IssueReport issueReport = new IssueReport(); foreach (Issue iss in strlist) { //Issue report //////////////////////////////////// if (iss.Repository.Equals(issueReport.Repository) != true) { if (nIndex != 0) { strReportlist.Add(issueReport); } issueReport = null; } if (issueReport == null) { issueReport = new IssueReport(); } issueReport.Repository = iss.Repository; if (iss.IsPullRequest == true) { issueReport.TotalPullRequest++; } else { issueReport.TotalOpenIssues++; } /////////////////////////////////////////////////// int nCount = 0; if (iss.IsPullRequest == true) { TotalPullRequests++; } else { TotalIssues++; } foreach (Repository rep in _cfgAcccess.Repositories) { if (iss.Repository.CompareTo(rep.Name) == 0 && _cfgAcccess.Repositories[nCount].githubissues != null) { foreach (GithubIssue ghissue in _cfgAcccess.Repositories[nCount].githubissues) { if (strlist[nIndex].Number == ghissue.number) { strlist[nIndex].Assignee = ghissue.assignee; break; } } } nCount++; } nIndex++; } gridItems = strlist; gridIssueReportItems = strReportlist; }
public async Task <IActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } var well = await _context.Wells.Where(a => a.WellName == IssueReportViewModel.WellName).FirstOrDefaultAsync(); if (well == null) { } var user = await _userManager.GetUserAsync(HttpContext.User); var fileName = ""; if (IssueReportViewModel.File != null) { var fileContent = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue.Parse(IssueReportViewModel.File.ContentDisposition); fileName = Path.GetFileName(fileContent.FileName.ToString().Trim('"')); var filePath = Path.GetTempFileName(); string result = await UploadFile(IssueReportViewModel.File, filePath); } IssueReport insertData = new IssueReport { WellId = well.Id, ProblemDescription = IssueReportViewModel.ProblemDescription, SolutionDescription = IssueReportViewModel.SolutionDescription, NewActivatorSerialNumber = IssueReportViewModel.NewActivatorSerialNumber, NewValveSerialNumber = IssueReportViewModel.NewValveSerialNumber, OldActivatorSerialNumber = well.ActivatorSerialNumber, OldValveSerialNumber = well.ValveSerialNumber, IsChargeable = IssueReportViewModel.IsChargeable, IsPhoto = IssueReportViewModel.IsPhoto, IsLowVacuum = IssueReportViewModel.IsLowVacuum, MasterNode = IssueReportViewModel.MasterNode + 1, Photo = fileName, Alarm = IssueReportViewModel.Alarm + 1, TimeForAlarm = IssueReportViewModel.TimeForAlarm, ArrivalTime = IssueReportViewModel.ArrivalTime, TimeToRepair = IssueReportViewModel.TimeToRepair, AspNetUserId = user.Id, CreatedAt = DateTime.UtcNow, UpdatedAt = DateTime.UtcNow }; well.ActivatorSerialNumber = string.IsNullOrEmpty(IssueReportViewModel.NewActivatorSerialNumber) ? well.ActivatorSerialNumber : IssueReportViewModel.NewActivatorSerialNumber; well.ValveSerialNumber = string.IsNullOrEmpty(IssueReportViewModel.NewValveSerialNumber) ? well.ValveSerialNumber : IssueReportViewModel.NewValveSerialNumber; well.UpdatedAt = DateTime.UtcNow; await _context.AddAsync(well); _context.Entry(well).State = EntityState.Modified; await _context.SaveChangesAsync(); _context.IssueReports.Add(insertData); await _context.SaveChangesAsync(); return(RedirectToPage("WaterDrainReport")); }
/// <summary> /// Parse IssueReportIssueComponent /// </summary> public static IssueReport.IssueReportIssueComponent ParseIssueReportIssueComponent(IFhirReader reader, ErrorList errors, IssueReport.IssueReportIssueComponent existingInstance = null ) { IssueReport.IssueReportIssueComponent result = existingInstance != null ? existingInstance : new IssueReport.IssueReportIssueComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if( ParserUtils.IsAtFhirElement(reader, "extension") ) { result.Extension = new List<Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element internalId else if( reader.IsAtRefIdElement() ) result.InternalId = Id.Parse(reader.ReadRefIdContents()); // Parse element severity else if( ParserUtils.IsAtFhirElement(reader, "severity") ) result.Severity = CodeParser.ParseCode<IssueReport.IssueSeverity>(reader, errors); // Parse element type else if( ParserUtils.IsAtFhirElement(reader, "type") ) result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element details else if( ParserUtils.IsAtFhirElement(reader, "details") ) result.Details = FhirStringParser.ParseFhirString(reader, errors); // Parse element location else if( ParserUtils.IsAtFhirElement(reader, "location") ) { result.Location = new List<FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "location") ) result.Location.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return result; }
/// <summary> /// Parse IssueReport /// </summary> public static IssueReport ParseIssueReport(IFhirReader reader, ErrorList errors, IssueReport existingInstance = null ) { IssueReport result = existingInstance != null ? existingInstance : new IssueReport(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if( ParserUtils.IsAtFhirElement(reader, "extension") ) { result.Extension = new List<Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element language else if( ParserUtils.IsAtFhirElement(reader, "language") ) result.Language = CodeParser.ParseCode(reader, errors); // Parse element text else if( ParserUtils.IsAtFhirElement(reader, "text") ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( ParserUtils.IsAtFhirElement(reader, "contained") ) { result.Contained = new List<Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element internalId else if( reader.IsAtRefIdElement() ) result.InternalId = Id.Parse(reader.ReadRefIdContents()); // Parse element issue else if( ParserUtils.IsAtFhirElement(reader, "issue") ) { result.Issue = new List<IssueReport.IssueReportIssueComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "issue") ) result.Issue.Add(IssueReportParser.ParseIssueReportIssueComponent(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return result; }
public ActionResult ReportIssue([Bind(Include = "Name,Email,Subject,Message")] IssueReport issueMessage, HttpPostedFileBase upload) { return(View(issueMessage)); }
public static void SerializeIssueReport(IssueReport value, IFhirWriter writer) { writer.WriteStartRootObject("IssueReport"); writer.WriteStartComplexContent(); // Serialize element's localId attribute if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents)) { writer.WriteRefIdContents(value.InternalId.Contents); } // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if (value.Language != null) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.Language, writer); writer.WriteEndElement(); } // Serialize element text if (value.Text != null) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element issue if (value.Issue != null && value.Issue.Count > 0) { writer.WriteStartArrayElement("issue"); foreach (var item in value.Issue) { writer.WriteStartArrayMember("issue"); IssueReportSerializer.SerializeIssueReportIssueComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public IssueReportViewModel(IssueReport issue) { _issue = issue; }
/// <summary> /// Parse IssueReport /// </summary> public static IssueReport ParseIssueReport(IFhirReader reader, ErrorList errors, IssueReport existingInstance = null) { IssueReport result = existingInstance != null ? existingInstance : new IssueReport(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "extension")) { result.Extension = new List <Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (ParserUtils.IsAtFhirElement(reader, "language")) { result.Language = CodeParser.ParseCode(reader, errors); } // Parse element text else if (ParserUtils.IsAtFhirElement(reader, "text")) { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (ParserUtils.IsAtFhirElement(reader, "contained")) { result.Contained = new List <Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element internalId else if (reader.IsAtRefIdElement()) { result.InternalId = Id.Parse(reader.ReadRefIdContents()); } // Parse element issue else if (ParserUtils.IsAtFhirElement(reader, "issue")) { result.Issue = new List <IssueReport.IssueReportIssueComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "issue")) { result.Issue.Add(IssueReportParser.ParseIssueReportIssueComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// 確定無貨回報 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Report_Click(object sender, EventArgs e) { try { int productStatus = int.Parse(ViewState["productStatus"].ToString()); var pick = Utility.GetPickNumRegex(lblPickNum.Text); var num = int.Parse(pick.Number); var store = pick.Store; var areaId = pick.Area; var pickType = pick.PickType; string oldShelf = lbl_Shelf.Text; string productId = lbl_Product.Text; int lackquantity = int.Parse(lbl_Quantity.Text); string account = lbl_Account.Text; string comment = lblComment.Text; var issurReports = POS_Library.ShopPos.NoProduct.GetIssueReport(num, store, pickType).Where(x => x.FinishDate == null && x.FlowStatus != (int)POS_Library.ShopPos.EnumData.FlowType.補貨確認).ToList(); var expTicketLogs = POS_Library.ShopPos.NoProduct.GetExpTicketLogs(num, store, pickType).Where(x => x.ProductId == productId).ToList(); if (Regex.IsMatch(oldShelf, @"無貨")) { var expNoProductQ = expTicketLogs.Count(x => string.IsNullOrEmpty(x.FromShelfId)); //未結案+目前回報數量 不可大於 目前是無貨數量 if ((issurReports.Count + lackquantity) > expNoProductQ) { lblMsg.Text = "此問題已回報!!"; return; } } else { if ((issurReports.Count + lackquantity) > expTicketLogs.Count) { //if (issurReports.First().Comment == "瑕疵") //{ // var shelf = WMS_Library.Public.Utility.GetShelfData((int)WMS_Library.ProductStorage.EnumData.StorageType.不良儲位, int_treasurytype); // lblMsg.Text = "此問題已回報!!請將此產品放置不良儲位【" + shelf.Shelf + "】"; //} //else //{ // var shelf = WMS_Library.Public.Utility.GetShelfData((int)WMS_Library.ProductStorage.EnumData.StorageType.無貨儲位, int_treasurytype); // lblMsg.Text = "此問題已回報!!請將此產品放置無貨儲位【" + shelf.Shelf + "】"; //} lblMsg.Text = "此問題已回報!!"; return; } } //檢查來原儲位是否為新儲位 var oldStorage = POS_Library.ShopPos.Storage.GetStorage(oldShelf, areaId); bool fromNewStorage = oldStorage != null ? true : false; var error = false; if (expTicketLogs.Count > 0) { //for (int i = 1; i <= quantity; i++) //{ //新增無貨 var issue = new IssueReport(); var issueFlow = 0; var ticketId = 0; var shipId = 0; if (pickType == (int)Utility.ShipPDF.寄倉調出) { ticketId = num; issueFlow = (int)POS_Library.ShopPos.EnumData.FlowType.調出; } else { shipId = num; issue.TicketId = num; issue.ShipOutId = num; issueFlow = (int)POS_Library.ShopPos.EnumData.FlowType.出貨; } //var issFlowType = POS_Library.ShopPos.EnumData.FlowType.出貨; //if ((productStatus == (int)POS_Library.ShopPos.NoProduct.EnumReportStatus.瑕疵)) //{ // issFlowType = POS_Library.ShopPos.EnumData.FlowType.瑕疵; //} issue.Id = POS_Library.Public.Utility.GetGuidMD5(); issue.TicketId = ticketId; issue.ShipOutId = shipId; issue.BoxNum = fromNewStorage ? oldShelf : "無貨"; issue.ProductId = productId; issue.Quantity = lackquantity; issue.IsQuantity = false; issue.ShopType = store; issue.Account = ""; issue.CreateAuditor = auditor; issue.CreateDate = DateTime.Now; issue.Comment = comment; //調出/出貨 issue.FlowStatus = issueFlow; var result = POS_Library.ShopPos.NoProductDA.SetDiff(issue, num, pickType, areaId, fromNewStorage, auditor, productStatus); lblMsg.Text = result.Reason; //有出錯標記 if (result.Result == "0") { error = true; } } if (error) { lblMsg.Text += " 此問題回報發生錯誤,請重新回報!!"; } else { btn_Report.Visible = false; if (pickType == (int)Utility.ShipPDF.寄倉調出 && PageKey == "ShipOutVerify") { var url = "ShipOutVerify.aspx?tick=" + num + "&area=" + areaId + "&store=" + store; Page.RegisterClientScriptBlock("checkinput", @"<script>alert('回報成功!'); window.open('" + url + "','_self');</script>"); //} } } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
/// <summary> /// Constructor /// </summary> /// <param name="issueReportService"></param> /// <param name="report"></param> public IssueReportDialogViewModel(IIssueReportService issueReportService, IssueReport report) { _issueReportService = issueReportService; _issueReportViewModel = new IssueReportViewModel(report); }
public static void SerializeIssueReportIssueComponent(IssueReport.IssueReportIssueComponent value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element's localId attribute if( value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents) ) writer.WriteRefIdContents(value.InternalId.Contents); // Serialize element extension if(value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach(var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element severity if(value.Severity != null) { writer.WriteStartElement("severity"); CodeSerializer.SerializeCode<IssueReport.IssueSeverity>(value.Severity, writer); writer.WriteEndElement(); } // Serialize element type if(value.Type != null) { writer.WriteStartElement("type"); CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer); writer.WriteEndElement(); } // Serialize element details if(value.Details != null) { writer.WriteStartElement("details"); FhirStringSerializer.SerializeFhirString(value.Details, writer); writer.WriteEndElement(); } // Serialize element location if(value.Location != null && value.Location.Count > 0) { writer.WriteStartArrayElement("location"); foreach(var item in value.Location) { writer.WriteStartArrayMember("location"); FhirStringSerializer.SerializeFhirString(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); }
public static void SerializeIssueReport(IssueReport value, IFhirWriter writer) { writer.WriteStartRootObject("IssueReport"); writer.WriteStartComplexContent(); // Serialize element's localId attribute if( value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents) ) writer.WriteRefIdContents(value.InternalId.Contents); // Serialize element extension if(value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach(var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if(value.Language != null) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.Language, writer); writer.WriteEndElement(); } // Serialize element text if(value.Text != null) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer); writer.WriteEndElement(); } // Serialize element contained if(value.Contained != null && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach(var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element issue if(value.Issue != null && value.Issue.Count > 0) { writer.WriteStartArrayElement("issue"); foreach(var item in value.Issue) { writer.WriteStartArrayMember("issue"); IssueReportSerializer.SerializeIssueReportIssueComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }