public static Task <DocumentFileData> createDocument(int WoN, string title, DocumentString document) { DocumentFileData file = new DocumentFileData(); file.DOC_CLASS = "400"; file.DOC_FORMAT = "*"; file.DOC_TYPE = "ORIGINAL"; file.TITLE = title + DateTime.Now.ToString("yyyyMMdd"); file.LOCAL_PATH = @"\\TriggerReports\TriggerReport"; file.FILE_DATA = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(document))); file.FILE_EXT_ORIGINAL = "TXT"; file.ORIGINAL_FILE_NAME = "TriggerReport.txt"; file.LU_NAME = "WorkOrder"; file.KEY_REF = string.Format("WO_NO={0}^", WoN); file.SET_STATE = "Preliminary".ToUpper(); var result = cloud.CreateAndCheckInDocument(file); return(result); }
private static async Task ShowDialog(Sensor sensor, SensorFault fault, FaultReport report, DocumentFileData docFileData) { var dialog = new ContentDialog { Title = "Faulted" }; dialog.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center; dialog.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; dialog.Loaded += async(sender, e) => { await Task.Delay(4000); dialog.Hide(); }; var panel = new StackPanel(); var text = new TextBlock(); text.Text = $"Sensor '{sensor.Id}' faulted with type: {fault.Type}\n"; if (report == null) { dialog.Title += " (ERROR)"; text.Text += "but failed to send a fault report, check the cloud connection"; } else { text.Text = $"Report generated with Work Order: {report.WoNo} \n Attachement Number: {docFileData.DOC_NO}"; } panel.Children.Add(text); dialog.Content = panel; dialog.SecondaryButtonText = "Close"; dialog.IsSecondaryButtonEnabled = true; if (report != null) { dialog.PrimaryButtonText = "View Report"; dialog.IsPrimaryButtonEnabled = true; dialog.PrimaryButtonCommand = new ActionCommand <object>(o => { ShellPage.Current.ContentNavigate(typeof(FaultReportDetailsPage), report); }); } Interlocked.Increment(ref dialogCount); await dialog.ShowAsync(); }