| | |
| | | 名称 |
| | | </summary> |
| | | </member> |
| | | <member name="T:FlexJobApi.Core.DeleteTaskInfoCommand"> |
| | | <summary> |
| | | 删除任务 |
| | | </summary> |
| | | </member> |
| | | <member name="T:FlexJobApi.Core.SaveTaskInfoCommand"> |
| | | <summary> |
| | | 保存任务 |
| | |
| | | /// 删除数据字典类别 |
| | | /// </summary> |
| | | [Resource([EnumResourceController.Dictionary])] |
| | | public class DeleteDictionaryCategoryCommand : DeleteDataCommand, IRequest<int> |
| | | public class DeleteDictionaryCategoryCommand : DeleteDataCommand |
| | | { |
| | | |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace FlexJobApi.Core |
| | | { |
| | | /// <summary> |
| | | /// 删除任务 |
| | | /// </summary> |
| | | [Resource([EnumResourceController.Task])] |
| | | public class DeleteTaskInfoCommand : DeleteDataCommand |
| | | { |
| | | |
| | | } |
| | | } |
| | |
| | | /// 删除菜单 |
| | | /// </summary> |
| | | [Resource([EnumResourceController.Menu])] |
| | | public class DeleteMenuCommand : DeleteDataCommand, IRequest<int> |
| | | public class DeleteMenuCommand : DeleteDataCommand |
| | | { |
| | | |
| | | } |
| | |
| | | /// 删除角色 |
| | | /// </summary> |
| | | [Resource([EnumResourceController.Role])] |
| | | public class DeleteRoleCommand : DeleteDataCommand, IRequest<int> |
| | | public class DeleteRoleCommand : DeleteDataCommand |
| | | { |
| | | |
| | | } |
| | |
| | | using System; |
| | | using MediatR; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | |
| | | /// <summary> |
| | | /// 删除命令 |
| | | /// </summary> |
| | | public abstract class DeleteDataCommand |
| | | public abstract class DeleteDataCommand : IRequest<int> |
| | | { |
| | | protected DeleteDataCommand() |
| | | { |
| | |
| | | /// </summary> |
| | | public class SmsUtils |
| | | { |
| | | private readonly IRepository<SmsLog> rep; |
| | | private readonly IRepository<SmsLog, LogDbContextLocator> rep; |
| | | private readonly AliyunSmsUtils aliyunSmsUtils; |
| | | |
| | | public SmsUtils( |
| | | IRepository<SmsLog> rep, |
| | | IRepository<SmsLog, LogDbContextLocator> rep, |
| | | AliyunSmsUtils aliyunSmsUtils) |
| | | { |
| | | this.rep = rep; |
| | |
| | | <param name="cancellationToken"></param> |
| | | <returns></returns> |
| | | </member> |
| | | <member name="M:FlexJobApi.FlexJobServer.Application.TaskInfoCommandHandler.Handle(FlexJobApi.Core.DeleteTaskInfoCommand,System.Threading.CancellationToken)"> |
| | | <summary> |
| | | 删除任务 |
| | | </summary> |
| | | <param name="request"></param> |
| | | <param name="cancellationToken"></param> |
| | | <returns></returns> |
| | | </member> |
| | | <member name="T:FlexJobApi.FlexJobServer.Application.TaskInfoQueryHandler"> |
| | | <summary> |
| | | 任务查询处理器 |
| | |
| | | ) : |
| | | IRequestHandler<SaveTaskInfoCommand, Guid>, |
| | | IRequestHandler<SetTaskInfoReleaseStatusCommand, int>, |
| | | IRequestHandler<SetTaskInfoRecommendStatusCommand, int> |
| | | IRequestHandler<SetTaskInfoRecommendStatusCommand, int>, |
| | | IRequestHandler<DeleteTaskInfoCommand, int> |
| | | { |
| | | private readonly IRepository<TaskInfo> rep = rep; |
| | | |
| | |
| | | return entities.Count; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除任务 |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public Task<int> Handle(DeleteTaskInfoCommand request, CancellationToken cancellationToken) |
| | | { |
| | | return request.DeleteData<TaskInfo>( |
| | | q => |
| | | { |
| | | q = TaskInfoRepository.GetQueryable(rep, false); |
| | | if (q.AsNoTracking().Any(it => it.Status == EnumTaskStatus.Complete)) |
| | | { |
| | | throw Oops.Oh(EnumErrorCodeType.s510, "已安排的任务无法删除"); |
| | | } |
| | | return q; |
| | | }, cancellationToken); |
| | | } |
| | | |
| | | private async Task BuildCode(TaskInfo entity) |
| | | { |
| | | entity.Code = $"{DateTime.Now:yyyyMMddHHmm}{new Random(IDGen.NextID().GetHashCode()).Next(1000, 9999)}"; |