| base.OnInitialized(); | base.OnInitialized(); | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| try { | try { | ||||
| response = await IBicycleRestService.SendFoundReport(ReportDataProvider.Report); | |||||
| if (ReportDataProvider.ReportRepositoryItem != null) { | |||||
| response = await IBicycleRestService.SendFoundReport((FoundReportRepositoryItem)ReportDataProvider.ReportRepositoryItem); | |||||
| } else { | |||||
| response = await IBicycleRestService.SendFoundReport(ReportDataProvider.Report); | |||||
| } | |||||
| responseStatus = response==null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error; | responseStatus = response==null ? ResponseStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResponseStatus.OK : ResponseStatus.Error; | ||||
| } catch (HttpRequestException ex) { | } catch (HttpRequestException ex) { | ||||
| response = new(i18n.GetString("FoundBike"), new string[] { ex.Message }); | response = new(i18n.GetString("FoundBike"), new string[] { ex.Message }); |
| base.OnInitialized(); | base.OnInitialized(); | ||||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | ||||
| try { | try { | ||||
| response = await IBicycleRestService.SendMissingReport(ReportDataProvider.Report); | |||||
| if (ReportDataProvider.ReportRepositoryItem != null) { | |||||
| response = await IBicycleRestService.SendMissingReport((MissingReportRepositoryItem)ReportDataProvider.ReportRepositoryItem); | |||||
| } else { | |||||
| response = await IBicycleRestService.SendMissingReport(ReportDataProvider.Report); | |||||
| } | |||||
| responseStatus = response == null ? ResposeStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResposeStatus.OK : ResposeStatus.Error; | responseStatus = response == null ? ResposeStatus.NoConnection : System.Net.HttpStatusCode.OK == response.StatusCode ? ResposeStatus.OK : ResposeStatus.Error; | ||||
| } catch (HttpRequestException ex) { | } catch (HttpRequestException ex) { | ||||
| response = new(i18n.GetString("MissingBike"), new string[] { ex.Message }); | response = new(i18n.GetString("MissingBike"), new string[] { ex.Message }); |
| private void updateDtoFromGUI() { | private void updateDtoFromGUI() { | ||||
| MissingReport report = ReportDataProvider.GetMissingReport(); | MissingReport report = ReportDataProvider.GetMissingReport(); | ||||
| report.FotoString = imgUrl; | report.FotoString = imgUrl; | ||||
| report.FarbeId = selectedColor != null ? selectedColor.Id : 0; | |||||
| report.TypId = selectedBcType != null ? selectedBcType.Id : 0; | |||||
| report.FarbeId = selectedColor != null ? selectedColor.Id : null; | |||||
| report.TypId = selectedBcType != null ? selectedBcType.Id : null; | |||||
| if (SelectedBrand != null) { | if (SelectedBrand != null) { | ||||
| if (SelectedBrand.Id == -999) { | if (SelectedBrand.Id == -999) { | ||||
| report.NeueMarke = SelectedBrand.Bezeichnung; | report.NeueMarke = SelectedBrand.Bezeichnung; |
| return await SendReport(report, subResourceUrl, new FoundReportRepositoryItem((FoundReport)report, ReportRepositoryService.GetCurrentTimeInMillis())); | return await SendReport(report, subResourceUrl, new FoundReportRepositoryItem((FoundReport)report, ReportRepositoryService.GetCurrentTimeInMillis())); | ||||
| } | } | ||||
| private async Task<ReportResponse> SendFoundReport(FoundReportRepositoryItem reportRepositoryItem) { | |||||
| public async Task<ReportResponse> SendFoundReport(FoundReportRepositoryItem reportRepositoryItem) { | |||||
| string subResourceUrl = configuration.GetValue<string>("subresource_url_foundreport"); | string subResourceUrl = configuration.GetValue<string>("subresource_url_foundreport"); | ||||
| return await SendReport(reportRepositoryItem.Report, subResourceUrl, reportRepositoryItem); | return await SendReport(reportRepositoryItem.Report, subResourceUrl, reportRepositoryItem); | ||||
| } | } | ||||
| await reportRepositoryService.SaveReport(reportRepositoryItem); | await reportRepositoryService.SaveReport(reportRepositoryItem); | ||||
| return response; | return response; | ||||
| } | } | ||||
| } | } | ||||
| } | } |
| Task<ReportResponse> SendFoundReport(Report report); | Task<ReportResponse> SendFoundReport(Report report); | ||||
| Task<ReportResponse> SendFoundReport(FoundReportRepositoryItem reportRepositoryItem); | |||||
| Task<ReportResponse> SendMissingReport(Report report); | Task<ReportResponse> SendMissingReport(Report report); | ||||
| Task<ReportResponse> SendMissingReport(MissingReportRepositoryItem reportRepositoryItem); | |||||
| Task<int> TrySendPendingReports(); | Task<int> TrySendPendingReports(); | ||||
| Task<int> TrySendFoundPendingReports(); | Task<int> TrySendFoundPendingReports(); |
| <PropertyGroup> | <PropertyGroup> | ||||
| <ActiveDebugProfile>CaritasPWA</ActiveDebugProfile> | <ActiveDebugProfile>CaritasPWA</ActiveDebugProfile> | ||||
| <NameOfLastUsedPublishProfile>D:\Work\Caritas\cwebplusApp\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> | <NameOfLastUsedPublishProfile>D:\Work\Caritas\cwebplusApp\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> | ||||
| <ShowAllFiles>true</ShowAllFiles> | |||||
| <ShowAllFiles>false</ShowAllFiles> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| </Project> | </Project> |