-
Notifications
You must be signed in to change notification settings - Fork 0
Member info #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Member info #28
Changes from all commits
7fe8020
cfac179
03a2aeb
6c67611
8277af5
16fe831
f8f4708
25150cf
314984d
2127fca
ca36545
2210c40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // Copyright (c) Dominic Schira <domshyra@gmail.com>. All Rights Reserved. | ||
|
|
||
| using ExcelExtensions.Models; | ||
| using ExcelExtensions.Models.Columns; | ||
| using ExcelExtensions.Models.Columns.Export; | ||
| using ExcelExtensions.Models.Columns.Import; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Reflection; | ||
| using static ExcelExtensions.Enums.Enums; | ||
|
|
||
| namespace ExcelExtensions.Interfaces.Import | ||
| { | ||
| //todo fix these comments | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO |
||
| /// <summary> | ||
| /// Provides methods to give to the parse methods from models | ||
| /// </summary> | ||
| public interface IColumnMap | ||
| { | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <param name="import"></param> | ||
| /// <param name="currentColumnNumber"></param> | ||
| /// <param name="columnsUsed"></param> | ||
| /// <param name="modelPropertyName"></param> | ||
| /// <param name="attribute"></param> | ||
| /// <returns></returns> | ||
| int GetAttributeColumnNumber(bool import, int currentColumnNumber, Dictionary<int, string> columnsUsed, string modelPropertyName, ColumnAttribute attribute); | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <param name="modelType"></param> | ||
| /// <param name="item"></param> | ||
| /// <param name="formatType"></param> | ||
| /// <param name="modelPropertyName"></param> | ||
| /// <param name="displayName"></param> | ||
| /// <param name="attribute"></param> | ||
| /// <param name="format"></param> | ||
| /// <param name="required"></param> | ||
| void GetColumnAttributes(Type modelType, PropertyInfo item, FormatType formatType, out string modelPropertyName, out string displayName, out ColumnAttribute attribute, out FormatType format, out bool required); | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <param name="modelType"></param> | ||
| /// <param name="formatType"></param> | ||
| /// <param name="startColumnNumber"></param> | ||
| /// <returns></returns> | ||
| List<ExportColumn> GetExportColumns(Type modelType, FormatType formatType = FormatType.String, int startColumnNumber = 1); | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <param name="modelType"></param> | ||
| /// <param name="formatType"></param> | ||
| /// <param name="startColumnNumber"></param> | ||
| /// <returns></returns> | ||
| List<InAndOutColumn> GetInAndOutColumns(Type modelType, FormatType formatType = FormatType.String, int startColumnNumber = 1); | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <param name="modelType"></param> | ||
| /// <param name="formatType"></param> | ||
| /// <param name="startColumnNumber"></param> | ||
| /// <returns></returns> | ||
| List<InformedImportColumn> GetInformedImportColumns(Type modelType, FormatType formatType = FormatType.String, int startColumnNumber = 1); | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <param name="modelType"></param> | ||
| /// <param name="formatType"></param> | ||
| /// <param name="startColumnNumber"></param> | ||
| /// <returns></returns> | ||
| List<UninformedImportColumn> GetUninformedImportColumns(Type modelType, FormatType formatType = FormatType.String, int startColumnNumber = 1); | ||
| } | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // Copyright (c) Dominic Schira <domshyra@gmail.com>. All Rights Reserved. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel.DataAnnotations; | ||
| using System.Reflection; | ||
| using static ExcelExtensions.Enums.Enums; | ||
|
|
||
| namespace ExcelExtensions.Models | ||
| { | ||
| /// <summary> | ||
| /// Provides extensions to models for import and export with excel extensions | ||
| /// </summary> | ||
| [AttributeUsage(AttributeTargets.Property, Inherited = false)] | ||
| public class ColumnAttribute : Attribute | ||
| { | ||
| /// <summary> | ||
| /// Represent the list of options for the header name | ||
| /// <para>Default will look at the <see cref="PropertyInfo.Name"/> and the <see cref="DisplayAttribute.Name"/></para> | ||
| /// </summary> | ||
| public List<string> ImportColumnTitleOptions { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// If required then <see cref="ParseExceptionSeverity.Error"/> if not then <see cref="ParseExceptionSeverity.Warning"/> | ||
| /// </summary> | ||
| public bool IsRequired { get; set; } | ||
|
|
||
| //Might be able to deprecate this ????????? who knows yet | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add more descript comment as to why I can deprecate it |
||
| /// <summary> | ||
| /// Represents the format type for the excel object | ||
| /// </summary> | ||
| public FormatType Format { get; set; } | ||
| /// <summary> | ||
| /// Represents the number of decimal places in the output for export | ||
| /// </summary> | ||
| public int? DecimalPrecision { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Represents the export location | ||
| /// </summary> | ||
| public string? ExportColumnLetter { get; set; } | ||
| /// <summary> | ||
| /// Represents the export location | ||
| /// </summary> | ||
| public int? ExportColumnNumber { get; set; } | ||
| /// <summary> | ||
| /// Represents the import location | ||
| /// </summary> | ||
| public string? ImportColumnLetter { get; set; } | ||
| /// <summary> | ||
| /// Represents the import location | ||
| /// </summary> | ||
| public int? ImportColumnNumber { get; set; } | ||
|
|
||
| public ColumnAttribute() | ||
| { | ||
| IsRequired = true; | ||
| } | ||
|
|
||
| //todo summary | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <param name="format"></param> | ||
| /// <param name="titleOptions"></param> | ||
| /// <param name="precision"></param> | ||
| public ColumnAttribute(FormatType format, List<string> titleOptions = null, int? precision = null) | ||
| { | ||
| if (titleOptions is not null) | ||
| { | ||
| ImportColumnTitleOptions = titleOptions; | ||
| } | ||
|
|
||
| if (precision is not null) | ||
| { | ||
| DecimalPrecision = precision; | ||
| } | ||
|
|
||
| Format = format; | ||
| IsRequired = true; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Dominic Schira <domshyra@gmail.com>. All Rights Reserved. | ||
|
|
||
| using ExcelExtensions.Interfaces; | ||
| using System; | ||
| using static ExcelExtensions.Enums.Enums; | ||
|
|
||
| namespace ExcelExtensions.Models.Columns | ||
| { | ||
| /// <summary> | ||
| /// Represents an excel column | ||
| /// </summary> | ||
| public class Column | ||
| { | ||
| public string ModelProperty { get; set; } | ||
| /// <summary> | ||
| /// Represents the human readable column header name/title | ||
| /// </summary> | ||
| public string DisplayName { get; set; } | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HeaderTitle |
||
| /// <summary> | ||
| /// Represents the format type for the excel object | ||
| /// </summary> | ||
| public FormatType Format { get; set; } | ||
| /// <summary> | ||
| /// Represents the number of decimal places in the output for export | ||
| /// </summary> | ||
| public int? DecimalPrecision { get; set; } | ||
|
|
||
| public int? ColumnNumber { get; set; } | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add description |
||
|
|
||
| public Column() | ||
| { | ||
|
|
||
| } | ||
| public Column(string modelPropertyName, string displayName, FormatType format, int? decimalPrecision = null) | ||
| { | ||
| ModelProperty = modelPropertyName; | ||
| DisplayName = displayName; | ||
| Format = format; | ||
| DecimalPrecision = decimalPrecision; | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove