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

            #region 檢查資料完整性
            var checkKindDateResult = CurrentRecord.CheckKindDate();
            if (string.IsNullOrEmpty(checkKindDateResult) == false)
            {
                MessageBox.Show("400px", "200px", "警告", checkKindDateResult);
                return;
            }
            #endregion

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

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

                    Grid.Refresh();
                }
                IsShowEditRecord = false;
            }
        }