소스 검색

Merge branch 'TPE/develop' of http://163.228.141.122:3000/TEAMMODEL/TEAMModelOS into TPE/develop

jeff 8 달 전
부모
커밋
82697f2e94
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      TEAMModelOS.Function/IESServiceBusTrigger.cs

+ 11 - 0
TEAMModelOS.Function/IESServiceBusTrigger.cs

@@ -41,6 +41,7 @@ using System.Security.Policy;
 using System.Net.Http.Headers;
 using Microsoft.AspNetCore.Hosting;
 using Newtonsoft.Json.Linq;
+using static TEAMModelOS.SDK.Models.JointEvent;
 
 namespace TEAMModelOS.Function
 {
@@ -3282,6 +3283,7 @@ namespace TEAMModelOS.Function
 
                 string location = Environment.GetEnvironmentVariable("Option:Location");
                 var client = _azureCosmos.GetCosmosClient();
+                var table = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
                 string lang = (location.Contains("China")) ? "zh-cn" : "zh-tw";
 
                 StringBuilder sqlStr = new StringBuilder($"SELECT DISTINCT c.creatorId, c.creatorName, c.creatorEmail FROM c WHERE c.jointEventId = '{jointEventId}' ");
@@ -3340,6 +3342,15 @@ namespace TEAMModelOS.Function
                         }
                     }
                 }
+                //將寄送訊息刪除
+                string tablePartitionKey = string.Format("{0}{1}{2}{3}{4}", "JointMessage", "-", $"{jointEventId}", "-", $"{type}"); //主key: JointMessage-{jointEventId}-{type}  RowKey: {jointScheduleId}
+                string tableRowKey = $"{jointScheduleId}";
+                List<ChangeRecord> records = await table.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", tableRowKey }, { "PartitionKey", tablePartitionKey } });
+                if (records.Count > 0)
+                {
+                    await table.Delete<ChangeRecord>(records[0]);
+                }
+
             }
             catch (Exception ex)
             {