Files
HTCloud/HT.Cloud.Domain/Entity/IBaseEntity/IEntity.cs

51 lines
1.2 KiB
C#
Raw Normal View History

2023-03-03 16:07:50 +08:00
/*******************************************************************************
* Copyright © 2020 HT.Cloud.Framework
* Author: HT.Cloud
* Description: WaterCloud快速开发平台
* Website
*********************************************************************************/
using System;
using HT.Cloud.Code;
namespace HT.Cloud.Domain
{
public class IEntity<TEntity>
{
public void Create()
{
var entity = this as ICreationAudited;
entity.F_Id = Utils.GuId();
var LoginInfo = OperatorProvider.Provider.GetCurrent();
if (LoginInfo != null)
{
entity.F_CreatorUserId = LoginInfo.UserId;
}
entity.F_CreatorTime = DateTime.Now;
}
public void Modify(string keyValue)
{
var entity = this as IModificationAudited;
entity.F_Id = keyValue;
var LoginInfo = OperatorProvider.Provider.GetCurrent();
if (LoginInfo != null)
{
entity.F_LastModifyUserId = LoginInfo.UserId;
}
entity.F_LastModifyTime = DateTime.Now;
}
public void Remove()
{
var entity = this as IDeleteAudited;
var LoginInfo = OperatorProvider.Provider.GetCurrent();
if (LoginInfo != null)
{
entity.F_DeleteUserId = LoginInfo.UserId;
}
entity.F_DeleteTime = DateTime.Now;
entity.F_DeleteMark = true;
}
}
}