Grid InInsert Sütunların Varsayılan Değer Tanımlaması
@NEWID
This commit is contained in:
parent
8d97c06dd0
commit
b20d1c06dc
9 changed files with 58 additions and 11 deletions
|
|
@ -19,7 +19,8 @@ public static class SeederDefaults
|
||||||
{
|
{
|
||||||
new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
|
new() { FieldName = "CreationTime", FieldDbType = DbType.DateTime, Value = "@NOW", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
|
||||||
new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
|
new() { FieldName = "CreatorId", FieldDbType = DbType.Guid, Value = "@USERID", CustomValueType = FieldCustomValueTypeEnum.CustomKey },
|
||||||
new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }
|
new() { FieldName = "IsDeleted", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value },
|
||||||
|
new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@NEWID", CustomValueType = FieldCustomValueTypeEnum.CustomKey }
|
||||||
});
|
});
|
||||||
|
|
||||||
public static readonly string DefaultDeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[]
|
public static readonly string DefaultDeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[]
|
||||||
|
|
|
||||||
|
|
@ -1330,6 +1330,7 @@ public static class PlatformConsts
|
||||||
public const string Month = "@MONTH";
|
public const string Month = "@MONTH";
|
||||||
public const string Day = "@DAY";
|
public const string Day = "@DAY";
|
||||||
public const string Id = "@ID";
|
public const string Id = "@ID";
|
||||||
|
public const string NewId = "@NEWID";
|
||||||
public const string Selected_Ids = "@SELECTED_IDS";
|
public const string Selected_Ids = "@SELECTED_IDS";
|
||||||
public const string TenantId = "@TENANTID";
|
public const string TenantId = "@TENANTID";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,13 +88,6 @@ public class ListFormManager : PlatformDomainService, IListFormManager
|
||||||
{
|
{
|
||||||
var fields = new Dictionary<string, object>();
|
var fields = new Dictionary<string, object>();
|
||||||
|
|
||||||
if (op == OperationEnum.Insert && listForm.KeyFieldDbSourceType == DbType.Guid)
|
|
||||||
{
|
|
||||||
// TODO: parametre sayisi artirilarak daha detayli kontrol yapilabilir.
|
|
||||||
// Ornegin Autoincrement olmayan ve elle deger veilmesi gereken bir Int alan ise?
|
|
||||||
fields.Add(listForm.KeyFieldName, Guid.NewGuid());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((object)inputParams != null)
|
if ((object)inputParams != null)
|
||||||
{
|
{
|
||||||
foreach (var item in JsonSerializer.Deserialize<Dictionary<string, object>>(inputParams))
|
foreach (var item in JsonSerializer.Deserialize<Dictionary<string, object>>(inputParams))
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class DefaultValueHelper : ITransientDependency
|
||||||
var result = strValue
|
var result = strValue
|
||||||
.Replace(PlatformConsts.DefaultValues.UserId, _currentUser.Id?.ToString() ?? Guid.Empty.ToString())
|
.Replace(PlatformConsts.DefaultValues.UserId, _currentUser.Id?.ToString() ?? Guid.Empty.ToString())
|
||||||
.Replace(PlatformConsts.DefaultValues.UserName, _currentUser.UserName ?? string.Empty)
|
.Replace(PlatformConsts.DefaultValues.UserName, _currentUser.UserName ?? string.Empty)
|
||||||
.Replace(PlatformConsts.DefaultValues.Roles, string.Join("','", _currentUser.Roles ?? Array.Empty<string>()))
|
.Replace(PlatformConsts.DefaultValues.Roles, string.Join("','", _currentUser.Roles ?? []))
|
||||||
.Replace(PlatformConsts.DefaultValues.Now, now.ToString("O", CultureInfo.InvariantCulture))
|
.Replace(PlatformConsts.DefaultValues.Now, now.ToString("O", CultureInfo.InvariantCulture))
|
||||||
.Replace(PlatformConsts.DefaultValues.Day, now.Day.ToString(CultureInfo.InvariantCulture))
|
.Replace(PlatformConsts.DefaultValues.Day, now.Day.ToString(CultureInfo.InvariantCulture))
|
||||||
.Replace(PlatformConsts.DefaultValues.Month, now.Month.ToString(CultureInfo.InvariantCulture))
|
.Replace(PlatformConsts.DefaultValues.Month, now.Month.ToString(CultureInfo.InvariantCulture))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -83,6 +82,8 @@ public class DefaultValueManager : PlatformDomainService, IDefaultValueManager
|
||||||
value = Clock.Now.Year;
|
value = Clock.Now.Year;
|
||||||
else if (field.Value == PlatformConsts.DefaultValues.Id)
|
else if (field.Value == PlatformConsts.DefaultValues.Id)
|
||||||
value = keys?.FirstOrDefault();
|
value = keys?.FirstOrDefault();
|
||||||
|
else if (field.Value == PlatformConsts.DefaultValues.NewId)
|
||||||
|
value = Guid.NewGuid();
|
||||||
else if (field.Value == PlatformConsts.DefaultValues.Selected_Ids)
|
else if (field.Value == PlatformConsts.DefaultValues.Selected_Ids)
|
||||||
value = keys;
|
value = keys;
|
||||||
else if (field.Value == PlatformConsts.DefaultValues.TenantId)
|
else if (field.Value == PlatformConsts.DefaultValues.TenantId)
|
||||||
|
|
|
||||||
|
|
@ -2298,7 +2298,7 @@
|
||||||
"code": "PERFECT_ATTENDANCE",
|
"code": "PERFECT_ATTENDANCE",
|
||||||
"name": "Mükemmel Devam",
|
"name": "Mükemmel Devam",
|
||||||
"description": "Düzenli ve zamanında işe gelen, devamsızlık yapmayan çalışanlar",
|
"description": "Düzenli ve zamanında işe gelen, devamsızlık yapmayan çalışanlar",
|
||||||
"icon": "📅",
|
"icon": "❤️",
|
||||||
"color": "#28A745",
|
"color": "#28A745",
|
||||||
"backgroundColor": "#E8F5E8",
|
"backgroundColor": "#E8F5E8",
|
||||||
"category": "Attendance",
|
"category": "Attendance",
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ export const SCREENS = {
|
||||||
// Border radius (Tailwind ile uyumlu)
|
// Border radius (Tailwind ile uyumlu)
|
||||||
export const BORDER_RADIUS = {
|
export const BORDER_RADIUS = {
|
||||||
none: '0px',
|
none: '0px',
|
||||||
|
xs: '0.0625rem',
|
||||||
sm: '0.125rem',
|
sm: '0.125rem',
|
||||||
DEFAULT: '0.25rem',
|
DEFAULT: '0.25rem',
|
||||||
md: '0.375rem',
|
md: '0.375rem',
|
||||||
|
|
|
||||||
|
|
@ -825,6 +825,31 @@ const Grid = (props: GridProps) => {
|
||||||
resizeEnabled: gridDto.gridOptions.editingOptionDto?.popup?.resizeEnabled,
|
resizeEnabled: gridDto.gridOptions.editingOptionDto?.popup?.resizeEnabled,
|
||||||
fullScreen: isPopupFullScreen,
|
fullScreen: isPopupFullScreen,
|
||||||
toolbarItems: [
|
toolbarItems: [
|
||||||
|
{
|
||||||
|
widget: 'dxButton',
|
||||||
|
toolbar: 'bottom',
|
||||||
|
location: 'after',
|
||||||
|
options: {
|
||||||
|
text: translate('::Save'),
|
||||||
|
type: 'default',
|
||||||
|
onClick: () => {
|
||||||
|
const grid = gridRef.current?.instance
|
||||||
|
grid?.saveEditData()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
widget: 'dxButton',
|
||||||
|
toolbar: 'bottom',
|
||||||
|
location: 'after',
|
||||||
|
options: {
|
||||||
|
text: translate('::Cancel'),
|
||||||
|
onClick: () => {
|
||||||
|
const grid = gridRef.current?.instance
|
||||||
|
grid?.cancelEditData()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
widget: 'dxButton',
|
widget: 'dxButton',
|
||||||
toolbar: 'top',
|
toolbar: 'top',
|
||||||
|
|
|
||||||
|
|
@ -659,6 +659,31 @@ const Tree = (props: TreeProps) => {
|
||||||
resizeEnabled: gridDto.gridOptions.editingOptionDto?.popup?.resizeEnabled,
|
resizeEnabled: gridDto.gridOptions.editingOptionDto?.popup?.resizeEnabled,
|
||||||
fullScreen: isPopupFullScreen,
|
fullScreen: isPopupFullScreen,
|
||||||
toolbarItems: [
|
toolbarItems: [
|
||||||
|
{
|
||||||
|
widget: 'dxButton',
|
||||||
|
toolbar: 'bottom',
|
||||||
|
location: 'after',
|
||||||
|
options: {
|
||||||
|
text: translate('::Save'),
|
||||||
|
type: 'default',
|
||||||
|
onClick: () => {
|
||||||
|
const tree = gridRef.current?.instance
|
||||||
|
tree?.saveEditData()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
widget: 'dxButton',
|
||||||
|
toolbar: 'bottom',
|
||||||
|
location: 'after',
|
||||||
|
options: {
|
||||||
|
text: translate('::Cancel'),
|
||||||
|
onClick: () => {
|
||||||
|
const tree = gridRef.current?.instance
|
||||||
|
tree?.cancelEditData()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
widget: 'dxButton',
|
widget: 'dxButton',
|
||||||
toolbar: 'top',
|
toolbar: 'top',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue