You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

3 weeks ago
  1. using NFine.Code;
  2. using System;
  3. namespace NFine.Domain
  4. {
  5. public class IEntity<TEntity>
  6. {
  7. public void Create()
  8. {
  9. var entity = this as ICreationAudited;
  10. if (String.IsNullOrEmpty(entity.F_Id))
  11. {
  12. entity.F_Id = Common.GuId();
  13. }
  14. var LoginInfo = OperatorProvider.Provider.GetCurrent();
  15. if (LoginInfo != null)
  16. {
  17. entity.F_CreatorUserId = LoginInfo.UserId;
  18. }
  19. entity.F_CreatorTime = DateTime.Now;
  20. }
  21. public void Modify(string keyValue)
  22. {
  23. var entity = this as IModificationAudited;
  24. entity.F_Id = keyValue;
  25. var LoginInfo = OperatorProvider.Provider.GetCurrent();
  26. if (LoginInfo != null)
  27. {
  28. entity.F_LastModifyUserId = LoginInfo.UserId;
  29. }
  30. entity.F_LastModifyTime = DateTime.Now;
  31. }
  32. public void Remove()
  33. {
  34. var entity = this as IDeleteAudited;
  35. var LoginInfo = OperatorProvider.Provider.GetCurrent();
  36. if (LoginInfo != null)
  37. {
  38. entity.F_DeleteUserId = LoginInfo.UserId;
  39. }
  40. entity.F_DeleteTime = DateTime.Now;
  41. entity.F_DeleteMark = true;
  42. }
  43. }
  44. }