public async Task OnCommandClicked(CommandClickEventArgs <ProductAdapterModel> args) { ProductAdapterModel item = args.RowData as ProductAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdEdit) { CurrentRecord = item.Clone(); EditRecordDialogTitle = "修改紀錄"; IsShowEditRecord = true; isNewRecordMode = false; } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdDelete) { 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)); await Task.Yield(); thisRazorComponent.NeedRefresh(); return; } #endregion ConfirmMessageBox.Show("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?"); } }
public async Task OnCommandClicked(CommandClickEventArgs <FlowInboxAdapterModel> args) { FlowInboxAdapterModel item = args.RowData as FlowInboxAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdEdit) { #region 點選 修改紀錄 按鈕 await CurrentService.MailReadedAsync(item); 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(); thisView.NeedRefresh(); return; } #endregion #region 刪除這筆紀錄 await Task.Yield(); var checkTask = ConfirmMessageBox.ShowAsync("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?", ConfirmMessageBox.HiddenAsync); thisView.NeedRefresh(); 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 OnCommandClicked(CommandClickEventArgs <OrderMasterAdapterModel> args) { OrderMasterAdapterModel item = args.RowData as OrderMasterAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdEdit) { #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)); await Task.Yield(); thisView.NeedRefresh(); return; } #endregion ConfirmMessageBox.Show("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?"); #endregion } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdShowDetailOfMaster) { #region 點選 開啟多筆 CRUD 對話窗 按鈕 IsShowMoreDetailsRecord = true; ShowMoreDetailsRecordDialogTitle = MagicHelper.訂單明細管理功能名稱; MasterRecord masterRecord = new MasterRecord() { Id = item.Id }; Header = masterRecord; if (ShowMoreDetailsGrid != null) { await Task.Delay(100); // 使用延遲,讓 Header 的資料綁定可以成功 ShowMoreDetailsGrid.RefreshGrid(); } #endregion } }
public Task ShowAsync(string width, string height, string title, string body, Func <Task> messageCallbackDelegate = null, int timeElapsing = 0, IRazorPage razorPage = null) { TimeElapsing = timeElapsing; RazorPage = razorPage; MessageDelegate = messageCallbackDelegate; TaskCompletionSource = new TaskCompletionSource(); Height = height; Width = width; Title = title; Body = body; IsVisible = true; if (TimeElapsing > 0 && RazorPage != null) { WaitTask = Task.Run(async() => { int timeCounter = 0; while (true) { if (timeCounter > TimeElapsing) { if (messageCallbackDelegate != null) { await messageCallbackDelegate(); } await RazorPage.NeedInvokeAsync(() => { RazorPage.NeedRefresh(); }); break; } await Task.Delay(500); timeCounter += 500; } }); } return(TaskCompletionSource.Task); }
public async Task OnCommandClicked(CommandClickEventArgs <PolicyHeaderAdapterModel> args) { PolicyHeaderAdapterModel item = args.RowData as PolicyHeaderAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdEdit) { #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(); thisView.NeedRefresh(); return; } #endregion #region 刪除這筆紀錄 await Task.Yield(); var checkTask = ConfirmMessageBox.ShowAsync("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?", ConfirmMessageBox.HiddenAsync); thisView.NeedRefresh(); var checkAgain = await checkTask; if (checkAgain == true) { var verifyRecordResult = await CurrentService.DeleteAsync(CurrentNeedDeleteRecord.Id); await TranscationResultHelper.CheckDatabaseResult(MessageBox, verifyRecordResult); dataGrid.RefreshGrid(); } #endregion #endregion } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdShowDetailOfMaster) { #region 點選 開啟多筆 CRUD 對話窗 按鈕 IsShowMoreDetailsRecord = true; ShowMoreDetailsRecordDialogTitle = MagicHelper.簽核流程政策明細; MasterRecord masterRecord = new MasterRecord() { Id = item.Id }; Header = masterRecord; if (ShowMoreDetailsGrid != null) { await Task.Delay(100); // 使用延遲,讓 Header 的資料綁定可以成功 ShowMoreDetailsGrid.RefreshGrid(); } #endregion } }
public async Task OnCommandClicked(CommandClickEventArgs <FlowMasterAdapterModel> args) { FlowMasterAdapterModel item = args.RowData as FlowMasterAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdEdit) { #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); thisView.NeedRefresh(); if (checkedResult.Success == false) { var checkTask1 = ConfirmMessageBox.ShowAsync("400px", "200px", "警告", $"你確定真的要刪除與這筆紀錄相關紀錄嗎?例如:收件匣、簽呈使用者、簽成歷史紀錄 ({checkedResult.Message})", ConfirmMessageBox.HiddenAsync); thisView.NeedRefresh(); var checkAgain1 = await checkTask1; if (checkAgain1 == true) { var verifyRecordResult = await CurrentService.DeleteAsync(CurrentNeedDeleteRecord.Id); await TranscationResultHelper.CheckDatabaseResult(MessageBox, verifyRecordResult); dataGrid.RefreshGrid(); } await Task.Yield(); thisView.NeedRefresh(); return; } #endregion #region 刪除這筆紀錄 await Task.Yield(); var checkTask = ConfirmMessageBox.ShowAsync("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?", ConfirmMessageBox.HiddenAsync); thisView.NeedRefresh(); var checkAgain = await checkTask; if (checkAgain == true) { var verifyRecordResult = await CurrentService.DeleteAsync(CurrentNeedDeleteRecord.Id); await TranscationResultHelper.CheckDatabaseResult(MessageBox, verifyRecordResult); dataGrid.RefreshGrid(); } #endregion #endregion } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdShowFlowUser) { #region 點選 稽核使用者 對話窗 按鈕 IsShowFlowUserRecord = true; ShowMoreDetailsRecordDialogTitle = MagicHelper.簽核使用者明細; MasterRecord masterRecord = new MasterRecord() { Id = item.Id }; Header = masterRecord; if (ShowFlowUserGrid != null) { await Task.Delay(100); // 使用延遲,讓 Header 的資料綁定可以成功 ShowFlowUserGrid.RefreshGrid(); } #endregion } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdShowFlowHistory) { #region 點選 開啟多筆 CRUD 對話窗 按鈕 IsShowFlowHistoryRecord = true; ShowMoreDetailsRecordDialogTitle = MagicHelper.簽核歷史紀錄; MasterRecord masterRecord = new MasterRecord() { Id = item.Id }; Header = masterRecord; if (ShowFlowHistoryGrid != null) { await Task.Delay(100); // 使用延遲,讓 Header 的資料綁定可以成功 ShowFlowHistoryGrid.RefreshGrid(); } #endregion } }