Beispiel #1
0
        public async System.Threading.Tasks.Task SubmitAsync()
        {
            if (!form.IsValid())
            {
                return;
            }
            string error = string.Empty;

            isLoading  = true;
            Connection = form.GetValue <ConnectionEntity>();
            if (isCreate)
            {
                await ConnectionService.AddAsync(Connection);
            }
            else
            {
                await ConnectionService.UpdateAsync(Connection);
            }

            isLoading = false;
            if (!string.IsNullOrWhiteSpace(error))
            {
                Toast(error);
                return;
            }
            _ = DialogService.CloseDialogAsync(this, (object)null);
        }
Beispiel #2
0
        public async System.Threading.Tasks.Task SubmitAsync()
        {
            if (!form.IsValid())
            {
                return;
            }

            string error;

            Role = form.GetValue <RoleModel>();
            if (isCreate)
            {
                error = await UserService.CreateRoleAsync(Role);
            }
            else
            {
                error = await UserService.UpdateRoleAsync(Role);
            }
            if (!string.IsNullOrWhiteSpace(error))
            {
                Toast(error);
                return;
            }
            _ = DialogService.CloseDialogAsync(this, (object)null);
        }
Beispiel #3
0
        public async System.Threading.Tasks.Task SubmitAsync()
        {
            if (!form.IsValid())
            {
                return;
            }

            string error;

            EditingUser = form.GetValue <UserModel>();
            if (string.IsNullOrWhiteSpace(EditingUser.Password))
            {
                EditingUser.Password = "******";
            }
            if (isCreate)
            {
                error = await UserService.CreateUserAsync(EditingUser);
            }
            else
            {
                error = await UserService.UpdateUserAsync(EditingUser);
            }
            if (!string.IsNullOrWhiteSpace(error))
            {
                Toast(error);
                return;
            }
            _ = DialogService.CloseDialogAsync(this, (object)null);
        }
        public async Task SubmitAsync()
        {
            if (!form.IsValid())
            {
                return;
            }
            string error = string.Empty;

            isLoading      = true;
            OnlineTemplate = form.GetValue <OnlineTemplateToolEntity>();
            if (isCreate)
            {
                await OnlineTemplateService.AddAsync(OnlineTemplate);
            }
            else
            {
                await OnlineTemplateService.UpdateAsync(OnlineTemplate);
            }

            isLoading = false;
            if (!string.IsNullOrWhiteSpace(error))
            {
                Toast(error);
                return;
            }
            _ = DialogService.CloseDialogAsync(this, (object)null);
        }
Beispiel #5
0
 internal protected void Submit()
 {
     if (!form.IsValid())
     {
         return;
     }
     _ = DialogService.CloseDialogAsync(this, form.GetValue <LinkModel>());
 }
Beispiel #6
0
        internal void Submit()
        {
            if (!form.IsValid())
            {
                return;
            }

            var model = form.GetValue <CreateTableModel>();

            _ = DialogService.CloseDialogAsync(this, model);
        }
Beispiel #7
0
        public virtual async System.Threading.Tasks.Task ModifyAsync()
        {
            if (!form.IsValid())
            {
                return;
            }

            var info = form.GetValue <ModifyPasswordModel>();

            var result = await UserService.ChangePasswordAsync(Username, info.OldPassword, info.NewPassword);

            if (string.IsNullOrWhiteSpace(result))
            {
                _ = DialogService.CloseDialogAsync(this, info);
                return;
            }
            Toast(result);
        }
Beispiel #8
0
        protected async Task Submit()
        {
            formAlign = LabelAlign.Right;
            if (!demoForm.IsValid())
            {
                return;
            }
            bool result    = false;
            var  taskCount = await Quartzservice.CountAsync();

            if (taskCount > 15)
            {
                return;
            }
            var quartzOption = demoForm.GetValue <QuartzOptionDTO>();
            var quartzModel  = mapper.Map <QuartzModel>(quartzOption);

            quartzModel.LastRunTime = DateTime.Now;
            quartzModel.Describe ??= quartzOption.TaskName;

            if (Operation == Operation.Update)
            {
                if (quartzModel.Id == 1000 || quartzModel.Id == 1001)
                {
                    this.MessageService.Show($"默认任务不可修改 ", MessageType.Error);
                    return;
                }
                var          oldjob          = mapper.Map <QuartzOptionDTO>(Quartzservice.QueryById(quartzModel.Id));
                QuartzResult operationResult = null;
                if (oldjob != null)
                {
                    if (oldjob.TaskStatus != quartzOption.TaskStatus)
                    {
                        switch (quartzOption.TaskStatus)
                        {
                        case TriggerState.Normal:
                            operationResult = await schedulerFactory.Start(mapper.Map <QuartzOption>(oldjob));

                            break;

                        case TriggerState.Paused:
                            operationResult = await schedulerFactory.Pause(mapper.Map <QuartzOption> (oldjob));

                            break;

                        case TriggerState.Complete:
                        case TriggerState.Error:
                        case TriggerState.Blocked:
                        case TriggerState.None:
                            operationResult = await schedulerFactory.Remove(mapper.Map <QuartzOption>(oldjob));

                            break;

                        default:
                            throw new NotImplementedException(" unkown TriggerState");
                        }
                    }

                    result = await Quartzservice.UpdateAsync(quartzModel);

                    if (operationResult != null && operationResult.status)
                    {
                        this.MessageService.Show($"操作结果:{JsonConvert.SerializeObject(operationResult)} ");
                    }
                }
            }
            else
            {
                var AddJobResult = await schedulerFactory.AddJob(mapper.Map <QuartzOption>(quartzOption));

                if (!AddJobResult.status)
                {
                    this.MessageService.Show($"添加调度任务失败:{JsonConvert.SerializeObject(AddJobResult)} ");
                    return;
                }
                result = await Quartzservice.InsertAsync(quartzModel);

                if (!result)
                {
                    await schedulerFactory.Remove(mapper.Map <QuartzOption>(quartzOption));
                }
            }
            if (result)
            {
                await ResetCache();
            }
            this.MessageService.Show($"操作结果:{result} ");
            await DialogService.CloseDialogAsync(this, result);
        }