Updating
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Requests;
|
||||
|
||||
public class ExcelDataRequest
|
||||
{
|
||||
[Required(AllowEmptyStrings = false, ErrorMessage = "FileContent is required")]
|
||||
public string FileContent { get; set; }
|
||||
public List<SheetRequest> SheetRequests { get; set; } = null;
|
||||
|
||||
public bool SkipSheetForExtraction(string sheetName, out SheetRequest currentSheetRequest)
|
||||
{
|
||||
currentSheetRequest = SheetRequests is null || !SheetRequests.Any() ?
|
||||
null :
|
||||
SheetRequests.FirstOrDefault(sheetReq => sheetReq.SheetName == sheetName);
|
||||
|
||||
if (this is not null &&
|
||||
SheetRequests is not null &&
|
||||
SheetRequests.Any() &&
|
||||
currentSheetRequest is null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
currentSheetRequest ??= new SheetRequest();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Requests;
|
||||
|
||||
public class SheetRequest
|
||||
{
|
||||
[Required(AllowEmptyStrings = false, ErrorMessage = "Sheet Name is required")]
|
||||
public string SheetName { get; set; }
|
||||
public List<string> Columns { get; set; } = null;
|
||||
public List<int> Rows { get; set; } = null;
|
||||
|
||||
public bool SkipRowForExtraction(int rowIndex)
|
||||
{
|
||||
if (this is not null && Rows is not null && Rows.Any())
|
||||
{
|
||||
if (!Rows.Contains(rowIndex))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SkipColumnForExtraction(string columnName)
|
||||
{
|
||||
if (this is not null && Columns is not null && Columns.Any())
|
||||
{
|
||||
if (!Columns.Contains(columnName, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class CellResponse
|
||||
{
|
||||
public string ColumnName { get; set; }
|
||||
public int Row { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string Formula { get; set; }
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class ExcelDataResponse
|
||||
{
|
||||
public ExcelDataResponse()
|
||||
{
|
||||
WorkBook = new WorkBook();
|
||||
}
|
||||
|
||||
public WorkBook WorkBook { get; set; }
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class SheetResponse
|
||||
{
|
||||
public SheetResponse(string sheetName)
|
||||
{
|
||||
SheetName = sheetName;
|
||||
CellResponses = new List<CellResponse>();
|
||||
}
|
||||
|
||||
public string SheetName { get; set; }
|
||||
public List<CellResponse> CellResponses { get; set; }
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Responses;
|
||||
|
||||
public class WorkBook
|
||||
{
|
||||
public WorkBook()
|
||||
{
|
||||
SheetResponses = new List<SheetResponse>();
|
||||
}
|
||||
|
||||
public List<SheetResponse> SheetResponses { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user