Before ve After Command tanımlamaları

This commit is contained in:
Sedat Öztürk 2025-12-06 22:58:23 +03:00
parent c3ce3583a6
commit e54dfe4f98
11 changed files with 256 additions and 45 deletions

View file

@ -33,6 +33,8 @@ public class GridOptionsEditDto : GridOptionsDto
} }
public string DeleteCommand { get; set; } public string DeleteCommand { get; set; }
public string BeforeDeleteCommand { get; set; }
public string AfterDeleteCommand { get; set; }
[JsonIgnore] [JsonIgnore]
public string DeleteFieldsDefaultValueJson { get; set; } public string DeleteFieldsDefaultValueJson { get; set; }
public List<FieldsDefaultValueDto> DeleteFieldsDefaultValueDto public List<FieldsDefaultValueDto> DeleteFieldsDefaultValueDto
@ -48,6 +50,8 @@ public class GridOptionsEditDto : GridOptionsDto
} }
public string InsertCommand { get; set; } public string InsertCommand { get; set; }
public string BeforeInsertCommand { get; set; }
public string AfterInsertCommand { get; set; }
[JsonIgnore] [JsonIgnore]
public string InsertFieldsDefaultValueJson { get; set; } public string InsertFieldsDefaultValueJson { get; set; }
public List<FieldsDefaultValueDto> InsertFieldsDefaultValueDto public List<FieldsDefaultValueDto> InsertFieldsDefaultValueDto
@ -63,6 +67,8 @@ public class GridOptionsEditDto : GridOptionsDto
} }
public string UpdateCommand { get; set; } public string UpdateCommand { get; set; }
public string BeforeUpdateCommand { get; set; }
public string AfterUpdateCommand { get; set; }
[JsonIgnore] [JsonIgnore]
public string UpdateFieldsDefaultValueJson { get; set; } public string UpdateFieldsDefaultValueJson { get; set; }
public List<FieldsDefaultValueDto> UpdateFieldsDefaultValueDto public List<FieldsDefaultValueDto> UpdateFieldsDefaultValueDto

View file

@ -94,16 +94,22 @@ public class ListFormsAppService : CrudAppService<
{ {
item.InsertServiceAddress = input.InsertServiceAddress; item.InsertServiceAddress = input.InsertServiceAddress;
item.InsertCommand = input.InsertCommand; item.InsertCommand = input.InsertCommand;
item.BeforeInsertCommand = input.BeforeInsertCommand;
item.AfterInsertCommand = input.AfterInsertCommand;
} }
else if (input.EditType == ListFormEditTabs.Database.Update.UpdateForm) else if (input.EditType == ListFormEditTabs.Database.Update.UpdateForm)
{ {
item.UpdateServiceAddress = input.UpdateServiceAddress; item.UpdateServiceAddress = input.UpdateServiceAddress;
item.UpdateCommand = input.UpdateCommand; item.UpdateCommand = input.UpdateCommand;
item.BeforeUpdateCommand = input.BeforeUpdateCommand;
item.AfterUpdateCommand = input.AfterUpdateCommand;
} }
else if (input.EditType == ListFormEditTabs.Database.Delete.DeleteForm) else if (input.EditType == ListFormEditTabs.Database.Delete.DeleteForm)
{ {
item.DeleteServiceAddress = input.DeleteServiceAddress; item.DeleteServiceAddress = input.DeleteServiceAddress;
item.DeleteCommand = input.DeleteCommand; item.DeleteCommand = input.DeleteCommand;
item.BeforeDeleteCommand = input.BeforeDeleteCommand;
item.AfterDeleteCommand = input.AfterDeleteCommand;
} }
else if (input.EditType == ListFormEditTabs.PermissionForm) else if (input.EditType == ListFormEditTabs.PermissionForm)
{ {

View file

@ -4033,6 +4033,18 @@
"en": "Insert Command", "en": "Insert Command",
"tr": "Insert T-Sql" "tr": "Insert T-Sql"
}, },
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.BeforeDatabaseInsertCommand",
"en": "Before Insert Command",
"tr": "Before Insert T-Sql"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.AfterDatabaseInsertCommand",
"en": "After Insert Command",
"tr": "After Insert T-Sql"
},
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "ListForms.ListFormEdit.DatabaseInsertFieldsDefaultValues", "key": "ListForms.ListFormEdit.DatabaseInsertFieldsDefaultValues",
@ -4093,6 +4105,18 @@
"en": "Update Command", "en": "Update Command",
"tr": "Update T-Sql" "tr": "Update T-Sql"
}, },
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.BeforeDatabaseUpdateCommand",
"en": "Before Update Command",
"tr": "Before Update T-Sql"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.AfterDatabaseUpdateCommand",
"en": "After Update Command",
"tr": "After Update T-Sql"
},
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "ListForms.ListFormEdit.DatabaseUpdateFieldsDefaultValues", "key": "ListForms.ListFormEdit.DatabaseUpdateFieldsDefaultValues",
@ -4117,6 +4141,18 @@
"en": "Delete Command", "en": "Delete Command",
"tr": "Delete T-Sql" "tr": "Delete T-Sql"
}, },
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.BeforeDatabaseDeleteCommand",
"en": "Before Delete Command",
"tr": "Before Delete T-Sql"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.AfterDatabaseDeleteCommand",
"en": "After Delete Command",
"tr": "After Delete T-Sql"
},
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "ListForms.ListFormEdit.DatabaseDeleteFieldsDefaultValues", "key": "ListForms.ListFormEdit.DatabaseDeleteFieldsDefaultValues",

View file

@ -67,18 +67,24 @@ public class ListForm : FullAuditedEntity<Guid>
/// <summary> Silme yapilacak harici sorgu. icerisinde @ID, @USERID, @USERNAME, @ROLES anahtarlari kullanilabilir. /// <summary> Silme yapilacak harici sorgu. icerisinde @ID, @USERID, @USERNAME, @ROLES anahtarlari kullanilabilir.
/// </summary> /// </summary>
public string DeleteCommand { get; set; } public string DeleteCommand { get; set; }
public string BeforeDeleteCommand { get; set; }
public string AfterDeleteCommand { get; set; }
/// <summary>Guncelleme yapilacak harici sorgu. /// <summary>Guncelleme yapilacak harici sorgu.
/// icerisinde @ID, @USERID, @USERNAME, @ROLES ozel anahtarlari kullanilabilir. /// icerisinde @ID, @USERID, @USERNAME, @ROLES ozel anahtarlari kullanilabilir.
/// ilaveten tabloya ait butun alanlar icin FieldName onune @ isareti eklenerek guncellenebilir. /// ilaveten tabloya ait butun alanlar icin FieldName onune @ isareti eklenerek guncellenebilir.
/// ornegin tablodaki Ad alanini guncellemek icin '@Ad' yazildiginda bu kisim ekrandan gelen deger ile degistirilir /// ornegin tablodaki Ad alanini guncellemek icin '@Ad' yazildiginda bu kisim ekrandan gelen deger ile degistirilir
/// </summary> /// </summary>
public string UpdateCommand { get; set; } public string UpdateCommand { get; set; }
public string BeforeUpdateCommand { get; set; }
public string AfterUpdateCommand { get; set; }
/// <summary>insert yapacak harici sorgu. /// <summary>insert yapacak harici sorgu.
/// icerisinde @USERID, @USERNAME ozel anahtarlari kullanilabilir. /// icerisinde @USERID, @USERNAME ozel anahtarlari kullanilabilir.
/// ilaveten tabloya ait butun alanlar icin FieldName onune @ isareti eklenerek guncellenebilir. /// ilaveten tabloya ait butun alanlar icin FieldName onune @ isareti eklenerek guncellenebilir.
/// ornegin tablodaki Ad alanini guncellemek icin '@Ad' yazildiginda bu kisim ekrandan gelen deger ile degistirilir /// ornegin tablodaki Ad alanini guncellemek icin '@Ad' yazildiginda bu kisim ekrandan gelen deger ile degistirilir
/// </summary> /// </summary>
public string InsertCommand { get; set; } public string InsertCommand { get; set; }
public string BeforeInsertCommand { get; set; }
public string AfterInsertCommand { get; set; }
/// <summary> Guncelleme islemini yapacak servis adresi /// <summary> Guncelleme islemini yapacak servis adresi
/// </summary> /// </summary>

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Erp.Platform.Migrations namespace Erp.Platform.Migrations
{ {
[DbContext(typeof(PlatformDbContext))] [DbContext(typeof(PlatformDbContext))]
[Migration("20251205115506_Initial")] [Migration("20251206194239_Initial")]
partial class Initial partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -6173,6 +6173,15 @@ namespace Erp.Platform.Migrations
b.Property<string>("AdaptiveLayoutJson") b.Property<string>("AdaptiveLayoutJson")
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("AfterDeleteCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("AfterInsertCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("AfterUpdateCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("AnimationJson") b.Property<string>("AnimationJson")
.HasColumnType("text"); .HasColumnType("text");
@ -6182,6 +6191,15 @@ namespace Erp.Platform.Migrations
b.Property<string>("ArgumentAxisJson") b.Property<string>("ArgumentAxisJson")
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("BeforeDeleteCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("BeforeInsertCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("BeforeUpdateCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("ColumnOptionJson") b.Property<string>("ColumnOptionJson")
.HasColumnType("text"); .HasColumnType("text");

View file

@ -2290,8 +2290,14 @@ namespace Erp.Platform.Migrations
CommandColumnJson = table.Column<string>(type: "text", nullable: true), CommandColumnJson = table.Column<string>(type: "text", nullable: true),
StateStoringJson = table.Column<string>(type: "text", nullable: true), StateStoringJson = table.Column<string>(type: "text", nullable: true),
DeleteCommand = table.Column<string>(type: "text", nullable: true), DeleteCommand = table.Column<string>(type: "text", nullable: true),
BeforeDeleteCommand = table.Column<string>(type: "nvarchar(max)", nullable: true),
AfterDeleteCommand = table.Column<string>(type: "nvarchar(max)", nullable: true),
UpdateCommand = table.Column<string>(type: "text", nullable: true), UpdateCommand = table.Column<string>(type: "text", nullable: true),
BeforeUpdateCommand = table.Column<string>(type: "nvarchar(max)", nullable: true),
AfterUpdateCommand = table.Column<string>(type: "nvarchar(max)", nullable: true),
InsertCommand = table.Column<string>(type: "text", nullable: true), InsertCommand = table.Column<string>(type: "text", nullable: true),
BeforeInsertCommand = table.Column<string>(type: "nvarchar(max)", nullable: true),
AfterInsertCommand = table.Column<string>(type: "nvarchar(max)", nullable: true),
UpdateServiceAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), UpdateServiceAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
InsertServiceAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), InsertServiceAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
DeleteServiceAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true), DeleteServiceAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),

View file

@ -6170,6 +6170,15 @@ namespace Erp.Platform.Migrations
b.Property<string>("AdaptiveLayoutJson") b.Property<string>("AdaptiveLayoutJson")
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("AfterDeleteCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("AfterInsertCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("AfterUpdateCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("AnimationJson") b.Property<string>("AnimationJson")
.HasColumnType("text"); .HasColumnType("text");
@ -6179,6 +6188,15 @@ namespace Erp.Platform.Migrations
b.Property<string>("ArgumentAxisJson") b.Property<string>("ArgumentAxisJson")
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("BeforeDeleteCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("BeforeInsertCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("BeforeUpdateCommand")
.HasColumnType("nvarchar(max)");
b.Property<string>("ColumnOptionJson") b.Property<string>("ColumnOptionJson")
.HasColumnType("text"); .HasColumnType("text");

View file

@ -632,12 +632,18 @@ export interface GridOptionsEditDto extends GridOptionsDto, Record<string, any>
selectFieldsDefaultValueJson?: string selectFieldsDefaultValueJson?: string
selectFieldsDefaultValueDto: FieldsDefaultValueDto[] selectFieldsDefaultValueDto: FieldsDefaultValueDto[]
deleteCommand?: string deleteCommand?: string
beforeDeleteCommand?: string
afterDeleteCommand?: string
deleteFieldsDefaultValueJson?: string deleteFieldsDefaultValueJson?: string
deleteFieldsDefaultValueDto: FieldsDefaultValueDto[] deleteFieldsDefaultValueDto: FieldsDefaultValueDto[]
insertCommand?: string insertCommand?: string
beforeInsertCommand?: string
afterInsertCommand?: string
insertFieldsDefaultValueJson?: string insertFieldsDefaultValueJson?: string
insertFieldsDefaultValueDto: FieldsDefaultValueDto[] insertFieldsDefaultValueDto: FieldsDefaultValueDto[]
updateCommand?: string updateCommand?: string
beforeUpdateCommand?: string
afterUpdateCommand?: string
updateFieldsDefaultValueJson?: string updateFieldsDefaultValueJson?: string
updateFieldsDefaultValueDto: FieldsDefaultValueDto[] updateFieldsDefaultValueDto: FieldsDefaultValueDto[]
formFieldsDefaultValueJson?: string formFieldsDefaultValueJson?: string

View file

@ -65,20 +65,57 @@ function FormTabDatabaseDelete({
component={Input} component={Input}
/> />
</FormItem> </FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.DatabaseDeleteCommand')} <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
invalid={errors.deleteCommand && touched.deleteCommand} <FormItem
errorMessage={errors.deleteCommand} label={translate('::ListForms.ListFormEdit.DatabaseDeleteCommand')}
> invalid={errors.deleteCommand && touched.deleteCommand}
<Field errorMessage={errors.deleteCommand}
type="text" >
autoComplete="off" <Field
name="deleteCommand" type="text"
placeholder={translate('::ListForms.ListFormEdit.DatabaseDeleteCommand')} autoComplete="off"
component={Input} name="deleteCommand"
textArea={true} placeholder={translate('::ListForms.ListFormEdit.DatabaseDeleteCommand')}
/> component={Input}
</FormItem> textArea={true}
rows={6}
/>
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.BeforeDatabaseDeleteCommand')}
invalid={errors.beforeDeleteCommand && touched.beforeDeleteCommand}
errorMessage={errors.beforeDeleteCommand}
>
<Field
type="text"
autoComplete="off"
name="beforeDeleteCommand"
placeholder={translate(
'::ListForms.ListFormEdit.BeforeDatabaseDeleteCommand',
)}
component={Input}
textArea={true}
rows={6}
/>
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.AfterDatabaseDeleteCommand')}
invalid={errors.afterDeleteCommand && touched.afterDeleteCommand}
errorMessage={errors.afterDeleteCommand}
>
<Field
type="text"
autoComplete="off"
name="afterDeleteCommand"
placeholder={translate('::ListForms.ListFormEdit.AfterDatabaseDeleteCommand')}
component={Input}
textArea={true}
rows={6}
/>
</FormItem>
</div>
<Button block variant="solid" loading={isSubmitting}> <Button block variant="solid" loading={isSubmitting}>
{isSubmitting ? translate('::SavingWithThreeDot') : translate('::Save')} {isSubmitting ? translate('::SavingWithThreeDot') : translate('::Save')}
</Button> </Button>

View file

@ -65,20 +65,55 @@ function FormTabDatabaseInsert({
component={Input} component={Input}
/> />
</FormItem> </FormItem>
<FormItem <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
label={translate('::ListForms.ListFormEdit.DatabaseInsertCommand')} <FormItem
invalid={errors.insertCommand && touched.insertCommand} label={translate('::ListForms.ListFormEdit.DatabaseInsertCommand')}
errorMessage={errors.insertCommand} invalid={errors.insertCommand && touched.insertCommand}
> errorMessage={errors.insertCommand}
<Field >
type="text" <Field
autoComplete="off" type="text"
name="insertCommand" autoComplete="off"
placeholder={translate('::ListForms.ListFormEdit.DatabaseInsertCommand')} name="insertCommand"
component={Input} placeholder={translate('::ListForms.ListFormEdit.DatabaseInsertCommand')}
textArea={true} component={Input}
/> textArea={true}
</FormItem> rows={6}
/>
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.BeforeDatabaseInsertCommand')}
invalid={errors.beforeInsertCommand && touched.beforeInsertCommand}
errorMessage={errors.beforeInsertCommand}
>
<Field
type="text"
autoComplete="off"
name="beforeInsertCommand"
placeholder={translate(
'::ListForms.ListFormEdit.BeforeDatabaseInsertCommand',
)}
component={Input}
textArea={true}
rows={6}
/>
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.AfterDatabaseInsertCommand')}
invalid={errors.afterInsertCommand && touched.afterInsertCommand}
errorMessage={errors.afterInsertCommand}
>
<Field
type="text"
autoComplete="off"
name="afterInsertCommand"
placeholder={translate('::ListForms.ListFormEdit.AfterDatabaseInsertCommand')}
component={Input}
textArea={true}
rows={6}
/>
</FormItem>
</div>
<Button block variant="solid" loading={isSubmitting}> <Button block variant="solid" loading={isSubmitting}>
{isSubmitting ? translate('::SavingWithThreeDot') : translate('::Save')} {isSubmitting ? translate('::SavingWithThreeDot') : translate('::Save')}
</Button> </Button>

View file

@ -65,20 +65,57 @@ function FormTabDatabaseUpdate({
component={Input} component={Input}
/> />
</FormItem> </FormItem>
<FormItem <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
label={translate('::ListForms.ListFormEdit.DatabaseUpdateCommand')} <FormItem
invalid={errors.updateCommand && touched.updateCommand} label={translate('::ListForms.ListFormEdit.DatabaseUpdateCommand')}
errorMessage={errors.updateCommand} invalid={errors.updateCommand && touched.updateCommand}
> errorMessage={errors.updateCommand}
<Field >
type="text" <Field
autoComplete="off" type="text"
name="updateCommand" autoComplete="off"
placeholder={translate('::ListForms.ListFormEdit.DatabaseUpdateCommand')} name="updateCommand"
component={Input} placeholder={translate('::ListForms.ListFormEdit.DatabaseUpdateCommand')}
textArea={true} component={Input}
/> textArea={true}
</FormItem> rows={6}
/>
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.BeforeDatabaseUpdateCommand')}
invalid={errors.beforeUpdateCommand && touched.beforeUpdateCommand}
errorMessage={errors.beforeUpdateCommand}
>
<Field
type="text"
autoComplete="off"
name="beforeUpdateCommand"
placeholder={translate(
'::ListForms.ListFormEdit.BeforeDatabaseUpdateCommand',
)}
component={Input}
textArea={true}
rows={6}
/>
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.AfterDatabaseUpdateCommand')}
invalid={errors.afterUpdateCommand && touched.afterUpdateCommand}
errorMessage={errors.afterUpdateCommand}
>
<Field
type="text"
autoComplete="off"
name="afterUpdateCommand"
placeholder={translate(
'::ListForms.ListFormEdit.AfterDatabaseUpdateCommand',
)}
component={Input}
textArea={true}
rows={6}
/>
</FormItem>
</div>
<Button block variant="solid" loading={isSubmitting}> <Button block variant="solid" loading={isSubmitting}>
{isSubmitting ? translate('::SavingWithThreeDot') : translate('::Save')} {isSubmitting ? translate('::SavingWithThreeDot') : translate('::Save')}
</Button> </Button>