public async Task OnRecordEditConfirm()
        {
            #region 進行 Form Validation 檢查驗證作業
            if (LocalEditContext.Validate() == false)
            {
                return;
            }
            #endregion

            #region 檢查資料完整性
            #endregion

            if (IsShowEditRecord == true)
            {
                if (isNewRecordMode == true)
                {
                    await CurrentService.AddAsync(mapper.Map <Outline>(CurrentRecord));

                    Grid.Refresh();
                }
                else
                {
                    await CurrentService.UpdateAsync(mapper.Map <Outline>(CurrentRecord));

                    Grid.Refresh();
                }
                IsShowEditRecord = false;
            }
        }
Exemple #2
0
        public async Task OnRecordEditConfirm()
        {
            #region 進行 Form Validation 檢查驗證作業
            if (LocalEditContext.Validate() == false)
            {
                return;
            }
            #endregion

            #region 檢查資料完整性
            if (isNewRecordMode == true)
            {
                var checkedResult = await CurrentService
                                    .BeforeAddCheckAsync(mapper.Map <Outline>(CurrentRecord));

                if (checkedResult == false)
                {
                    ConfirmMessageBox.Show("400px", "200px", "警告", "該學生已經存在該課程內,無法完成新增");
                    return;
                }
            }
            else
            {
                var checkedResult = await CurrentService
                                    .BeforeUpdateCheckAsync(mapper.Map <Outline>(CurrentRecord));

                if (checkedResult == false)
                {
                    ConfirmMessageBox.Show("400px", "200px", "警告", "該學生已經存在該課程內,無法完成修改");
                    return;
                }
            }
            #endregion

            if (IsShowEditRecord == true)
            {
                if (isNewRecordMode == true)
                {
                    await CurrentService.AddAsync(mapper.Map <Outline>(CurrentRecord));

                    dataGrid.RefreshGrid();
                }
                else
                {
                    await CurrentService.UpdateAsync(mapper.Map <Outline>(CurrentRecord));

                    dataGrid.RefreshGrid();
                }
                IsShowEditRecord = false;
            }
        }