From 650d2fad046cbf46106223722126e5a650280477 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Wed, 13 Mar 2024 15:17:43 +0800 Subject: [PATCH] =?UTF-8?q?ResultStatus=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResultStatuses/ResultStatusManager.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Shentun.Peis.Domain/ResultStatuses/ResultStatusManager.cs b/src/Shentun.Peis.Domain/ResultStatuses/ResultStatusManager.cs index 891bfed..bfd25ec 100644 --- a/src/Shentun.Peis.Domain/ResultStatuses/ResultStatusManager.cs +++ b/src/Shentun.Peis.Domain/ResultStatuses/ResultStatusManager.cs @@ -33,7 +33,7 @@ namespace Shentun.Peis.ResultStatuses { Check.NotNullOrWhiteSpace(entity.Id, nameof(entity.Id)); Check.NotNullOrWhiteSpace(entity.DisplayName, nameof(entity.DisplayName)); - + Verify(entity); var existEntity = await _repository.FindAsync(o => o.Id == entity.Id); if (existEntity != null) { @@ -73,14 +73,7 @@ namespace Shentun.Peis.ResultStatuses if (oldentity != null) { - if (!DataHelper.IsColorNumber(entity.DataInputBackgroundColor)) - throw new UserFriendlyException($"数据录入报告单颜色代码格式不正确"); - if (!DataHelper.IsColorNumber(entity.DataInputFontColor)) - throw new UserFriendlyException($"数据录入字体颜色代码格式不正确"); - if (!DataHelper.IsColorNumber(entity.ReportBackgroundColor)) - throw new UserFriendlyException($"报告单背景颜色代码格式不正确"); - if (!DataHelper.IsColorNumber(entity.ReportFontColor)) - throw new UserFriendlyException($"报告单字体颜色代码格式不正确"); + Verify(entity); oldentity.DataInputBackgroundColor = entity.DataInputBackgroundColor; oldentity.DataInputFontColor = entity.DataInputFontColor; @@ -99,7 +92,17 @@ namespace Shentun.Peis.ResultStatuses } } - + public void Verify(ResultStatus entity) + { + if (!DataHelper.IsColorNumber(entity.DataInputBackgroundColor)) + throw new UserFriendlyException($"数据录入报告单颜色代码格式不正确"); + if (!DataHelper.IsColorNumber(entity.DataInputFontColor)) + throw new UserFriendlyException($"数据录入字体颜色代码格式不正确"); + if (!DataHelper.IsColorNumber(entity.ReportBackgroundColor)) + throw new UserFriendlyException($"报告单背景颜色代码格式不正确"); + if (!DataHelper.IsColorNumber(entity.ReportFontColor)) + throw new UserFriendlyException($"报告单字体颜色代码格式不正确"); + } /// /// 修改排序 相邻之间 ///