Compare commits
76 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c555ef6a0 | ||
|
|
81abe549cf | ||
|
|
932ee406b1 | ||
|
|
cb2e007302 | ||
|
|
b9331e66b4 | ||
|
|
3d419a6e7c | ||
|
|
9bbf66e94d | ||
|
|
a3ec85aed0 | ||
|
|
1c5ff7bdd5 | ||
|
|
4a1eb264b1 | ||
|
|
8f14f259ca | ||
|
|
8e86f6fb83 | ||
|
|
32720abac2 | ||
|
|
cbfb5ccef6 | ||
|
|
149f28bda6 | ||
|
|
98d748c398 | ||
|
|
36907db226 | ||
|
|
ddc8054bb4 | ||
|
|
0f790b1183 | ||
|
|
63185d7b22 | ||
|
|
0420f1a3e5 | ||
|
|
aa3a3c7684 | ||
|
|
9055657ef2 | ||
|
|
f5315a4aca | ||
|
|
712918121e | ||
|
|
483a249428 | ||
|
|
f17d1da1bd | ||
|
|
260784d016 | ||
|
|
0681eb9479 | ||
|
|
5a4244dee3 | ||
|
|
7cf448ec13 | ||
|
|
3e588fb98b | ||
|
|
f18818d16a | ||
|
|
5f5bf81a6b | ||
|
|
4c95b52ea8 | ||
|
|
d1157953a8 | ||
|
|
55aaad3d31 | ||
|
|
ee0b8d8421 | ||
|
|
16c187489c | ||
|
|
2e1dc8db3a | ||
|
|
0d69ae05ce | ||
|
|
df158a0d8e | ||
|
|
d176565887 | ||
|
|
6b4e64c3ca | ||
|
|
3437ec9ad9 | ||
|
|
43a8e20eb0 | ||
|
|
ba78863509 | ||
|
|
8c5a141c8e | ||
|
|
b11b5f2185 | ||
|
|
58ab8661fb | ||
|
|
43875b9af8 | ||
|
|
fc124830f4 | ||
|
|
0058a0180c | ||
|
|
5c7793c86e | ||
|
|
6eb18fbdda | ||
|
|
e664ad4ccc | ||
|
|
c437f4cf75 | ||
|
|
5e16262371 | ||
|
|
3ba59ee870 | ||
|
|
b503b74e02 | ||
|
|
ff49904bb0 | ||
|
|
6cf82fa913 | ||
|
|
cd896e2e9f | ||
|
|
a9a137a08c | ||
|
|
6e6599ba15 | ||
|
|
8bb9d8ed87 | ||
|
|
abd7dd05fd | ||
|
|
1745707691 | ||
|
|
540668b1c0 | ||
|
|
279d285f76 | ||
|
|
a3c307c72a | ||
|
|
c32a00f156 | ||
|
|
8b44d15cbd | ||
|
|
8ff6234165 | ||
|
|
847150aaea | ||
|
|
32530c72c0 |
424 changed files with 68977 additions and 1519171 deletions
12
api/.config/dotnet-tools.json
Normal file
12
api/.config/dotnet-tools.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"volo.abp.cli": {
|
||||
"version": "9.0.2",
|
||||
"commands": [
|
||||
"abp"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,10 @@ COPY "modules/Erp.Settings/Erp.Settings.Application.Contracts/Erp.Settings.Appli
|
|||
COPY "modules/Erp.Settings/Erp.Settings.Domain/Erp.Settings.Domain.csproj" "modules/Erp.Settings/Erp.Settings.Domain/"
|
||||
COPY "modules/Erp.Settings/Erp.Settings.Domain.Shared/Erp.Settings.Domain.Shared.csproj" "modules/Erp.Settings/Erp.Settings.Domain.Shared/"
|
||||
COPY "modules/Erp.Settings/Erp.Settings.EntityFrameworkCore/Erp.Settings.EntityFrameworkCore.csproj" "modules/Erp.Settings/Erp.Settings.EntityFrameworkCore/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/Erp.SqlQueryManager.Application.Contracts.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/Erp.SqlQueryManager.Domain.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/Erp.SqlQueryManager.Domain.Shared.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/Erp.SqlQueryManager.EntityFrameworkCore.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/"
|
||||
COPY "src/Erp.Platform.Application.Contracts/Erp.Platform.Application.Contracts.csproj" "src/Erp.Platform.Application.Contracts/"
|
||||
COPY "src/Erp.Platform.DbMigrator/Erp.Platform.DbMigrator.csproj" "src/Erp.Platform.DbMigrator/"
|
||||
COPY "src/Erp.Platform.Domain/Erp.Platform.Domain.csproj" "src/Erp.Platform.Domain/"
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ WORKDIR /app
|
|||
RUN apk update && apk upgrade
|
||||
RUN apk add nodejs~=22 npm~=11
|
||||
|
||||
RUN dotnet tool install -g Volo.Abp.Cli
|
||||
ENV PATH="/root/.dotnet/tools:${PATH}"
|
||||
COPY .config/dotnet-tools.json .config/dotnet-tools.json
|
||||
RUN dotnet tool restore
|
||||
ENV PATH="/root/.dotnet/tools:/app/.config/dotnet/tools:${PATH}"
|
||||
COPY "src/Erp.Platform.HttpApi.Host/Erp.Platform.HttpApi.Host.csproj" "src/Erp.Platform.HttpApi.Host/"
|
||||
COPY "src/Erp.Platform.HttpApi.Host/package.json" "src/Erp.Platform.HttpApi.Host/"
|
||||
COPY "src/Erp.Platform.HttpApi.Host/package-lock.json" "src/Erp.Platform.HttpApi.Host/"
|
||||
WORKDIR /app/src/Erp.Platform.HttpApi.Host
|
||||
RUN abp install-libs
|
||||
RUN dotnet tool run abp install-libs
|
||||
WORKDIR /app
|
||||
|
||||
COPY "modules/Erp.Languages/Erp.Languages.Application/Erp.Languages.Application.csproj" "modules/Erp.Languages/Erp.Languages.Application/"
|
||||
|
|
@ -30,6 +31,11 @@ COPY "modules/Erp.Settings/Erp.Settings.Application.Contracts/Erp.Settings.Appli
|
|||
COPY "modules/Erp.Settings/Erp.Settings.Domain/Erp.Settings.Domain.csproj" "modules/Erp.Settings/Erp.Settings.Domain/"
|
||||
COPY "modules/Erp.Settings/Erp.Settings.Domain.Shared/Erp.Settings.Domain.Shared.csproj" "modules/Erp.Settings/Erp.Settings.Domain.Shared/"
|
||||
COPY "modules/Erp.Settings/Erp.Settings.EntityFrameworkCore/Erp.Settings.EntityFrameworkCore.csproj" "modules/Erp.Settings/Erp.Settings.EntityFrameworkCore/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application/Erp.SqlQueryManager.Application.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/Erp.SqlQueryManager.Application.Contracts.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/Erp.SqlQueryManager.Domain.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/Erp.SqlQueryManager.Domain.Shared.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/"
|
||||
COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/Erp.SqlQueryManager.EntityFrameworkCore.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/"
|
||||
COPY "src/Erp.Platform.Application/Erp.Platform.Application.csproj" "src/Erp.Platform.Application/"
|
||||
COPY "src/Erp.Platform.Application.Contracts/Erp.Platform.Application.Contracts.csproj" "src/Erp.Platform.Application.Contracts/"
|
||||
COPY "src/Erp.Platform.Domain/Erp.Platform.Domain.csproj" "src/Erp.Platform.Domain/"
|
||||
|
|
@ -73,5 +79,3 @@ EXPOSE 443
|
|||
WORKDIR /srv/app
|
||||
COPY --from=build /app/publish .
|
||||
ENTRYPOINT ["./Erp.Platform.HttpApi.Host"]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Erp.SqlQueryManager", "Erp.SqlQueryManager", "{2889482E-64CA-4A25-91D8-5B963D83681B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Erp.SqlQueryManager.Domain.Shared", "modules\Erp.SqlQueryManager\Erp.SqlQueryManager.Domain.Shared\Erp.SqlQueryManager.Domain.Shared.csproj", "{10D71F44-C9FD-41F2-8F1A-D93FAE3CE696}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Erp.SqlQueryManager.Domain", "modules\Erp.SqlQueryManager\Erp.SqlQueryManager.Domain\Erp.SqlQueryManager.Domain.csproj", "{8730045F-91F5-4438-8772-C6E31E89AACC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Erp.SqlQueryManager.Application.Contracts", "modules\Erp.SqlQueryManager\Erp.SqlQueryManager.Application.Contracts\Erp.SqlQueryManager.Application.Contracts.csproj", "{B45A3E8B-286B-4A74-9602-FC192ACEE8C4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Erp.SqlQueryManager.Application", "modules\Erp.SqlQueryManager\Erp.SqlQueryManager.Application\Erp.SqlQueryManager.Application.csproj", "{ED9C639A-A706-4ECB-9638-A15B3681BDEC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Erp.SqlQueryManager.EntityFrameworkCore", "modules\Erp.SqlQueryManager\Erp.SqlQueryManager.EntityFrameworkCore\Erp.SqlQueryManager.EntityFrameworkCore.csproj", "{1DA666D8-DBFE-40F7-8EBF-95CC892E4EB6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -198,6 +210,26 @@ Global
|
|||
{D9E0D333-60F3-493F-A5B2-5758ACA42A17}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D9E0D333-60F3-493F-A5B2-5758ACA42A17}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D9E0D333-60F3-493F-A5B2-5758ACA42A17}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{10D71F44-C9FD-41F2-8F1A-D93FAE3CE696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10D71F44-C9FD-41F2-8F1A-D93FAE3CE696}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10D71F44-C9FD-41F2-8F1A-D93FAE3CE696}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10D71F44-C9FD-41F2-8F1A-D93FAE3CE696}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8730045F-91F5-4438-8772-C6E31E89AACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8730045F-91F5-4438-8772-C6E31E89AACC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8730045F-91F5-4438-8772-C6E31E89AACC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8730045F-91F5-4438-8772-C6E31E89AACC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B45A3E8B-286B-4A74-9602-FC192ACEE8C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B45A3E8B-286B-4A74-9602-FC192ACEE8C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B45A3E8B-286B-4A74-9602-FC192ACEE8C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B45A3E8B-286B-4A74-9602-FC192ACEE8C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED9C639A-A706-4ECB-9638-A15B3681BDEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ED9C639A-A706-4ECB-9638-A15B3681BDEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ED9C639A-A706-4ECB-9638-A15B3681BDEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED9C639A-A706-4ECB-9638-A15B3681BDEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1DA666D8-DBFE-40F7-8EBF-95CC892E4EB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DA666D8-DBFE-40F7-8EBF-95CC892E4EB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DA666D8-DBFE-40F7-8EBF-95CC892E4EB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DA666D8-DBFE-40F7-8EBF-95CC892E4EB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -236,10 +268,14 @@ Global
|
|||
{631092C7-B59D-4EA7-92D0-5E181AB4F9F6} = {41A473FE-2537-4223-8CF3-A4A2A4A4F41E}
|
||||
{23659070-58F7-403B-8973-B2E20B5E9BE1} = {41A473FE-2537-4223-8CF3-A4A2A4A4F41E}
|
||||
{D9E0D333-60F3-493F-A5B2-5758ACA42A17} = {41A473FE-2537-4223-8CF3-A4A2A4A4F41E}
|
||||
{2889482E-64CA-4A25-91D8-5B963D83681B} = {03E1C8DA-035E-4882-AF81-F392139FCF38}
|
||||
{10D71F44-C9FD-41F2-8F1A-D93FAE3CE696} = {2889482E-64CA-4A25-91D8-5B963D83681B}
|
||||
{8730045F-91F5-4438-8772-C6E31E89AACC} = {2889482E-64CA-4A25-91D8-5B963D83681B}
|
||||
{B45A3E8B-286B-4A74-9602-FC192ACEE8C4} = {2889482E-64CA-4A25-91D8-5B963D83681B}
|
||||
{ED9C639A-A706-4ECB-9638-A15B3681BDEC} = {2889482E-64CA-4A25-91D8-5B963D83681B}
|
||||
{1DA666D8-DBFE-40F7-8EBF-95CC892E4EB6} = {2889482E-64CA-4A25-91D8-5B963D83681B}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
public class DatabaseTableDto
|
||||
{
|
||||
public string SchemaName { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public string FullName => $"{SchemaName}.{TableName}";
|
||||
}
|
||||
|
||||
public class DatabaseColumnDto
|
||||
{
|
||||
public string ColumnName { get; set; }
|
||||
public string DataType { get; set; }
|
||||
public bool IsNullable { get; set; }
|
||||
public int? MaxLength { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>Erp.SqlQueryManager</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="9.0.2" />
|
||||
<PackageReference Include="Volo.Abp.Authorization" Version="9.0.2" />
|
||||
<ProjectReference Include="..\Erp.SqlQueryManager.Domain.Shared\Erp.SqlQueryManager.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ConfigureAwait />
|
||||
</Weavers>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Unified service for SQL Object Explorer and CRUD operations
|
||||
/// </summary>
|
||||
public interface ISqlObjectManagerAppService : IApplicationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all SQL objects for Object Explorer (Queries, SPs, Views, Functions, Tables, Templates)
|
||||
/// </summary>
|
||||
/// <param name="dataSourceCode">Data source code to filter objects</param>
|
||||
/// <returns>Combined response with all object types</returns>
|
||||
Task<SqlObjectExplorerDto> GetAllObjectsAsync(string dataSourceCode);
|
||||
|
||||
// Query Operations
|
||||
Task<SqlQueryDto> CreateQueryAsync(CreateSqlQueryDto input);
|
||||
Task<SqlQueryDto> UpdateQueryAsync(Guid id, UpdateSqlQueryDto input);
|
||||
Task DeleteQueryAsync(Guid id);
|
||||
Task<SqlQueryExecutionResultDto> ExecuteQueryAsync(ExecuteSqlQueryDto input);
|
||||
Task<SqlQueryExecutionResultDto> ExecuteSavedQueryAsync(Guid id);
|
||||
|
||||
// Stored Procedure Operations
|
||||
Task<SqlStoredProcedureDto> UpdateStoredProcedureAsync(Guid id, UpdateSqlStoredProcedureDto input);
|
||||
Task DeleteStoredProcedureAsync(Guid id);
|
||||
Task<SqlQueryExecutionResultDto> DeployStoredProcedureAsync(DeployStoredProcedureDto input);
|
||||
|
||||
// View Operations
|
||||
Task<SqlViewDto> UpdateViewAsync(Guid id, UpdateSqlViewDto input);
|
||||
Task DeleteViewAsync(Guid id);
|
||||
Task<SqlQueryExecutionResultDto> DeployViewAsync(DeployViewDto input);
|
||||
|
||||
// Function Operations
|
||||
Task<SqlFunctionDto> UpdateFunctionAsync(Guid id, UpdateSqlFunctionDto input);
|
||||
Task DeleteFunctionAsync(Guid id);
|
||||
Task<SqlQueryExecutionResultDto> DeployFunctionAsync(DeployFunctionDto input);
|
||||
|
||||
// Database Metadata Operations
|
||||
Task<List<DatabaseColumnDto>> GetTableColumnsAsync(string dataSourceCode, string schemaName, string tableName);
|
||||
|
||||
// Smart Save - Analyzes SQL and saves to appropriate table with auto-deploy
|
||||
Task<SmartSaveResultDto> SmartSaveAsync(SmartSaveInputDto input);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Input for smart save operation
|
||||
/// </summary>
|
||||
public class SmartSaveInputDto
|
||||
{
|
||||
public string SqlText { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Result of smart save operation
|
||||
/// </summary>
|
||||
public class SmartSaveResultDto
|
||||
{
|
||||
public string ObjectType { get; set; }
|
||||
public Guid ObjectId { get; set; }
|
||||
public bool Deployed { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
public class SqlFunctionDto : FullAuditedEntityDto<Guid>
|
||||
{
|
||||
public string FunctionName { get; set; }
|
||||
public string SchemaName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public SqlFunctionType FunctionType { get; set; }
|
||||
public string FunctionBody { get; set; }
|
||||
public string ReturnType { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
public string Category { get; set; }
|
||||
public bool IsDeployed { get; set; }
|
||||
public DateTime? LastDeployedAt { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class CreateSqlFunctionDto
|
||||
{
|
||||
public string FunctionName { get; set; }
|
||||
public string SchemaName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public SqlFunctionType FunctionType { get; set; }
|
||||
public string FunctionBody { get; set; }
|
||||
public string ReturnType { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateSqlFunctionDto
|
||||
{
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string FunctionBody { get; set; }
|
||||
public string ReturnType { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class DeployFunctionDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public bool DropIfExists { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Combined DTO for Object Explorer containing all SQL objects
|
||||
/// </summary>
|
||||
public class SqlObjectExplorerDto
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL Queries
|
||||
/// </summary>
|
||||
public List<SqlQueryDto> Queries { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Stored Procedures
|
||||
/// </summary>
|
||||
public List<SqlStoredProcedureDto> StoredProcedures { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Views
|
||||
/// </summary>
|
||||
public List<SqlViewDto> Views { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Functions
|
||||
/// </summary>
|
||||
public List<SqlFunctionDto> Functions { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Database Tables
|
||||
/// </summary>
|
||||
public List<DatabaseTableDto> Tables { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Query Templates
|
||||
/// </summary>
|
||||
public List<SqlTemplateDto> Templates { get; set; } = new();
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
public class SqlQueryDto : FullAuditedEntityDto<Guid>
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string QueryText { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Tags { get; set; }
|
||||
public DateTime? LastExecutedAt { get; set; }
|
||||
public int ExecutionCount { get; set; }
|
||||
public bool IsModifyingData { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class CreateSqlQueryDto
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string QueryText { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Tags { get; set; }
|
||||
public bool IsModifyingData { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateSqlQueryDto
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string QueryText { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Tags { get; set; }
|
||||
public bool IsModifyingData { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class ExecuteSqlQueryDto
|
||||
{
|
||||
public string QueryText { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public Dictionary<string, object> Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class SqlQueryExecutionResultDto
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string Message { get; set; }
|
||||
public IEnumerable<dynamic> Data { get; set; }
|
||||
public int RowsAffected { get; set; }
|
||||
public long ExecutionTimeMs { get; set; }
|
||||
public Dictionary<string, object> Metadata { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using Volo.Abp.Application;
|
||||
using Volo.Abp.Authorization;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace Erp.SqlQueryManager;
|
||||
|
||||
[DependsOn(
|
||||
typeof(SqlQueryManagerDomainSharedModule),
|
||||
typeof(AbpDddApplicationContractsModule),
|
||||
typeof(AbpAuthorizationModule)
|
||||
)]
|
||||
public class SqlQueryManagerApplicationContractsModule : AbpModule
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
public class SqlStoredProcedureDto : FullAuditedEntityDto<Guid>
|
||||
{
|
||||
public string ProcedureName { get; set; }
|
||||
public string SchemaName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ProcedureBody { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
public string Category { get; set; }
|
||||
public bool IsDeployed { get; set; }
|
||||
public DateTime? LastDeployedAt { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class CreateSqlStoredProcedureDto
|
||||
{
|
||||
public string ProcedureName { get; set; }
|
||||
public string SchemaName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ProcedureBody { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateSqlStoredProcedureDto
|
||||
{
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ProcedureBody { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
|
||||
public class DeployStoredProcedureDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public bool DropIfExists { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
public class SqlTemplateDto
|
||||
{
|
||||
public string Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Template { get; set; }
|
||||
}
|
||||
|
||||
public class GetTemplateInput
|
||||
{
|
||||
public string TemplateType { get; set; }
|
||||
public string ObjectName { get; set; }
|
||||
public string SchemaName { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application.Contracts;
|
||||
|
||||
public class SqlViewDto : FullAuditedEntityDto<Guid>
|
||||
{
|
||||
public string ViewName { get; set; }
|
||||
public string SchemaName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ViewDefinition { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
public string Category { get; set; }
|
||||
public bool IsDeployed { get; set; }
|
||||
public DateTime? LastDeployedAt { get; set; }
|
||||
public bool WithSchemaBinding { get; set; }
|
||||
}
|
||||
|
||||
public class CreateSqlViewDto
|
||||
{
|
||||
public string ViewName { get; set; }
|
||||
public string SchemaName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ViewDefinition { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public string Category { get; set; }
|
||||
public bool WithSchemaBinding { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateSqlViewDto
|
||||
{
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ViewDefinition { get; set; }
|
||||
public string Category { get; set; }
|
||||
public bool WithSchemaBinding { get; set; }
|
||||
}
|
||||
|
||||
public class DeployViewDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public bool DropIfExists { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>Erp.SqlQueryManager</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.AutoMapper" Version="9.0.2" />
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="9.0.2" />
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="9.0.2" />
|
||||
<ProjectReference Include="..\Erp.SqlQueryManager.Application.Contracts\Erp.SqlQueryManager.Application.Contracts.csproj" />
|
||||
<ProjectReference Include="..\Erp.SqlQueryManager.Domain\Erp.SqlQueryManager.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ConfigureAwait />
|
||||
</Weavers>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -0,0 +1,825 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Erp.SqlQueryManager.Application.Contracts;
|
||||
using Erp.SqlQueryManager.Domain.Entities;
|
||||
using Erp.SqlQueryManager.Domain.Services;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application;
|
||||
|
||||
/// <summary>
|
||||
/// Unified service for SQL Object Explorer
|
||||
/// Combines all SQL objects into a single endpoint
|
||||
/// </summary>
|
||||
[Authorize("App.SqlQueryManager")]
|
||||
public class SqlObjectManagerAppService : ApplicationService, ISqlObjectManagerAppService
|
||||
{
|
||||
private readonly IRepository<SqlQuery, Guid> _queryRepository;
|
||||
private readonly IRepository<SqlStoredProcedure, Guid> _procedureRepository;
|
||||
private readonly IRepository<SqlView, Guid> _viewRepository;
|
||||
private readonly IRepository<SqlFunction, Guid> _functionRepository;
|
||||
private readonly ISqlExecutorService _sqlExecutorService;
|
||||
private readonly ISqlTemplateProvider _templateProvider;
|
||||
|
||||
public SqlObjectManagerAppService(
|
||||
IRepository<SqlQuery, Guid> queryRepository,
|
||||
IRepository<SqlStoredProcedure, Guid> procedureRepository,
|
||||
IRepository<SqlView, Guid> viewRepository,
|
||||
IRepository<SqlFunction, Guid> functionRepository,
|
||||
ISqlExecutorService sqlExecutorService,
|
||||
ISqlTemplateProvider templateProvider)
|
||||
{
|
||||
_queryRepository = queryRepository;
|
||||
_procedureRepository = procedureRepository;
|
||||
_viewRepository = viewRepository;
|
||||
_functionRepository = functionRepository;
|
||||
_sqlExecutorService = sqlExecutorService;
|
||||
_templateProvider = templateProvider;
|
||||
}
|
||||
|
||||
public async Task<SqlObjectExplorerDto> GetAllObjectsAsync(string dataSourceCode)
|
||||
{
|
||||
var result = new SqlObjectExplorerDto();
|
||||
|
||||
// Get all queries for this data source
|
||||
var queries = await _queryRepository.GetListAsync();
|
||||
result.Queries = queries
|
||||
.Where(q => q.DataSourceCode == dataSourceCode)
|
||||
.Select(q => new SqlQueryDto
|
||||
{
|
||||
Id = q.Id,
|
||||
Code = q.Code,
|
||||
Name = q.Name,
|
||||
Description = q.Description,
|
||||
QueryText = q.QueryText,
|
||||
DataSourceCode = q.DataSourceCode,
|
||||
Status = q.Status,
|
||||
Category = q.Category,
|
||||
Tags = q.Tags,
|
||||
IsModifyingData = q.IsModifyingData,
|
||||
Parameters = q.Parameters,
|
||||
ExecutionCount = q.ExecutionCount,
|
||||
LastExecutedAt = q.LastExecutedAt
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// Get all stored procedures for this data source
|
||||
var procedures = await _procedureRepository.GetListAsync();
|
||||
result.StoredProcedures = procedures
|
||||
.Where(p => p.DataSourceCode == dataSourceCode)
|
||||
.Select(p => new SqlStoredProcedureDto
|
||||
{
|
||||
Id = p.Id,
|
||||
ProcedureName = p.ProcedureName,
|
||||
SchemaName = p.SchemaName,
|
||||
DisplayName = p.DisplayName,
|
||||
Description = p.Description,
|
||||
ProcedureBody = p.ProcedureBody,
|
||||
DataSourceCode = p.DataSourceCode,
|
||||
Category = p.Category,
|
||||
Parameters = p.Parameters,
|
||||
IsDeployed = p.IsDeployed,
|
||||
LastDeployedAt = p.LastDeployedAt
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// Get all views for this data source
|
||||
var views = await _viewRepository.GetListAsync();
|
||||
result.Views = views
|
||||
.Where(v => v.DataSourceCode == dataSourceCode)
|
||||
.Select(v => new SqlViewDto
|
||||
{
|
||||
Id = v.Id,
|
||||
ViewName = v.ViewName,
|
||||
SchemaName = v.SchemaName,
|
||||
DisplayName = v.DisplayName,
|
||||
Description = v.Description,
|
||||
ViewDefinition = v.ViewDefinition,
|
||||
DataSourceCode = v.DataSourceCode,
|
||||
Category = v.Category,
|
||||
WithSchemaBinding = v.WithSchemaBinding,
|
||||
IsDeployed = v.IsDeployed,
|
||||
LastDeployedAt = v.LastDeployedAt
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// Get all functions for this data source
|
||||
var functions = await _functionRepository.GetListAsync();
|
||||
result.Functions = functions
|
||||
.Where(f => f.DataSourceCode == dataSourceCode)
|
||||
.Select(f => new SqlFunctionDto
|
||||
{
|
||||
Id = f.Id,
|
||||
FunctionName = f.FunctionName,
|
||||
SchemaName = f.SchemaName,
|
||||
DisplayName = f.DisplayName,
|
||||
Description = f.Description,
|
||||
FunctionType = f.FunctionType,
|
||||
FunctionBody = f.FunctionBody,
|
||||
ReturnType = f.ReturnType,
|
||||
DataSourceCode = f.DataSourceCode,
|
||||
Category = f.Category,
|
||||
Parameters = f.Parameters,
|
||||
IsDeployed = f.IsDeployed,
|
||||
LastDeployedAt = f.LastDeployedAt
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// Get all database tables
|
||||
result.Tables = await GetTablesAsync(dataSourceCode);
|
||||
|
||||
// Get all templates
|
||||
result.Templates = _templateProvider.GetAvailableQueryTemplates()
|
||||
.Select(t => new SqlTemplateDto
|
||||
{
|
||||
Type = t.Type,
|
||||
Name = t.Name,
|
||||
Description = t.Description,
|
||||
Template = _templateProvider.GetQueryTemplate(t.Type)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<List<DatabaseTableDto>> GetTablesAsync(string dataSourceCode)
|
||||
{
|
||||
var query = @"
|
||||
SELECT
|
||||
SCHEMA_NAME(t.schema_id) AS SchemaName,
|
||||
t.name AS TableName
|
||||
FROM
|
||||
sys.tables t
|
||||
WHERE
|
||||
t.is_ms_shipped = 0
|
||||
ORDER BY
|
||||
SCHEMA_NAME(t.schema_id), t.name";
|
||||
|
||||
var result = await _sqlExecutorService.ExecuteQueryAsync(query, dataSourceCode);
|
||||
|
||||
var tables = new List<DatabaseTableDto>();
|
||||
if (result.Success && result.Data != null)
|
||||
{
|
||||
foreach (var row in result.Data)
|
||||
{
|
||||
var dict = row as System.Collections.Generic.IDictionary<string, object>;
|
||||
if (dict != null)
|
||||
{
|
||||
tables.Add(new DatabaseTableDto
|
||||
{
|
||||
SchemaName = dict["SchemaName"]?.ToString() ?? "dbo",
|
||||
TableName = dict["TableName"]?.ToString() ?? ""
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
#region Query Operations
|
||||
|
||||
public async Task<SqlQueryDto> CreateQueryAsync(CreateSqlQueryDto input)
|
||||
{
|
||||
var query = ObjectMapper.Map<CreateSqlQueryDto, SqlQuery>(input);
|
||||
query.Status = SqlQueryStatus.Draft;
|
||||
|
||||
var created = await _queryRepository.InsertAsync(query, autoSave: true);
|
||||
return ObjectMapper.Map<SqlQuery, SqlQueryDto>(created);
|
||||
}
|
||||
|
||||
public async Task<SqlQueryDto> UpdateQueryAsync(Guid id, UpdateSqlQueryDto input)
|
||||
{
|
||||
var query = await _queryRepository.GetAsync(id);
|
||||
|
||||
query.Name = input.Name;
|
||||
query.Description = input.Description;
|
||||
query.QueryText = input.QueryText;
|
||||
query.Category = input.Category;
|
||||
query.Tags = input.Tags;
|
||||
|
||||
var updated = await _queryRepository.UpdateAsync(query, autoSave: true);
|
||||
return ObjectMapper.Map<SqlQuery, SqlQueryDto>(updated);
|
||||
}
|
||||
|
||||
public async Task DeleteQueryAsync(Guid id)
|
||||
{
|
||||
await _queryRepository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
public async Task<SqlQueryExecutionResultDto> ExecuteQueryAsync(ExecuteSqlQueryDto input)
|
||||
{
|
||||
var sqlText = input.QueryText.Trim();
|
||||
var sqlUpper = sqlText.ToUpperInvariant();
|
||||
|
||||
// Check if this is a DDL command (CREATE/ALTER/DROP for VIEW/PROCEDURE/FUNCTION)
|
||||
bool isDDLCommand =
|
||||
sqlUpper.Contains("CREATE VIEW") || sqlUpper.Contains("ALTER VIEW") ||
|
||||
sqlUpper.Contains("CREATE PROCEDURE") || sqlUpper.Contains("CREATE PROC") ||
|
||||
sqlUpper.Contains("ALTER PROCEDURE") || sqlUpper.Contains("ALTER PROC") ||
|
||||
sqlUpper.Contains("CREATE FUNCTION") || sqlUpper.Contains("ALTER FUNCTION") ||
|
||||
sqlUpper.Contains("DROP VIEW") || sqlUpper.Contains("DROP PROCEDURE") ||
|
||||
sqlUpper.Contains("DROP PROC") || sqlUpper.Contains("DROP FUNCTION");
|
||||
|
||||
if (isDDLCommand)
|
||||
{
|
||||
// For DDL commands, only validate syntax without executing
|
||||
try
|
||||
{
|
||||
// Try to parse/validate the SQL using SET PARSEONLY
|
||||
var validationSql = $"SET PARSEONLY ON;\n{sqlText}\nSET PARSEONLY OFF;";
|
||||
await _sqlExecutorService.ExecuteNonQueryAsync(validationSql, input.DataSourceCode);
|
||||
|
||||
return new SqlQueryExecutionResultDto
|
||||
{
|
||||
Success = true,
|
||||
Message = "SQL syntax is valid. Use Save button to save and Deploy button to create in SQL Server.",
|
||||
Data = new List<object>(),
|
||||
RowsAffected = 0,
|
||||
ExecutionTimeMs = 0
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new SqlQueryExecutionResultDto
|
||||
{
|
||||
Success = false,
|
||||
Message = $"SQL syntax error: {ex.Message}",
|
||||
Data = new List<object>(),
|
||||
RowsAffected = 0,
|
||||
ExecutionTimeMs = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// For DML commands (SELECT, INSERT, UPDATE, DELETE), execute normally
|
||||
var result = await _sqlExecutorService.ExecuteQueryAsync(input.QueryText, input.DataSourceCode);
|
||||
return MapExecutionResult(result);
|
||||
}
|
||||
|
||||
public async Task<SqlQueryExecutionResultDto> ExecuteSavedQueryAsync(Guid id)
|
||||
{
|
||||
var query = await _queryRepository.GetAsync(id);
|
||||
var result = await _sqlExecutorService.ExecuteQueryAsync(query.QueryText, query.DataSourceCode);
|
||||
|
||||
// Update execution statistics
|
||||
query.ExecutionCount++;
|
||||
query.LastExecutedAt = DateTime.UtcNow;
|
||||
await _queryRepository.UpdateAsync(query, autoSave: true);
|
||||
|
||||
return MapExecutionResult(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Stored Procedure Operations
|
||||
|
||||
public async Task<SqlStoredProcedureDto> UpdateStoredProcedureAsync(Guid id, UpdateSqlStoredProcedureDto input)
|
||||
{
|
||||
var procedure = await _procedureRepository.GetAsync(id);
|
||||
|
||||
procedure.DisplayName = input.DisplayName;
|
||||
procedure.Description = input.Description;
|
||||
procedure.ProcedureBody = input.ProcedureBody;
|
||||
procedure.Category = input.Category;
|
||||
procedure.IsDeployed = false;
|
||||
procedure.LastDeployedAt = null;
|
||||
|
||||
var updated = await _procedureRepository.UpdateAsync(procedure, autoSave: true);
|
||||
return ObjectMapper.Map<SqlStoredProcedure, SqlStoredProcedureDto>(updated);
|
||||
}
|
||||
|
||||
public async Task DeleteStoredProcedureAsync(Guid id)
|
||||
{
|
||||
var procedure = await _procedureRepository.GetAsync(id);
|
||||
|
||||
// Drop stored procedure from SQL Server (always try, regardless of IsDeployed flag)
|
||||
try
|
||||
{
|
||||
var dropSql = $"IF OBJECT_ID('[{procedure.SchemaName}].[{procedure.ProcedureName}]', 'P') IS NOT NULL DROP PROCEDURE [{procedure.SchemaName}].[{procedure.ProcedureName}]";
|
||||
await _sqlExecutorService.ExecuteNonQueryAsync(dropSql, procedure.DataSourceCode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore errors if object doesn't exist in database
|
||||
}
|
||||
|
||||
await _procedureRepository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
public async Task<SqlQueryExecutionResultDto> DeployStoredProcedureAsync(DeployStoredProcedureDto input)
|
||||
{
|
||||
var procedure = await _procedureRepository.GetAsync(input.Id);
|
||||
|
||||
try
|
||||
{
|
||||
// Önce DROP işlemi yap (varsa)
|
||||
var dropSql = $"IF OBJECT_ID('[{procedure.SchemaName}].[{procedure.ProcedureName}]', 'P') IS NOT NULL DROP PROCEDURE [{procedure.SchemaName}].[{procedure.ProcedureName}]";
|
||||
await _sqlExecutorService.ExecuteNonQueryAsync(dropSql, procedure.DataSourceCode);
|
||||
|
||||
// Sonra CREATE işlemi yap
|
||||
var result = await _sqlExecutorService.DeployStoredProcedureAsync(
|
||||
procedure.ProcedureBody,
|
||||
procedure.DataSourceCode
|
||||
);
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
procedure.IsDeployed = true;
|
||||
procedure.LastDeployedAt = DateTime.UtcNow;
|
||||
await _procedureRepository.UpdateAsync(procedure, autoSave: true);
|
||||
}
|
||||
|
||||
return MapExecutionResult(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new SqlQueryExecutionResultDto
|
||||
{
|
||||
Success = false,
|
||||
Message = $"Deploy failed: {ex.Message}",
|
||||
Data = new List<object>(),
|
||||
RowsAffected = 0,
|
||||
ExecutionTimeMs = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region View Operations
|
||||
|
||||
public async Task<SqlViewDto> UpdateViewAsync(Guid id, UpdateSqlViewDto input)
|
||||
{
|
||||
var view = await _viewRepository.GetAsync(id);
|
||||
|
||||
view.DisplayName = input.DisplayName;
|
||||
view.Description = input.Description;
|
||||
view.ViewDefinition = input.ViewDefinition;
|
||||
view.Category = input.Category;
|
||||
view.IsDeployed = false;
|
||||
view.LastDeployedAt = null;
|
||||
|
||||
var updated = await _viewRepository.UpdateAsync(view, autoSave: true);
|
||||
return ObjectMapper.Map<SqlView, SqlViewDto>(updated);
|
||||
}
|
||||
|
||||
public async Task DeleteViewAsync(Guid id)
|
||||
{
|
||||
var view = await _viewRepository.GetAsync(id);
|
||||
|
||||
// Drop view from SQL Server (always try, regardless of IsDeployed flag)
|
||||
try
|
||||
{
|
||||
var dropSql = $"IF OBJECT_ID('[{view.SchemaName}].[{view.ViewName}]', 'V') IS NOT NULL DROP VIEW [{view.SchemaName}].[{view.ViewName}]";
|
||||
await _sqlExecutorService.ExecuteNonQueryAsync(dropSql, view.DataSourceCode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore errors if object doesn't exist in database
|
||||
}
|
||||
|
||||
await _viewRepository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
public async Task<SqlQueryExecutionResultDto> DeployViewAsync(DeployViewDto input)
|
||||
{
|
||||
var view = await _viewRepository.GetAsync(input.Id);
|
||||
|
||||
try
|
||||
{
|
||||
// Önce DROP işlemi yap (varsa)
|
||||
var dropSql = $"IF OBJECT_ID('[{view.SchemaName}].[{view.ViewName}]', 'V') IS NOT NULL DROP VIEW [{view.SchemaName}].[{view.ViewName}]";
|
||||
await _sqlExecutorService.ExecuteNonQueryAsync(dropSql, view.DataSourceCode);
|
||||
|
||||
// Sonra CREATE işlemi yap
|
||||
var result = await _sqlExecutorService.DeployViewAsync(
|
||||
view.ViewDefinition,
|
||||
view.DataSourceCode
|
||||
);
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
view.IsDeployed = true;
|
||||
view.LastDeployedAt = DateTime.UtcNow;
|
||||
await _viewRepository.UpdateAsync(view, autoSave: true);
|
||||
}
|
||||
|
||||
return MapExecutionResult(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new SqlQueryExecutionResultDto
|
||||
{
|
||||
Success = false,
|
||||
Message = $"Deploy failed: {ex.Message}",
|
||||
Data = new List<object>(),
|
||||
RowsAffected = 0,
|
||||
ExecutionTimeMs = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Function Operations
|
||||
|
||||
public async Task<SqlFunctionDto> UpdateFunctionAsync(Guid id, UpdateSqlFunctionDto input)
|
||||
{
|
||||
var function = await _functionRepository.GetAsync(id);
|
||||
|
||||
function.DisplayName = input.DisplayName;
|
||||
function.Description = input.Description;
|
||||
function.FunctionBody = input.FunctionBody;
|
||||
function.Category = input.Category;
|
||||
function.IsDeployed = false;
|
||||
function.LastDeployedAt = null;
|
||||
|
||||
var updated = await _functionRepository.UpdateAsync(function, autoSave: true);
|
||||
return ObjectMapper.Map<SqlFunction, SqlFunctionDto>(updated);
|
||||
}
|
||||
|
||||
public async Task DeleteFunctionAsync(Guid id)
|
||||
{
|
||||
var function = await _functionRepository.GetAsync(id);
|
||||
|
||||
// Drop function from SQL Server (always try, regardless of IsDeployed flag)
|
||||
try
|
||||
{
|
||||
var dropSql = $"IF OBJECT_ID('[{function.SchemaName}].[{function.FunctionName}]', 'FN') IS NOT NULL DROP FUNCTION [{function.SchemaName}].[{function.FunctionName}]";
|
||||
await _sqlExecutorService.ExecuteNonQueryAsync(dropSql, function.DataSourceCode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore errors if object doesn't exist in database
|
||||
}
|
||||
|
||||
await _functionRepository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
public async Task<SqlQueryExecutionResultDto> DeployFunctionAsync(DeployFunctionDto input)
|
||||
{
|
||||
var function = await _functionRepository.GetAsync(input.Id);
|
||||
|
||||
try
|
||||
{
|
||||
// Önce DROP işlemi yap (varsa)
|
||||
var dropSql = $"IF OBJECT_ID('[{function.SchemaName}].[{function.FunctionName}]', 'FN') IS NOT NULL DROP FUNCTION [{function.SchemaName}].[{function.FunctionName}]";
|
||||
await _sqlExecutorService.ExecuteNonQueryAsync(dropSql, function.DataSourceCode);
|
||||
|
||||
// Sonra CREATE işlemi yap
|
||||
var result = await _sqlExecutorService.DeployFunctionAsync(
|
||||
function.FunctionBody,
|
||||
function.DataSourceCode
|
||||
);
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
function.IsDeployed = true;
|
||||
function.LastDeployedAt = DateTime.UtcNow;
|
||||
await _functionRepository.UpdateAsync(function, autoSave: true);
|
||||
}
|
||||
|
||||
return MapExecutionResult(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new SqlQueryExecutionResultDto
|
||||
{
|
||||
Success = false,
|
||||
Message = $"Deploy failed: {ex.Message}",
|
||||
Data = new List<object>(),
|
||||
RowsAffected = 0,
|
||||
ExecutionTimeMs = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Database Metadata Operations
|
||||
|
||||
public async Task<List<DatabaseColumnDto>> GetTableColumnsAsync(string dataSourceCode, string schemaName, string tableName)
|
||||
{
|
||||
var query = $@"
|
||||
SELECT
|
||||
c.name AS ColumnName,
|
||||
TYPE_NAME(c.user_type_id) AS DataType,
|
||||
c.is_nullable AS IsNullable,
|
||||
c.max_length AS MaxLength
|
||||
FROM
|
||||
sys.columns c
|
||||
INNER JOIN sys.tables t ON c.object_id = t.object_id
|
||||
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
|
||||
WHERE
|
||||
s.name = '{schemaName}'
|
||||
AND t.name = '{tableName}'
|
||||
ORDER BY
|
||||
c.column_id";
|
||||
|
||||
var result = await _sqlExecutorService.ExecuteQueryAsync(query, dataSourceCode);
|
||||
|
||||
var columns = new List<DatabaseColumnDto>();
|
||||
if (result.Success && result.Data != null)
|
||||
{
|
||||
foreach (var row in result.Data)
|
||||
{
|
||||
var dict = row as System.Collections.Generic.IDictionary<string, object>;
|
||||
if (dict != null)
|
||||
{
|
||||
columns.Add(new DatabaseColumnDto
|
||||
{
|
||||
ColumnName = dict["ColumnName"]?.ToString() ?? "",
|
||||
DataType = dict["DataType"]?.ToString() ?? "",
|
||||
IsNullable = dict["IsNullable"] is bool b && b,
|
||||
MaxLength = dict["MaxLength"] != null ? int.Parse(dict["MaxLength"].ToString()) : null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public async Task<SmartSaveResultDto> SmartSaveAsync(SmartSaveInputDto input)
|
||||
{
|
||||
var result = new SmartSaveResultDto();
|
||||
var sqlText = input.SqlText.Trim();
|
||||
var sqlUpper = sqlText.ToUpperInvariant();
|
||||
|
||||
try
|
||||
{
|
||||
// Analyze SQL to determine object type
|
||||
if (sqlUpper.Contains("CREATE VIEW") || sqlUpper.Contains("ALTER VIEW"))
|
||||
{
|
||||
// Extract view name
|
||||
var viewName = input.Name;
|
||||
var schemaName = "dbo";
|
||||
var displayName = input.Name;
|
||||
|
||||
// Check if view already exists
|
||||
var existingView = (await _viewRepository.GetListAsync())
|
||||
.FirstOrDefault(v => v.ViewName == viewName && v.DataSourceCode == input.DataSourceCode);
|
||||
|
||||
SqlView view;
|
||||
if (existingView != null)
|
||||
{
|
||||
// Update existing view
|
||||
existingView.DisplayName = displayName;
|
||||
existingView.ViewDefinition = sqlText;
|
||||
existingView.IsDeployed = false;
|
||||
existingView.LastDeployedAt = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
existingView.Description = input.Description;
|
||||
}
|
||||
view = await _viewRepository.UpdateAsync(existingView, autoSave: true);
|
||||
result.Message = $"View '{viewName}' updated successfully. Use Deploy button to deploy changes to SQL Server.";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new view
|
||||
view = new SqlView(
|
||||
GuidGenerator.Create(),
|
||||
viewName, // ViewName from SQL
|
||||
schemaName,
|
||||
displayName, // DisplayName from user input
|
||||
sqlText,
|
||||
input.DataSourceCode
|
||||
);
|
||||
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
view.Description = input.Description;
|
||||
}
|
||||
|
||||
await _viewRepository.InsertAsync(view, autoSave: true);
|
||||
result.Message = $"View '{viewName}' saved successfully. Use Deploy button to deploy to SQL Server.";
|
||||
}
|
||||
|
||||
result.ObjectType = "View";
|
||||
result.ObjectId = view.Id;
|
||||
result.Deployed = view.IsDeployed;
|
||||
}
|
||||
else if (sqlUpper.Contains("CREATE PROCEDURE") || sqlUpper.Contains("CREATE PROC") ||
|
||||
sqlUpper.Contains("ALTER PROCEDURE") || sqlUpper.Contains("ALTER PROC"))
|
||||
{
|
||||
// Extract procedure name
|
||||
var procName = input.Name;
|
||||
var schemaName = "dbo";
|
||||
var displayName = input.Name;
|
||||
|
||||
// Check if procedure already exists
|
||||
var existingProcedure = (await _procedureRepository.GetListAsync())
|
||||
.FirstOrDefault(p => p.ProcedureName == procName && p.DataSourceCode == input.DataSourceCode);
|
||||
|
||||
SqlStoredProcedure procedure;
|
||||
if (existingProcedure != null)
|
||||
{
|
||||
// Update existing procedure
|
||||
existingProcedure.DisplayName = displayName;
|
||||
existingProcedure.ProcedureBody = sqlText;
|
||||
existingProcedure.IsDeployed = false;
|
||||
existingProcedure.LastDeployedAt = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
existingProcedure.Description = input.Description;
|
||||
}
|
||||
procedure = await _procedureRepository.UpdateAsync(existingProcedure, autoSave: true);
|
||||
result.Message = $"Stored Procedure '{procName}' updated successfully. Use Deploy button to deploy changes to SQL Server.";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new procedure
|
||||
procedure = new SqlStoredProcedure(
|
||||
GuidGenerator.Create(),
|
||||
procName, // ProcedureName from SQL
|
||||
schemaName,
|
||||
displayName, // DisplayName from user input
|
||||
sqlText,
|
||||
input.DataSourceCode
|
||||
);
|
||||
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
procedure.Description = input.Description;
|
||||
}
|
||||
|
||||
await _procedureRepository.InsertAsync(procedure, autoSave: true);
|
||||
result.Message = $"Stored Procedure '{procName}' saved successfully. Use Deploy button to deploy to SQL Server.";
|
||||
}
|
||||
|
||||
result.ObjectType = "StoredProcedure";
|
||||
result.ObjectId = procedure.Id;
|
||||
result.Deployed = procedure.IsDeployed;
|
||||
}
|
||||
else if (sqlUpper.Contains("CREATE FUNCTION") || sqlUpper.Contains("ALTER FUNCTION"))
|
||||
{
|
||||
// Extract function name
|
||||
var funcName = input.Name;
|
||||
var schemaName = "dbo";
|
||||
var returnType = "NVARCHAR(MAX)"; // Default, can be extracted from SQL
|
||||
var displayName = input.Name;
|
||||
|
||||
// Check if function already exists
|
||||
var existingFunction = (await _functionRepository.GetListAsync())
|
||||
.FirstOrDefault(f => f.FunctionName == funcName && f.DataSourceCode == input.DataSourceCode);
|
||||
|
||||
SqlFunction function;
|
||||
if (existingFunction != null)
|
||||
{
|
||||
// Update existing function
|
||||
existingFunction.DisplayName = displayName;
|
||||
existingFunction.FunctionBody = sqlText;
|
||||
existingFunction.IsDeployed = false;
|
||||
existingFunction.LastDeployedAt = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
existingFunction.Description = input.Description;
|
||||
}
|
||||
function = await _functionRepository.UpdateAsync(existingFunction, autoSave: true);
|
||||
result.Message = $"Function '{funcName}' updated successfully. Use Deploy button to deploy changes to SQL Server.";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new function
|
||||
function = new SqlFunction(
|
||||
GuidGenerator.Create(),
|
||||
funcName, // FunctionName from SQL
|
||||
schemaName,
|
||||
displayName, // DisplayName from user input
|
||||
SqlFunctionType.ScalarFunction,
|
||||
sqlText,
|
||||
returnType,
|
||||
input.DataSourceCode
|
||||
);
|
||||
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
function.Description = input.Description;
|
||||
}
|
||||
|
||||
await _functionRepository.InsertAsync(function, autoSave: true);
|
||||
result.Message = $"Function '{funcName}' saved successfully. Use Deploy button to deploy to SQL Server.";
|
||||
}
|
||||
|
||||
result.ObjectType = "Function";
|
||||
result.ObjectId = function.Id;
|
||||
result.Deployed = function.IsDeployed;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default to Query (SELECT, INSERT, UPDATE, DELETE, etc.)
|
||||
var queryName = input.Name ?? $"Query_{DateTime.Now:yyyyMMddHHmmss}";
|
||||
var queryCode = queryName.Replace(" ", "_");
|
||||
|
||||
// Check if query already exists
|
||||
var existingQuery = (await _queryRepository.GetListAsync())
|
||||
.FirstOrDefault(q => q.Code == queryCode && q.DataSourceCode == input.DataSourceCode);
|
||||
|
||||
SqlQuery query;
|
||||
if (existingQuery != null)
|
||||
{
|
||||
// Update existing query
|
||||
existingQuery.Name = queryName;
|
||||
existingQuery.QueryText = sqlText;
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
existingQuery.Description = input.Description;
|
||||
}
|
||||
query = await _queryRepository.UpdateAsync(existingQuery, autoSave: true);
|
||||
result.Message = $"Query '{queryName}' updated successfully";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new query
|
||||
query = new SqlQuery(
|
||||
GuidGenerator.Create(),
|
||||
queryCode,
|
||||
queryName,
|
||||
sqlText,
|
||||
input.DataSourceCode
|
||||
);
|
||||
|
||||
if (!string.IsNullOrEmpty(input.Description))
|
||||
{
|
||||
query.Description = input.Description;
|
||||
}
|
||||
|
||||
await _queryRepository.InsertAsync(query, autoSave: true);
|
||||
result.Message = $"Query '{queryName}' saved successfully";
|
||||
}
|
||||
|
||||
result.ObjectType = "Query";
|
||||
result.ObjectId = query.Id;
|
||||
result.Deployed = false; // Queries are not deployed;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Volo.Abp.UserFriendlyException($"Failed to save SQL object: {ex.Message}");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private string ExtractObjectName(string sql, params string[] keywords)
|
||||
{
|
||||
var sqlUpper = sql.ToUpperInvariant();
|
||||
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
var createIndex = sqlUpper.IndexOf($"CREATE {keyword}", StringComparison.OrdinalIgnoreCase);
|
||||
var alterIndex = sqlUpper.IndexOf($"ALTER {keyword}", StringComparison.OrdinalIgnoreCase);
|
||||
var startIndex = Math.Max(createIndex, alterIndex);
|
||||
|
||||
if (startIndex >= 0)
|
||||
{
|
||||
startIndex = sqlUpper.IndexOf(keyword, startIndex, StringComparison.OrdinalIgnoreCase) + keyword.Length;
|
||||
var endIndex = sql.IndexOfAny(new[] { ' ', '\r', '\n', '\t', '(', '[' }, startIndex);
|
||||
|
||||
if (endIndex > startIndex)
|
||||
{
|
||||
var name = sql.Substring(startIndex, endIndex - startIndex).Trim();
|
||||
// Remove schema prefix if exists
|
||||
if (name.Contains("."))
|
||||
{
|
||||
name = name.Substring(name.LastIndexOf('.') + 1);
|
||||
}
|
||||
// Remove square brackets
|
||||
name = name.Replace("[", "").Replace("]", "");
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "UnnamedObject";
|
||||
}
|
||||
|
||||
#region Helper Methods
|
||||
|
||||
private SqlQueryExecutionResultDto MapExecutionResult(SqlExecutionResult result)
|
||||
{
|
||||
return new SqlQueryExecutionResultDto
|
||||
{
|
||||
Success = result.Success,
|
||||
Message = result.Message,
|
||||
Data = result.Data,
|
||||
RowsAffected = result.RowsAffected,
|
||||
ExecutionTimeMs = result.ExecutionTimeMs,
|
||||
Metadata = result.Metadata
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp.Application;
|
||||
using Volo.Abp.AutoMapper;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace Erp.SqlQueryManager;
|
||||
|
||||
[DependsOn(
|
||||
typeof(SqlQueryManagerDomainModule),
|
||||
typeof(SqlQueryManagerApplicationContractsModule),
|
||||
typeof(AbpDddApplicationModule),
|
||||
typeof(AbpAutoMapperModule)
|
||||
)]
|
||||
public class SqlQueryManagerApplicationModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
context.Services.AddAutoMapperObjectMapper<SqlQueryManagerApplicationModule>();
|
||||
|
||||
Configure<AbpAutoMapperOptions>(options =>
|
||||
{
|
||||
options.AddMaps<SqlQueryManagerApplicationModule>(validate: true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
using AutoMapper;
|
||||
using Erp.SqlQueryManager.Application.Contracts;
|
||||
using Erp.SqlQueryManager.Domain.Entities;
|
||||
using Volo.Abp.AutoMapper;
|
||||
|
||||
namespace Erp.SqlQueryManager.Application;
|
||||
|
||||
public class SqlQueryManagerAutoMapperProfile : Profile
|
||||
{
|
||||
public SqlQueryManagerAutoMapperProfile()
|
||||
{
|
||||
CreateMap<SqlQuery, SqlQueryDto>();
|
||||
CreateMap<CreateSqlQueryDto, SqlQuery>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.LastExecutedAt)
|
||||
.Ignore(x => x.ExecutionCount);
|
||||
|
||||
CreateMap<UpdateSqlQueryDto, SqlQuery>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.LastExecutedAt)
|
||||
.Ignore(x => x.ExecutionCount);
|
||||
|
||||
CreateMap<SqlStoredProcedure, SqlStoredProcedureDto>();
|
||||
CreateMap<CreateSqlStoredProcedureDto, SqlStoredProcedure>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.IsDeployed)
|
||||
.Ignore(x => x.LastDeployedAt);
|
||||
CreateMap<UpdateSqlStoredProcedureDto, SqlStoredProcedure>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.ProcedureName)
|
||||
.Ignore(x => x.SchemaName)
|
||||
.Ignore(x => x.DataSourceCode)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.IsDeployed)
|
||||
.Ignore(x => x.LastDeployedAt);
|
||||
|
||||
CreateMap<SqlView, SqlViewDto>();
|
||||
CreateMap<CreateSqlViewDto, SqlView>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.IsDeployed)
|
||||
.Ignore(x => x.LastDeployedAt);
|
||||
CreateMap<UpdateSqlViewDto, SqlView>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.ViewName)
|
||||
.Ignore(x => x.SchemaName)
|
||||
.Ignore(x => x.DataSourceCode)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.IsDeployed)
|
||||
.Ignore(x => x.LastDeployedAt);
|
||||
|
||||
CreateMap<SqlFunction, SqlFunctionDto>();
|
||||
CreateMap<CreateSqlFunctionDto, SqlFunction>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.IsDeployed)
|
||||
.Ignore(x => x.LastDeployedAt);
|
||||
CreateMap<UpdateSqlFunctionDto, SqlFunction>()
|
||||
.IgnoreFullAuditedObjectProperties()
|
||||
.Ignore(x => x.Id)
|
||||
.Ignore(x => x.TenantId)
|
||||
.Ignore(x => x.FunctionName)
|
||||
.Ignore(x => x.SchemaName)
|
||||
.Ignore(x => x.FunctionType)
|
||||
.Ignore(x => x.DataSourceCode)
|
||||
.Ignore(x => x.Status)
|
||||
.Ignore(x => x.IsDeployed)
|
||||
.Ignore(x => x.LastDeployedAt);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
|
||||
<RootNamespace>Erp.SqlQueryManager</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Ddd.Domain.Shared" Version="9.0.2" />
|
||||
<PackageReference Include="Volo.Abp.Validation" Version="9.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Localization\SqlQueryManager\*.json" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
using Volo.Abp.Localization;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Shared;
|
||||
|
||||
[LocalizationResourceName("SqlQueryManager")]
|
||||
public class ErpSqlQueryManagerResource
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ConfigureAwait />
|
||||
</Weavers>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
namespace Erp.SqlQueryManager.Domain.Shared;
|
||||
|
||||
public enum SqlObjectType
|
||||
{
|
||||
Query = 1,
|
||||
StoredProcedure = 2,
|
||||
View = 3,
|
||||
Function = 4
|
||||
}
|
||||
|
||||
public enum SqlFunctionType
|
||||
{
|
||||
ScalarFunction = 1,
|
||||
TableValuedFunction = 2,
|
||||
InlineTableValuedFunction = 3
|
||||
}
|
||||
|
||||
public enum SqlQueryStatus
|
||||
{
|
||||
Draft = 1,
|
||||
Active = 2,
|
||||
Archived = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Domain;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.Localization.ExceptionHandling;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.Validation;
|
||||
using Volo.Abp.VirtualFileSystem;
|
||||
|
||||
namespace Erp.SqlQueryManager;
|
||||
|
||||
[DependsOn(
|
||||
typeof(AbpValidationModule),
|
||||
typeof(AbpDddDomainSharedModule)
|
||||
)]
|
||||
public class SqlQueryManagerDomainSharedModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
||||
{
|
||||
options.FileSets.AddEmbedded<SqlQueryManagerDomainSharedModule>();
|
||||
});
|
||||
|
||||
Configure<AbpLocalizationOptions>(options =>
|
||||
{
|
||||
options.Resources.Add<ErpSqlQueryManagerResource>("en");
|
||||
});
|
||||
|
||||
Configure<AbpExceptionLocalizationOptions>(options =>
|
||||
{
|
||||
options.MapCodeNamespace("SqlQueryManager", typeof(ErpSqlQueryManagerResource));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
namespace Erp.SqlQueryManager.Domain.Shared;
|
||||
|
||||
public static class SqlQueryManagerErrorCodes
|
||||
{
|
||||
public const string InvalidSqlQuery = "SqlQueryManager:InvalidSqlQuery";
|
||||
public const string DataSourceNotFound = "SqlQueryManager:DataSourceNotFound";
|
||||
public const string ExecutionFailed = "SqlQueryManager:ExecutionFailed";
|
||||
public const string PermissionDenied = "SqlQueryManager:PermissionDenied";
|
||||
public const string InvalidObjectName = "SqlQueryManager:InvalidObjectName";
|
||||
public const string ObjectAlreadyExists = "SqlQueryManager:ObjectAlreadyExists";
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using Volo.Abp.Reflection;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Shared;
|
||||
|
||||
public static class SqlQueryManagerPermissions
|
||||
{
|
||||
public const string GroupName = "SqlQueryManager";
|
||||
|
||||
public static class SqlQuery
|
||||
{
|
||||
public const string Default = GroupName + ".SqlQuery";
|
||||
public const string Create = Default + ".Create";
|
||||
public const string Update = Default + ".Update";
|
||||
public const string Delete = Default + ".Delete";
|
||||
public const string Execute = Default + ".Execute";
|
||||
}
|
||||
|
||||
public static class SqlStoredProcedure
|
||||
{
|
||||
public const string Default = GroupName + ".SqlStoredProcedure";
|
||||
public const string Create = Default + ".Create";
|
||||
public const string Update = Default + ".Update";
|
||||
public const string Delete = Default + ".Delete";
|
||||
public const string Deploy = Default + ".Deploy";
|
||||
public const string Drop = Default + ".Drop";
|
||||
}
|
||||
|
||||
public static class SqlView
|
||||
{
|
||||
public const string Default = GroupName + ".SqlView";
|
||||
public const string Create = Default + ".Create";
|
||||
public const string Update = Default + ".Update";
|
||||
public const string Delete = Default + ".Delete";
|
||||
public const string Deploy = Default + ".Deploy";
|
||||
public const string Drop = Default + ".Drop";
|
||||
}
|
||||
|
||||
public static class SqlFunction
|
||||
{
|
||||
public const string Default = GroupName + ".SqlFunction";
|
||||
public const string Create = Default + ".Create";
|
||||
public const string Update = Default + ".Update";
|
||||
public const string Delete = Default + ".Delete";
|
||||
public const string Deploy = Default + ".Deploy";
|
||||
public const string Drop = Default + ".Drop";
|
||||
}
|
||||
|
||||
public static class Templates
|
||||
{
|
||||
public const string Default = GroupName + ".Templates";
|
||||
}
|
||||
|
||||
public static string[] GetAll()
|
||||
{
|
||||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(SqlQueryManagerPermissions));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// SQL Function entity for creating and managing database functions
|
||||
/// </summary>
|
||||
public class SqlFunction : FullAuditedEntity<Guid>, IMultiTenant
|
||||
{
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Function name in database
|
||||
/// </summary>
|
||||
public string FunctionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Schema name (default: dbo)
|
||||
/// </summary>
|
||||
public string SchemaName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display name
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Function type
|
||||
/// </summary>
|
||||
public SqlFunctionType FunctionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Full function definition (CREATE/ALTER)
|
||||
/// </summary>
|
||||
public string FunctionBody { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return type definition
|
||||
/// </summary>
|
||||
public string ReturnType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataSource code
|
||||
/// </summary>
|
||||
public string DataSourceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status
|
||||
/// </summary>
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Category
|
||||
/// </summary>
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether function exists in database
|
||||
/// </summary>
|
||||
public bool IsDeployed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last deployment time
|
||||
/// </summary>
|
||||
public DateTime? LastDeployedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Parameter definitions (JSON)
|
||||
/// </summary>
|
||||
public string Parameters { get; set; }
|
||||
|
||||
protected SqlFunction()
|
||||
{
|
||||
}
|
||||
|
||||
public SqlFunction(
|
||||
Guid id,
|
||||
string functionName,
|
||||
string schemaName,
|
||||
string displayName,
|
||||
SqlFunctionType functionType,
|
||||
string functionBody,
|
||||
string returnType,
|
||||
string dataSourceCode,
|
||||
Guid? tenantId = null) : base(id)
|
||||
{
|
||||
FunctionName = functionName;
|
||||
SchemaName = schemaName ?? "dbo";
|
||||
DisplayName = displayName;
|
||||
FunctionType = functionType;
|
||||
FunctionBody = functionBody;
|
||||
ReturnType = returnType;
|
||||
DataSourceCode = dataSourceCode;
|
||||
TenantId = tenantId;
|
||||
Status = SqlQueryStatus.Draft;
|
||||
IsDeployed = false;
|
||||
}
|
||||
|
||||
public void UpdateBody(string body)
|
||||
{
|
||||
FunctionBody = body;
|
||||
}
|
||||
|
||||
public void MarkAsDeployed()
|
||||
{
|
||||
IsDeployed = true;
|
||||
LastDeployedAt = DateTime.UtcNow;
|
||||
Status = SqlQueryStatus.Active;
|
||||
}
|
||||
|
||||
public string GetFullName() => $"{SchemaName}.{FunctionName}";
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
using System;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// SQL Query entity for storing and managing SQL queries
|
||||
/// </summary>
|
||||
public class SqlQuery : FullAuditedEntity<Guid>, IMultiTenant
|
||||
{
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique code for the query
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description of the query
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SQL query content
|
||||
/// </summary>
|
||||
public string QueryText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataSource code to use for execution
|
||||
/// </summary>
|
||||
public string DataSourceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Query status
|
||||
/// </summary>
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Category for organization
|
||||
/// </summary>
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tags for filtering
|
||||
/// </summary>
|
||||
public string Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last execution time
|
||||
/// </summary>
|
||||
public DateTime? LastExecutedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Execution count
|
||||
/// </summary>
|
||||
public int ExecutionCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether query modifies data
|
||||
/// </summary>
|
||||
public bool IsModifyingData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Expected parameter definitions (JSON format)
|
||||
/// </summary>
|
||||
public string Parameters { get; set; }
|
||||
|
||||
protected SqlQuery()
|
||||
{
|
||||
}
|
||||
|
||||
public SqlQuery(
|
||||
Guid id,
|
||||
string code,
|
||||
string name,
|
||||
string queryText,
|
||||
string dataSourceCode,
|
||||
Guid? tenantId = null) : base(id)
|
||||
{
|
||||
Code = code;
|
||||
Name = name;
|
||||
QueryText = queryText;
|
||||
DataSourceCode = dataSourceCode;
|
||||
TenantId = tenantId;
|
||||
Status = SqlQueryStatus.Draft;
|
||||
ExecutionCount = 0;
|
||||
}
|
||||
|
||||
public void UpdateQueryText(string queryText)
|
||||
{
|
||||
QueryText = queryText;
|
||||
}
|
||||
|
||||
public void MarkAsExecuted()
|
||||
{
|
||||
LastExecutedAt = DateTime.UtcNow;
|
||||
ExecutionCount++;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
Status = SqlQueryStatus.Active;
|
||||
}
|
||||
|
||||
public void Archive()
|
||||
{
|
||||
Status = SqlQueryStatus.Archived;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// SQL Stored Procedure entity for creating and managing stored procedures
|
||||
/// </summary>
|
||||
public class SqlStoredProcedure : FullAuditedEntity<Guid>, IMultiTenant
|
||||
{
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Procedure name in database
|
||||
/// </summary>
|
||||
public string ProcedureName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Schema name (default: dbo)
|
||||
/// </summary>
|
||||
public string SchemaName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display name
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Full procedure definition (CREATE/ALTER)
|
||||
/// </summary>
|
||||
public string ProcedureBody { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataSource code
|
||||
/// </summary>
|
||||
public string DataSourceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status
|
||||
/// </summary>
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Category
|
||||
/// </summary>
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether procedure exists in database
|
||||
/// </summary>
|
||||
public bool IsDeployed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last deployment time
|
||||
/// </summary>
|
||||
public DateTime? LastDeployedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Parameter definitions (JSON)
|
||||
/// </summary>
|
||||
public string Parameters { get; set; }
|
||||
|
||||
protected SqlStoredProcedure()
|
||||
{
|
||||
}
|
||||
|
||||
public SqlStoredProcedure(
|
||||
Guid id,
|
||||
string procedureName,
|
||||
string schemaName,
|
||||
string displayName,
|
||||
string procedureBody,
|
||||
string dataSourceCode,
|
||||
Guid? tenantId = null) : base(id)
|
||||
{
|
||||
ProcedureName = procedureName;
|
||||
SchemaName = schemaName ?? "dbo";
|
||||
DisplayName = displayName;
|
||||
ProcedureBody = procedureBody;
|
||||
DataSourceCode = dataSourceCode;
|
||||
TenantId = tenantId;
|
||||
Status = SqlQueryStatus.Draft;
|
||||
IsDeployed = false;
|
||||
}
|
||||
|
||||
public void UpdateBody(string body)
|
||||
{
|
||||
ProcedureBody = body;
|
||||
}
|
||||
|
||||
public void MarkAsDeployed()
|
||||
{
|
||||
IsDeployed = true;
|
||||
LastDeployedAt = DateTime.UtcNow;
|
||||
Status = SqlQueryStatus.Active;
|
||||
}
|
||||
|
||||
public string GetFullName() => $"{SchemaName}.{ProcedureName}";
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
using System;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// SQL View entity for creating and managing database views
|
||||
/// </summary>
|
||||
public class SqlView : FullAuditedEntity<Guid>, IMultiTenant
|
||||
{
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// View name in database
|
||||
/// </summary>
|
||||
public string ViewName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Schema name (default: dbo)
|
||||
/// </summary>
|
||||
public string SchemaName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display name
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// View definition (SELECT statement)
|
||||
/// </summary>
|
||||
public string ViewDefinition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataSource code
|
||||
/// </summary>
|
||||
public string DataSourceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status
|
||||
/// </summary>
|
||||
public SqlQueryStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Category
|
||||
/// </summary>
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether view exists in database
|
||||
/// </summary>
|
||||
public bool IsDeployed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last deployment time
|
||||
/// </summary>
|
||||
public DateTime? LastDeployedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to use WITH SCHEMABINDING
|
||||
/// </summary>
|
||||
public bool WithSchemaBinding { get; set; }
|
||||
|
||||
protected SqlView()
|
||||
{
|
||||
}
|
||||
|
||||
public SqlView(
|
||||
Guid id,
|
||||
string viewName,
|
||||
string schemaName,
|
||||
string displayName,
|
||||
string viewDefinition,
|
||||
string dataSourceCode,
|
||||
Guid? tenantId = null) : base(id)
|
||||
{
|
||||
ViewName = viewName;
|
||||
SchemaName = schemaName ?? "dbo";
|
||||
DisplayName = displayName;
|
||||
ViewDefinition = viewDefinition;
|
||||
DataSourceCode = dataSourceCode;
|
||||
TenantId = tenantId;
|
||||
Status = SqlQueryStatus.Draft;
|
||||
IsDeployed = false;
|
||||
WithSchemaBinding = false;
|
||||
}
|
||||
|
||||
public void UpdateDefinition(string definition)
|
||||
{
|
||||
ViewDefinition = definition;
|
||||
}
|
||||
|
||||
public void MarkAsDeployed()
|
||||
{
|
||||
IsDeployed = true;
|
||||
LastDeployedAt = DateTime.UtcNow;
|
||||
Status = SqlQueryStatus.Active;
|
||||
}
|
||||
|
||||
public string GetFullName() => $"{SchemaName}.{ViewName}";
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>Erp.SqlQueryManager</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="9.0.2" />
|
||||
<ProjectReference Include="..\Erp.SqlQueryManager.Domain.Shared\Erp.SqlQueryManager.Domain.Shared.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Erp.Platform.Domain\Erp.Platform.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ConfigureAwait />
|
||||
</Weavers>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Result of SQL query execution
|
||||
/// </summary>
|
||||
public class SqlExecutionResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string Message { get; set; }
|
||||
public IEnumerable<dynamic> Data { get; set; }
|
||||
public int RowsAffected { get; set; }
|
||||
public long ExecutionTimeMs { get; set; }
|
||||
public Dictionary<string, object> Metadata { get; set; }
|
||||
|
||||
public SqlExecutionResult()
|
||||
{
|
||||
Metadata = new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Service for executing SQL commands
|
||||
/// </summary>
|
||||
public interface ISqlExecutorService
|
||||
{
|
||||
/// <summary>
|
||||
/// Execute a SELECT query and return results
|
||||
/// </summary>
|
||||
Task<SqlExecutionResult> ExecuteQueryAsync(
|
||||
string sql,
|
||||
string dataSourceCode,
|
||||
Dictionary<string, object> parameters = null);
|
||||
|
||||
/// <summary>
|
||||
/// Execute a non-query command (INSERT, UPDATE, DELETE)
|
||||
/// </summary>
|
||||
Task<SqlExecutionResult> ExecuteNonQueryAsync(
|
||||
string sql,
|
||||
string dataSourceCode,
|
||||
Dictionary<string, object> parameters = null);
|
||||
|
||||
/// <summary>
|
||||
/// Execute scalar query (returns single value)
|
||||
/// </summary>
|
||||
Task<SqlExecutionResult> ExecuteScalarAsync<T>(
|
||||
string sql,
|
||||
string dataSourceCode,
|
||||
Dictionary<string, object> parameters = null);
|
||||
|
||||
/// <summary>
|
||||
/// Deploy stored procedure to database
|
||||
/// </summary>
|
||||
Task<SqlExecutionResult> DeployStoredProcedureAsync(
|
||||
string procedureBody,
|
||||
string dataSourceCode);
|
||||
|
||||
/// <summary>
|
||||
/// Deploy view to database
|
||||
/// </summary>
|
||||
Task<SqlExecutionResult> DeployViewAsync(
|
||||
string viewDefinition,
|
||||
string dataSourceCode);
|
||||
|
||||
/// <summary>
|
||||
/// Deploy function to database
|
||||
/// </summary>
|
||||
Task<SqlExecutionResult> DeployFunctionAsync(
|
||||
string functionBody,
|
||||
string dataSourceCode);
|
||||
|
||||
/// <summary>
|
||||
/// Check if database object exists
|
||||
/// </summary>
|
||||
Task<bool> CheckObjectExistsAsync(
|
||||
string objectName,
|
||||
string objectType,
|
||||
string dataSourceCode,
|
||||
string schemaName = "dbo");
|
||||
|
||||
/// <summary>
|
||||
/// Drop database object
|
||||
/// </summary>
|
||||
Task<SqlExecutionResult> DropObjectAsync(
|
||||
string objectName,
|
||||
string objectType,
|
||||
string dataSourceCode,
|
||||
string schemaName = "dbo");
|
||||
|
||||
/// <summary>
|
||||
/// Validate SQL syntax (basic validation)
|
||||
/// </summary>
|
||||
Task<(bool IsValid, string ErrorMessage)> ValidateSqlAsync(string sql);
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
using System.Collections.Generic;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Provides SQL templates for creating database objects
|
||||
/// </summary>
|
||||
public interface ISqlTemplateProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Get stored procedure template
|
||||
/// </summary>
|
||||
string GetStoredProcedureTemplate(string procedureName, string schemaName = "dbo");
|
||||
|
||||
/// <summary>
|
||||
/// Get view template
|
||||
/// </summary>
|
||||
string GetViewTemplate(string viewName, string schemaName = "dbo", bool withSchemaBinding = false);
|
||||
|
||||
/// <summary>
|
||||
/// Get function template
|
||||
/// </summary>
|
||||
string GetFunctionTemplate(string functionName, SqlFunctionType functionType, string schemaName = "dbo");
|
||||
|
||||
/// <summary>
|
||||
/// Get query template with common patterns
|
||||
/// </summary>
|
||||
string GetQueryTemplate(string queryType);
|
||||
|
||||
/// <summary>
|
||||
/// Get available query template types
|
||||
/// </summary>
|
||||
List<QueryTemplateInfo> GetAvailableQueryTemplates();
|
||||
}
|
||||
|
||||
public class QueryTemplateInfo
|
||||
{
|
||||
public string Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,301 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Erp.Platform.DynamicData;
|
||||
using Erp.Platform.Queries;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Domain.Services;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Services;
|
||||
|
||||
public class SqlExecutorService : DomainService, ISqlExecutorService
|
||||
{
|
||||
private readonly IDataSourceManager _dataSourceManager;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
public SqlExecutorService(
|
||||
IDataSourceManager dataSourceManager,
|
||||
IServiceProvider serviceProvider)
|
||||
{
|
||||
_dataSourceManager = dataSourceManager;
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
private async Task<IDynamicDataRepository> GetRepositoryAsync(string dataSourceCode)
|
||||
{
|
||||
// Get DataSource to determine database type
|
||||
var dataSource = await _dataSourceManager.GetDataSourceAsync(
|
||||
CurrentTenant.IsAvailable,
|
||||
dataSourceCode);
|
||||
|
||||
if (dataSource == null)
|
||||
{
|
||||
throw new BusinessException("SqlQueryManager:DataSourceNotFound")
|
||||
.WithData("DataSourceCode", dataSourceCode);
|
||||
}
|
||||
|
||||
// Get appropriate repository based on database type
|
||||
// For now, using MS SQL Server repository
|
||||
var repository = _serviceProvider.GetKeyedService<IDynamicDataRepository>("Ms");
|
||||
|
||||
if (repository == null)
|
||||
{
|
||||
throw new BusinessException("SqlQueryManager:RepositoryNotFound")
|
||||
.WithData("DatabaseType", "Ms");
|
||||
}
|
||||
|
||||
return repository;
|
||||
}
|
||||
|
||||
public async Task<SqlExecutionResult> ExecuteQueryAsync(
|
||||
string sql,
|
||||
string dataSourceCode,
|
||||
Dictionary<string, object> parameters = null)
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
var result = new SqlExecutionResult();
|
||||
|
||||
try
|
||||
{
|
||||
var connectionString = await _dataSourceManager.GetConnectionStringAsync(
|
||||
CurrentTenant.IsAvailable,
|
||||
dataSourceCode);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(connectionString))
|
||||
{
|
||||
throw new BusinessException("SqlQueryManager:InvalidConnectionString")
|
||||
.WithData("DataSourceCode", dataSourceCode);
|
||||
}
|
||||
|
||||
var repository = await GetRepositoryAsync(dataSourceCode);
|
||||
var data = await repository.QueryAsync(sql, connectionString, parameters);
|
||||
|
||||
stopwatch.Stop();
|
||||
|
||||
result.Success = true;
|
||||
result.Data = data;
|
||||
result.RowsAffected = data?.Count() ?? 0;
|
||||
result.ExecutionTimeMs = stopwatch.ElapsedMilliseconds;
|
||||
result.Message = $"Query executed successfully.";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
stopwatch.Stop();
|
||||
result.Success = false;
|
||||
result.Message = $"Query execution failed: {ex.Message}";
|
||||
result.ExecutionTimeMs = stopwatch.ElapsedMilliseconds;
|
||||
result.Metadata["ErrorDetail"] = ex.ToString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<SqlExecutionResult> ExecuteNonQueryAsync(
|
||||
string sql,
|
||||
string dataSourceCode,
|
||||
Dictionary<string, object> parameters = null)
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
var result = new SqlExecutionResult();
|
||||
|
||||
try
|
||||
{
|
||||
var connectionString = await _dataSourceManager.GetConnectionStringAsync(
|
||||
CurrentTenant.IsAvailable,
|
||||
dataSourceCode);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(connectionString))
|
||||
{
|
||||
throw new BusinessException("SqlQueryManager:InvalidConnectionString")
|
||||
.WithData("DataSourceCode", dataSourceCode);
|
||||
}
|
||||
|
||||
var repository = await GetRepositoryAsync(dataSourceCode);
|
||||
var rowsAffected = await repository.ExecuteAsync(sql, connectionString, parameters);
|
||||
|
||||
stopwatch.Stop();
|
||||
|
||||
result.Success = true;
|
||||
result.RowsAffected = rowsAffected;
|
||||
result.ExecutionTimeMs = stopwatch.ElapsedMilliseconds;
|
||||
result.Message = $"Command executed successfully. Rows affected: {rowsAffected}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
stopwatch.Stop();
|
||||
result.Success = false;
|
||||
result.Message = $"Command execution failed: {ex.Message}";
|
||||
result.ExecutionTimeMs = stopwatch.ElapsedMilliseconds;
|
||||
result.Metadata["ErrorDetail"] = ex.ToString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<SqlExecutionResult> ExecuteScalarAsync<T>(
|
||||
string sql,
|
||||
string dataSourceCode,
|
||||
Dictionary<string, object> parameters = null)
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
var result = new SqlExecutionResult();
|
||||
|
||||
try
|
||||
{
|
||||
var connectionString = await _dataSourceManager.GetConnectionStringAsync(
|
||||
CurrentTenant.IsAvailable,
|
||||
dataSourceCode);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(connectionString))
|
||||
{
|
||||
throw new BusinessException("SqlQueryManager:InvalidConnectionString")
|
||||
.WithData("DataSourceCode", dataSourceCode);
|
||||
}
|
||||
|
||||
var repository = await GetRepositoryAsync(dataSourceCode);
|
||||
var scalarValue = await repository.ExecuteScalarAsync<T>(sql, connectionString, parameters);
|
||||
|
||||
stopwatch.Stop();
|
||||
|
||||
result.Success = true;
|
||||
result.Data = new[] { new { Value = scalarValue } };
|
||||
result.ExecutionTimeMs = stopwatch.ElapsedMilliseconds;
|
||||
result.Message = "Scalar query executed successfully";
|
||||
result.Metadata["ScalarValue"] = scalarValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
stopwatch.Stop();
|
||||
result.Success = false;
|
||||
result.Message = $"Scalar query execution failed: {ex.Message}";
|
||||
result.ExecutionTimeMs = stopwatch.ElapsedMilliseconds;
|
||||
result.Metadata["ErrorDetail"] = ex.ToString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<SqlExecutionResult> DeployStoredProcedureAsync(
|
||||
string procedureBody,
|
||||
string dataSourceCode)
|
||||
{
|
||||
return await ExecuteNonQueryAsync(procedureBody, dataSourceCode);
|
||||
}
|
||||
|
||||
public async Task<SqlExecutionResult> DeployViewAsync(
|
||||
string viewDefinition,
|
||||
string dataSourceCode)
|
||||
{
|
||||
return await ExecuteNonQueryAsync(viewDefinition, dataSourceCode);
|
||||
}
|
||||
|
||||
public async Task<SqlExecutionResult> DeployFunctionAsync(
|
||||
string functionBody,
|
||||
string dataSourceCode)
|
||||
{
|
||||
return await ExecuteNonQueryAsync(functionBody, dataSourceCode);
|
||||
}
|
||||
|
||||
public async Task<bool> CheckObjectExistsAsync(
|
||||
string objectName,
|
||||
string objectType,
|
||||
string dataSourceCode,
|
||||
string schemaName = "dbo")
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $@"
|
||||
SELECT COUNT(*)
|
||||
FROM sys.objects o
|
||||
INNER JOIN sys.schemas s ON o.schema_id = s.schema_id
|
||||
WHERE s.name = @SchemaName
|
||||
AND o.name = @ObjectName
|
||||
AND o.type_desc = @ObjectType";
|
||||
|
||||
var parameters = new Dictionary<string, object>
|
||||
{
|
||||
{ "SchemaName", schemaName },
|
||||
{ "ObjectName", objectName },
|
||||
{ "ObjectType", objectType.ToUpperInvariant() }
|
||||
};
|
||||
|
||||
var result = await ExecuteScalarAsync<int>(sql, dataSourceCode, parameters);
|
||||
|
||||
return result.Success && result.Metadata.ContainsKey("ScalarValue")
|
||||
&& Convert.ToInt32(result.Metadata["ScalarValue"]) > 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<SqlExecutionResult> DropObjectAsync(
|
||||
string objectName,
|
||||
string objectType,
|
||||
string dataSourceCode,
|
||||
string schemaName = "dbo")
|
||||
{
|
||||
var dropCommand = objectType.ToUpperInvariant() switch
|
||||
{
|
||||
"SQL_STORED_PROCEDURE" => $"DROP PROCEDURE IF EXISTS [{schemaName}].[{objectName}]",
|
||||
"VIEW" => $"DROP VIEW IF EXISTS [{schemaName}].[{objectName}]",
|
||||
"SQL_SCALAR_FUNCTION" => $"DROP FUNCTION IF EXISTS [{schemaName}].[{objectName}]",
|
||||
"SQL_TABLE_VALUED_FUNCTION" => $"DROP FUNCTION IF EXISTS [{schemaName}].[{objectName}]",
|
||||
"SQL_INLINE_TABLE_VALUED_FUNCTION" => $"DROP FUNCTION IF EXISTS [{schemaName}].[{objectName}]",
|
||||
_ => throw new BusinessException("SqlQueryManager:UnsupportedObjectType")
|
||||
.WithData("ObjectType", objectType)
|
||||
};
|
||||
|
||||
return await ExecuteNonQueryAsync(dropCommand, dataSourceCode);
|
||||
}
|
||||
|
||||
public Task<(bool IsValid, string ErrorMessage)> ValidateSqlAsync(string sql)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sql))
|
||||
{
|
||||
return Task.FromResult((false, "SQL query is empty"));
|
||||
}
|
||||
|
||||
// Basic validation - check for dangerous keywords
|
||||
var dangerousPatterns = new[]
|
||||
{
|
||||
@"\bDROP\s+DATABASE\b",
|
||||
@"\bDROP\s+SCHEMA\b",
|
||||
@"\bTRUNCATE\s+TABLE\b",
|
||||
@"\bALTER\s+DATABASE\b",
|
||||
@"\bSHUTDOWN\b",
|
||||
@"\bxp_cmdshell\b"
|
||||
};
|
||||
|
||||
foreach (var pattern in dangerousPatterns)
|
||||
{
|
||||
if (Regex.IsMatch(sql, pattern, RegexOptions.IgnoreCase))
|
||||
{
|
||||
return Task.FromResult((false, $"SQL contains potentially dangerous command: {pattern}"));
|
||||
}
|
||||
}
|
||||
|
||||
// Check for balanced parentheses
|
||||
var openCount = sql.Count(c => c == '(');
|
||||
var closeCount = sql.Count(c => c == ')');
|
||||
|
||||
if (openCount != closeCount)
|
||||
{
|
||||
return Task.FromResult((false, "Unbalanced parentheses in SQL"));
|
||||
}
|
||||
|
||||
return Task.FromResult((true, string.Empty));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Task.FromResult((false, $"Validation error: {ex.Message}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,395 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Erp.SqlQueryManager.Domain.Shared;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace Erp.SqlQueryManager.Domain.Services;
|
||||
|
||||
public class SqlTemplateProvider : ISqlTemplateProvider, ITransientDependency
|
||||
{
|
||||
public string GetStoredProcedureTemplate(string procedureName, string schemaName = "dbo")
|
||||
{
|
||||
return $@"-- =============================================
|
||||
-- Author: <Author Name>
|
||||
-- Create date: <Create Date>
|
||||
-- Description: <Description>
|
||||
-- =============================================
|
||||
CREATE OR ALTER PROCEDURE [{schemaName}].[{procedureName}]
|
||||
-- Add parameters here
|
||||
@Parameter1 INT = NULL,
|
||||
@Parameter2 NVARCHAR(100) = NULL
|
||||
AS
|
||||
BEGIN
|
||||
-- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
@Parameter1 AS Parameter1,
|
||||
@Parameter2 AS Parameter2
|
||||
|
||||
-- Example error handling
|
||||
BEGIN TRY
|
||||
-- Your logic here
|
||||
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
-- Error handling
|
||||
DECLARE @ErrorMessage NVARCHAR(4000) = ERROR_MESSAGE();
|
||||
DECLARE @ErrorSeverity INT = ERROR_SEVERITY();
|
||||
DECLARE @ErrorState INT = ERROR_STATE();
|
||||
|
||||
RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
|
||||
END CATCH
|
||||
END
|
||||
GO";
|
||||
}
|
||||
|
||||
public string GetViewTemplate(string viewName, string schemaName = "dbo", bool withSchemaBinding = false)
|
||||
{
|
||||
var schemaBindingClause = withSchemaBinding ? " WITH SCHEMABINDING" : "";
|
||||
|
||||
return $@"-- =============================================
|
||||
-- Author: <Author Name>
|
||||
-- Create date: <Create Date>
|
||||
-- Description: <Description>
|
||||
-- =============================================
|
||||
CREATE OR ALTER VIEW [{schemaName}].[{viewName}]{schemaBindingClause}
|
||||
AS
|
||||
-- Define your SELECT statement here
|
||||
SELECT
|
||||
Column1,
|
||||
Column2,
|
||||
Column3
|
||||
FROM
|
||||
TableName
|
||||
WHERE
|
||||
-- Add your conditions
|
||||
1 = 1
|
||||
GO";
|
||||
}
|
||||
|
||||
public string GetFunctionTemplate(string functionName, SqlFunctionType functionType, string schemaName = "dbo")
|
||||
{
|
||||
return functionType switch
|
||||
{
|
||||
SqlFunctionType.ScalarFunction => GetScalarFunctionTemplate(functionName, schemaName),
|
||||
SqlFunctionType.TableValuedFunction => GetTableValuedFunctionTemplate(functionName, schemaName),
|
||||
SqlFunctionType.InlineTableValuedFunction => GetInlineTableValuedFunctionTemplate(functionName, schemaName),
|
||||
_ => GetScalarFunctionTemplate(functionName, schemaName)
|
||||
};
|
||||
}
|
||||
|
||||
private string GetScalarFunctionTemplate(string functionName, string schemaName)
|
||||
{
|
||||
return $@"-- =============================================
|
||||
-- Author: <Author Name>
|
||||
-- Create date: <Create Date>
|
||||
-- Description: Scalar function that returns a single value
|
||||
-- =============================================
|
||||
CREATE OR ALTER FUNCTION [{schemaName}].[{functionName}]
|
||||
(
|
||||
-- Add parameters here
|
||||
@Parameter1 INT,
|
||||
@Parameter2 NVARCHAR(100)
|
||||
)
|
||||
RETURNS INT
|
||||
AS
|
||||
BEGIN
|
||||
-- Declare the return variable here
|
||||
DECLARE @Result INT;
|
||||
|
||||
-- Add your logic here
|
||||
SELECT @Result = COUNT(*)
|
||||
FROM YourTable
|
||||
WHERE Column1 = @Parameter1;
|
||||
|
||||
-- Return the result
|
||||
RETURN @Result;
|
||||
END
|
||||
GO";
|
||||
}
|
||||
|
||||
private string GetTableValuedFunctionTemplate(string functionName, string schemaName)
|
||||
{
|
||||
return $@"-- =============================================
|
||||
-- Author: <Author Name>
|
||||
-- Create date: <Create Date>
|
||||
-- Description: Multi-statement table-valued function
|
||||
-- =============================================
|
||||
CREATE OR ALTER FUNCTION [{schemaName}].[{functionName}]
|
||||
(
|
||||
-- Add parameters here
|
||||
@Parameter1 INT,
|
||||
@Parameter2 NVARCHAR(100)
|
||||
)
|
||||
RETURNS @ResultTable TABLE
|
||||
(
|
||||
-- Define the structure of the result table
|
||||
Id INT,
|
||||
Name NVARCHAR(100),
|
||||
Value DECIMAL(18,2)
|
||||
)
|
||||
AS
|
||||
BEGIN
|
||||
-- Fill the table variable with data
|
||||
INSERT INTO @ResultTable (Id, Name, Value)
|
||||
SELECT
|
||||
Id,
|
||||
Name,
|
||||
Value
|
||||
FROM
|
||||
YourTable
|
||||
WHERE
|
||||
Column1 = @Parameter1;
|
||||
|
||||
-- Return
|
||||
RETURN;
|
||||
END
|
||||
GO";
|
||||
}
|
||||
|
||||
private string GetInlineTableValuedFunctionTemplate(string functionName, string schemaName)
|
||||
{
|
||||
return $@"-- =============================================
|
||||
-- Author: <Author Name>
|
||||
-- Create date: <Create Date>
|
||||
-- Description: Inline table-valued function
|
||||
-- =============================================
|
||||
CREATE OR ALTER FUNCTION [{schemaName}].[{functionName}]
|
||||
(
|
||||
-- Add parameters here
|
||||
@Parameter1 INT,
|
||||
@Parameter2 NVARCHAR(100)
|
||||
)
|
||||
RETURNS TABLE
|
||||
AS
|
||||
RETURN
|
||||
(
|
||||
-- Add your SELECT statement here
|
||||
SELECT
|
||||
Id,
|
||||
Name,
|
||||
Value,
|
||||
CreatedDate
|
||||
FROM
|
||||
YourTable
|
||||
WHERE
|
||||
Column1 = @Parameter1
|
||||
AND Column2 LIKE '%' + @Parameter2 + '%'
|
||||
)
|
||||
GO";
|
||||
}
|
||||
|
||||
public string GetQueryTemplate(string queryType)
|
||||
{
|
||||
return queryType?.ToUpperInvariant() switch
|
||||
{
|
||||
"SELECT" => GetSelectTemplate(),
|
||||
"INSERT" => GetInsertTemplate(),
|
||||
"UPDATE" => GetUpdateTemplate(),
|
||||
"DELETE" => GetDeleteTemplate(),
|
||||
"JOIN" => GetJoinTemplate(),
|
||||
"CTE" => GetCteTemplate(),
|
||||
"PIVOT" => GetPivotTemplate(),
|
||||
"TRANSACTION" => GetTransactionTemplate(),
|
||||
_ => GetSelectTemplate()
|
||||
};
|
||||
}
|
||||
|
||||
private string GetSelectTemplate()
|
||||
{
|
||||
return @"-- Basic SELECT query
|
||||
SELECT
|
||||
Column1,
|
||||
Column2,
|
||||
Column3
|
||||
FROM
|
||||
TableName
|
||||
WHERE
|
||||
-- Add your conditions
|
||||
Column1 = 'value'
|
||||
AND IsActive = 1
|
||||
ORDER BY
|
||||
Column1 ASC;";
|
||||
}
|
||||
|
||||
private string GetInsertTemplate()
|
||||
{
|
||||
return @"-- INSERT statement
|
||||
INSERT INTO TableName
|
||||
(
|
||||
Column1,
|
||||
Column2,
|
||||
Column3,
|
||||
CreatedDate
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
'Value1',
|
||||
'Value2',
|
||||
123,
|
||||
GETDATE()
|
||||
);
|
||||
|
||||
-- Or with SELECT
|
||||
INSERT INTO TableName (Column1, Column2)
|
||||
SELECT
|
||||
Column1,
|
||||
Column2
|
||||
FROM
|
||||
SourceTable
|
||||
WHERE
|
||||
Condition = 1;";
|
||||
}
|
||||
|
||||
private string GetUpdateTemplate()
|
||||
{
|
||||
return @"-- UPDATE statement
|
||||
UPDATE TableName
|
||||
SET
|
||||
Column1 = 'NewValue',
|
||||
Column2 = 'NewValue2',
|
||||
UpdatedDate = GETDATE()
|
||||
WHERE
|
||||
Id = 123
|
||||
AND IsActive = 1;";
|
||||
}
|
||||
|
||||
private string GetDeleteTemplate()
|
||||
{
|
||||
return @"-- DELETE statement
|
||||
DELETE FROM TableName
|
||||
WHERE
|
||||
Id = 123
|
||||
AND IsActive = 0;
|
||||
|
||||
-- Soft delete pattern
|
||||
UPDATE TableName
|
||||
SET
|
||||
IsDeleted = 1,
|
||||
DeletedDate = GETDATE(),
|
||||
DeletedBy = 'UserName'
|
||||
WHERE
|
||||
Id = 123;";
|
||||
}
|
||||
|
||||
private string GetJoinTemplate()
|
||||
{
|
||||
return @"-- JOIN query example
|
||||
SELECT
|
||||
t1.Column1,
|
||||
t1.Column2,
|
||||
t2.Column3,
|
||||
t3.Column4
|
||||
FROM
|
||||
Table1 t1
|
||||
INNER JOIN Table2 t2 ON t1.Id = t2.Table1Id
|
||||
LEFT JOIN Table3 t3 ON t2.Id = t3.Table2Id
|
||||
WHERE
|
||||
t1.IsActive = 1
|
||||
AND t2.Status = 'Active'
|
||||
ORDER BY
|
||||
t1.Column1;";
|
||||
}
|
||||
|
||||
private string GetCteTemplate()
|
||||
{
|
||||
return @"-- Common Table Expression (CTE) example
|
||||
WITH CTE_Name AS
|
||||
(
|
||||
SELECT
|
||||
Column1,
|
||||
Column2,
|
||||
COUNT(*) as RecordCount
|
||||
FROM
|
||||
TableName
|
||||
WHERE
|
||||
IsActive = 1
|
||||
GROUP BY
|
||||
Column1, Column2
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CTE_Name
|
||||
WHERE
|
||||
RecordCount > 5
|
||||
ORDER BY
|
||||
RecordCount DESC;";
|
||||
}
|
||||
|
||||
private string GetPivotTemplate()
|
||||
{
|
||||
return @"-- PIVOT example
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
Category,
|
||||
Year,
|
||||
Amount
|
||||
FROM
|
||||
Sales
|
||||
) AS SourceTable
|
||||
PIVOT
|
||||
(
|
||||
SUM(Amount)
|
||||
FOR Year IN ([2021], [2022], [2023], [2024])
|
||||
) AS PivotTable
|
||||
ORDER BY
|
||||
Category;";
|
||||
}
|
||||
|
||||
private string GetTransactionTemplate()
|
||||
{
|
||||
return @"-- Transaction example
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
BEGIN TRY
|
||||
-- Your SQL statements here
|
||||
UPDATE Table1
|
||||
SET Column1 = 'Value'
|
||||
WHERE Id = 1;
|
||||
|
||||
INSERT INTO Table2 (Column1, Column2)
|
||||
VALUES ('Value1', 'Value2');
|
||||
|
||||
DELETE FROM Table3
|
||||
WHERE Id = 123;
|
||||
|
||||
-- Commit if all successful
|
||||
COMMIT TRANSACTION;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
-- Rollback on error
|
||||
ROLLBACK TRANSACTION;
|
||||
|
||||
-- Return error information
|
||||
SELECT
|
||||
ERROR_NUMBER() AS ErrorNumber,
|
||||
ERROR_SEVERITY() AS ErrorSeverity,
|
||||
ERROR_STATE() AS ErrorState,
|
||||
ERROR_PROCEDURE() AS ErrorProcedure,
|
||||
ERROR_LINE() AS ErrorLine,
|
||||
ERROR_MESSAGE() AS ErrorMessage;
|
||||
END CATCH;";
|
||||
}
|
||||
|
||||
public List<QueryTemplateInfo> GetAvailableQueryTemplates()
|
||||
{
|
||||
return new List<QueryTemplateInfo>
|
||||
{
|
||||
new() { Type = "SELECT", Name = "Basic Select", Description = "Simple SELECT query with WHERE and ORDER BY" },
|
||||
new() { Type = "INSERT", Name = "Insert Data", Description = "INSERT statement with VALUES or SELECT" },
|
||||
new() { Type = "UPDATE", Name = "Update Data", Description = "UPDATE statement with conditions" },
|
||||
new() { Type = "DELETE", Name = "Delete Data", Description = "DELETE statement with soft delete example" },
|
||||
new() { Type = "JOIN", Name = "Join Tables", Description = "Query with INNER and LEFT JOINs" },
|
||||
new() { Type = "CTE", Name = "Common Table Expression", Description = "CTE (WITH clause) example" },
|
||||
new() { Type = "PIVOT", Name = "Pivot Table", Description = "PIVOT query for data transformation" },
|
||||
new() { Type = "TRANSACTION", Name = "Transaction", Description = "Transaction with error handling" }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
namespace Erp.SqlQueryManager;
|
||||
|
||||
public static class Prefix
|
||||
{
|
||||
public static string MenuPrefix { get; set; } = "Sqm";
|
||||
public static string HostPrefix { get; set; } = "T";
|
||||
public static string? DbSchema { get; set; } = null;
|
||||
|
||||
public const string ConnectionStringName = "SqlQueryManager";
|
||||
}
|
||||
|
||||
public static class TablePrefix
|
||||
{
|
||||
public static string ByName(string tableName)
|
||||
{
|
||||
return $"{Prefix.MenuPrefix}_{Prefix.HostPrefix}_{tableName}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp.Domain;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace Erp.SqlQueryManager;
|
||||
|
||||
[DependsOn(
|
||||
typeof(AbpDddDomainModule),
|
||||
typeof(SqlQueryManagerDomainSharedModule)
|
||||
)]
|
||||
public class SqlQueryManagerDomainModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
// Domain services configuration can be added here
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>Erp.SqlQueryManager</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="9.0.2" />
|
||||
<ProjectReference Include="..\Erp.SqlQueryManager.Domain\Erp.SqlQueryManager.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ConfigureAwait />
|
||||
</Weavers>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using Erp.SqlQueryManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.EntityFrameworkCore;
|
||||
|
||||
namespace Erp.SqlQueryManager.EntityFrameworkCore;
|
||||
|
||||
[ConnectionStringName("Default")]
|
||||
public class SqlQueryManagerDbContext : AbpDbContext<SqlQueryManagerDbContext>
|
||||
{
|
||||
public DbSet<SqlQuery> SqlQueries { get; set; }
|
||||
public DbSet<SqlStoredProcedure> SqlStoredProcedures { get; set; }
|
||||
public DbSet<SqlView> SqlViews { get; set; }
|
||||
public DbSet<SqlFunction> SqlFunctions { get; set; }
|
||||
|
||||
public SqlQueryManagerDbContext(DbContextOptions<SqlQueryManagerDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.ConfigureSqlQueryManager();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
using Erp.SqlQueryManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.EntityFrameworkCore.Modeling;
|
||||
|
||||
namespace Erp.SqlQueryManager.EntityFrameworkCore;
|
||||
|
||||
public static class SqlQueryManagerDbContextModelCreatingExtensions
|
||||
{
|
||||
public static void ConfigureSqlQueryManager(this ModelBuilder builder)
|
||||
{
|
||||
Check.NotNull(builder, nameof(builder));
|
||||
|
||||
// SqlQuery
|
||||
builder.Entity<SqlQuery>(b =>
|
||||
{
|
||||
b.ToTable(TablePrefix.ByName(nameof(SqlQuery)), Prefix.DbSchema);
|
||||
b.ConfigureByConvention();
|
||||
|
||||
b.Property(x => x.Code).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.Name).IsRequired().HasMaxLength(256);
|
||||
b.Property(x => x.Description).HasMaxLength(1000);
|
||||
b.Property(x => x.QueryText).IsRequired();
|
||||
b.Property(x => x.DataSourceCode).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.Status).IsRequired();
|
||||
b.Property(x => x.Category).HasMaxLength(128);
|
||||
b.Property(x => x.Tags).HasMaxLength(500);
|
||||
b.Property(x => x.Parameters).HasMaxLength(4000);
|
||||
|
||||
b.HasIndex(x => x.Code);
|
||||
b.HasIndex(x => x.DataSourceCode);
|
||||
b.HasIndex(x => x.Status);
|
||||
b.HasIndex(x => x.Category);
|
||||
});
|
||||
|
||||
// SqlStoredProcedure
|
||||
builder.Entity<SqlStoredProcedure>(b =>
|
||||
{
|
||||
b.ToTable(TablePrefix.ByName(nameof(SqlStoredProcedure)), Prefix.DbSchema);
|
||||
b.ConfigureByConvention();
|
||||
|
||||
b.Property(x => x.ProcedureName).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.SchemaName).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.DisplayName).IsRequired().HasMaxLength(256);
|
||||
b.Property(x => x.Description).HasMaxLength(1000);
|
||||
b.Property(x => x.ProcedureBody).IsRequired();
|
||||
b.Property(x => x.DataSourceCode).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.Status).IsRequired();
|
||||
b.Property(x => x.Category).HasMaxLength(128);
|
||||
b.Property(x => x.Parameters).HasMaxLength(4000);
|
||||
|
||||
b.HasIndex(x => new { x.SchemaName, x.ProcedureName });
|
||||
b.HasIndex(x => x.DataSourceCode);
|
||||
b.HasIndex(x => x.Status);
|
||||
b.HasIndex(x => x.IsDeployed);
|
||||
});
|
||||
|
||||
// SqlView
|
||||
builder.Entity<SqlView>(b =>
|
||||
{
|
||||
b.ToTable(TablePrefix.ByName(nameof(SqlView)), Prefix.DbSchema);
|
||||
b.ConfigureByConvention();
|
||||
|
||||
b.Property(x => x.ViewName).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.SchemaName).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.DisplayName).IsRequired().HasMaxLength(256);
|
||||
b.Property(x => x.Description).HasMaxLength(1000);
|
||||
b.Property(x => x.ViewDefinition).IsRequired();
|
||||
b.Property(x => x.DataSourceCode).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.Status).IsRequired();
|
||||
b.Property(x => x.Category).HasMaxLength(128);
|
||||
|
||||
b.HasIndex(x => new { x.SchemaName, x.ViewName });
|
||||
b.HasIndex(x => x.DataSourceCode);
|
||||
b.HasIndex(x => x.Status);
|
||||
b.HasIndex(x => x.IsDeployed);
|
||||
});
|
||||
|
||||
// SqlFunction
|
||||
builder.Entity<SqlFunction>(b =>
|
||||
{
|
||||
b.ToTable(TablePrefix.ByName(nameof(SqlFunction)), Prefix.DbSchema);
|
||||
b.ConfigureByConvention();
|
||||
|
||||
b.Property(x => x.FunctionName).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.SchemaName).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.DisplayName).IsRequired().HasMaxLength(256);
|
||||
b.Property(x => x.Description).HasMaxLength(1000);
|
||||
b.Property(x => x.FunctionType).IsRequired();
|
||||
b.Property(x => x.FunctionBody).IsRequired();
|
||||
b.Property(x => x.ReturnType).IsRequired().HasMaxLength(256);
|
||||
b.Property(x => x.DataSourceCode).IsRequired().HasMaxLength(128);
|
||||
b.Property(x => x.Status).IsRequired();
|
||||
b.Property(x => x.Category).HasMaxLength(128);
|
||||
b.Property(x => x.Parameters).HasMaxLength(4000);
|
||||
|
||||
b.HasIndex(x => new { x.SchemaName, x.FunctionName });
|
||||
b.HasIndex(x => x.DataSourceCode);
|
||||
b.HasIndex(x => x.Status);
|
||||
b.HasIndex(x => x.FunctionType);
|
||||
b.HasIndex(x => x.IsDeployed);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp.EntityFrameworkCore;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace Erp.SqlQueryManager.EntityFrameworkCore;
|
||||
|
||||
[DependsOn(
|
||||
typeof(SqlQueryManagerDomainModule),
|
||||
typeof(AbpEntityFrameworkCoreModule)
|
||||
)]
|
||||
public class SqlQueryManagerEntityFrameworkCoreModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
context.Services.AddAbpDbContext<SqlQueryManagerDbContext>(options =>
|
||||
{
|
||||
options.AddDefaultRepositories(includeAllEntities: true);
|
||||
});
|
||||
}
|
||||
}
|
||||
24
api/modules/Erp.SqlQueryManager/common.props
Normal file
24
api/modules/Erp.SqlQueryManager/common.props
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Version>0.1.0</Version>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<AbpProjectType>module</AbpProjectType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.1" PrivateAssets="All" />
|
||||
<PackageReference Include="Fody" Version="6.5.3">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="NoWarnOnRazorViewImportedTypeConflicts" BeforeTargets="RazorCoreCompile">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);0436</NoWarn>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
@ -11,8 +11,7 @@ public class BankAccountDto : AuditedEntityDto<Guid>
|
|||
|
||||
public string AccountOwner { get; set; }
|
||||
|
||||
public Guid? CurrencyId { get; set; }
|
||||
public string CurrencyCode { get; set; }
|
||||
public string Currency { get; set; }
|
||||
|
||||
public bool CanTransferMoney { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class EmployeeDto : FullAuditedEntityDto<Guid>
|
|||
public Guid? TenantId { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Avatar { get; set; }
|
||||
public string NationalId { get; set; }
|
||||
public DateTime BirthDate { get; set; }
|
||||
|
|
@ -19,7 +19,7 @@ public class EmployeeDto : FullAuditedEntityDto<Guid>
|
|||
public string Country { get; set; }
|
||||
public string City { get; set; }
|
||||
public string District { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string Township { get; set; }
|
||||
public string PostalCode { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string MobileNumber { get; set; }
|
||||
|
|
@ -50,10 +50,12 @@ public class EmployeeDto : FullAuditedEntityDto<Guid>
|
|||
public EmployeeDto Manager { get; set; }
|
||||
|
||||
public decimal BaseSalary { get; set; }
|
||||
public Guid? CurrencyId { get; set; }
|
||||
public string Currency { get; set; }
|
||||
|
||||
public string PayrollGroup { get; set; } // e.g., Monthly, Biweekly, Weekly
|
||||
public Guid? BankAccountId { get; set; }
|
||||
|
||||
public Guid BankId { get; set; }
|
||||
public string IbanNumber { get; set; }
|
||||
public Guid? BadgeId { get; set; }
|
||||
|
||||
public string EmployeeStatus { get; set; }
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ public class ExpenseDto : FullAuditedEntityDto<Guid>
|
|||
public string Category { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
public Guid? CurrencyId { get; set; }
|
||||
public string CurrencyCode { get; set; }
|
||||
public string Currency { get; set; }
|
||||
|
||||
public DateTime RequestDate { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ public class JobPositionDto : FullAuditedEntityDto<Guid>
|
|||
public string Level { get; set; }
|
||||
public decimal MinSalary { get; set; }
|
||||
public decimal MaxSalary { get; set; }
|
||||
public Guid? CurrencyId { get; set; }
|
||||
public string CurrencyName { get; set; }
|
||||
public string Currency { get; set; }
|
||||
public string RequiredSkills { get; set; }
|
||||
public string Responsibilities { get; set; }
|
||||
public string Qualifications { get; set; }
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public class VisitorDto : FullAuditedEntityDto<Guid>
|
|||
{
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string CompanyName { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class CreateUpdateTenantInput
|
|||
public string Country { get; set; }
|
||||
public string City { get; set; }
|
||||
public string District { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string Township { get; set; }
|
||||
public string Address1 { get; set; }
|
||||
public string Address2 { get; set; }
|
||||
public string PostalCode { get; set; }
|
||||
|
|
|
|||
|
|
@ -52,5 +52,14 @@ public class CommandColumnDto
|
|||
/// <summary> Url boş ise calisacak 'eval' icerisinde calisacak olan kod
|
||||
/// </summary>
|
||||
public string OnClick { get; set; }
|
||||
/// <summary> Görünür durumu
|
||||
/// </summary>
|
||||
public bool IsVisible { get; set; } = true;
|
||||
/// <summary> Dinamik görünürlük kontrolü için JavaScript fonksiyonu
|
||||
/// Örnek: "(e) => !e.row.isEditing" veya "(e) => e.row.data.Status === 'Active'"
|
||||
/// Fonksiyon parametre olarak DevExtreme button event objesini alır (e.row, e.row.data, e.row.isEditing vb.)
|
||||
/// true/false döndürmelidir
|
||||
/// </summary>
|
||||
public string VisibleExpression { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
namespace Erp.Platform.ListForms;
|
||||
|
||||
/// <summary>
|
||||
/// TreeList için özel ayarları içerir
|
||||
/// </summary>
|
||||
public class GanttOptionDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Parent kaydı belirten field adı (örn: "Id")
|
||||
/// </summary>
|
||||
public string KeyExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Parent kaydı belirten field adı (örn: "parentId")
|
||||
/// </summary>
|
||||
public string ParentIdExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alt kayıtların olup olmadığını belirten field adı (opsiyonel)
|
||||
/// </summary>
|
||||
public string HasItemsExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Root (en üst) seviyedeki kayıtların parent değeri (genelde null veya 0)
|
||||
/// </summary>
|
||||
public object RootValue { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Başlangıçta açık olacak node'ların ID'leri
|
||||
/// </summary>
|
||||
public object[] ExpandedRowKeys { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Tüm node'ları başlangıçta açık göster
|
||||
/// </summary>
|
||||
public bool AutoExpandAll { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Alt kayıtlar seçildiğinde parent kayıtları da seç (recursive selection)
|
||||
/// </summary>
|
||||
public bool RecursiveSelection { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Başlık alanı (örn: "Title")
|
||||
/// </summary>
|
||||
public string TitleExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Zaman ölçeği tipi (örn: "days", "weeks", "months")
|
||||
/// </summary>
|
||||
public string ScaleType { get; set; } = "weeks";
|
||||
|
||||
/// <summary>
|
||||
/// Başlangıç Tarihi ifadesi (örn: "0001-01-01")
|
||||
/// </summary>
|
||||
public string StartExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bitiş Tarihi ifadesi (örn: "9999-12-31")
|
||||
/// </summary>
|
||||
public string EndExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// İlerleme ifadesi (örn: "%50")
|
||||
/// </summary>
|
||||
public string ProgressExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Düzenlemeye izin verilsin mi
|
||||
/// </summary>
|
||||
public bool AllowEditing { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Task eklemeye izin verilsin mi
|
||||
/// </summary>
|
||||
public bool AllowTaskAdding { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Task güncellemeye izin verilsin mi
|
||||
/// </summary>
|
||||
public bool AllowTaskUpdating { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Task silmeye izin verilsin mi
|
||||
/// </summary>
|
||||
public bool AllowTaskDeleting { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Bağlantılar için kullanılan field adı (örn: "predecessors")
|
||||
/// </summary>
|
||||
public bool AllowDependencyAdding { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Bağlantılar için kullanılan field adı (örn: "predecessors")
|
||||
/// </summary>
|
||||
public bool AllowDependencyDeleting { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Kaynaklar için kullanılan field adı (örn: "resources")
|
||||
/// </summary>
|
||||
public bool AllowResourceAdding { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Kaynaklar için kullanılan field adı (örn: "resources")
|
||||
/// </summary>
|
||||
public bool AllowResourceDeleting { get; set; } = false;
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ public class GridColumnOptionDto
|
|||
|
||||
/// <summary> ilk kolon(lar) sabitlesitirlmesi ayari aktif mi
|
||||
/// </summary>
|
||||
public bool ColumnFixingEnabled { get; set; }
|
||||
public bool ColumnFixingEnabled { get; set; } = false;
|
||||
/// <summary> kolon secme butonu gosterilsin mi
|
||||
/// </summary>
|
||||
/// <summary> alabilecegi degerler: 'dragAndDrop', 'select'
|
||||
|
|
@ -30,7 +30,7 @@ public class GridColumnOptionDto
|
|||
/// </summary>
|
||||
public bool HoverStateEnabled { get; set; } = false;
|
||||
public bool ColumnHidingEnabled { get; set; } = true;
|
||||
public bool FocusedRowEnabled { get; set; } = false;
|
||||
public bool FocusedRowEnabled { get; set; } = true;
|
||||
public bool ShowColumnHeaders { get; set; } = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,32 @@ public class GridOptionsDto : AuditedEntityDto<Guid>
|
|||
set { TreeOptionJson = JsonSerializer.Serialize(value); }
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string GanttOptionJson { get; set; }
|
||||
public GanttOptionDto GanttOptionDto
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(GanttOptionJson))
|
||||
return JsonSerializer.Deserialize<GanttOptionDto>(GanttOptionJson);
|
||||
return new GanttOptionDto();
|
||||
}
|
||||
set { GanttOptionJson = JsonSerializer.Serialize(value); }
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string SchedulerOptionJson { get; set; }
|
||||
public SchedulerOptionDto SchedulerOptionDto
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(SchedulerOptionJson))
|
||||
return JsonSerializer.Deserialize<SchedulerOptionDto>(SchedulerOptionJson);
|
||||
return new SchedulerOptionDto();
|
||||
}
|
||||
set { SchedulerOptionJson = JsonSerializer.Serialize(value); }
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string PagerOptionJson { get; set; }
|
||||
public GridPagerOptionDto PagerOptionDto
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ public class LayoutDto
|
|||
public bool Grid { get; set; } = true;
|
||||
public bool Card { get; set; } = true;
|
||||
public bool Pivot { get; set; } = true;
|
||||
public bool Tree { get; set; } = true;
|
||||
public bool Chart { get; set; } = true;
|
||||
public bool Tree { get; set; } = true;
|
||||
public bool Gantt { get; set; } = true;
|
||||
public bool Scheduler { get; set; } = true;
|
||||
public string DefaultLayout { get; set; } = "grid";
|
||||
public int CardLayoutColumn { get; set; } = 4;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
namespace Erp.Platform.ListForms;
|
||||
|
||||
/// <summary>
|
||||
/// TreeList için özel ayarları içerir
|
||||
/// </summary>
|
||||
public class SchedulerOptionDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Text olarak gösterilecek field adı (örn: "title")
|
||||
/// </summary>
|
||||
public string TextExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Başlangıç tarihinin tutulduğu field adı (örn: "startDate")
|
||||
/// </summary>
|
||||
public string StartDateExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Bitiş tarihinin tutulduğu field adı (örn: "endDate")
|
||||
/// </summary>
|
||||
public string EndDateExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Tüm gün etkinlikler için kullanılan field adı (örn: "allDay")
|
||||
/// </summary>
|
||||
public string AllDayExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Tekrarlama kuralının tutulduğu field adı (örn: "recurrenceRule")
|
||||
/// </summary>
|
||||
public string RecurrenceRuleExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Tekrarlama istisnasının tutulduğu field adı (örn: "recurrenceException")
|
||||
/// </summary>
|
||||
public string RecurrenceExceptionExpr { get; set; }
|
||||
/// <summary>
|
||||
/// Kaynaklar (örn: kaynaklar için kullanılan field adı, veri kaynağı vb.)
|
||||
/// </summary>
|
||||
public int StartDayHour { get; set; } = 8;
|
||||
/// <summary>
|
||||
/// Günün bitiş saati (örn: "18" = 18:00)
|
||||
/// </summary>
|
||||
public int EndDayHour { get; set; } = 18;
|
||||
/// <summary>
|
||||
/// Varsayılan görünüm (örn: "week", "month", "day")
|
||||
/// </summary>
|
||||
public string DefaultView { get; set; } = "week";
|
||||
/// <summary>
|
||||
/// Tüm gün panelini gösterme durumu
|
||||
/// </summary>
|
||||
public bool ShowAllDayPanel { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Hücre süresi (dakika cinsinden, örn: 30)
|
||||
/// </summary>
|
||||
public int CellDuration { get; set; } = 30;
|
||||
/// <summary>
|
||||
/// Haftanın ilk günü (örn: "0" = Pazar, "1" = Pazartesi)
|
||||
/// </summary>
|
||||
public int FirstDayOfWeek { get; set; } = 1;
|
||||
/// <summary>
|
||||
/// Kaydırma çubuğunun çapraz kaydırma durumunu belirtir
|
||||
/// </summary>
|
||||
public bool CrossScrollingEnabled { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Etkinliklerin yeniden boyutlandırılmasına izin verilip verilmediğini belirtir
|
||||
/// </summary>
|
||||
public bool AllowResizing { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Etkinliklerin sürüklenip bırakılmasına izin verilip verilmediğini belirtir
|
||||
/// </summary>
|
||||
public bool AllowDragging { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Etkinlik eklemeye izin verilip verilmediğini belirtir
|
||||
/// </summary>
|
||||
public bool AllowDeleting { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Etkinlik güncellemeye izin verilip verilmediğini belirtir
|
||||
/// </summary>
|
||||
public bool AllowUpdating { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Etkinlik eklemeye izin verilip verilmediğini belirtir
|
||||
/// </summary>
|
||||
public bool AllowAdding { get; set; } = false;
|
||||
}
|
||||
|
|
@ -4,8 +4,8 @@ namespace Erp.Platform.ListForms;
|
|||
|
||||
public class SubFormDto
|
||||
{
|
||||
public string TabTitle { get; set; }
|
||||
public string TabType { get; set; }
|
||||
public string TabTitle { get; set; }
|
||||
public string Code { get; set; }
|
||||
public bool IsRefresh { get; set; }
|
||||
public SubFormRelationDto[] Relation { get; set; }
|
||||
|
|
|
|||
|
|
@ -38,5 +38,25 @@ public class TreeOptionDto
|
|||
/// Alt kayıtlar seçildiğinde parent kayıtları da seç (recursive selection)
|
||||
/// </summary>
|
||||
public bool RecursiveSelection { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Başlık alanı (örn: "Title")
|
||||
/// </summary>
|
||||
public string TitleExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Başlangıç Tarihi ifadesi (örn: "0001-01-01")
|
||||
/// </summary>
|
||||
public string StartExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bitiş Tarihi ifadesi (örn: "9999-12-31")
|
||||
/// </summary>
|
||||
public string EndExpr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// İlerleme ifadesi (örn: "%50")
|
||||
/// </summary>
|
||||
public string ProgressExpr { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ public class ListFormEditTabs
|
|||
public const string ColumnForm = "column";
|
||||
public const string PivotForm = "pivot";
|
||||
public const string TreeForm = "tree";
|
||||
public const string GanttForm = "gantt";
|
||||
public const string SchedulerForm = "scheduler";
|
||||
public const string PagerForm = "pager";
|
||||
public const string StateForm = "state";
|
||||
public const string SubFormJsonRow = "subForm";
|
||||
|
|
|
|||
|
|
@ -27,6 +27,39 @@ public static class LookupQueryValues
|
|||
$"ORDER BY \"{DisplayExpr}\";"
|
||||
});
|
||||
|
||||
public static string DefaultLookupQuery(
|
||||
string TableName,
|
||||
string ValueExpr,
|
||||
string DisplayExpr,
|
||||
bool isTable = true,
|
||||
bool isDeleted = false)
|
||||
{
|
||||
return $"SELECT " +
|
||||
$"\"{ValueExpr}\" AS \"Key\", " +
|
||||
$"\"{DisplayExpr}\" AS \"Name\" " +
|
||||
$"FROM \"{(isTable ? TableNameResolver.GetFullTableName($"{TableName}") : TableNameResolver.GetFullViewName($"{TableName}"))}\" " +
|
||||
(!isDeleted ? "" : $"WHERE \"IsDeleted\" = 'false'") +
|
||||
$"ORDER BY \"{DisplayExpr}\";";
|
||||
}
|
||||
|
||||
public static string ProjectPhaseValues =
|
||||
$"SELECT " +
|
||||
$"\"Id\" AS \"Key\", " +
|
||||
$"\"Name\" AS \"Name\" " +
|
||||
$"FROM \"{FullNameTable(TableNameEnum.ProjectPhase)}\" " +
|
||||
$"WHERE " +
|
||||
$"(\"ProjectId\" = @param0 OR @param0 IS NULL) " +
|
||||
$"AND \"IsDeleted\" = 'false' " +
|
||||
$"ORDER BY \"Name\";";
|
||||
|
||||
public static string TechnicalSkillsValues =
|
||||
$"SELECT " +
|
||||
$"\"Name\" AS \"Key\", " +
|
||||
$"\"Name\" AS \"Name\" " +
|
||||
$"FROM \"{FullNameTable(TableNameEnum.Skill)}\" " +
|
||||
$"WHERE \"SkillTypeId\" IN (SELECT \"Id\" FROM \"{FullNameTable(TableNameEnum.SkillType)}\" WHERE \"Name\"='Technical Skills' ) " +
|
||||
$"ORDER BY \"Name\"";
|
||||
|
||||
public static string CustomerValues =
|
||||
$"SELECT " +
|
||||
$"\"Id\" AS \"Key\", " +
|
||||
|
|
@ -46,12 +79,12 @@ public static class LookupQueryValues
|
|||
public static string PartnerContactValues =
|
||||
$"SELECT " +
|
||||
$"\"Id\" AS \"Key\", " +
|
||||
$"\"FullName\" AS \"Name\" " +
|
||||
$"\"Name\" AS \"Name\" " +
|
||||
$"FROM \"{FullNameTable(TableNameEnum.PartnerContact)}\" " +
|
||||
$"WHERE " +
|
||||
$"(\"PartnerId\" = @param0 OR @param0 IS NULL) " +
|
||||
$"AND \"IsActive\" = 'true' " +
|
||||
$"ORDER BY \"FullName\";";
|
||||
$"ORDER BY \"Name\";";
|
||||
|
||||
public static string TenantValues =
|
||||
$"SELECT * FROM (" +
|
||||
|
|
@ -113,18 +146,18 @@ public static class LookupQueryValues
|
|||
$"GROUP BY \"Name\" " +
|
||||
$"ORDER BY \"Name\";";
|
||||
|
||||
public static string StreetValues =
|
||||
public static string TownshipValues =
|
||||
$"SELECT " +
|
||||
$"\"Street\" AS \"Key\", " +
|
||||
$"\"Street\" AS \"Name\" " +
|
||||
$"\"Township\" AS \"Key\", " +
|
||||
$"\"Township\" AS \"Name\" " +
|
||||
$"FROM \"{FullNameTable(TableNameEnum.District)}\" " +
|
||||
$"WHERE " +
|
||||
$"(\"Country\" = @param0 OR @param0 IS NULL) " +
|
||||
$"AND (\"City\" = @param1 OR @param1 IS NULL) " +
|
||||
$"AND (\"Name\" = @param2 OR @param2 IS NULL) " +
|
||||
$"AND \"IsDeleted\" = 'false' " +
|
||||
$"GROUP BY \"Street\" " +
|
||||
$"ORDER BY \"Street\";";
|
||||
$"GROUP BY \"Township\" " +
|
||||
$"ORDER BY \"Township\";";
|
||||
|
||||
public static string RoleValues =
|
||||
$"SELECT " +
|
||||
|
|
@ -203,4 +236,33 @@ public static class LookupQueryValues
|
|||
$"FROM \"AbpOrganizationUnits\"" +
|
||||
$"WHERE \"Code\" LIKE '00001%' " +
|
||||
$"ORDER BY \"DisplayName\"";
|
||||
|
||||
public static string WarehouseValues =
|
||||
$"SELECT " +
|
||||
$"\"Id\" AS \"Key\", " +
|
||||
$"\"Name\" AS \"Name\" " +
|
||||
$"FROM \"{FullNameTable(TableNameEnum.Warehouse)}\" " +
|
||||
$"WHERE \"IsDeleted\" = 'false' " +
|
||||
$"ORDER BY \"Name\";";
|
||||
|
||||
public static string ZoneValues =
|
||||
$"SELECT " +
|
||||
$"\"Id\" AS \"Key\", " +
|
||||
$"\"Name\" AS \"Name\" " +
|
||||
$"FROM \"{FullNameTable(TableNameEnum.Zone)}\" " +
|
||||
$"WHERE " +
|
||||
$"(\"WarehouseId\" = @param0 OR @param0 IS NULL) " +
|
||||
$"AND \"IsDeleted\" = 'false' " +
|
||||
$"ORDER BY \"Name\";";
|
||||
|
||||
public static string LocationValues =
|
||||
$"SELECT " +
|
||||
$"\"Id\" AS \"Key\", " +
|
||||
$"\"Name\" AS \"Name\" " +
|
||||
$"FROM \"{FullNameTable(TableNameEnum.Location)}\" " +
|
||||
$"WHERE " +
|
||||
$"(\"WarehouseId\" = @param0 OR @param0 IS NULL) " +
|
||||
$"AND (\"ZoneId\" = @param1 OR @param1 IS NULL) " +
|
||||
$"AND \"IsDeleted\" = 'false' " +
|
||||
$"ORDER BY \"Name\";";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class CountryDto : AuditedEntityDto<Guid>
|
|||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public string CurrencyCode { get; set; }
|
||||
public string Currency { get; set; }
|
||||
public int PhoneCode { get; set; }
|
||||
public string TaxLabel { get; set; }
|
||||
public bool ZipRequired { get; set; }
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public class DemoDto : FullAuditedEntityDto<Guid>
|
|||
{
|
||||
public Guid? TenantId { get; set; }
|
||||
public string OrganizationName { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
public string Address { get; set; }
|
||||
|
|
|
|||
|
|
@ -9,6 +9,4 @@ public class DistrictDto : AuditedEntityDto<Guid>
|
|||
public string City { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Township { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string ZipCode { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,4 @@ namespace Erp.Platform.Sectors;
|
|||
public class SectorDto : AuditedEntityDto<Guid>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class CustomTenantDto
|
|||
public string Country { get; set; }
|
||||
public string City { get; set; }
|
||||
public string District { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string Township { get; set; }
|
||||
public string Address1 { get; set; }
|
||||
public string Address2 { get; set; }
|
||||
public string PostalCode { get; set; }
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService
|
|||
Organizer = new EventOrganizerDto
|
||||
{
|
||||
Id = employee.Id,
|
||||
Name = employee.FullName,
|
||||
Name = employee.Name,
|
||||
Position = employee.JobPosition.Name,
|
||||
Avatar = employee.Avatar
|
||||
},
|
||||
|
|
@ -387,7 +387,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService
|
|||
Employee = new EventOrganizerDto
|
||||
{
|
||||
Id = commentAuthor.Id,
|
||||
Name = commentAuthor.FullName,
|
||||
Name = commentAuthor.Name,
|
||||
Position = commentAuthor.JobPosition.Name,
|
||||
Avatar = commentAuthor.Avatar
|
||||
},
|
||||
|
|
|
|||
|
|
@ -151,6 +151,14 @@ public class ListFormsAppService : CrudAppService<
|
|||
{
|
||||
item.TreeOptionJson = JsonSerializer.Serialize(input.TreeOptionDto);
|
||||
}
|
||||
else if (input.EditType == ListFormEditTabs.GanttForm)
|
||||
{
|
||||
item.GanttOptionJson = JsonSerializer.Serialize(input.GanttOptionDto);
|
||||
}
|
||||
else if (input.EditType == ListFormEditTabs.SchedulerForm)
|
||||
{
|
||||
item.SchedulerOptionJson = JsonSerializer.Serialize(input.SchedulerOptionDto);
|
||||
}
|
||||
else if (input.EditType == ListFormEditTabs.PagerForm)
|
||||
{
|
||||
item.PageSize = input.PageSize;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public class ListFormDynamicApiAppService : PlatformAppService, IListFormDynamic
|
|||
entity.SetCountry(input.Data.Country);
|
||||
entity.SetCity(input.Data.City);
|
||||
entity.SetDistrict(input.Data.District);
|
||||
entity.SetStreet(input.Data.Street);
|
||||
entity.SetTownship(input.Data.Township);
|
||||
entity.SetAddress1(input.Data.Address1);
|
||||
entity.SetAddress2(input.Data.Address2);
|
||||
entity.SetPostalCode(input.Data.PostalCode);
|
||||
|
|
@ -155,7 +155,7 @@ public class ListFormDynamicApiAppService : PlatformAppService, IListFormDynamic
|
|||
entity.SetCountry(input.Data.Country);
|
||||
entity.SetCity(input.Data.City);
|
||||
entity.SetDistrict(input.Data.District);
|
||||
entity.SetStreet(input.Data.Street);
|
||||
entity.SetTownship(input.Data.Township);
|
||||
entity.SetAddress1(input.Data.Address1);
|
||||
entity.SetAddress2(input.Data.Address2);
|
||||
entity.SetPostalCode(input.Data.PostalCode);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using Volo.Abp.PermissionManagement;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Erp.Platform.PermissionManagement;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class PublicAppService : PlatformAppService
|
|||
|
||||
var bodyBuilder = new StringBuilder();
|
||||
bodyBuilder.AppendLine($"Şirket: {input.OrganizationName}");
|
||||
bodyBuilder.AppendLine($"Ad Soyad: {input.FullName}");
|
||||
bodyBuilder.AppendLine($"Ad Soyad: {input.Name}");
|
||||
bodyBuilder.AppendLine($"E-Posta: {input.Email}");
|
||||
bodyBuilder.AppendLine($"Telefon: {input.PhoneNumber}");
|
||||
bodyBuilder.AppendLine($"Adres: {input.Address}");
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class PlatformTenantAppService : TenantAppService, IPlatformTenantAppServ
|
|||
dto.Country = tenant.GetCountry();
|
||||
dto.City = tenant.GetCity();
|
||||
dto.District = tenant.GetDistrict();
|
||||
dto.Street = tenant.GetStreet();
|
||||
dto.Township = tenant.GetTownship();
|
||||
dto.Address1 = tenant.GetAddress1();
|
||||
dto.Address2 = tenant.GetAddress2();
|
||||
dto.PostalCode = tenant.GetPostalCode();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"AiBots": [
|
||||
{
|
||||
"BotName": "Chat Bot"
|
||||
"BotName": "Chat Bot",
|
||||
"Description": "A general purpose chat bot that can answer questions and have conversations.",
|
||||
"ApiUrl": "https://api.openai.com/v1/chat/completions",
|
||||
"IsActive": true
|
||||
}
|
||||
],
|
||||
"Settings": [
|
||||
|
|
@ -239,7 +242,15 @@
|
|||
"dx.material.purple.light.compact": "App.Setting.material.purple.light.compact",
|
||||
"dx.material.purple.dark.compact": "App.Setting.material.purple.dark.compact",
|
||||
"dx.material.teal.light.compact": "App.Setting.material.teal.light.compact",
|
||||
"dx.material.teal.dark.compact": "App.Setting.material.teal.dark.compact"
|
||||
"dx.material.teal.dark.compact": "App.Setting.material.teal.dark.compact",
|
||||
"dx.fluent.blue.dark.compact": "App.Setting.fluent.blue.dark.compact",
|
||||
"dx.fluent.blue.dark": "App.Setting.fluent.blue.dark",
|
||||
"dx.fluent.blue.light.compact": "App.Setting.fluent.blue.light.compact",
|
||||
"dx.fluent.blue.light": "App.Setting.fluent.blue.light",
|
||||
"dx.fluent.saas.dark.compact": "App.Setting.fluent.saas.dark.compact",
|
||||
"dx.fluent.saas.dark": "App.Setting.fluent.saas.dark",
|
||||
"dx.fluent.saas.light.compact": "App.Setting.fluent.saas.light.compact",
|
||||
"dx.fluent.saas.light": "App.Setting.fluent.saas.light"
|
||||
},
|
||||
"order": 3
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ namespace Erp.Platform.Data.Seeds;
|
|||
public class AiBotSeedDto
|
||||
{
|
||||
public string BotName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ApiUrl { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
|
||||
public class LanguageTextsSeedDto
|
||||
|
|
@ -285,14 +288,12 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
if (!seenCodes.Add(item.Code) || existingCodes.Contains(item.Code))
|
||||
continue;
|
||||
|
||||
var currency = await _currencyRepository.FirstOrDefaultAsync(c => c.Code == item.CurrencyCode);
|
||||
|
||||
buffer.Add(new Country(
|
||||
Guid.NewGuid(),
|
||||
item.Code,
|
||||
item.Name,
|
||||
item.GroupName,
|
||||
currency != null ? currency.Id : null,
|
||||
item.Currency,
|
||||
item.PhoneCode,
|
||||
item.TaxLabel
|
||||
));
|
||||
|
|
@ -386,11 +387,11 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
|
||||
// 1. Mevcut kayıtları çek (tek sorguda)
|
||||
var existingDistricts = await dbCtx.Set<District>()
|
||||
.Select(d => new { d.Country, d.City, d.Name, d.Township, d.Street, d.ZipCode })
|
||||
.Select(d => new { d.Country, d.City, d.Name, d.Township })
|
||||
.ToListAsync();
|
||||
|
||||
var existingSet = existingDistricts
|
||||
.Select(d => $"{d.Country}:{d.City}:{d.Name}:{d.Township}:{d.Street}:{d.ZipCode}")
|
||||
.Select(d => $"{d.Country}:{d.City}:{d.Name}:{d.Township}")
|
||||
.ToHashSet();
|
||||
|
||||
var options = new JsonSerializerOptions
|
||||
|
|
@ -406,7 +407,7 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
{
|
||||
if (item == null) continue;
|
||||
|
||||
var key = $"{item.Country}:{item.Country}.{item.City}:{item.Name}:{item.Township}:{item.Street}:{item.ZipCode}";
|
||||
var key = $"{item.Country}:{item.Country}.{item.City}:{item.Name}:{item.Township}";
|
||||
var city = $"{item.Country}.{item.City}";
|
||||
if (existingSet.Contains(key)) continue;
|
||||
|
||||
|
|
@ -415,9 +416,7 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
item.Country,
|
||||
city,
|
||||
item.Name,
|
||||
item.Township,
|
||||
item.Street,
|
||||
item.ZipCode
|
||||
item.Township
|
||||
));
|
||||
|
||||
if (buffer.Count >= 5000) // 3. Batch
|
||||
|
|
@ -678,6 +677,9 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
await _aiBotRepository.InsertAsync(new AiBot
|
||||
{
|
||||
BotName = item.BotName,
|
||||
Description = item.Description,
|
||||
ApiUrl = item.ApiUrl,
|
||||
IsActive = item.IsActive
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -43,27 +43,29 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
using var utils = new SeederUtils();
|
||||
var utils = new SeederUtils(_listFormRepository, _listFormFieldRepository);
|
||||
var listFormName = String.Empty;
|
||||
|
||||
#region Bank
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Bank))
|
||||
listFormName = AppCodes.Accounting.Bank;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Bank,
|
||||
Name = AppCodes.Accounting.Bank,
|
||||
Title = AppCodes.Accounting.Bank,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
Description = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Accounting.Bank,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bank)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -76,18 +78,18 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Accounting.Bank),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Bank)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Accounting.Bank, 600, 600, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 600, 400, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =
|
||||
[
|
||||
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 2, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox},
|
||||
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "IdentifierCode", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox},
|
||||
new EditingFormItemDto { Order = 5, DataField = "Address1", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 6, DataField = "Address2", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
|
|
@ -105,7 +107,8 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
Text ="Manage",
|
||||
UrlTarget="_blank",
|
||||
AuthName = AppCodes.Accounting.BankAccount,
|
||||
Url=$"/admin/form/{utils.GetDefaultFormCodes(ListFormCodes.Lists.Bank)}/@Id"
|
||||
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
|
||||
IsVisible = true
|
||||
},
|
||||
}),
|
||||
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
|
||||
|
|
@ -156,14 +159,12 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Name",
|
||||
Width = 150,
|
||||
FieldName = "Code",
|
||||
Width = 200,
|
||||
ListOrderNo = 3,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
SortIndex = 1,
|
||||
SortDirection = GridColumnOptions.SortOrderAsc,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -174,12 +175,14 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "IdentifierCode",
|
||||
Width = 150,
|
||||
FieldName = "Name",
|
||||
Width = 200,
|
||||
ListOrderNo = 4,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
SortIndex = 1,
|
||||
SortDirection = GridColumnOptions.SortOrderAsc,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -233,7 +236,7 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
DisplayExpr = "Name",
|
||||
ValueExpr = "Key",
|
||||
LookupQuery = LookupQueryValues.CountryValues,
|
||||
CascadeEmptyFields = "City,District,Street"
|
||||
CascadeEmptyFields = "City,District,Township"
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
|
|
@ -259,7 +262,7 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
CascadeRelationField = "Country",
|
||||
CascadeFilterOperator="=",
|
||||
CascadeParentFields = "Country",
|
||||
CascadeEmptyFields = "District,Street"
|
||||
CascadeEmptyFields = "District,Township"
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
|
|
@ -285,7 +288,7 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
CascadeRelationField = "City",
|
||||
CascadeFilterOperator="=",
|
||||
CascadeParentFields = "Country,City",
|
||||
CascadeEmptyFields = "Street",
|
||||
CascadeEmptyFields = "Township",
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
|
|
@ -327,7 +330,7 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Email",
|
||||
Width = 150,
|
||||
Width = 200,
|
||||
ListOrderNo = 12,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
|
|
@ -344,24 +347,25 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
#endregion
|
||||
|
||||
#region BankAccount
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BankAccount))
|
||||
listFormName = AppCodes.Accounting.BankAccount;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = true,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.BankAccount,
|
||||
Name = AppCodes.Accounting.BankAccount,
|
||||
Title = AppCodes.Accounting.BankAccount,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Accounting.BankAccount,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.BankAccount)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -374,24 +378,25 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Accounting.BankAccount),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.BankAccount)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Accounting.BankAccount, 600, 300, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 600, 300, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =
|
||||
[
|
||||
new EditingFormItemDto { Order = 1, DataField = "AccountNumber", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 2, DataField = "AccountOwner", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 3, DataField = "CurrencyId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Currency", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 4, DataField = "CanTransferMoney", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox },
|
||||
]}
|
||||
}),
|
||||
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
|
||||
new() { FieldName = "CanTransferMoney", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }
|
||||
new() { FieldName = "CanTransferMoney", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value },
|
||||
new() { FieldName = "Currency", FieldDbType = DbType.String, Value = "TRY", CustomValueType = FieldCustomValueTypeEnum.Value }
|
||||
}),
|
||||
}, autoSave: true
|
||||
);
|
||||
|
|
@ -452,15 +457,15 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Guid,
|
||||
FieldName = "CurrencyId",
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Currency",
|
||||
Width = 150,
|
||||
ListOrderNo = 4,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Currency), "Id", "Name"),
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Currency), "Code", "Name"),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
|
|
@ -486,15 +491,14 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
#endregion
|
||||
|
||||
// Bank ve Bank Account arasında Sub Forms ilişkisinin kurulması
|
||||
await utils.CloneListFormWithFieldsAsync(
|
||||
_listFormRepository,
|
||||
_listFormFieldRepository,
|
||||
ListFormCodes.Lists.Bank,
|
||||
JsonSerializer.Serialize(new List<dynamic>() {
|
||||
await utils.CloneFormLayoutAsync(
|
||||
AppCodes.Accounting.Bank,
|
||||
JsonSerializer.Serialize(
|
||||
new List<dynamic>() {
|
||||
new {
|
||||
TabTitle = "Bank Accounts",
|
||||
TabType = ListFormTabTypeEnum.List,
|
||||
Code = ListFormCodes.Lists.BankAccount,
|
||||
TabTitle = AppCodes.Accounting.BankAccount,
|
||||
Code = AppCodes.Accounting.BankAccount,
|
||||
Relation = new List<dynamic>() {
|
||||
new {
|
||||
ParentFieldName = "Id",
|
||||
|
|
@ -503,8 +507,523 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende
|
|||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
#region Cash
|
||||
listFormName = AppCodes.Accounting.Cash;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
Description = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Cash)),
|
||||
KeyFieldName = "Id",
|
||||
KeyFieldDbSourceType = DbType.Guid,
|
||||
DefaultFilter = DefaultFilterJson,
|
||||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Cash)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 600, 300, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =
|
||||
[
|
||||
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 2, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea },
|
||||
new EditingFormItemDto { Order = 5, DataField = "Currency", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
||||
new EditingFormItemDto { Order = 6, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox },
|
||||
]}
|
||||
}),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
|
||||
new() { FieldName = "Currency", FieldDbType = DbType.String, Value = "TRY", CustomValueType = FieldCustomValueTypeEnum.Value },
|
||||
new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }
|
||||
})
|
||||
}
|
||||
, autoSave: true);
|
||||
|
||||
#region Cash Fields
|
||||
await _listFormFieldRepository.InsertManyAsync([
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Guid,
|
||||
FieldName = "Id",
|
||||
Width = 100,
|
||||
ListOrderNo = 0,
|
||||
Visible = false,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
SortIndex = 0,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Guid,
|
||||
FieldName = "BranchId",
|
||||
Width = 150,
|
||||
ListOrderNo = 2,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
LookupJson = JsonSerializer.Serialize(
|
||||
new LookupDto {
|
||||
DataSourceType = UiLookupDataSourceTypeEnum.Query,
|
||||
DisplayExpr = "Name",
|
||||
ValueExpr = "Key",
|
||||
LookupQuery = LookupQueryValues.BranchValues,
|
||||
}
|
||||
),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Code",
|
||||
Width = 150,
|
||||
ListOrderNo = 3,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Name",
|
||||
Width = 150,
|
||||
ListOrderNo = 4,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
SortIndex = 1,
|
||||
SortDirection = GridColumnOptions.SortOrderAsc,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Description",
|
||||
Width = 300,
|
||||
ListOrderNo = 5,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Currency",
|
||||
Width = 150,
|
||||
ListOrderNo = 6,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Currency), "Code", "Name"),
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Decimal,
|
||||
FieldName = "Balance",
|
||||
Format = "fixedPoint",
|
||||
Alignment = "right",
|
||||
Width = 100,
|
||||
ListOrderNo = 7,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Boolean,
|
||||
FieldName = "IsActive",
|
||||
Width = 100,
|
||||
ListOrderNo = 8,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
}
|
||||
], autoSave: true);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CurrentAccount
|
||||
listFormName = AppCodes.Accounting.CurrentAccount;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
Description = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CurrentAccount)),
|
||||
KeyFieldName = "Id",
|
||||
KeyFieldDbSourceType = DbType.Guid,
|
||||
DefaultFilter = DefaultFilterJson,
|
||||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.CurrentAccount)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 600, 500, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =
|
||||
[
|
||||
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 2, DataField = "PartnerId", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 5, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea },
|
||||
new EditingFormItemDto { Order = 6, DataField = "TaxNumber", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox },
|
||||
new EditingFormItemDto { Order = 7, DataField = "TaxOffice", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 8, DataField = "CreditLimit", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
||||
new EditingFormItemDto { Order = 9, DataField = "Currency", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 10, DataField = "Risk", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 11, DataField = "PaymentTermId", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 12, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox },
|
||||
]}
|
||||
}),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
|
||||
new() { FieldName = "Currency", FieldDbType = DbType.String, Value = "TRY", CustomValueType = FieldCustomValueTypeEnum.Value },
|
||||
new() { FieldName = "CreditLimit", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value },
|
||||
new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value },
|
||||
new() { FieldName = "Risk", FieldDbType = DbType.String, Value = "Low", CustomValueType = FieldCustomValueTypeEnum.Value }
|
||||
})
|
||||
}
|
||||
, autoSave: true);
|
||||
|
||||
#region CurrentAccount Fields
|
||||
await _listFormFieldRepository.InsertManyAsync([
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Guid,
|
||||
FieldName = "Id",
|
||||
Width = 100,
|
||||
ListOrderNo = 0,
|
||||
Visible = false,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
SortIndex = 0,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Guid,
|
||||
FieldName = "BranchId",
|
||||
Width = 150,
|
||||
ListOrderNo = 2,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
LookupJson = JsonSerializer.Serialize(
|
||||
new LookupDto {
|
||||
DataSourceType = UiLookupDataSourceTypeEnum.Query,
|
||||
DisplayExpr = "Name",
|
||||
ValueExpr = "Key",
|
||||
LookupQuery = LookupQueryValues.BranchValues,
|
||||
}
|
||||
),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Guid,
|
||||
FieldName = "PartnerId",
|
||||
Width = 250,
|
||||
ListOrderNo = 3,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Partner), "Id", "Name"),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Code",
|
||||
Width = 150,
|
||||
ListOrderNo = 4,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Name",
|
||||
Width = 150,
|
||||
ListOrderNo = 5,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
SortIndex = 1,
|
||||
SortDirection = GridColumnOptions.SortOrderAsc,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Description",
|
||||
Width = 300,
|
||||
ListOrderNo = 6,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Int64,
|
||||
FieldName = "TaxNumber",
|
||||
Width = 100,
|
||||
ListOrderNo = 7,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "TaxOffice",
|
||||
Width = 100,
|
||||
ListOrderNo = 8,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Decimal,
|
||||
FieldName = "CreditLimit",
|
||||
Format = "fixedPoint",
|
||||
Alignment = "right",
|
||||
Width = 100,
|
||||
ListOrderNo = 9,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Decimal,
|
||||
FieldName = "Balance",
|
||||
Format = "fixedPoint",
|
||||
Alignment = "right",
|
||||
Width = 100,
|
||||
ListOrderNo = 10,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Currency",
|
||||
Width = 150,
|
||||
ListOrderNo = 11,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Currency), "Code", "Name"),
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Risk",
|
||||
Width = 100,
|
||||
ListOrderNo = 12,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
LookupJson = JsonSerializer.Serialize(new LookupDto
|
||||
{
|
||||
DataSourceType = UiLookupDataSourceTypeEnum.StaticData,
|
||||
DisplayExpr = "name",
|
||||
ValueExpr = "key",
|
||||
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||
new () { Key = "Low", Name = "Low" },
|
||||
new () { Key = "Medium", Name = "Medium" },
|
||||
new () { Key = "High", Name = "High" },
|
||||
new () { Key = "Blocked", Name = "Blocked" },
|
||||
}),
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Guid,
|
||||
FieldName = "PaymentTermId",
|
||||
Width = 100,
|
||||
ListOrderNo = 13,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.PaymentTerm), "Id", "Name"),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
},
|
||||
new() {
|
||||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.Boolean,
|
||||
FieldName = "IsActive",
|
||||
Width = 100,
|
||||
ListOrderNo = 13,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
}
|
||||
], autoSave: true);
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -43,27 +43,29 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
using var utils = new SeederUtils();
|
||||
var utils = new SeederUtils(_listFormRepository, _listFormFieldRepository);
|
||||
var listFormName = String.Empty;
|
||||
|
||||
#region Program
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Program))
|
||||
listFormName = AppCodes.Definitions.Program;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Program,
|
||||
Name = AppCodes.Definitions.Program,
|
||||
Title = AppCodes.Definitions.Program,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.Program,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Program)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -76,11 +78,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Program),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Program)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.Program, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -146,8 +148,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
DisplayExpr = "name",
|
||||
ValueExpr = "key",
|
||||
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||
new () { Key="Aktif",Name="Aktif" },
|
||||
new () { Key="Pasif",Name="Pasif" },
|
||||
new () { Key="Aktif", Name="Aktif" },
|
||||
new () { Key="Pasif", Name="Pasif" },
|
||||
}),
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -160,24 +162,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region Schedule
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Schedule))
|
||||
listFormName = AppCodes.Definitions.Schedule;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Schedule,
|
||||
Name = AppCodes.Definitions.Schedule,
|
||||
Title = AppCodes.Definitions.Schedule,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.Schedule,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Schedule)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -190,11 +193,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Schedule),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Schedule)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.Schedule, 750, 400, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 750, 400, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order = 1, ColCount = 2, ColSpan = 1, ItemType = "group",
|
||||
|
|
@ -309,8 +312,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
DisplayExpr = "name",
|
||||
ValueExpr = "key",
|
||||
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||
new () { Key="Aktif",Name="Aktif" },
|
||||
new () { Key="Pasif",Name="Pasif" },
|
||||
new () { Key="Aktif", Name="Aktif" },
|
||||
new () { Key="Pasif", Name="Pasif" },
|
||||
}),
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -554,24 +557,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region RegistrationType
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.RegistrationType))
|
||||
listFormName = AppCodes.Definitions.RegistrationType;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.RegistrationType,
|
||||
Name = AppCodes.Definitions.RegistrationType,
|
||||
Title = AppCodes.Definitions.RegistrationType,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.RegistrationType,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationType)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -584,11 +588,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.RegistrationType),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.RegistrationType)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.RegistrationType, 500, 300, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 300, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -686,8 +690,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
DisplayExpr = "name",
|
||||
ValueExpr = "key",
|
||||
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||
new () { Key="Aktif",Name="Aktif" },
|
||||
new () { Key="Pasif",Name="Pasif" },
|
||||
new () { Key="Aktif", Name="Aktif" },
|
||||
new () { Key="Pasif", Name="Pasif" },
|
||||
}),
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -700,24 +704,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region RegistrationMethod
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.RegistrationMethod))
|
||||
listFormName = AppCodes.Definitions.RegistrationMethod;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.RegistrationMethod,
|
||||
Name = AppCodes.Definitions.RegistrationMethod,
|
||||
Title = AppCodes.Definitions.RegistrationMethod,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.RegistrationMethod,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.RegistrationMethod)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -730,11 +735,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.RegistrationMethod),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.RegistrationMethod)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.RegistrationMethod, 550, 350, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 550, 350, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -859,8 +864,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
DisplayExpr = "name",
|
||||
ValueExpr = "key",
|
||||
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||
new () { Key="Aktif",Name="Aktif" },
|
||||
new () { Key="Pasif",Name="Pasif" },
|
||||
new () { Key="Aktif", Name="Aktif" },
|
||||
new () { Key="Pasif", Name="Pasif" },
|
||||
}),
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -873,24 +878,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region ClassType
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClassType))
|
||||
listFormName = AppCodes.Definitions.ClassType;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.ClassType,
|
||||
Name = AppCodes.Definitions.ClassType,
|
||||
Title = AppCodes.Definitions.ClassType,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.ClassType,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassType)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -903,11 +909,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.ClassType),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.ClassType)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.ClassType, 600, 400, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 600, 400, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -1067,8 +1073,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
DisplayExpr = "name",
|
||||
ValueExpr = "key",
|
||||
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||
new () { Key="Aktif",Name="Aktif" },
|
||||
new () { Key="Pasif",Name="Pasif" },
|
||||
new () { Key="Aktif", Name="Aktif" },
|
||||
new () { Key="Pasif", Name="Pasif" },
|
||||
}),
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -1081,24 +1087,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region Class
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Class))
|
||||
listFormName = AppCodes.Definitions.Class;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Class,
|
||||
Name = AppCodes.Definitions.Class,
|
||||
Title = AppCodes.Definitions.Class,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.Class,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Class)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1111,11 +1118,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Class),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Class)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.Class, 550, 300, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 550, 300, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -1240,8 +1247,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
DisplayExpr = "name",
|
||||
ValueExpr = "key",
|
||||
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
|
||||
new () { Key="Aktif",Name="Aktif" },
|
||||
new () { Key="Pasif",Name="Pasif" },
|
||||
new () { Key="Aktif", Name="Aktif" },
|
||||
new () { Key="Pasif", Name="Pasif" },
|
||||
}),
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
|
|
@ -1254,24 +1261,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region Level
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Level))
|
||||
listFormName = AppCodes.Definitions.Level;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Level,
|
||||
Name = AppCodes.Definitions.Level,
|
||||
Title = AppCodes.Definitions.Level,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.Level,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Level)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1284,11 +1292,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Level),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Level)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(ListFormCodes.Lists.Level, 650, 450, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 650, 450, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -1526,24 +1534,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region ClassCancellationReason
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ClassCancellationReason))
|
||||
listFormName = AppCodes.Definitions.ClassCancellationReason;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.ClassCancellationReason,
|
||||
Name = AppCodes.Definitions.ClassCancellationReason,
|
||||
Title = AppCodes.Definitions.ClassCancellationReason,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.ClassCancellationReason,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ClassCancellationReason)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1556,11 +1565,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.ClassCancellationReason),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.ClassCancellationReason)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.ClassCancellationReason, 500, 300, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 300, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -1640,24 +1649,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region LessonPeriod
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.LessonPeriod))
|
||||
listFormName = AppCodes.Definitions.LessonPeriod;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.LessonPeriod,
|
||||
Name = AppCodes.Definitions.LessonPeriod,
|
||||
Title = AppCodes.Definitions.LessonPeriod,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.LessonPeriod,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.LessonPeriod)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1670,11 +1680,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.LessonPeriod),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.LessonPeriod)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.LessonPeriod, 600, 500, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 600, 500, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -1879,24 +1889,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region QuestionTag
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.QuestionTag))
|
||||
listFormName = AppCodes.Definitions.QuestionTag;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.QuestionTag,
|
||||
Name = AppCodes.Definitions.QuestionTag,
|
||||
Title = AppCodes.Definitions.QuestionTag,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.QuestionTag,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionTag)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1909,11 +1920,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionTag),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.QuestionTag)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.QuestionTag, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=
|
||||
|
|
@ -1999,24 +2010,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region Question Pool
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.QuestionPool))
|
||||
listFormName = AppCodes.Definitions.QuestionPool;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.QuestionPool,
|
||||
Name = AppCodes.Definitions.QuestionPool,
|
||||
Title = AppCodes.Definitions.QuestionPool,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.QuestionPool,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.QuestionPool)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -2029,11 +2041,11 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.QuestionPool),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.QuestionPool)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.QuestionPool, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1,ItemType="group", Items= [
|
||||
|
|
@ -2049,7 +2061,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
Text ="Questions",
|
||||
UrlTarget="_blank",
|
||||
AuthName = AppCodes.Definitions.Question,
|
||||
Url=$"/admin/form/{utils.GetDefaultFormCodes(ListFormCodes.Lists.QuestionPool)}/@Id",
|
||||
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
|
||||
IsVisible = true,
|
||||
},
|
||||
}),
|
||||
}, autoSave: true
|
||||
|
|
@ -2128,24 +2141,25 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region Question
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Question))
|
||||
listFormName = AppCodes.Definitions.Question;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = true,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Question,
|
||||
Name = AppCodes.Definitions.Question,
|
||||
Title = AppCodes.Definitions.Question,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.Question,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Question)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -2158,21 +2172,20 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Question),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Question)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.Question, 500, 520, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 520, true, true, true, true, false),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] {
|
||||
new() {
|
||||
Hint = "Answers",
|
||||
Text = "Answers",
|
||||
AuthName = AppCodes.Definitions.Question,
|
||||
AuthName = listFormName,
|
||||
DialogName = "QuestionAnswers",
|
||||
DialogParameters = JsonSerializer.Serialize(new {
|
||||
id = "@Id"
|
||||
})
|
||||
DialogParameters = JsonSerializer.Serialize(new { id = "@Id" }),
|
||||
IsVisible = true
|
||||
},
|
||||
}),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
|
|
@ -2410,15 +2423,13 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
}
|
||||
|
||||
// QuestionPool ve Question arasında Sub Forms ilişkisinin kurulması
|
||||
await utils.CloneListFormWithFieldsAsync(
|
||||
_listFormRepository,
|
||||
_listFormFieldRepository,
|
||||
ListFormCodes.Lists.QuestionPool,
|
||||
await utils.CloneFormLayoutAsync(
|
||||
AppCodes.Definitions.QuestionPool,
|
||||
JsonSerializer.Serialize(new List<dynamic>() {
|
||||
new {
|
||||
TabTitle = "Questions",
|
||||
TabTitle = AppCodes.Definitions.Question,
|
||||
TabType = ListFormTabTypeEnum.List,
|
||||
Code = ListFormCodes.Lists.Question,
|
||||
Code = AppCodes.Definitions.Question,
|
||||
Relation = new List<dynamic>() {
|
||||
new {
|
||||
ParentFieldName = "Id",
|
||||
|
|
@ -2429,6 +2440,7 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend
|
|||
}
|
||||
})
|
||||
);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -43,27 +43,29 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
using var utils = new SeederUtils();
|
||||
var utils = new SeederUtils(_listFormRepository, _listFormFieldRepository);
|
||||
var listFormName = String.Empty;
|
||||
|
||||
#region EventType
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EventType))
|
||||
listFormName = AppCodes.Intranet.EventType;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.EventType,
|
||||
Name = AppCodes.Intranet.EventType,
|
||||
Title = AppCodes.Intranet.EventType,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.EventType,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventType)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -72,15 +74,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.EventType),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.EventType)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.EventType, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -131,24 +133,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region EventCategory
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.EventCategory))
|
||||
listFormName = AppCodes.Intranet.EventCategory;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.EventCategory,
|
||||
Name = AppCodes.Intranet.EventCategory,
|
||||
Title = AppCodes.Intranet.EventCategory,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.EventCategory,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventCategory)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -157,15 +160,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.EventCategory),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.EventCategory)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.EventCategory, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1,ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -216,24 +219,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Event
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Event))
|
||||
listFormName = AppCodes.Intranet.Event;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Event,
|
||||
Name = AppCodes.Intranet.Event,
|
||||
Title = AppCodes.Intranet.Event,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.Event,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Event)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -242,15 +246,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Event),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Event)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.Event, 500, 400, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 400, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -395,7 +399,7 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"),
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "Name"),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
|
|
@ -464,24 +468,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Meal
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Meal))
|
||||
listFormName = AppCodes.Intranet.Meal;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Meal,
|
||||
Name = AppCodes.Intranet.Meal,
|
||||
Title = AppCodes.Intranet.Meal,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = true,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.Meal,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Meal)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -490,16 +495,16 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Meal),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Meal)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.Meal, 500, 300, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 300, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
|
|
@ -653,24 +658,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Reservations
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Reservation))
|
||||
listFormName = AppCodes.Intranet.Reservation;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Reservation,
|
||||
Name = AppCodes.Intranet.Reservation,
|
||||
Title = AppCodes.Intranet.Reservation,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.Reservation,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Reservation)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -679,15 +685,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Reservation),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Reservation)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.Reservation, 500, 400, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 400, true, true, true, true, false),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
|
|
@ -784,7 +790,7 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"),
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "Name"),
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
|
|
@ -902,24 +908,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Shuttle Routes
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.ShuttleRoute))
|
||||
listFormName = AppCodes.Intranet.ShuttleRoute;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.ShuttleRoute,
|
||||
Name = AppCodes.Intranet.ShuttleRoute,
|
||||
Title = AppCodes.Intranet.ShuttleRoute,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.ShuttleRoute,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ShuttleRoute)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -928,15 +935,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.ShuttleRoute),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.ShuttleRoute)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.ShuttleRoute, 500, 300, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 300, true, true, true, true, false),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
|
|
@ -1128,24 +1135,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Announncements
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Announcement))
|
||||
listFormName = AppCodes.Intranet.Announcement;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Announcement,
|
||||
Name = AppCodes.Intranet.Announcement,
|
||||
Title = AppCodes.Intranet.Announcement,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.Announcement,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Announcement)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1154,15 +1162,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Announcement),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Announcement)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.Announcement, 500, 600, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 600, true, true, true, true, false),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
|
|
@ -1309,7 +1317,7 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"),
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "Name"),
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
|
|
@ -1398,24 +1406,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Visitors
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Visitor))
|
||||
listFormName = AppCodes.Intranet.Visitor;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Visitor,
|
||||
Name = AppCodes.Intranet.Visitor,
|
||||
Title = AppCodes.Intranet.Visitor,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.Visitor,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Visitor)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1424,21 +1433,21 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.Visitor),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Visitor)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.Visitor, 500, 450, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 450, true, true, true, true, false),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[
|
||||
new EditingFormItemDto { Order = 1, DataField = "FullName", ColSpan=1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan=1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 2, DataField = "CompanyName", ColSpan=1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Email", ColSpan=1, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "PhoneNumber", ColSpan=1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.PhoneEditorOptions },
|
||||
|
|
@ -1481,7 +1490,7 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
ListFormCode = listForm.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "FullName",
|
||||
FieldName = "Name",
|
||||
Width = 150,
|
||||
ListOrderNo = 2,
|
||||
Visible = true,
|
||||
|
|
@ -1615,7 +1624,7 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"),
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "Name"),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
|
|
@ -1652,24 +1661,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Social Post
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SocialPost))
|
||||
listFormName = AppCodes.Intranet.SocialPost;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.SocialPost,
|
||||
Name = AppCodes.Intranet.SocialPost,
|
||||
Title = AppCodes.Intranet.SocialPost,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.SocialPost,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SocialPost)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1678,15 +1688,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.SocialPost),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.SocialPost)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.SocialPost, 700, 600, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 700, 600, true, true, true, true, false),
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||
{
|
||||
|
|
@ -1704,8 +1714,9 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
Hint = "Comments",
|
||||
Text ="Comments",
|
||||
UrlTarget="_blank",
|
||||
AuthName = AppCodes.Intranet.SocialComment,
|
||||
Url=$"/admin/form/{utils.GetDefaultFormCodes(ListFormCodes.Lists.SocialComment)}/@Id",
|
||||
AuthName = listFormName,
|
||||
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
|
||||
IsVisible = true,
|
||||
},
|
||||
}),
|
||||
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[]
|
||||
|
|
@ -1746,7 +1757,7 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"),
|
||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "Name"),
|
||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
|
|
@ -1819,24 +1830,25 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
#endregion
|
||||
|
||||
#region Social Comment
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SocialComment))
|
||||
listFormName = AppCodes.Intranet.SocialComment;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.SocialComment,
|
||||
Name = AppCodes.Intranet.SocialComment,
|
||||
Title = AppCodes.Intranet.SocialComment,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Intranet.SocialComment,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SocialComment)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -1845,15 +1857,15 @@ public class ListFormSeeder_Intranet : IDataSeedContributor, ITransientDependenc
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Intranet.SocialComment),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.SocialComment)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Intranet.SocialComment, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Content", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextArea },
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -43,25 +43,28 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
var listFormName = String.Empty;
|
||||
|
||||
#region MeetingMethod
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MeetingMethod))
|
||||
listFormName = AppCodes.Definitions.MeetingMethod;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.MeetingMethod,
|
||||
Name = AppCodes.Definitions.MeetingMethod,
|
||||
Title = AppCodes.Definitions.MeetingMethod,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.MeetingMethod,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingMethod)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -70,15 +73,15 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.MeetingMethod),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MeetingMethod)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.MeetingMethod, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -187,24 +190,25 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region MeetingResult
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MeetingResult))
|
||||
listFormName = AppCodes.Definitions.MeetingResult;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.MeetingResult,
|
||||
Name = AppCodes.Definitions.MeetingResult,
|
||||
Title = AppCodes.Definitions.MeetingResult,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.MeetingResult,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MeetingResult)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -213,15 +217,15 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.MeetingResult),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MeetingResult)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.MeetingResult, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -319,24 +323,25 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region Source
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Source))
|
||||
listFormName = AppCodes.Definitions.Source;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Source,
|
||||
Name = AppCodes.Definitions.Source,
|
||||
Title = AppCodes.Definitions.Source,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.Source,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Source)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -345,15 +350,15 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Source),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Source)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.Source, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1,ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -433,24 +438,25 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region Interesting
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Interesting))
|
||||
listFormName = AppCodes.Definitions.Interesting;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.Interesting,
|
||||
Name = AppCodes.Definitions.Interesting,
|
||||
Title = AppCodes.Definitions.Interesting,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.Interesting,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Interesting)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -459,15 +465,15 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.Interesting),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Interesting)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.Interesting, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -547,24 +553,25 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region SalesRejectionReason
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.SalesRejectionReason))
|
||||
listFormName = AppCodes.Definitions.SalesRejectionReason;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.SalesRejectionReason,
|
||||
Name = AppCodes.Definitions.SalesRejectionReason,
|
||||
Title = AppCodes.Definitions.SalesRejectionReason,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.SalesRejectionReason,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.SalesRejectionReason)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -573,15 +580,15 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.SalesRejectionReason),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.SalesRejectionReason)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.SalesRejectionReason, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items=[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -693,24 +700,25 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
#endregion
|
||||
|
||||
#region NoteType
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.NoteType))
|
||||
listFormName = AppCodes.Definitions.NoteType;
|
||||
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName))
|
||||
{
|
||||
var listForm = await _listFormRepository.InsertAsync(
|
||||
new ListForm()
|
||||
{
|
||||
ListFormType = ListFormTypeEnum.List,
|
||||
ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = ListFormCodes.Lists.NoteType,
|
||||
Name = AppCodes.Definitions.NoteType,
|
||||
Title = AppCodes.Definitions.NoteType,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
Title = listFormName,
|
||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
IsTenant = true,
|
||||
IsBranch = false,
|
||||
IsOrganizationUnit = false,
|
||||
Description = AppCodes.Definitions.NoteType,
|
||||
Description = listFormName,
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.NoteType)),
|
||||
KeyFieldName = "Id",
|
||||
|
|
@ -719,16 +727,16 @@ public class ListFormSeeder_Participant : IDataSeedContributor, ITransientDepend
|
|||
SortMode = GridOptions.SortModeSingle,
|
||||
FilterRowJson = DefaultFilterRowJson,
|
||||
HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
SearchPanelJson= DefaultSearchPanelJson,
|
||||
SearchPanelJson = DefaultSearchPanelJson,
|
||||
GroupPanelJson = DefaultGroupPanelJson,
|
||||
SelectionJson = DefaultSelectionSingleJson,
|
||||
ColumnOptionJson = DefaultColumnOptionJson,
|
||||
PermissionJson = DefaultPermissionJson(AppCodes.Definitions.NoteType),
|
||||
PermissionJson = DefaultPermissionJson(listFormName),
|
||||
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.NoteType)),
|
||||
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
PagerOptionJson = DefaultPagerOptionJson,
|
||||
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Definitions.NoteType, 500, 250, true, true, true, true, false),
|
||||
EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, true, true, true, true, false),
|
||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
new() {
|
||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
2630
api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs
Normal file
2630
api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,185 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Erp.Languages.Languages;
|
||||
using Erp.Platform.Entities;
|
||||
using Erp.Platform.Enums;
|
||||
using Erp.Platform.ListForms;
|
||||
using Erp.Platform.Queries;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.TenantManagement;
|
||||
using AbpIdentity = Erp.Platform.Data.Seeds.SeedConsts.AbpIdentity;
|
||||
using AppCodes = Erp.Platform.Data.Seeds.SeedConsts.AppCodes;
|
||||
using static Erp.Platform.PlatformConsts;
|
||||
using static Erp.Platform.PlatformSeeder.SeederDefaults;
|
||||
|
||||
namespace Erp.Platform.Data.Seeds;
|
||||
|
||||
public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
private readonly IRepository<ListForm, Guid> _listFormRepository;
|
||||
private readonly IRepository<ListFormField, Guid> _listFormFieldRepository;
|
||||
private readonly IdentityUserManager _identityUserManager;
|
||||
private readonly IdentityRoleManager _identityRoleManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public ListFormSeeder_Warehouse(
|
||||
IRepository<ListForm, Guid> listFormRepository,
|
||||
IRepository<ListFormField, Guid> listFormFieldRepository,
|
||||
IdentityUserManager userManager,
|
||||
IdentityRoleManager roleManager,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_listFormRepository = listFormRepository;
|
||||
_listFormFieldRepository = listFormFieldRepository;
|
||||
_identityUserManager = userManager;
|
||||
_identityRoleManager = roleManager;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public async Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
// #region Material Type
|
||||
// if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.MaterialType))
|
||||
// {
|
||||
// var listFormMaterialType = await _listFormRepository.InsertAsync(
|
||||
// new ListForm()
|
||||
// {
|
||||
// ListFormType = ListFormTypeEnum.List,
|
||||
// IsSubForm = false,
|
||||
// LayoutJson = DefaultLayoutJson,
|
||||
// CultureName = LanguageCodes.En,
|
||||
// ListFormCode = ListFormCodes.Lists.MaterialType,
|
||||
// Name = AppCodes.SupplyChain.MaterialType,
|
||||
// Title = AppCodes.SupplyChain.MaterialType,
|
||||
// DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
||||
// IsTenant = true,
|
||||
// IsBranch = false,
|
||||
// IsOrganizationUnit = false,
|
||||
// Description = AppCodes.SupplyChain.MaterialType,
|
||||
// SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
// SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialType)),
|
||||
// KeyFieldName = "Id",
|
||||
// KeyFieldDbSourceType = DbType.Guid,
|
||||
// DefaultFilter = DefaultFilterJson,
|
||||
// SortMode = GridOptions.SortModeSingle,
|
||||
// FilterRowJson = DefaultFilterRowJson,
|
||||
// HeaderFilterJson = DefaultHeaderFilterJson,
|
||||
// SearchPanelJson= DefaultSearchPanelJson,
|
||||
// GroupPanelJson = DefaultGroupPanelJson,
|
||||
// SelectionJson = DefaultSelectionSingleJson,
|
||||
// ColumnOptionJson = DefaultColumnOptionJson,
|
||||
// PermissionJson = DefaultPermissionJson(AppCodes.SupplyChain.MaterialType),
|
||||
// DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MaterialType)),
|
||||
// DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
|
||||
// PagerOptionJson = DefaultPagerOptionJson,
|
||||
// EditingOptionJson = DefaultEditingOptionJson(AppCodes.SupplyChain.MaterialType, 500, 250, true, true, true, true, false),
|
||||
// EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||
// new() { Order=1,ColCount=1,ColSpan=1,ItemType="group", Items=[
|
||||
// new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
// new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
// new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea },
|
||||
// new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox },
|
||||
// ]}
|
||||
// }),
|
||||
// InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
|
||||
// FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
|
||||
// new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }
|
||||
// }),
|
||||
// }
|
||||
// );
|
||||
|
||||
// #region MaterialType Fields
|
||||
// await _listFormFieldRepository.InsertManyAsync(new ListFormField[] {
|
||||
// new() {
|
||||
// ListFormCode = listFormMaterialType.ListFormCode,
|
||||
// CultureName = LanguageCodes.En,
|
||||
// SourceDbType = DbType.Guid,
|
||||
// FieldName = "Id",
|
||||
// Width = 100,
|
||||
// ListOrderNo = 1,
|
||||
// Visible = false,
|
||||
// IsActive = true,
|
||||
// IsDeleted = false,
|
||||
// ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
// ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
// PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType),
|
||||
// PivotSettingsJson = DefaultPivotSettingsJson
|
||||
// },
|
||||
// new() {
|
||||
// ListFormCode = listFormMaterialType.ListFormCode,
|
||||
// CultureName = LanguageCodes.En,
|
||||
// SourceDbType = DbType.String,
|
||||
// FieldName = "Code",
|
||||
// Width = 150,
|
||||
// ListOrderNo = 2,
|
||||
// Visible = true,
|
||||
// IsActive = true,
|
||||
// IsDeleted = false,
|
||||
// AllowSearch = true,
|
||||
// ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
// ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
// PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType),
|
||||
// PivotSettingsJson = DefaultPivotSettingsJson
|
||||
// },
|
||||
// new() {
|
||||
// ListFormCode = listFormMaterialType.ListFormCode,
|
||||
// CultureName = LanguageCodes.En,
|
||||
// SourceDbType = DbType.String,
|
||||
// FieldName = "Name",
|
||||
// Width = 350,
|
||||
// ListOrderNo = 3,
|
||||
// Visible = true,
|
||||
// IsActive = true,
|
||||
// IsDeleted = false,
|
||||
// SortIndex = 1,
|
||||
// SortDirection = GridColumnOptions.SortOrderAsc,
|
||||
// AllowSearch = true,
|
||||
// ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||
// ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
// PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType),
|
||||
// PivotSettingsJson = DefaultPivotSettingsJson
|
||||
// },
|
||||
// new() {
|
||||
// ListFormCode = listFormMaterialType.ListFormCode,
|
||||
// CultureName = LanguageCodes.En,
|
||||
// SourceDbType = DbType.String,
|
||||
// FieldName = "Description",
|
||||
// Width = 500,
|
||||
// ListOrderNo = 4,
|
||||
// Visible = true,
|
||||
// IsActive = true,
|
||||
// IsDeleted = false,
|
||||
// AllowSearch = true,
|
||||
// ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
// PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType),
|
||||
// PivotSettingsJson = DefaultPivotSettingsJson
|
||||
// },
|
||||
|
||||
// new() {
|
||||
// ListFormCode = listFormMaterialType.ListFormCode,
|
||||
// CultureName = LanguageCodes.En,
|
||||
// SourceDbType = DbType.Boolean,
|
||||
// FieldName = "IsActive",
|
||||
// Width = 100,
|
||||
// ListOrderNo = 5,
|
||||
// Visible = true,
|
||||
// IsActive = true,
|
||||
// IsDeleted = false,
|
||||
// AllowSearch = true,
|
||||
// ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
// PermissionJson = DefaultFieldPermissionJson(AppCodes.SupplyChain.MaterialType),
|
||||
// PivotSettingsJson = DefaultPivotSettingsJson
|
||||
// }
|
||||
// });
|
||||
// #endregion
|
||||
// }
|
||||
// #endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -60,19 +60,31 @@ public static class SeederDefaults
|
|||
AllowColumnResizing = true,
|
||||
AllowColumnReordering = true,
|
||||
ColumnResizingMode = "widget",
|
||||
FocusRowEnabled = true,
|
||||
});
|
||||
public static readonly string DefaultLayoutJson = JsonSerializer.Serialize(new LayoutDto()
|
||||
public static string DefaultLayoutJson(string DefaultLayout = "grid") => JsonSerializer.Serialize(new LayoutDto()
|
||||
{
|
||||
Grid = true,
|
||||
Card = true,
|
||||
Pivot = true,
|
||||
Chart = true,
|
||||
DefaultLayout = "grid",
|
||||
Tree = true,
|
||||
Gantt = true,
|
||||
Scheduler = true,
|
||||
DefaultLayout = DefaultLayout,
|
||||
CardLayoutColumn = 4
|
||||
});
|
||||
public static readonly string DefaultExportJson = JsonSerializer.Serialize(new ChartExportDto
|
||||
{
|
||||
Enabled = true,
|
||||
AllowExportSelectedData = false,
|
||||
PrintingEnabled = true,
|
||||
BackgroundColor = "#FFFFFF",
|
||||
Margin = 10
|
||||
});
|
||||
public static readonly string DefaultSelectionSingleJson = JsonSerializer.Serialize(new SelectionDto
|
||||
{
|
||||
Mode = GridOptions.SelectionModeSingle,
|
||||
Mode = GridOptions.SelectionModeNone,
|
||||
AllowSelectAll = false
|
||||
});
|
||||
public static readonly string DefaultSelectionMultipleJson = JsonSerializer.Serialize(new SelectionDto
|
||||
|
|
@ -81,11 +93,11 @@ public static class SeederDefaults
|
|||
Mode = GridOptions.SelectionModeMultiple,
|
||||
SelectAllMode = GridOptions.SelectionAllModeAllPages
|
||||
});
|
||||
public static string DefaultTreeOptionJson(string KeyExpr, string ParentIdExpr, bool AutoExpandAll = true) => JsonSerializer.Serialize(new TreeOptionDto
|
||||
public static string DefaultTreeOptionJson(string KeyExpr, string ParentIdExpr, bool AutoExpandAll = true, object RootValue = null) => JsonSerializer.Serialize(new TreeOptionDto
|
||||
{
|
||||
KeyExpr = KeyExpr,
|
||||
ParentIdExpr = ParentIdExpr,
|
||||
RootValue = null,
|
||||
RootValue = RootValue,
|
||||
AutoExpandAll = AutoExpandAll
|
||||
});
|
||||
public static readonly string DefaultPagerOptionJson = JsonSerializer.Serialize(new GridPagerOptionDto
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue