public async Task OnCommandClicked(CommandClickEventArgs <SystemLogAdapterModel> args) { SystemLogAdapterModel item = args.RowData as SystemLogAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdRead) { #region 點選 修改紀錄 按鈕 CurrentRecord = item.Clone(); EditRecordDialogTitle = "修改紀錄"; IsShowEditRecord = true; isNewRecordMode = false; #endregion } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdDelete) { #region 點選 刪除紀錄 按鈕 CurrentNeedDeleteRecord = item; #region 檢查關聯資料是否存在 var checkedResult = await CurrentService .BeforeDeleteCheckAsync(CurrentNeedDeleteRecord); await Task.Delay(100); if (checkedResult.Success == false) { MessageBox.Show("400px", "200px", "警告", ErrorMessageMappingHelper.Instance.GetErrorMessage(checkedResult.MessageId), MessageBox.HiddenAsync); await Task.Yield(); await thisView.NeedRefreshAsync(); return; } #endregion #region 刪除這筆紀錄 await Task.Yield(); var checkTask = ConfirmMessageBox.ShowAsync("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?", ConfirmMessageBox.HiddenAsync); await thisView.NeedRefreshAsync(); var checkAgain = await checkTask; if (checkAgain == true) { var verifyRecordResult = await CurrentService.DeleteAsync(CurrentNeedDeleteRecord.Id); await TranscationResultHelper.CheckDatabaseResult(MessageBox, verifyRecordResult); dataGrid.RefreshGrid(); } #endregion #endregion } }
public async Task RemoveThisRecord(bool NeedDelete) { if (NeedDelete == true) { var verifyRecordResult = await CurrentService.DeleteAsync(CurrentNeedDeleteRecord.Id); await TranscationResultHelper.CheckDatabaseResult(MessageBox, verifyRecordResult); dataGrid.RefreshGrid(); } ConfirmMessageBox.Hidden(); }