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 <Department>(CurrentRecord));

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

                    dataGrid.RefreshGrid();
                }
                IsShowEditRecord = false;
            }
        }
示例#2
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 <Holuser>(CurrentRecord));

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

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

            #region 檢查資料完整性
            #endregion

            if (IsShowEditRecord == true)
            {
                if (isNewRecordMode == true)
                {
                    Random rm = new Random();
                    CurrentRecord.CourseId = rm.Next(1000, 999999);
                    await CurrentService.AddAsync(mapper.Map <Course>(CurrentRecord));

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

                    Grid.Refresh();
                }
                IsShowEditRecord = false;
            }
        }
        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", "警告",
                                    VerifyRecordResultHelper.GetMessageString(checkedResult),
                                    MessageBox.HiddenAsync);
                    thisView.NeedRefresh();
                    return;
                }
            }
            else
            {
                var checkedResult = await CurrentService
                                    .BeforeUpdateCheckAsync(CurrentRecord);

                if (checkedResult.Success == false)
                {
                    MessageBox.Show("400px", "200px", "警告",
                                    VerifyRecordResultHelper.GetMessageString(checkedResult), MessageBox.HiddenAsync);
                    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;
            }
        }
        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)
                {
                    await CurrentService.AddAsync(CurrentRecord);

                    dataGrid.RefreshGrid();
                }
                else
                {
                    await CurrentService.UpdateAsync(CurrentRecord);

                    dataGrid.RefreshGrid();
                }
                IsShowEditRecord = false;
            }
        }
示例#6
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;
            }
        }
示例#7
0
        public async Task OnSaveAsync()
        {
            Relogin = false;

            MyUserAdapterModel myUserAdapterModel = new MyUserAdapterModel();

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

            #region 其他資料完整性驗證
            if (ChangePasswordModel.NewPasswordAgain != ChangePasswordModel.NewPassword)
            {
                MessageBox.Show("400px", "200px",
                                ErrorMessageMappingHelper.Instance.GetErrorMessage(ErrorMessageEnum.警告),
                                ErrorMessageMappingHelper.Instance.GetErrorMessage(ErrorMessageEnum.新密碼2次輸入須相同),
                                CloseMessageBox);
                return;
            }
            else
            {
                myUserAdapterModel = await ChangePasswordService.GetCurrentUser();

                if (myUserAdapterModel == null)
                {
                    MessageBox.Show("400px", "200px",
                                    ErrorMessageMappingHelper.Instance.GetErrorMessage(ErrorMessageEnum.警告),
                                    ErrorMessageMappingHelper.Instance.GetErrorMessage(ErrorMessageEnum.使用者不存在),
                                    CloseMessageBox);
                    return;
                }
            }
            #endregion

            #region 進行密碼變更
            await ChangePasswordService.ChangePassword(myUserAdapterModel, ChangePasswordModel.NewPassword,
                                                       HttpContextAccessor.GetConnectionIP());

            Relogin = true;
            MessageBox.Show("400px", "200px",
                            ErrorMessageMappingHelper.Instance.GetErrorMessage(ErrorMessageEnum.警告),
                            ErrorMessageMappingHelper.Instance.GetErrorMessage(ErrorMessageEnum.密碼已經變更成功),
                            CloseMessageBox);

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

            #region 其他資料完整性驗證
            #endregion

            #region 進行密碼變更
            await SystemEnvironmentService.UpdateAsync(SystemEnvironmentModel);

            MessageBox.Show("400px", "200px", "通知", "紀錄已經儲存成功", MessageBox.HiddenAsync);

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

            #region 其他資料完整性驗證
            #endregion

            #region 進行密碼變更
            await AccountPolicyService.UpdateAsync(AccountPolicyModel);

            await thisView.NeedRefreshAsync();

            await Task.Delay(200);

            MessageBox.Show("400px", "200px", "通知", "紀錄已經儲存成功", MessageBox.HiddenAsync);

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

            #region 檢查資料完整性
            if (isNewRecordMode == true)
            {
                if (string.IsNullOrEmpty(CurrentRecord.PasswordPlaintext))
                {
                    MessageBox.Show("400px", "200px", "警告",
                                    ErrorMessageMappingHelper.Instance.GetErrorMessage(ErrorMessageEnum.密碼不能為空白),
                                    MessageBox.HiddenAsync);
                    thisView.NeedRefresh();
                    return;
                }
                var checkedResult = await CurrentService
                                    .BeforeAddCheckAsync(CurrentRecord);

                if (checkedResult.Success == false)
                {
                    MessageBox.Show("400px", "200px", "警告",
                                    VerifyRecordResultHelper.GetMessageString(checkedResult), MessageBox.HiddenAsync);
                    thisView.NeedRefresh();
                    return;
                }
                CurrentRecord.Salt     = Guid.NewGuid().ToString();
                CurrentRecord.Password =
                    PasswordHelper.GetPasswordSHA(CurrentRecord.Salt, CurrentRecord.PasswordPlaintext);
            }
            else
            {
                var checkedResult = await CurrentService
                                    .BeforeUpdateCheckAsync(CurrentRecord);

                if (checkedResult.Success == false)
                {
                    MessageBox.Show("400px", "200px", "警告",
                                    VerifyRecordResultHelper.GetMessageString(checkedResult), MessageBox.HiddenAsync);
                    thisView.NeedRefresh();
                    return;
                }
                if (string.IsNullOrEmpty(CurrentRecord.PasswordPlaintext) == false)
                {
                    CurrentRecord.Password =
                        PasswordHelper.GetPasswordSHA(CurrentRecord.Salt, CurrentRecord.PasswordPlaintext);
                }
            }
            #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;
            }
        }