| #region << 版 本 注 释 >> | 
| /*---------------------------------------------------------------- | 
|  * 命名空间:WIDESEAWCS_QuartzJob | 
|  * 创建者:胡童庆 | 
|  * 创建时间:2024/8/2 16:13:36 | 
|  * 版本:V1.0.0 | 
|  * 描述:自定义调度服务异常类 | 
|  * | 
|  * ---------------------------------------------------------------- | 
|  * 修改人: | 
|  * 修改时间: | 
|  * 版本:V1.0.1 | 
|  * 修改说明: | 
|  *  | 
|  *----------------------------------------------------------------*/ | 
| #endregion << 版 本 注 释 >> | 
|   | 
| using System; | 
| using System.Collections.Generic; | 
| using System.Linq; | 
| using System.Text; | 
| using System.Threading.Tasks; | 
|   | 
| namespace WIDESEAWCS_QuartzJob.CustomException | 
| { | 
|     /// <summary> | 
|     /// 定时器错误类 | 
|     /// </summary> | 
|     [Serializable] | 
|     public class QuartzJobException : Exception | 
|     { | 
|   | 
|         /// <summary> | 
|         /// 错误代码 | 
|         /// </summary> | 
|         public int? ErrorCode { get; } | 
|   | 
|         /// <summary> | 
|         /// 错误类型 | 
|         /// </summary> | 
|         public string ErrorType { get; } | 
|   | 
|         public Exception? BaseException { get; } | 
|   | 
|         public override string Message => _message; | 
|   | 
|         private string _message; | 
|   | 
|         /// <summary>   | 
|         /// 初始化一个新的 CommunicationException 实例。   | 
|         /// </summary>   | 
|         /// <param name="message">错误的描述。</param>   | 
|         /// <param name="errorType">错误类型。</param>   | 
|         /// <param name="errorCode">错误代码(可选)。</param>   | 
|         /// <param name="innerException">导致当前异常的异常(可选)。</param>   | 
|         public QuartzJobException(string message, string errorType = "", int? errorCode = null, Exception? innerException = null) | 
|         { | 
|             ErrorCode = errorCode; | 
|             ErrorType = errorType; | 
|             BaseException = innerException; | 
|             _message = message; | 
|         } | 
|   | 
|         public override string ToString() | 
|         { | 
|             return base.ToString(); | 
|         } | 
|     } | 
|   | 
|   | 
|     public enum QuartzJobErrorType | 
|     { | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         Warning, | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         Error, | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         Exception, | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         LogicError | 
|     } | 
|   | 
|     /// <summary> | 
|     /// 调度服务异常 | 
|     /// </summary> | 
|     public class QuartzJobExceptionMessage | 
|     { | 
|         public const string StartJobException = "调度服务开启异常,错误信息:{0}"; | 
|   | 
|         public const string StopJobException = "调度服务停止异常,错误信息:{0}"; | 
|   | 
|         public const string AddJobException = "调度计划添加异常:【{0}】,错误信息:{1}"; | 
|   | 
|         public const string JobFactoryInstanceException = "从Factory中获取Scheduler实例异常,错误信息:{0}"; | 
|   | 
|         public const string StopAJobException = "调度计划【{0}】停止异常,错误信息:{1}"; | 
|   | 
|         public const string ResumeJobException = "调度计划【{0}】恢复异常,错误信息:{1}"; | 
|   | 
|         public const string ExecuteJobException = "立即执行调度计划:【{0}】异常,错误信息:{1}"; | 
|     } | 
|   | 
|     /// <summary> | 
|     /// 调度服务信息 | 
|     /// </summary> | 
|     public class QuartzJobInfoMessage | 
|     { | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string JobHasStart = "调度服务已经开启"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string StartJobSuccess = "调度服务开启成功"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string JobHasStop = "调度服务已经停止"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string StopJobSuccess = "调度服务停止成功"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string JobHasAdd = "该调度计划已经在执行:【{0}】,请勿重复启动!"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string JobAddSuccess = "【{0}】调度计划添加到调度中心成功"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string JobNotExist = "调度计划不存在:【{0}】"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string StopAJobSuccess = "调度计划【{0}】停止成功"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string ResumeJobSuccess = "调度计划【{0}】恢复成功"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string ResumeJobNotExist = "未找到要恢复的调度计划:【{0}】"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string PauseJobSuccess = "调度计划【{0}】暂停成功"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string PauseJobNotExist = "未找到要暂停的调度计划:【{0}】"; | 
|   | 
|         /// <summary> | 
|         ///  | 
|         /// </summary> | 
|         public const string ExecuteJobSuccess = "立即执行调度计划:【{0}】成功"; | 
|     } | 
| } |