|
5 | 5 | using BExIS.Dlm.Services.DataStructure; |
6 | 6 | using BExIS.Dlm.Services.Meanings; |
7 | 7 | using BExIS.IO.DataType.DisplayPattern; |
| 8 | +using DocumentFormat.OpenXml.Drawing.Charts; |
| 9 | +using DocumentFormat.OpenXml.Math; |
8 | 10 | using Newtonsoft.Json; |
9 | 11 | using System; |
10 | 12 | using System.Collections.Generic; |
11 | 13 | using System.Data; |
| 14 | +using System.IO; |
12 | 15 | using System.Linq; |
| 16 | +using System.Text; |
| 17 | +using System.Web.Configuration; |
| 18 | +using Vaiona.Utils.Cfg; |
| 19 | +using DataTable = System.Data.DataTable; |
13 | 20 |
|
14 | 21 | namespace BExIS.IO.Transform.Output |
15 | 22 | { |
@@ -426,16 +433,36 @@ public static string GetDataStructureAsJson(long id) |
426 | 433 | return JsonConvert.SerializeObject(new DataStructureDataTable(id)); |
427 | 434 | } |
428 | 435 |
|
429 | | - //public static string GetVariableListAsJson(long id) |
430 | | - //{ |
431 | | - // return JsonConvert.SerializeObject(new DataStructureDataList(id), Newtonsoft.Json.Formatting.Indented); |
432 | | - //} |
433 | 436 |
|
434 | 437 | public static DataStructureDataList GetVariableList(long id) |
435 | 438 | { |
436 | 439 | return new DataStructureDataList(id); |
437 | 440 | } |
438 | 441 |
|
| 442 | + public static string GenerateDataStructureAsText(long datastructureId) |
| 443 | + { |
| 444 | + StringBuilder stringBuilder = new StringBuilder(); |
| 445 | + |
| 446 | + using (var dataStructureManager = new DataStructureManager()) |
| 447 | + { |
| 448 | + StructuredDataStructure dataStructure = new StructuredDataStructure(); |
| 449 | + dataStructure = dataStructureManager.StructuredDataStructureRepo.Get(datastructureId); |
| 450 | + |
| 451 | + if (dataStructure != null) |
| 452 | + { |
| 453 | + stringBuilder.AppendLine(String.Join(",", dataStructure.Variables.Select(v => v.Label))); |
| 454 | + stringBuilder.AppendLine(String.Join(",", dataStructure.Variables.Select(v => v.Unit?.Name))); |
| 455 | + stringBuilder.AppendLine(String.Join(",", dataStructure.Variables.Select(v => v.Description))); |
| 456 | + stringBuilder.AppendLine(String.Join(",", dataStructure.Variables.Select(v => v.DataType?.Name))); |
| 457 | + stringBuilder.AppendLine(String.Join(",", dataStructure.Variables.Select(v => v.IsValueOptional? "optional" : "mandatory"))); |
| 458 | + stringBuilder.AppendLine(String.Join(",", dataStructure.Variables.Select(v => v.IsKey?"primary key":""))); |
| 459 | + } |
| 460 | + } |
| 461 | + |
| 462 | + return stringBuilder.ToString(); |
| 463 | + } |
| 464 | + |
| 465 | + |
439 | 466 | public static string GenerateDataStructure(long datasetId) |
440 | 467 | { |
441 | 468 | string path = ""; |
|
0 commit comments