Add Property WorkflowStash in WorkflowModel
This commit is contained in:
@@ -39,6 +39,6 @@
|
|||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"DefaultConnection": "Data Source=.;Initial Catalog=WfDb;User ID=sa;Password=123456;Integrated Security=false;TrustServerCertificate=True;"
|
//"DefaultConnection": "Data Source=.;Initial Catalog=WfDb;User ID=sa;Password=123456;Integrated Security=false;TrustServerCertificate=True;"
|
||||||
"DefaultConnection": "Server=.;Database=WfDb;User Id=sa;Password=123456;TrustServerCertificate=True;"
|
"DefaultConnection": "Server=.;Database=CaspianWfDb;User Id=sa;Password=123456;TrustServerCertificate=True;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class WorkflowModel
|
|||||||
/// فعلا استفاده ای نداریم
|
/// فعلا استفاده ای نداریم
|
||||||
/// </remark>
|
/// </remark>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? NextPageData { get; set; }
|
public JsonElement? NextPageData { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// آدرس صفحه بعدی
|
/// آدرس صفحه بعدی
|
||||||
@@ -52,4 +52,9 @@ public class WorkflowModel
|
|||||||
/// رویدادی که باید پس از سابمیت صفحه بعدی منتشر شود
|
/// رویدادی که باید پس از سابمیت صفحه بعدی منتشر شود
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? NextPageEventName { get; set; }
|
public string? NextPageEventName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// جای ذخیرهی موقت برای استفاده های بعدی
|
||||||
|
/// </summary>
|
||||||
|
public JsonElement? WorkflowStash { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,9 +72,39 @@ public static class ConversionExtensions
|
|||||||
// ? (object?)dictionary[nameof(workflowModel.NextPageData)]
|
// ? (object?)dictionary[nameof(workflowModel.NextPageData)]
|
||||||
// : null;
|
// : null;
|
||||||
|
|
||||||
workflowModel.NextPageData = dictionary.ContainsKey(nameof(workflowModel.NextPageData))
|
//workflowModel.NextPageData = dictionary.ContainsKey(nameof(workflowModel.NextPageData))
|
||||||
? dictionary[nameof(workflowModel.NextPageData)]?.ToString()
|
// ? dictionary[nameof(workflowModel.NextPageData)]?.ToString()
|
||||||
: null;
|
// : null;
|
||||||
|
|
||||||
|
if (dictionary.TryGetValue(nameof(workflowModel.NextPageData), out var nextPageDataObj) &&
|
||||||
|
nextPageDataObj is not null)
|
||||||
|
{
|
||||||
|
switch (nextPageDataObj)
|
||||||
|
{
|
||||||
|
case JsonElement je:
|
||||||
|
workflowModel.NextPageData = je;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JsonNode node:
|
||||||
|
// .NET 6+
|
||||||
|
workflowModel.NextPageData = JsonSerializer.SerializeToElement(node);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case string s:
|
||||||
|
// اگر به صورت string JSON ذخیره شده
|
||||||
|
workflowModel.NextPageData = JsonSerializer.Deserialize<JsonElement>(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// هر نوع دیگری: serialize و تبدیل به JsonElement
|
||||||
|
workflowModel.NextPageData = JsonSerializer.SerializeToElement(nextPageDataObj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
workflowModel.NextPageData = null;
|
||||||
|
}
|
||||||
|
|
||||||
workflowModel.NextPageUrl = dictionary.ContainsKey(nameof(workflowModel.NextPageUrl))
|
workflowModel.NextPageUrl = dictionary.ContainsKey(nameof(workflowModel.NextPageUrl))
|
||||||
? dictionary[nameof(workflowModel.NextPageUrl)]?.ToString()
|
? dictionary[nameof(workflowModel.NextPageUrl)]?.ToString()
|
||||||
@@ -84,6 +114,36 @@ public static class ConversionExtensions
|
|||||||
? dictionary[nameof(workflowModel.NextPageEventName)]?.ToString()
|
? dictionary[nameof(workflowModel.NextPageEventName)]?.ToString()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
if (dictionary.TryGetValue(nameof(workflowModel.WorkflowStash), out var workflowStashObj) &&
|
||||||
|
workflowStashObj is not null)
|
||||||
|
{
|
||||||
|
switch (workflowStashObj)
|
||||||
|
{
|
||||||
|
case JsonElement je:
|
||||||
|
workflowModel.WorkflowStash = je;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JsonNode node:
|
||||||
|
// .NET 6+
|
||||||
|
workflowModel.WorkflowStash = JsonSerializer.SerializeToElement(node);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case string s:
|
||||||
|
// اگر به صورت string JSON ذخیره شده
|
||||||
|
workflowModel.WorkflowStash = JsonSerializer.Deserialize<JsonElement>(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// هر نوع دیگری: serialize و تبدیل به JsonElement
|
||||||
|
workflowModel.WorkflowStash = JsonSerializer.SerializeToElement(workflowStashObj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
workflowModel.WorkflowStash = null;
|
||||||
|
}
|
||||||
|
|
||||||
return workflowModel;
|
return workflowModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"Sqlite": "", //"Data Source=App_Data/elsa.sqlite.db;Cache=Shared;",
|
"Sqlite": "", //"Data Source=App_Data/elsa.sqlite.db;Cache=Shared;",
|
||||||
//"SqlServer": "Server=localhost,1433;Initial Catalog=Elsa;User=sa;Password=!Elsa2025@;Encrypt=false;PersistSecurityInfo=false",
|
//"SqlServer": "Server=localhost,1433;Initial Catalog=Elsa;User=sa;Password=!Elsa2025@;Encrypt=false;PersistSecurityInfo=false",
|
||||||
"SqlServer": "Server=.;Database=WfDb;User Id=sa;Password=123456;TrustServerCertificate=True;",
|
"SqlServer": "Server=.;Database=CaspianWfDb;User Id=sa;Password=123456;TrustServerCertificate=True;",
|
||||||
"MySql": "", //"Server=localhost;Database=elsa;Uid=admin;Pwd=password;",
|
"MySql": "", //"Server=localhost;Database=elsa;Uid=admin;Pwd=password;",
|
||||||
"PostgreSql": "", //"Server=localhost;Username=elsa;Database=elsa;Port=5432;Password=elsa;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60",
|
"PostgreSql": "", //"Server=localhost;Username=elsa;Database=elsa;Port=5432;Password=elsa;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60",
|
||||||
"Citus": "", //"Server=localhost;Username=citus;Database=citus;Port=9700;Password=citus;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60",
|
"Citus": "", //"Server=localhost;Username=citus;Database=citus;Port=9700;Password=citus;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60",
|
||||||
|
|||||||
Reference in New Issue
Block a user