diff --git a/IRaCIS.Core.API/Startup.cs b/IRaCIS.Core.API/Startup.cs index abe8502bd..706fd4e49 100644 --- a/IRaCIS.Core.API/Startup.cs +++ b/IRaCIS.Core.API/Startup.cs @@ -19,6 +19,7 @@ using Microsoft.AspNetCore.Localization; using Localization; using Magicodes.ExporterAndImporter.Core.Filters; using IRaCIS.Core.Application.MediatR.CommandAndQueries; +using IRaCIS.Core.Infra.EFCore.Common; namespace IRaCIS.Core.API { @@ -81,6 +82,9 @@ namespace IRaCIS.Core.API }) .AddNewtonsoftJsonSetup(); // NewtonsoftJson 序列化 处理 + + //services.AddScoped(); + //动态WebApi + UnifiedApiResultFilter 省掉控制器代码 services.AddDynamicWebApiSetup(); //AutoMapper diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 309117805..ba9034687 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -318,11 +318,11 @@ namespace IRaCIS.Core.Application.Service.Inspection add =await _dataInspectionRepository.SetDataInspectionDateType(add); - await _repository.AddAsync(add); + //await _repository.AddAsync(add); - var success = await _repository.SaveChangesAsync(); - return ResponseOutput.Ok(success); + //var success = await _repository.SaveChangesAsync(); + return ResponseOutput.Ok(); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index fe1e37ff3..cd9867c0c 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -131,6 +131,7 @@ namespace IRaCIS.Application.Services [TypeFilter(typeof(TrialResourceFilter))] public async Task AddTrialUsers(TrialUserAddCommand[] userTrialCommands) { + var addArray = _mapper.Map(userTrialCommands); var trialUsers = await _trialUseRepository.AddRangeAsync(addArray); diff --git a/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs b/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs index 244346e44..9da2ebb9e 100644 --- a/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs +++ b/IRaCIS.Core.Domain.Share/AuthUser/IUserInfo.cs @@ -42,5 +42,7 @@ namespace IRaCIS.Core.Domain.Share bool IsEn_Us { get; } string RequestUrl { get; } + + Guid? SignId { get; set; } } } diff --git a/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs b/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs index ac82b9012..3428b4642 100644 --- a/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs +++ b/IRaCIS.Core.Domain.Share/AuthUser/UserInfo.cs @@ -224,6 +224,13 @@ namespace IRaCIS.Core.Domain.Share } } + + public Guid? SignId + { + + get; set; + } + } public static class ClaimAttributes diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index c585bee03..ac68168aa 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -163,6 +163,11 @@ namespace IRaCIS.Core.Domain.Models /// 鏄惁鏄墠绔坊鍔 /// public bool? IsFrontAdd { get; set; } + + /// + /// 涓婁竴鏉son + /// + public string LastJsonDetail { get; set; } } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs new file mode 100644 index 000000000..584760c8b --- /dev/null +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -0,0 +1,331 @@ +锘縰sing IRaCIS.Core.Domain.Common; +using IRaCIS.Core.Domain.Models; +using IRaCIS.Core.Domain.Share; +using IRaCIS.Core.Infra.EFCore.Common.Dto; +using IRaCIS.Core.Infra.EFCore.Dto; +using IRaCIS.Core.Infrastructure; +using IRaCIS.Core.Infrastructure.Extention; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Infra.EFCore.Common +{ + /// + /// 娣诲姞绋芥煡绋芥煡鏁版嵁 + /// + public class AuditingData : IAuditingData + { + + /// + /// 鏁版嵁搴撳璞 + /// + public IRaCISDBContext _dbContext { get; set; } + + /// + /// 鐢ㄦ埛淇℃伅 + /// + public IUserInfo _userInfo { get; set; } + + /// + /// 鏋勯犳柟娉 + /// + /// + /// + public AuditingData(IRaCISDBContext dbContext, IUserInfo userInfo) + { + _dbContext = dbContext; + _userInfo = userInfo; + } + + /// + /// 浼犲叆瀹炰綋瀵硅薄 + /// + public async Task IncomingEntitys(List entitys) + { + // 鏂板 + await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Added).ToList(), "Add"); + + // 淇敼 + await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Modified).ToList(), "Update"); + + // 鍒犻櫎 + await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Deleted).ToList(), "Deleted"); + } + + /// + /// 鎻掑叆Add鐨勫疄浣 + /// + /// + public async Task InsertAddEntitys(List entitys,string type) + { + // 椤圭洰浜哄憳 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser))) + { + await InsertInspection(item, type, x => new DataInspection() + { + GeneralId = x.Id + }); + } + // 鍙楄瘯鑰 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject))) + { + await InsertInspection(item, type, x => new DataInspection() { + SubjectId=x.Id + }); + } + } + + /// + /// 鎻掑叆绋芥煡瀹炰綋 + /// + /// 娉涘瀷 + /// 鏁版嵁 + /// 绫诲瀷 + /// 琛ㄨ揪寮 + /// + public async Task InsertInspection(EntityEntry data, string type, Expression> expression = null) where T:class + { + DataInspection inspection = new DataInspection(); + inspection.Identification = $"{GetRequestUrl()}/{ data.GetType().ToString().Substring(data.GetType().ToString().LastIndexOf('.') + 1)}/{type}"; + if (expression != null) + { + var f = expression.Compile(); + var entity = data.Entity as T; + inspection = f(entity); + } + var originaldata = data.OriginalValues as T; + if (originaldata != null) + { + inspection.LastJsonDetail = originaldata.ToJcJson(); + } + + await AddInspectionRecordAsync(inspection, data.Entity); + } + + /// + /// 鑾峰彇URl鍙傛暟 + /// + /// + public string GetRequestUrl() + { + return _userInfo.RequestUrl; + } + + /// + /// 鏄犲皠鏁版嵁 + /// + /// + /// 瑕佽祴鍊肩殑瀵硅薄 + public void MapData(dynamic data, dynamic mapData) + { + List column = new List() { "TrialId", "SiteId", "SubjectId", "SubjectVisitId", "CreateUserName", "TrialName", "SiteName", "SubjectCode", "SubjectVisitName", "RoleName", "SiteCode", "ResearchProgramNo" }; + foreach (var item in column) + { + try + { + var i = mapData.GetType().GetProperty(item).GetValue(mapData); + if (i == null) + { + var value = data.GetType().GetProperty(item).GetValue(data); + mapData.GetType().GetProperty(item).SetValue(mapData, value); + } + + } + catch (Exception) + { + continue; + + } + } + } + + public async Task AddInspectionRecordAsync(DataInspection add, dynamic data) + { + MapData(data, add); + InspectionGeneralData generalData = new InspectionGeneralData(); + MapData(add, generalData); + await SetInspectionNameValue(generalData); + #region 澶勭悊鏍囪瘑 + try + { + var from = await _dbContext.FrontAuditConfig.FirstOrDefaultAsync(x => x.Identification == add.Identification); + add.ObjectType = from?.ObjectTypeId; + add.OptType = from?.OptTypeId; + add.ChildrenType = from?.ChildrenTypeId; + add.ModuleType = from?.ModuleTypeId; + } + catch (Exception) + { + + throw new BusinessValidationFailedException("鎿嶄綔鏍囪瘑寮傚父"); + } + #endregion + if (add.ParentId == null) + { + add.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.VisitStageId == add.VisitStageId && x.GeneralId == add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; + + } + add.CreateUserId = _userInfo.Id; + add.IP = _userInfo.IP; + if (add.CreateTime == default(DateTime)) + { + add.CreateTime = DateTime.Now; + } + + if (_userInfo.SignId!=null) + { + add.SignId = _userInfo.SignId; + add.IsSign = true; + } + var inspectionData = new InspectionData() + { + Data = data, + Inspection = generalData + }; + add.JsonDetail = inspectionData.ToJcJson(); + await SetDataInspectionDateType(add); + await _dbContext.DataInspection.AddAsync(add); + } + + + /// + /// IsNullOrEmpty + /// + /// + /// + private bool IsNullOrEmpty(object value) + { + if (value == null || value.ToString() == string.Empty) + { + return true; + } + else + { + return false; + } + } + + /// + /// 璁剧疆椤圭洰浠ュ強鍚嶇О + /// + /// + /// + public async Task SetInspectionNameValue(InspectionGeneralData Data) + { + #region 椤圭洰鍚嶇О + + var trialdata = await _dbContext.Trial.Select(x => new { x.Id, x.ResearchProgramNo, x.ExperimentName, }).FirstOrDefaultAsync(x => x.Id == Data.TrialId); + if (IsNullOrEmpty(Data.ResearchProgramNo)) + { + + Data.ResearchProgramNo = trialdata?.ResearchProgramNo; + } + + if (IsNullOrEmpty(Data.TrialName)) + { + Data.TrialName = trialdata?.ExperimentName; + } + #endregion + + #region 娴嬭瘯涓績鍚嶇О + + + Data.SiteCode = (await _dbContext.TrialSite.IgnoreQueryFilters().FirstOrDefaultAsync(x => x.TrialId == Data.TrialId && x.SiteId == Data.SiteId))?.TrialSiteCode; + + + + if (IsNullOrEmpty(Data.SiteName) && Data.SiteId != null) + { + var sitedata = await _dbContext.Site.Where(x => x.Id == Data.SiteId).Select(x => new { x.SiteName }).FirstOrDefaultAsync(); + Data.SiteName = sitedata?.SiteName; + } + #endregion + + #region 鍙楄瘯鑰 + + + if (IsNullOrEmpty(Data.SubjectCode) && Data.SubjectId != null) + { + + Data.SubjectCode = (await _dbContext.Subject.Where(x => x.Id == Data.SubjectId).Select(x => new { x.Code }).FirstOrDefaultAsync())?.Code; + } + #endregion + + #region 璁胯 + if (IsNullOrEmpty(Data.SubjectVisitName)) + { + Data.SubjectVisitName = (await _dbContext.SubjectVisit.Where(x => x.Id == Data.SubjectVisitId).Select(x => new { x.VisitName }).FirstOrDefaultAsync())?.VisitName; + } + #endregion + + #region 鍒涘缓鑰 + + if (IsNullOrEmpty(Data.CreateUserName)) + { + Data.CreateUserName = _userInfo.RealName; + } + + if (IsNullOrEmpty(Data.RoleName)) + { + Data.RoleName = _userInfo.UserTypeShortName; + } + #endregion + } + + + + /// + /// 鏍煎紡鍖栨棩鏈熷拰鏃堕棿 + /// + /// 绋芥煡鏁版嵁 + /// + public async Task SetDataInspectionDateType(DataInspection Data) + { + var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == Data.Identification) + join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType == "Date") on parent.Id equals child.ParentId + select new DateDto() + { + Code = child.Code, + DateType = child.DateType, + }).ToListAsync(); + + var JsonData = JsonConvert.DeserializeObject>(Data.JsonDetail); + + foreach (var item in JsonData.Keys) + { + var datefirst = list.FirstOrDefault(x => x.Code.ToLower() == item.ToLower()); + if (datefirst != null && !IsNullOrEmpty(JsonData[item])) + { + try + { + if (datefirst.DateType == "Date") + { + JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd"); + } + + if (datefirst.DateType == "DateTime") + { + JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); + } + } + catch (Exception) + { + continue; + } + } + + } + Data.JsonDetail = JsonConvert.SerializeObject(JsonData); + + return Data; + } + + } +} diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/AuditingDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/AuditingDto.cs new file mode 100644 index 000000000..4e43a0065 --- /dev/null +++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/AuditingDto.cs @@ -0,0 +1,17 @@ +锘縰sing IRaCIS.Core.Domain.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Infra.EFCore.Common.Dto +{ + public class AuditingDto + { + public Type EntityType { get; set; } + + public Expression> Expression { get; set; } + } +} diff --git a/IRaCIS.Core.Infra.EFCore/Common/IAuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/IAuditingData.cs new file mode 100644 index 000000000..3ae884ef7 --- /dev/null +++ b/IRaCIS.Core.Infra.EFCore/Common/IAuditingData.cs @@ -0,0 +1,14 @@ +锘縰sing Microsoft.EntityFrameworkCore.ChangeTracking; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Infra.EFCore.Common +{ + public interface IAuditingData + { + Task IncomingEntitys(List entitys); + } +} diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index e4050c9a0..8712fc406 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -17,21 +17,28 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.ValueGeneration; using UserTypeGroup = IRaCIS.Core.Domain.Models.UserTypeGroup; using IRaCIS.Core.Infra.EFCore.Dto; +using IRaCIS.Core.Infra.EFCore.Common; namespace IRaCIS.Core.Infra.EFCore { public class IRaCISDBContext : DbContext { public readonly IUserInfo _userInfo; + //private readonly IAuditingData _auditingData; // 鍦ㄦ帶鍒跺彴 //public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); // 璋冭瘯绐楀彛 public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddDebug(); }); - public IRaCISDBContext(DbContextOptions options, IUserInfo userInfo) : base(options) + public IRaCISDBContext(DbContextOptions options, IUserInfo userInfo + + + //IAuditingData auditingData + ) : base(options) { _userInfo = userInfo; + //this._auditingData = auditingData; //_configuration = configuration; } @@ -346,84 +353,100 @@ namespace IRaCIS.Core.Infra.EFCore #region 搴熷純 - //public override int SaveChanges() - //{ - // UpdateAuditInfo(); - // return base.SaveChanges(); - //} + public override int SaveChanges() + { + //UpdateAuditInfo().GetAwaiter(); + AddAudit().GetAwaiter(); + return base.SaveChanges(); + } - //public override Task SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken()) - //{ - // UpdateAuditInfo(); - // return base.SaveChangesAsync(cancellationToken); - //} + public override async Task SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken()) + { + //await UpdateAuditInfo(); + await AddAudit(); + return await base.SaveChangesAsync(cancellationToken); + } + + + public async Task AddAudit() + { + var entities = ChangeTracker.Entries().Where(u => (u.State == EntityState.Modified || u.State == EntityState.Deleted || u.State == EntityState.Added)).Where(x => x.Entity.GetType() != typeof(DataInspection)).ToList(); + AuditingData auditingData = new AuditingData(this, _userInfo); + await auditingData.IncomingEntitys(entities); + } /// /// 閲嶅啓savechange鏂瑰紡 缁熶竴澧炲姞瀹¤淇℃伅 CreateUserId CreateTime UpdateTime UpdateUserId 鍙敤浜嬩欢缁戝畾鐨勬柟寮廢pdateAuitUser /// - private void UpdateAuditInfo() + private async Task UpdateAuditInfo() { - ChangeTracker.DetectChanges(); // Important! + + + + + //ChangeTracker.DetectChanges(); // Important! //// 鑾峰彇鎵鏈夋洿鏀癸紝鍒犻櫎锛屾柊澧炵殑瀹炰綋锛屼絾鎺掗櫎瀹¤瀹炰綋锛堥伩鍏嶆寰幆锛 - var entities = ChangeTracker.Entries() - .Where(u => (u.State == EntityState.Modified || u.State == EntityState.Deleted || u.State == EntityState.Added)); + //var entities = ChangeTracker.Entries() + // .Where(u => (u.State == EntityState.Modified || u.State == EntityState.Deleted || u.State == EntityState.Added)).Where(x=>x.Entity.GetType()!=typeof(data)).ToList(); + //AuditingData auditingData = new AuditingData(this, _userInfo); + //await auditingData.IncomingEntitys(entities); + //var items = entities.SelectMany(x => x.Entity.GetType().ToString()); - foreach (var t in entities) - { - switch (t.State) - { + //foreach (var t in entities) + //{ + // switch (t.State) + // { - case EntityState.Deleted: + // case EntityState.Deleted: - break; - case EntityState.Modified: + // break; + // case EntityState.Modified: - if (t.Entity is IAuditUpdate updateEntity1) - { - updateEntity1.UpdateTime = DateTime.UtcNow.AddHours(8); - updateEntity1.UpdateUserId = _userInfo.Id; - } + // if (t.Entity is IAuditUpdate updateEntity1) + // { + // updateEntity1.UpdateTime = DateTime.UtcNow.AddHours(8); + // updateEntity1.UpdateUserId = _userInfo.Id; + // } - break; - //娣诲姞鐨勬椂鍊欙紝鏇存柊瀹¤瀛楁涔熻祴鍊 - case EntityState.Added: + // break; + // //娣诲姞鐨勬椂鍊欙紝鏇存柊瀹¤瀛楁涔熻祴鍊 + // case EntityState.Added: - ////// 浠撳偍娣诲姞鏃 灏辨湁id浜 - //if (t.Entity is Entity entity && entity.Id == Guid.Empty) - //{ - // entity.Id = NewId.NextGuid(); - //} + // ////// 浠撳偍娣诲姞鏃 灏辨湁id浜 + // //if (t.Entity is Entity entity && entity.Id == Guid.Empty) + // //{ + // // entity.Id = NewId.NextGuid(); + // //} - if (t.Entity is IAuditAdd addEntity) - { - if (addEntity.CreateTime == default(DateTime)) - { - addEntity.CreateTime = DateTime.UtcNow.AddHours(8); - } + // if (t.Entity is IAuditAdd addEntity) + // { + // if (addEntity.CreateTime == default(DateTime)) + // { + // addEntity.CreateTime = DateTime.UtcNow.AddHours(8); + // } - addEntity.CreateUserId = _userInfo.Id; - } + // addEntity.CreateUserId = _userInfo.Id; + // } - if (t.Entity is IAuditUpdate updateEntity) - { - updateEntity.UpdateTime = DateTime.UtcNow.AddHours(8); - updateEntity.UpdateUserId = _userInfo.Id; - } - - if (t.Entity is IAuditAddWithUserName addEntity3) - { - addEntity3.CreateTime = DateTime.UtcNow.AddHours(8); - addEntity3.CreateUserId = _userInfo.Id; - addEntity3.CreateUser = _userInfo.RealName; - } - break; - } - } + // if (t.Entity is IAuditUpdate updateEntity) + // { + // updateEntity.UpdateTime = DateTime.UtcNow.AddHours(8); + // updateEntity.UpdateUserId = _userInfo.Id; + // } + // if (t.Entity is IAuditAddWithUserName addEntity3) + // { + // addEntity3.CreateTime = DateTime.UtcNow.AddHours(8); + // addEntity3.CreateUserId = _userInfo.Id; + // addEntity3.CreateUser = _userInfo.RealName; + // } + // break; + // } + //} } @@ -466,7 +489,7 @@ namespace IRaCIS.Core.Infra.EFCore break; } } - + if (e.Entry.Entity is IAuditAddWithUserName addEntity2) { switch (e.Entry.State) diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 3e00821d2..a2a5dee2a 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -61,7 +61,7 @@ namespace IRaCIS.Core.Infra.EFCore await _dbSet.AddAsync(entity).ConfigureAwait(false); // 娣诲姞绋芥煡 - await AddInspectionAsync(entity, isSaveAudit); + //await AddInspectionAsync(entity, isSaveAudit); if (autoSave) { @@ -1021,29 +1021,10 @@ namespace IRaCIS.Core.Infra.EFCore await SetDataInspectionDateType(add); } - await _dbContext.DataInspection.AddRangeAsync(datas); + //await _dbContext.DataInspection.AddRangeAsync(datas); } - - - /// - /// IsNullOrEmpty - /// - /// - /// - private bool IsNullOrEmpty(object value) - { - if (value == null || value.ToString() == string.Empty) - { - return true; - } - else - { - return false; - } - } - /// /// 鏍煎紡鍖栨棩鏈熷拰鏃堕棿 /// @@ -1052,7 +1033,7 @@ namespace IRaCIS.Core.Infra.EFCore public async Task SetDataInspectionDateType(DataInspection Data) { var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == Data.Identification) - join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType== "Date") on parent.Id equals child.ParentId + join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType == "Date") on parent.Id equals child.ParentId select new DateDto() { Code = child.Code, @@ -1090,6 +1071,25 @@ namespace IRaCIS.Core.Infra.EFCore return Data; } + /// + /// IsNullOrEmpty + /// + /// + /// + private bool IsNullOrEmpty(object value) + { + if (value == null || value.ToString() == string.Empty) + { + return true; + } + else + { + return false; + } + } + + + /// /// 璁剧疆椤圭洰浠ュ強鍚嶇О