// GET Report/ExportAudit public FileContentResult ExportAudit() { string displayName; var csvExport = new CSVExporter(); foreach (var auditRecord in AuditRecordProvider.GetAll()) { csvExport.AddRow(); foreach (var prop in auditRecord.GetType().GetProperties()) { switch (prop.Name) { case "EntityName": displayName = "Entity"; break; case "PrimaryKeyValue": displayName = "ID"; break; case "PropertyName": displayName = "Property"; break; case "OldValue": displayName = "Old Value"; break; case "NewValue": displayName = "New Value"; break; case "DateChanged": displayName = "Date Changed"; break; case "UserName": displayName = "Changed By"; break; default: displayName = prop.Name; break; } csvExport[displayName] = prop.GetValue(auditRecord, null); } } return(File(new UTF8Encoding().GetBytes(csvExport.Export()), "text/csv", "AuditRecords.csv")); }
private void ExportList() { try { CSVExporter exporter = new CSVExporter(); exporter.List = QuickSearch.DisplayList.ToList <dynamic>(); exporter.Export(); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
private void TryExportToCSV() { string newCSVExportPath = EditorUtility.SaveFilePanel("Save CSV", EditorWindowTools.GetDirectoryName(csvExportPath), csvExportPath, "csv"); if (!string.IsNullOrEmpty(newCSVExportPath)) { csvExportPath = newCSVExportPath; if (Application.platform == RuntimePlatform.WindowsEditor) { csvExportPath = csvExportPath.Replace("/", "\\"); } CSVExporter.Export(database, csvExportPath, exportActors, exportItems, exportLocations, exportVariables, exportConversations, exportConversationsAfterEntries, entrytagFormat); EditorUtility.DisplayDialog("Export Complete", "The dialogue database was exported to CSV (comma-separated values) format. ", "OK"); } }
public void OnExportClicked() { StringBuilder sb = new StringBuilder(); sb.AppendLine($"Type,Name,Action Summary,Notes"); foreach (ReturnedEntity item in ReportEntities) { sb.AppendLine( $"{item.Type},{item.FullName},{item.Action.actionType} completed by {item.Action.completedBy} on {item.Action.date.Value.ToShortDateString()},\"{item.Action.DecodedNotes}\""); } ReportExporter exporter = new CSVExporter() { Data = sb.ToString() }; exporter.Export(); }
public void OnExportClicked() { StringBuilder sb = new StringBuilder(); sb.AppendLine($"Type,SunshineID,Name,Address,Last Action"); foreach (ReturnedEntity item in ReportEntities) { sb.AppendLine( $"{item.Type},{item.SunshineId},{item.FullName},{item.FullAddress},{item.LastAction}"); } ReportExporter exporter = new CSVExporter() { Data = sb.ToString() }; exporter.Export(); }
// GET Report/ExportMatrix public FileContentResult ExportMatrix() { string displayName; var csvExport = new CSVExporter(); foreach (var reportMatrix in ReportProvider.GetMatrix()) { csvExport.AddRow(); foreach (var prop in reportMatrix.GetType().GetProperties()) { switch (prop.Name) { case "Reporting Period": displayName = "Reporting Period"; break; case "RecordStatus": displayName = "Record Status"; break; case "NewVehicles": displayName = "New Vehicles"; break; case "ExpansionVehicles": displayName = "Expansion Vehicles"; break; case "ReplacementVehicles": displayName = "Replacement Vehicles"; break; default: displayName = prop.Name; break; } csvExport[displayName] = prop.GetValue(reportMatrix, null); } } return(File(new UTF8Encoding().GetBytes(csvExport.Export()), "text/csv", "ReportMatrix.csv")); }
// GET DeviceSurvey/Export public FileContentResult Export() { var csvExport = new CSVExporter(); var excludedFields = "ID,HasGilligYN,HasNewFlyerYN,HasElDoradoYN,HasOtherYN,IsGilligNewVehiclesAndModelRequired,IsNewFlyerNewVehiclesAndModelRequired,IsElDoradoNewVehiclesAndModelRequired,IsOtherNewVehiclesAndModelRequired"; var excluded = excludedFields.Split(',').ToList <String>(); foreach (var deviceSurvey in DeviceSurveyProvider.GetAll()) { csvExport.AddRow(); foreach (var prop in deviceSurvey.GetType().GetProperties()) { if (excluded.Find(x => x == prop.Name) == null) { csvExport[prop.Name] = prop.GetValue(deviceSurvey, null); } } } return(File(new UTF8Encoding().GetBytes(csvExport.Export()), "text/csv", "DeviceSurvey.csv")); }
/// <summary> /// 导出统计结果 /// </summary> /// <param name="total"></param> /// <param name="fpath"></param> public void Export(Total total, string fpath) { try { //将total 转换成datatable DataTable dt = new DataTable(); dt.Columns.Add("type", typeof(string)); dt.Columns.Add("blank1", typeof(string)); dt.Columns.Add("copy", typeof(string)); dt.Columns.Add("blank2", typeof(string)); dt.Columns.Add("delete", typeof(string)); dt.Columns.Add("blank3", typeof(string)); dt.Columns.Add("transfer", typeof(string)); dt.Columns.Add("blank4", typeof(string)); dt.Columns.Add("transferDelete", typeof(string)); string blank = " "; //时间 if (total.TimeInterval != null) { dt.Rows.Add(new object[] { blank, total.TimeInterval.Start.ToLongDateString(), total.TimeInterval.Start.ToLongTimeString(), " -", total.TimeInterval.End.ToLongDateString(), total.TimeInterval.End.ToLongTimeString(), blank, blank }); } dt.Rows.Add(new object[] { blank, "コピー済み", blank, "削除", blank, "転送", blank, "削除" }); dt.Rows.Add(new object[] { "ファイル", total.FilesCopied, blank, total.FilesDeleted, blank, total.FileTransfered, blank, total.FileTransDeleted }); dt.Rows.Add(new object[] { "バイト", total.BytesCopied, blank, total.BytesDeleted, blank, total.BytesTransfered, blank, total.BytesTransDeleted }); CSVExporter csvExporter = new CSVExporter(); csvExporter.Export(dt, fpath); } catch (System.Exception ex) { logger.Error(ex.Message); throw; } }
private void ExportList() { try { CSVExporter exporter = new CSVExporter(); SaveFileDialog Dialog = new SaveFileDialog(); Dialog.FileName = "StockListExport"; Dialog.AddExtension = false; if (Dialog.ShowDialog() == true) { exporter.FileName = Dialog.FileName; exporter.List = QSearch.DisplayList.ToList <dynamic>(); exporter.Export(); } } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }