public async Task OnRecordEditConfirm() { #region 進行 Form Validation 檢查驗證作業 if (LocalEditContext.Validate() == false) { return; } #endregion #region 檢查資料完整性 if (isNewRecordMode == true) { var checkedResult = await CurrentService .BeforeAddCheckAsync(CurrentRecord); if (checkedResult.Success == false) { MessageBox.Show("400px", "200px", "警告", ErrorMessageMappingHelper.Instance.GetErrorMessage(checkedResult.MessageId)); thisView.NeedRefresh(); return; } } else { var checkedResult = await CurrentService .BeforeUpdateCheckAsync(CurrentRecord); if (checkedResult.Success == false) { MessageBox.Show("400px", "200px", "警告", ErrorMessageMappingHelper.Instance.GetErrorMessage(checkedResult.MessageId)); thisView.NeedRefresh(); return; } } #endregion if (IsShowEditRecord == true) { if (isNewRecordMode == true) { var verifyRecordResult = await CurrentService.AddAsync(CurrentRecord); await TranscationResultHelper.CheckDatabaseResult(MessageBox, verifyRecordResult); dataGrid.RefreshGrid(); } else { var verifyRecordResult = await CurrentService.UpdateAsync(CurrentRecord); await TranscationResultHelper.CheckDatabaseResult(MessageBox, verifyRecordResult); dataGrid.RefreshGrid(); } IsShowEditRecord = false; } }