static void Main(string[] args) { // Export to custom CSV ExportToCsv.Run(); // Import from custom CSV ImportFromCsv.Run(); }
public IProgressItem GetExportStatus() { if (!CRMSecurity.IsAdmin) { throw CRMSecurity.CreateSecurityException(); } return(ExportToCsv.GetStatus(false)); }
private static void Main(string[] args) { Parser.Default.ParseArguments <Options, Schema.Options>(args) .MapResult( (Options opts) => ExportToCsv.Export(opts), (Schema.Options opts) => PrintSchema.Print(opts), errs => 1); }
public IProgressItem CancelExport() { if (!CRMSecurity.IsAdmin) { throw CRMSecurity.CreateSecurityException(); } ExportToCsv.Cancel(false); return(ExportToCsv.GetStatus(false)); }
/// <summary> /// CSV DataExporter /// </summary> /// <param name="description">the produced file's description</param> /// <param name="fileName">the produced file's name</param> public void ToCsv(string description = "Exported Data", string fileName = "data.csv") { var exportToCsv = new ExportToCsv { Description = description, FileName = fileName }; _pdfReport.DataBuilder.CustomExportSettings.Add(exportToCsv); }
public IProgressItem StartExport() { if (!CRMSecurity.IsAdmin) { throw CRMSecurity.CreateSecurityException(); } MessageService.Send(Request, MessageAction.CrmAllDataExported); return(ExportToCsv.Start(null, CRMSettingResource.Export + ".zip")); }
public IProgressItem StartExport() { if (!CRMSecurity.IsAdmin) { throw CRMSecurity.CreateSecurityException(); } MessageService.Send(Request, MessageAction.CrmAllDataExported); return(ExportToCsv.Start(null, string.Format("{0}_{1}.zip", CRMSettingResource.Export, DateTime.UtcNow.Ticks))); }
private void Export(DataTable dataTable) { if (csvRadioButton.Checked) { ExportToCsv.Export(dataTable, _fileName, _dataViewerParameters); } else if (sqlRadioButton.Checked) { ExportToSql.Export(dataTable, _fileName, _dataViewerParameters); } else { ExportToPtt.Export(dataTable, databaseNameTextBox.Text.Trim(), _fileName); } }
public void ExportToCsv_exports_database_table_contents_to_csv_file_to_specified_path() { var dbRootPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, testDatabase); var dbFilePath = Path.Combine(dbRootPath, Path.GetFileName(testDatabase)); var exportPath = Path.Combine(dbRootPath, "export"); //Clear previous test results. if (Directory.Exists(exportPath)) { Directory.Delete(exportPath); } Directory.CreateDirectory(exportPath); using (var table = new PersistentHashTable(testDatabase)) { table.Initialize(); table.Batch(actions => { actions.Put(new PutRequest { Key = "abc1", Bytes = new byte[] { 1 } }); actions.Put(new PutRequest { Key = "abc2", Bytes = new byte[] { 2 } }); actions.Commit(); }); } var export = new ExportToCsv(dbFilePath, exportPath); export.Execute(); Assert.True(Directory.Exists(exportPath)); Assert.True(File.Exists(Path.Combine(exportPath, "keys.csv"))); Assert.True(File.Exists(Path.Combine(exportPath, "data.csv"))); Assert.True(File.Exists(Path.Combine(exportPath, "details.csv"))); Assert.True(File.Exists(Path.Combine(exportPath, "lists.csv"))); var linesInKeys = File.ReadAllLines(Path.Combine(exportPath, "keys.csv")); var linesInData = File.ReadAllLines(Path.Combine(exportPath, "data.csv")); Assert.True(linesInKeys.Length > 0); Assert.True(linesInData.Length > 0); }
public IProgressItem StartPartialExport(string entityType, string base64FilterString) { if (string.IsNullOrEmpty(base64FilterString)) { throw new ArgumentException(); } FilterObject filterObject; String fileName; switch (entityType.ToLower()) { case "contact": filterObject = new ContactFilterObject(base64FilterString); fileName = CRMContactResource.Contacts + ".csv"; MessageService.Send(Request, MessageAction.ContactsExportedToCsv); break; case "opportunity": filterObject = new DealFilterObject(base64FilterString); fileName = CRMCommonResource.DealModuleName + ".csv"; MessageService.Send(Request, MessageAction.OpportunitiesExportedToCsv); break; case "case": filterObject = new CasesFilterObject(base64FilterString); fileName = CRMCommonResource.CasesModuleName + ".csv"; MessageService.Send(Request, MessageAction.CasesExportedToCsv); break; case "task": filterObject = new TaskFilterObject(base64FilterString); fileName = CRMCommonResource.TaskModuleName + ".csv"; MessageService.Send(Request, MessageAction.CrmTasksExportedToCsv); break; case "invoiceitem": fileName = CRMCommonResource.ProductsAndServices + ".csv"; filterObject = new InvoiceItemFilterObject(base64FilterString); break; default: throw new ArgumentException(); } return(ExportToCsv.Start(filterObject, fileName)); }
public UtilsController(CrmSecurity crmSecurity, DaoFactory daoFactory, MessageService messageService, SettingsManager settingsManager, CurrencyProvider currencyProvider, InvoiceSetting invoiceSetting, ImportFromCSVManager importFromCSVManager, OrganisationLogoManager organisationLogoManager, Global global, ImportFromCSV importFromCSV, ExportToCsv exportToCsv, IMapper mapper) : base(daoFactory, crmSecurity, mapper) { _messageService = messageService; _currencyProvider = currencyProvider; _settingsManager = settingsManager; _invoiceSetting = invoiceSetting; _importFromCSVManager = importFromCSVManager; _organisationLogoManager = organisationLogoManager; _global = global; _importFromCSV = importFromCSV; _exportToCsv = exportToCsv; }
private void DatabaseOperation_DataSourceAllPagesReadyEventUnattended(DataSet dataSet) { if (_unattended) { DataTable statisticsInfoDataTable = dataSet.Tables[1]; string periodBegin = ""; if (statisticsInfoDataTable.Rows[0]["MinStartTime"] != DBNull.Value) { DateTime minStartTime = Convert.ToDateTime(statisticsInfoDataTable.Rows[0]["MinStartTime"]); _minStartTime = minStartTime; string formattedMinStartTime = GenericHelper.FormatFileNameDate(minStartTime); periodBegin = formattedMinStartTime; } string periodEnd = ""; if (statisticsInfoDataTable.Rows[0]["MaxStartTime"] != DBNull.Value) { DateTime maxStartTime = Convert.ToDateTime(statisticsInfoDataTable.Rows[0]["MaxStartTime"]); _maxStartTime = maxStartTime; string formattedMaxStartTime = GenericHelper.FormatFileNameDate(maxStartTime); periodEnd = formattedMaxStartTime; } _fileName = string.Format(_fileName, periodBegin, periodEnd, _totalRows); } _databaseOperation.DataSourceAllPagesReadyEvent -= DatabaseOperation_DataSourceAllPagesReadyEventUnattended; ExportToCsv.DoExport(dataSet.Tables[0], _fileName, _dataViewerParameters); }
public IProgressItem CancelPartialExport() { ExportToCsv.Cancel(true); return(ExportToCsv.GetStatus(true)); }
public IProgressItem GetPartialExportStatus() { return(ExportToCsv.GetStatus(true)); }