public ActionResult Index(string xmlFileName) { if (String.IsNullOrEmpty(xmlFileName)) { ViewData["Error"] = "You have to provide file name!"; return(View()); } if (!(xmlFileName.EndsWith(".xml", true, null))) { xmlFileName += ".xml"; } AspDatabase db = new AspDatabase(); Root root = db.LoadDataFromXmlDatabase(); if (root != null) { XmlGenerator generator = new XmlGenerator(); string path = Server.MapPath("~/App_Data/" + xmlFileName).ToString(); generator.Generate(path, root); ViewData["Message"] = "Download succesful! Xml saved to " + path; } else { ViewData["Error"] = "Download failed!"; } return(View()); }
private static IActionResult GetReport(ExportDto exportDto, TraceWriter log) { log.Info("Function started"); IActionResult check = exportDto.Validate(); if (check != null) { return(check); } var setup = new ExportSetup() { Year = exportDto.Year, Period = exportDto.Quarter ?? exportDto.Month.GetValueOrDefault(), ExportMode = exportDto.Quarter.HasValue ? ExportMode.Quarter : ExportMode.Month, OfficeDepartmentNo = exportDto.OfficeDepartmentId.ToString(), OfficeNo = exportDto.OfficeNo.ToString(), }; var connectConfig = new FakturoidConfiguration() { AccountName = exportDto.AccountName, Key = exportDto.Key, Login = exportDto.Login }; var exporter = new XmlGenerator(); log.Info("Export started"); var exportedData = new FakturoidVATExportAdapter(connectConfig).GetExportForPeriod(setup); log.Info("Data exported"); string xml = exporter.Generate(exportedData); log.Info("Report generated"); return(new OkObjectResult(xml)); }
static void GenerateCustomersDataFile() { var xmlGenerator = new XmlGenerator(_dataFilePath, 1000); xmlGenerator.Generate(); }
static void GenerateCustomersDataFile() { XmlGenerator xmlGenerator = new XmlGenerator(_dataFilePath, _numberOfNodes); xmlGenerator.Generate(); }
static void Main(string[] args) { PostgresDbCreator postgresDbCreator = new PostgresDbCreator(); PostgresDbSeeder postgresDbSeeder = new PostgresDbSeeder(); SQLiteDbCreator sqLiteDbCreator = new SQLiteDbCreator(); SQLiteDbSeeder sqLiteDbSeeder = new SQLiteDbSeeder(); PostgresDbExtractor postgresDbExtractor = new PostgresDbExtractor(); SQLiteDbExtractor sqLiteDbExtractor = new SQLiteDbExtractor(); CsvGenerator csvGenerator = new CsvGenerator(); HtmlGenerator htmlGenerator = new HtmlGenerator(); XmlGenerator xmlGenerator = new XmlGenerator(); CsGenerator csGenerator = new CsGenerator(); try { using (DbConnection connection = new SQLiteConnection(Configuration.SQLiteConnectionString)) { connection.Open(); var path = "D:\\sqLite_output"; if (Directory.Exists(path)) { Directory.Delete(path, true); } Directory.CreateDirectory(path); var sqLiteTables = sqLiteDbExtractor.GetTables(connection); foreach (var sqLiteTable in sqLiteTables.Where(x => x != "sqlite_sequence")) { csvGenerator.Generate(sqLiteDbExtractor, connection, sqLiteTable, path); htmlGenerator.Generate(sqLiteDbExtractor, connection, sqLiteTable, path); xmlGenerator.Generate(sqLiteDbExtractor, connection, sqLiteTable, path); csGenerator.Generate(sqLiteDbExtractor, connection, sqLiteTable, path); } } using (DbConnection connection = new NpgsqlConnection(Configuration.NpgsqlConnectionString)) { connection.Open(); var path = "D:\\pgsql_output"; if (Directory.Exists(path)) { Directory.Delete(path, true); } Directory.CreateDirectory(path); var pgsqlTables = postgresDbExtractor.GetTables(connection); foreach (var pgsqlTable in pgsqlTables) { csvGenerator.Generate(postgresDbExtractor, connection, pgsqlTable, path); htmlGenerator.Generate(postgresDbExtractor, connection, pgsqlTable, path); xmlGenerator.Generate(postgresDbExtractor, connection, pgsqlTable, path); csGenerator.Generate(postgresDbExtractor, connection, pgsqlTable, path); } } } catch (Exception e) { Console.WriteLine(e.Message); throw; } }