diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemGeoDateTag.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemGeoDateTag.cs index 5e2d1dbb..a988836f 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemGeoDateTag.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemGeoDateTag.cs @@ -13,6 +13,25 @@ namespace RMuseum.Services.Implementation /// public partial class GanjoorService : IGanjoorService { + + private int? _PrepareLunarDateTotalNumber(PoemGeoDateTag tag) + { + if (tag.LunarYear == null) + return null; + int res = (int)tag.LunarYear * 10000; + if(tag.LunarMonth != null) + { + res += (int)tag.LunarMonth * 100; + + if(tag.LunarDay != null) + { + res += (int)tag.LunarDay; + } + } + return res; + + } + /// /// add poem geo tag /// @@ -22,6 +41,7 @@ namespace RMuseum.Services.Implementation { try { + tag.LunarDateTotalNumber = _PrepareLunarDateTotalNumber(tag); _context.PoemGeoDateTags.Add(tag); await _context.SaveChangesAsync(); return new RServiceResult(tag); @@ -49,7 +69,7 @@ namespace RMuseum.Services.Implementation dbTag.LunarMonth = tag.LunarMonth; dbTag.LunarDay = tag.LunarDay; dbTag.PoemId = tag.PoemId; - dbTag.LunarDateTotalNumber = tag.LunarDateTotalNumber; + dbTag.LunarDateTotalNumber = _PrepareLunarDateTotalNumber(tag); _context.Update(dbTag); await _context.SaveChangesAsync(); return new RServiceResult(true);