diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ceee4df..95c66ef 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: .NET
+name: build and publish
on:
push:
@@ -25,18 +25,18 @@ jobs:
- run: cd $GITHUB_WORKSPACE
- - uses: actions/setup-python@v4
- with:
- python-version: '3.x'
- architecture: 'x64'
- - name: Change package version
- run: |
- python -c "import urllib.request; urllib.request.urlretrieve('https://raw.githubusercontent.com/il-katta/jenkins-libs/master/resources/it/loopback/jenkins/projedit.py', 'projedit.py')"
- foreach ($file in (Get-ChildItem ./ACUtils*/*.csproj) ) {
- $version = python projedit.py netstandard $file
- Write-Output "::set-output name=PROJECT_VERSION::$version"
- }
- id: project_version
+ #- uses: actions/setup-python@v4
+ # with:
+ # python-version: '3.x'
+ # architecture: 'x64'
+ #- name: Change package version
+ # run: |
+ # python -c "import urllib.request; urllib.request.urlretrieve('https://raw.githubusercontent.com/il-katta/jenkins-libs/master/resources/it/loopback/jenkins/projedit.py', 'projedit.py')"
+ # foreach ($file in (Get-ChildItem ./ACUtils*/*.csproj) ) {
+ # $version = python projedit.py netstandard $file
+ # Write-Output "::set-output name=PROJECT_VERSION::$version"
+ # }
+ # id: project_version
- name: Restore packages
run: nuget restore ACUtils.sln
@@ -46,13 +46,13 @@ jobs:
msbuild.exe ACUtils.sln /p:Configuration="Release" /p:Platform="Any CPU" /t:"Restore"
msbuild.exe ACUtils.sln /p:Configuration="Release" /p:Platform="Any CPU" /t:"Rebuild"
- - name: Commit deploy
- run: |
- git config user.name github-actions
- git config user.email github-actions@github.com
- git add ./ACUtils*/*.csproj
- git commit -m "deploy"
- git push
+ #- name: Commit deploy
+ # run: |
+ # git config user.name github-actions
+ # git config user.email github-actions@github.com
+ # git add ./ACUtils*/*.csproj
+ # git commit -m "deploy"
+ # git push
- name: Archive Nuget packages
uses: actions/upload-artifact@v3
@@ -62,15 +62,15 @@ jobs:
dist/*.nupkg
dist/*.snupkg
- - name: Create release
- uses: "marvinpinto/action-automatic-releases@latest"
- with:
- repo_token: "${{ secrets.GITHUB_TOKEN }}"
- prerelease: false
- automatic_release_tag: "${{ steps.project_version.outputs.PROJECT_VERSION }}"
- files: |
- dist/*.nupkg
- dist/*.snupkg
+ #- name: Create release
+ # uses: "marvinpinto/action-automatic-releases@latest"
+ # with:
+ # repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ # prerelease: false
+ # automatic_release_tag: "${{ steps.project_version.outputs.PROJECT_VERSION }}"
+ # files: |
+ # dist/*.nupkg
+ # dist/*.snupkg
- name: Publish
run: |
diff --git a/ACUtils.AXRepository/ACUtils.AXRepository.csproj b/ACUtils.AXRepository/ACUtils.AXRepository.csproj
index 839f9ab..589901a 100644
--- a/ACUtils.AXRepository/ACUtils.AXRepository.csproj
+++ b/ACUtils.AXRepository/ACUtils.AXRepository.csproj
@@ -5,13 +5,14 @@
Andrea Cattaneo
true
false
- 1.0.0.137
- 1.0.0.137
+ 1.0.0.138
+ 1.0.0.138
Utility per gestione classi documentali Arxivar
it
true
snupkg
..\dist\
+ false
@@ -21,7 +22,6 @@
-
diff --git a/ACUtils.AXRepository/AXModel.cs b/ACUtils.AXRepository/AXModel.cs
index 7daa5b8..be387d5 100644
--- a/ACUtils.AXRepository/AXModel.cs
+++ b/ACUtils.AXRepository/AXModel.cs
@@ -13,16 +13,42 @@ namespace ACUtils.AXRepository
#region properties
[AxField(ax_field: "DOCNUMBER")]
- public int? DOCNUMBER { get; set; }
+ public virtual int? DOCNUMBER { get; set; }
public string FilePath { get; set; }
- [AxField(ax_field: "DATA7_3")]
- public DateTime? DataUltimaModifica { get; set; }
+ private string _stato;
+ [AxField(ax_field: "Stato")]
+ public virtual string STATO
+ {
+ get => _stato ?? GetArxivarAttribute()?.Stato;
+ set => _stato = value;
+ }
[AxField(ax_field: "From")]
public virtual string User { get; set; }
+ [AxField(ax_field: "From_ExternalId")]
+ public virtual string MittenteCodiceRubrica { get; set; }
+
+ [AxField(ax_field: "From")]
+ public virtual int? MittenteId { get; protected set; }
+
+ //[AxField(ax_field: "From_IdRubrica")]
+ public virtual int? MittenteIdRubrica { get; set; }
+
+ [AxField(ax_field: "To_ExternalId")]
+ public virtual IEnumerable DestinatariCodiceRubrica { get; set; }
+
+ [AxField(ax_field: "To")]
+ public virtual IEnumerable DestinatariId { get; protected set; }
+
+ [AxField(ax_field: "To")]
+ public virtual IEnumerable Destinatari { get; protected set; }
+
+ //[AxField(ax_field: "To_IdRubrica")]
+ public virtual int? DestinatariIdRubrica { get; set; }
+
///
/// campo usato per popolare l'oggetto del documento
///
@@ -33,8 +59,12 @@ namespace ACUtils.AXRepository
/// campo usato per settare la data documento su arxivar
/// eseguire l'override per modificare il campo
///
- private DateTime? _dataDoc;
- public virtual DateTime? DataDoc { get => _dataDoc ?? DataUltimaModifica; set => _dataDoc = value; }
+
+ [AxField(ax_field: "DataDoc")]
+ public virtual DateTime? DataDoc { get; set; }
+
+ [AxField(ax_field: "WORKFLOW")]
+ public virtual bool? Workflow { get; set; }
public List Allegati { get; set; }
@@ -42,18 +72,65 @@ namespace ACUtils.AXRepository
#region setters
- public override void idrate(DataRow dr)
+ protected override void setValue(string key, object value, Type colType = null)
+ {
+ var property = this.GetType().GetProperty(key);
+ var sourceType = value?.GetType();
+ var targetType = property.PropertyType;
+ if (sourceType == typeof(ArxivarNext.Model.UserProfileDTO))
+ {
+ if (targetType == typeof(string))
+ {
+ value = ((ArxivarNext.Model.UserProfileDTO)value).Description;
+ }
+ if (targetType == typeof(int) || targetType == typeof(int?))
+ {
+ value = ((ArxivarNext.Model.UserProfileDTO)value).AddressBookId;
+ }
+ }
+
+ if (sourceType == typeof(ArxivarNextManagement.Model.UserProfileDTO))
+ {
+ if (targetType == typeof(string))
+ {
+ value = ((ArxivarNextManagement.Model.UserProfileDTO)value).Description;
+ }
+ if (targetType == typeof(int) || targetType == typeof(int?))
+ {
+ value = ((ArxivarNextManagement.Model.UserProfileDTO)value).AddressBookId;
+ }
+ }
+ if (sourceType == typeof(List))
+ {
+ var source = (List)value;
+ if (targetType == typeof(List) || targetType == typeof(IEnumerable))
+ {
+ value = source.Select(e => e.Description).ToList();
+ }
+ if (
+ targetType == typeof(List) || targetType == typeof(List) ||
+ targetType == typeof(IEnumerable) || targetType == typeof(IEnumerable)
+ )
+ {
+ value = source.Select(e => e.AddressBookId).ToList();
+ }
+ }
+
+ base.setValue(key, value, colType);
+ }
+
+ public void idrate(DataRow dr)
{
// popola i campi che corrispondono ai nomi delle property
base.idrate(dr);
- // popola i campi che corrispondono ai nome deninito del Attribute della property
+ // popola i campi che corrispondono al nome definito nel Attribute della property
PropertyInfo[] properties = this.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
if (!dr.Table.Columns.Contains(property.Name))
{
- var attr = this.GetArxivarAttribute(property.Name);
+ var attr = this.GetDbAttribute(property.Name);
if (attr?.DbField == null) continue;
if (dr.Table.Columns.Contains(attr.DbField))
{
@@ -64,7 +141,7 @@ public override void idrate(DataRow dr)
catch (Exception e)
{
Console.WriteLine($"{attr.DbField} -> {property.Name} - {dr[attr.DbField]}: {e?.Message}"); // TODO: write log entry
- //throw;
+ throw;
}
}
}
@@ -74,58 +151,72 @@ public override void idrate(DataRow dr)
public static T Idrate(ArxivarNext.Model.EditProfileSchemaDTO model)
{
var obj = new T();
- var properties = obj.GetType().GetProperties();
foreach (var field in model.Fields)
{
- if (obj.HasAXField(field.Name))
+ if (field.GetType().GetProperty("Value") != null)
{
- foreach (var property in properties)
- {
- if (field.Name == obj.GetArxivarAttribute(property.Name)?.AXField)
- {
- dynamic dfiled = field;
- obj.setValue(property.Name, dfiled.Value);
- }
-
- }
+ dynamic dfiled = field; // per poter accedere alla property Value
+ obj.SetPropertyIfExists(field.Name, dfiled.Value);
}
}
- obj.DOCNUMBER = model.ProfileInfo.DocNumber;
+
+ obj.SetPropertyIfExists("DOCNUMBER", model.ProfileInfo.DocNumber);
+
+ var mittente = model.Fields.GetField("TO");
+ obj.SetPropertyIfExists("To_ExternalId", mittente.Value?.Select(m => m.ExternalId));
+
+ var destinatario = model.Fields.GetField("FROM");
+ obj.SetPropertyIfExists("From_ExternalId", destinatario.Value?.ExternalId);
return obj;
}
- public static T Idrate(ArxivarNext.Model.RowSearchResult model)
+ public static T Idrate(ArxivarNext.Model.RowSearchResult searchresult)
{
var obj = new T();
- var properties = obj.GetType().GetProperties();
- foreach (var col in model.Columns)
+ foreach (var col in searchresult.Columns)
{
- if (obj.HasAXField(col.Id))
+ obj.SetPropertyIfExists(col.Id, col.Value);
+ }
+ return obj;
+ }
+
+ public bool SetPropertyIfExists(string axField, object value)
+ {
+ bool found = false;
+ if (this.HasAXField(axField))
+ {
+ var properties = this.GetType().GetProperties();
+ foreach (var property in properties)
{
- foreach (var property in properties)
+ if (axField == this.GetArxivarAttribute(property.Name)?.AXField)
{
- if (col.Id == obj.GetArxivarAttribute(property.Name)?.AXField)
- obj.setValue(property.Name, col.Value);
-
+ this.setValue(property.Name, value);
+ found = true;
}
+
}
}
- return obj;
+#if DEBUG
+ else
+ {
+ //System.Diagnostics.Debugger.Break();
+ }
+#endif
+ return found;
}
-
- public static List Idrate(List results)
+ public static List Idrate(List results)
{
return (from result in results select Idrate(result)).ToList();
}
- #endregion
+#endregion
- #region testers
- public bool HasAS400Field(string field)
+#region testers
+ public new bool HasDbField(string field)
{
return this.GetType().GetProperties().Where(property =>
- GetArxivarAttribute(property.Name)?.DbField == field
+ GetAxDbAttribute(property.Name)?.DbField == field
).Any();
}
@@ -133,9 +224,9 @@ public bool HasAXField(string field)
{
return this.GetType().GetProperties().Where(property => GetArxivarAttribute(property.Name)?.AXField == field).Any();
}
- #endregion
+#endregion
- #region getters
+#region getters
public AxClassAttribute GetArxivarAttribute()
{
@@ -143,14 +234,21 @@ public AxClassAttribute GetArxivarAttribute()
return attrs.LastOrDefault() as AxClassAttribute;
}
- public AxDbFieldAttribute GetArxivarAttribute(string propertyName)
+ public AxFieldAttribute GetArxivarAttribute(string propertyName)
+ {
+ var propr = GetType().GetProperty(propertyName);
+ var attrs = propr.GetCustomAttributes(typeof(AxFieldAttribute), true);
+ return attrs.LastOrDefault() as AxFieldAttribute;
+ }
+
+ public AxDbFieldAttribute GetAxDbAttribute(string propertyName)
{
var propr = GetType().GetProperty(propertyName);
var attrs = propr.GetCustomAttributes(typeof(AxDbFieldAttribute), true);
return attrs.LastOrDefault() as AxDbFieldAttribute;
}
- public List GetArxivarAttributes()
+ public List GetArxivarAttributes()
{
return (
from attr in (
@@ -162,9 +260,9 @@ select attr
).ToList();
}
- public Tm GetValueByAS400Field(string field)
+ public Tm GetValueByDbField(string field)
{
- return GetValueBy(field, property => GetArxivarAttribute(property.Name)?.DbField);
+ return GetValueBy(field, property => GetDbAttribute(property.Name)?.DbField);
}
public Tm GetValueByAXField(string field)
@@ -180,9 +278,9 @@ public Tm GetValueByAXField(string field)
{
return GetValueByPropertyName
+
@@ -54,8 +55,13 @@
+
+
+ {9315e643-f70a-4582-8b4e-ed86cd458a08}
+ ACUtils.AXRepository
+
{df92e0a8-bf71-45f6-89d8-397e6b8f2a95}
ACUtils.DotNetUtils
diff --git a/push.bat b/push.bat
deleted file mode 100644
index aea1295..0000000
--- a/push.bat
+++ /dev/null
@@ -1 +0,0 @@
-nuget push dist\*.134.nupkg oy2fcz4sx5a46vto5xnqgszddnc73pnexanc65sccfb2ze -Source "https://api.nuget.org/v3/index.json"
\ No newline at end of file