Permalink
Browse files

#25 merge from dev

  • Loading branch information...
DavidBlaa committed Jun 13, 2018
2 parents a9ff119 + 70811e1 commit ec83976a46c37a151a1062b39018d39230dfc7f0
Showing with 2,098 additions and 794 deletions.
  1. +1 −2 BExIS++.sln
  2. +13 −0 Components/DLM/BExIS.Dlm.Services/Data/DatasetManager.cs
  3. +6 −7 Components/IO/BExIS.IO.Transform.Input/AsciiFileReaderInfo.cs
  4. +21 −1 Components/IO/BExIS.IO.Transform.Input/ExcelFileReaderInfo.cs
  5. +3 −0 Components/IO/BExIS.IO.Transform.Input/ExcelHelper.cs
  6. +152 −2 Components/IO/BExIS.IO.Transform.Input/ExcelReader.cs
  7. +1 −0 Components/IO/BExIS.Io.Transform.Output/BExIS.Io.Transform.Output.csproj
  8. +60 −24 Components/IO/BExIS.Io.Transform.Output/DataWriter.cs
  9. +7 −0 Components/IO/BExIS.Io.Transform.Output/ExcelHelper.cs
  10. +219 −117 Components/IO/BExIS.Io.Transform.Output/ExcelWriter.cs
  11. +95 −345 Components/IO/BExIS.Io.Transform.Output/OutputDataManager.cs
  12. +60 −1 Components/IO/BExIS.Io/IOUtility.cs
  13. +6 −0 Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.csproj
  14. +352 −29 Console/BExIS.Web.Shell/Areas/DCM/Controllers/SubmitGetFileInformationController.cs
  15. +3 −2 Console/BExIS.Web.Shell/Areas/DCM/Controllers/SubmitSelectAFileController.cs
  16. +29 −8 Console/BExIS.Web.Shell/Areas/DCM/Controllers/SubmitSummaryController.cs
  17. +21 −2 Console/BExIS.Web.Shell/Areas/DCM/Controllers/SubmitValidationController.cs
  18. +315 −0 Console/BExIS.Web.Shell/Areas/DCM/Helpers/UploadUIHelper.cs
  19. +12 −0 Console/BExIS.Web.Shell/Areas/DCM/Models/FileInfoModel.cs
  20. +19 −16 Console/BExIS.Web.Shell/Areas/DCM/Views/SubmitGetFileInformation/GetFileInformation.cshtml
  21. +2 −25 Console/BExIS.Web.Shell/Areas/DCM/Views/SubmitGetFileInformation/_txtFormularView.cshtml
  22. +515 −121 Console/BExIS.Web.Shell/Areas/DCM/Views/SubmitGetFileInformation/_xlsFormularView.cshtml
  23. +70 −47 Console/BExIS.Web.Shell/Areas/DDM/Controllers/DataController.cs
  24. +7 −2 Console/BExIS.Web.Shell/Areas/DDM/Models/ShowPrimaryDataModel.cs
  25. +94 −39 Console/BExIS.Web.Shell/Areas/DDM/Views/Data/_structuredDataView.cshtml
  26. +1 −2 Console/BExIS.Web.Shell/Areas/DIM/Controllers/DataController.cs
  27. +9 −0 Modules/DCM/BExIS.Dcm.UploadWizard/TaskManager.cs
  28. +5 −2 Modules/DCM/BExIS.Dcm.UploadWizard/UploadWizardHelper.cs
View
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Console", "Console", "{A24A6801-2ECC-4F47-8284-8C93277D3030}"
EndProject
@@ -735,7 +735,6 @@ Global
{15821863-0273-485B-A9AB-D7C1E1011ADE} = {9A962207-D10C-472C-995B-A2519760F29A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7B94B508-3EC2-4BCB-9B8C-BFFE40A6CE23}
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.2.1.505.2\lib\NET35
SolutionGuid = {9B6E4921-8EBA-487D-A098-3E473A0EAC64}
EndGlobalSection
@@ -16,6 +16,19 @@
using MDS = BExIS.Dlm.Entities.MetadataStructure;
using Vaiona.Logging.Aspects;
namespace System.Data
{
public static class DataTableExtensionsForDataset
{
public static void Strip(this DataTable table)
{
if (table.Columns.Contains("id")) { table.Columns.Remove("id"); }
if (table.Columns.Contains("orderno")) { table.Columns.Remove("orderno"); }
if (table.Columns.Contains("timestamp")) { table.Columns.Remove("timestamp"); }
if (table.Columns.Contains("versionid")) { table.Columns.Remove("versionid"); }
}
}
}
namespace BExIS.Dlm.Services.Data
{
/// <summary>
@@ -15,13 +15,12 @@ public class AsciiFileReaderInfo:FileReaderInfo
/// </summary>
public AsciiFileReaderInfo()
{
this.Seperator = TextSeperator.tab;
this.TextMarker = TextMarker.quotes;
this.Offset = 0;
this.Orientation = Orientation.columnwise;
this.Variables = 1;
this.Data = 2;
this.Offset = 0;
Seperator = TextSeperator.tab;
TextMarker = TextMarker.quotes;
Offset = 0;
Orientation = Orientation.columnwise;
Variables = 1;
Data = 2;
}
/// <summary>
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
/// <summary>
///
/// </summary>
@@ -12,9 +14,27 @@ namespace BExIS.IO.Transform.Input
/// <remarks></remarks>
public class ExcelFileReaderInfo:FileReaderInfo
{
public int VariablesStartRow { get; set; }
public int VariablesEndRow { get; set; }
public int VariablesStartColumn { get; set; }
public int VariablesEndColumn { get; set; }
public int DataStartRow { get; set; }
public int DataEndRow { get; set; }
public int DataStartColumn { get; set; }
public int DataEndColumn { get; set; }
public string WorksheetUri { get; set; }
public ExcelFileReaderInfo()
{
this.Decimal = DecimalCharacter.point;
WorksheetUri = "";
}
}
}
@@ -14,5 +14,8 @@ public static double FromExcelSerialDate(double SerialDate)
if (SerialDate > 59) SerialDate -= 1; //Excel/Lotus 2/29/1900 bug
return new DateTime(1899, 12, 31).AddDays(SerialDate).ToOADate();
}
}
}
@@ -364,6 +364,102 @@ public List<DataTuple> ReadFile(Stream file, string fileName, FileReaderInfo fri
return this.DataTuples;
}
/// <summary>
/// Read a Excel row by row
/// Convert the rows into a datatuple based on the datastructure.
/// Return a list of datatuples
/// </summary>
/// <remarks></remarks>
/// <seealso cref=""/>
/// <param name="file">File as stream</param>
/// <param name="fileName">Name of the file</param>
/// <param name="fri">FileReaderInfo (ExcelFileReaderInfo) for additional Informations to read the file</param>
/// <param name="sds">StructuredDataStructure of a dataset</param>
/// <param name="datasetId">Datasetid of a dataset</param>
/// <returns>List of DataTuples</returns>
public List<DataTuple> ReadFile(Stream file, string fileName, ExcelFileReaderInfo fri, StructuredDataStructure sds, long datasetId, int packageSize)
{
this.FileStream = file;
this.FileName = fileName;
this.StructuredDataStructure = sds;
this.Info = fri;
this.DatasetId = datasetId;
// clear list of datatuples for the next package
this.DataTuples = new List<DataTuple>();
// Check params
if (this.FileStream == null)
{
this.ErrorMessages.Add(new Error(ErrorType.Other, "File not exist"));
}
if (!this.FileStream.CanRead)
{
this.ErrorMessages.Add(new Error(ErrorType.Other, "File is not readable"));
}
if (fri.VariablesStartRow <= 0)
{
this.ErrorMessages.Add(new Error(ErrorType.Other, "Startrow of Variable can´t be 0"));
}
if (fri.DataStartRow <= 0)
{
this.ErrorMessages.Add(new Error(ErrorType.Other, "Startrow of Data can´t be 0"));
}
if (this.ErrorMessages.Count == 0)
{
// open excel file
spreadsheetDocument = SpreadsheetDocument.Open(this.FileStream, false);
// get workbookpart
WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
startColumn = fri.DataStartColumn;
endColumn = fri.DataEndColumn;
numOfColumns = (endColumn - startColumn) + 1;
offset = fri.Offset;
int endRowData = fri.DataEndRow;
// select worksheetpart by selected defined name area like data in sheet
// sheet where data area is inside
WorksheetPart worksheetPart = workbookPart.WorksheetParts.First(); //GetWorkSheetPart(workbookPart, this._areaOfData);
// get styleSheet
_stylesheet = workbookPart.WorkbookStylesPart.Stylesheet;
// Get shared strings
_sharedStrings = workbookPart.SharedStringTablePart.SharedStringTable.Elements<SharedStringItem>().ToArray();
if (Position == 1)
{
Position = fri.DataStartRow;
}
else
Position++;
int endPosition = Position + packageSize;
if (endPosition > endRowData)
endPosition = endRowData;
if (GetSubmitedVariableIdentifier(worksheetPart, fri.VariablesStartRow, fri.VariablesEndRow) != null)
{
ReadRows(worksheetPart, Position, endPosition);
Position += packageSize;
}
return this.DataTuples;
}
return this.DataTuples;
}
/// <summary>
///
@@ -623,6 +719,59 @@ public void ValidateFile(Stream file, string fileName, StructuredDataStructure s
// close fehlt
}
/// <summary>
/// Validate a Excel Template file
/// </summary>
/// <remarks>Only when excel template is in use</remarks>
/// <seealso cref=""/>
/// <param name="file">File as stream</param>
/// <param name="fileName">Name of the file</param>
/// <param name="sds">StructuredDataStructure of a dataset</param>
/// <param name="datasetId">Datasetid of a dataset</param>
public void ValidateFile(Stream file, string fileName, ExcelFileReaderInfo fri, StructuredDataStructure sds, long datasetId)
{
this.FileStream = file;
this.FileName = fileName;
this.StructuredDataStructure = sds;
this.Info = fri;
this.DatasetId = datasetId;
// open excel file
spreadsheetDocument = SpreadsheetDocument.Open(this.FileStream, false);
// get workbookpart
WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
startColumn = fri.DataStartColumn;
endColumn = fri.DataEndColumn;
numOfColumns = (endColumn - startColumn) + 1;
offset = fri.Offset;
int endRowData = fri.DataEndRow;
// select worksheetpart by selected defined name area like data in sheet
// select worksheetpart by Uri
WorksheetPart worksheetPart = workbookPart.WorksheetParts.Where(ws => ws.Uri.ToString() == fri.WorksheetUri).FirstOrDefault();
// get styleSheet
_stylesheet = workbookPart.WorkbookStylesPart.Stylesheet;
// Get shared strings
_sharedStrings = workbookPart.SharedStringTablePart.SharedStringTable.Elements<SharedStringItem>().ToArray();
if (this.ErrorMessages.Count == 0)
{
if (ValidateDatastructure(worksheetPart, fri.VariablesStartRow, fri.VariablesEndRow))
{
ValidateRows(worksheetPart, fri.DataStartRow, endRowData);
}
}
// close fehlt
}
/// <summary>
/// Validate Datastructure from file
@@ -728,8 +877,8 @@ private List<string> RowToList(Row r)
if (c.CellValue != null)
{
// if cell reference in range of the area
int start = GetColumnNumber(this._areaOfData.StartColumn);
int end = GetColumnNumber(this._areaOfData.EndColumn);
int start = startColumn;//GetColumnNumber(this._areaOfData.StartColumn);
int end = endColumn;//GetColumnNumber(this._areaOfData.EndColumn);
if (cellReferencAsInterger >= start && cellReferencAsInterger <= end)
{
@@ -1170,6 +1319,7 @@ private bool IsEmpty(Row row)
return true;
}
#endregion
@@ -51,6 +51,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Oops, something went wrong.

0 comments on commit ec83976

Please sign in to comment.