コード例 #1
0
        /// <summary>
        /// 服务操作
        /// </summary>
        /// <param name="op"></param>
        public ActionResult ServiceOperate(string op)
        {
            bool isSuccess = false;

            switch (op)
            {
            case "SetupQuartzService":     //安装调度服务
                isSuccess = ServiceControl.InstallQuartzService();
                break;

            case "UnSetupQuartzService":     //反安装调度服务
                isSuccess = ServiceControl.UninstallQuartzService();
                break;

            case "StartQuartzService":     //启动调度服务
                isSuccess = ServiceControl.StartQuartzService();
                break;

            case "StopQuartzService":     //停止调度服务
                isSuccess = ServiceControl.StopQuartzService();
                break;

            case "RestartQuartzService":     //重启动调度服务
                isSuccess = ServiceControl.RestartQuartzService();
                break;
            }
            string errMsg = ServiceControl.ErrMsg;

            return(Json(new ReturnResult()
            {
                Success = isSuccess, Message = errMsg
            }));
        }