diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs index 3412dd383..a7f55ff61 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs @@ -15,9 +15,14 @@ namespace IRaCIS.Core.Application.ViewModel public string Keyboardkey { get; set; } public int ShortcutKeyEnum { get; set; } public int ImageToolType { get; set; } - public DateTime CreateTime { get; set; } - public Guid CreateUserId { get; set; } - } + public bool AltKey { get; set; } + + public bool CtrlKey { get; set; } + + public bool ShiftKey { get; set; } + + public bool MetaKey { get; set; } + } public class SetDefaultShortcutKey @@ -31,6 +36,14 @@ namespace IRaCIS.Core.Application.ViewModel { public string Keyboardkey { get; set; } public int ShortcutKeyEnum { get; set; } + + public bool AltKey { get; set; } + + public bool CtrlKey { get; set; } + + public bool ShiftKey { get; set; } + + public bool MetaKey { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs index 1057ab96e..3ff06dcde 100644 --- a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs @@ -34,18 +34,36 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task> GetDefaultShortcutKeyList(DefaultShortcutKeyQuery inQuery) + public async Task> GetDefaultShortcutKeyList(DefaultShortcutKeyQuery inQuery) { var defaultShortcutKey = await _defaultShortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType).ToListAsync(); var shortcutKeydic = await _dictionaryRepository.Where(x => x.Parent.Code == "ShortcutKey").ToListAsync(); - var result = shortcutKeydic.OrderBy(x=>x.ShowOrder).Select(x => new DefaultShortcutKeyView() - { - Id = x.Id, - ImageToolType = inQuery.ImageToolType, - ShortcutKeyEnum = int.Parse(x.Code), - Keyboardkey = defaultShortcutKey.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).Select(y => y.Keyboardkey).FirstOrDefault() ?? string.Empty, - }).ToList(); + + List result = new List(); + + shortcutKeydic.OrderBy(x => x.ShowOrder).ForEach(x => + { + var key= defaultShortcutKey.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).FirstOrDefault(); + + var isnull = key == null; + + result.Add(new DefaultShortcutKeyView() + { + Id = x.Id, + ImageToolType = inQuery.ImageToolType, + ShortcutKeyEnum = int.Parse(x.Code), + Keyboardkey = isnull ? string.Empty : key.Keyboardkey, + AltKey = isnull ? false : key.AltKey, + CtrlKey = isnull ? false : key.CtrlKey, + MetaKey = isnull ? false : key.MetaKey, + ShiftKey = isnull ? false : key.ShiftKey + }) ; + + }); + + + return result; } @@ -58,17 +76,7 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task> GetDoctorShortcutKey(DefaultShortcutKeyQuery inQuery) { - var defaultShortcutKey = await _defaultShortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType).ToListAsync(); - var shortcutKeydic = await _dictionaryRepository.Where(x => x.Parent.Code == "ShortcutKey").ToListAsync(); - var result = shortcutKeydic.OrderBy(x => x.ShowOrder).Select(x => new DefaultShortcutKeyView() - { - - Id = x.Id, - ImageToolType = inQuery.ImageToolType, - ShortcutKeyEnum = int.Parse(x.Code), - Keyboardkey = defaultShortcutKey.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).Select(y => y.Keyboardkey).FirstOrDefault() ?? string.Empty, - }).ToList(); - return result; + return await this.GetDefaultShortcutKeyList(inQuery); } diff --git a/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs index 93bc1deee..e2a8496d1 100644 --- a/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs +++ b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs @@ -39,8 +39,16 @@ namespace IRaCIS.Core.Domain.Models /// CreateUserId /// public Guid CreateUserId { get; set; } - - } + + public bool AltKey { get; set; } + + public bool CtrlKey { get; set; } + + public bool ShiftKey { get; set; } + + public bool MetaKey { get; set; } + + } }