├── .gitattributes ├── .gitignore ├── .nuget ├── NuGet.Config ├── NuGet.exe └── NuGet.targets ├── Dapper.SimpleCRUD ├── Dapper.SimpleCRUD.csproj ├── Properties │ └── AssemblyInfo.cs ├── SimpleCRUD.cs └── packages.config ├── README.md ├── TaskManager.sln ├── TaskManagerWeb ├── Content │ ├── Css │ │ ├── bootstrap.min.css │ │ ├── common.css │ │ ├── font-awesome.min.css │ │ ├── icon.css │ │ ├── index.css │ │ ├── login.css │ │ ├── plugins │ │ │ ├── jqgrid │ │ │ │ └── ui.jqgrid.css │ │ │ └── webuploader │ │ │ │ └── webuploader.css │ │ ├── style.css │ │ └── themes │ │ │ ├── bootstrap │ │ │ ├── easyui.css │ │ │ ├── easyui.min.css │ │ │ └── images │ │ │ │ ├── panel_tools.png │ │ │ │ ├── spinner_arrows.png │ │ │ │ └── tabs_icons.png │ │ │ └── icon.css │ ├── Image │ │ ├── 404.png │ │ ├── 500.png │ │ ├── favicon.ico │ │ ├── head-bg.png │ │ ├── login_bg.jpg │ │ ├── login_ico.gif │ │ └── user.png │ ├── Scripts │ │ ├── Config.js │ │ ├── bootstrap.min.js │ │ ├── cron.js │ │ ├── framework.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery.easyui.min.js │ │ └── plugins │ │ │ ├── artTemplate │ │ │ ├── template-native.js │ │ │ └── template.js │ │ │ ├── iCheck │ │ │ ├── custom.css │ │ │ ├── green.png │ │ │ ├── green@2x.png │ │ │ └── icheck.min.js │ │ │ ├── jqgrid │ │ │ ├── i18n │ │ │ │ └── grid.locale-cn.js │ │ │ └── jquery.jqGrid.min.js │ │ │ ├── layer │ │ │ ├── extend │ │ │ │ └── layer.ext.js │ │ │ ├── laydate │ │ │ │ ├── laydate.js │ │ │ │ ├── need │ │ │ │ │ └── laydate.css │ │ │ │ └── skins │ │ │ │ │ └── default │ │ │ │ │ ├── icon.png │ │ │ │ │ └── laydate.css │ │ │ ├── layer.min.js │ │ │ ├── layim │ │ │ │ ├── data │ │ │ │ │ ├── chatlog.json │ │ │ │ │ ├── friend.json │ │ │ │ │ ├── group.json │ │ │ │ │ └── groups.json │ │ │ │ ├── layim.css │ │ │ │ ├── layim.js │ │ │ │ └── loading.gif │ │ │ └── skin │ │ │ │ ├── default │ │ │ │ ├── icon-ext.png │ │ │ │ ├── icon.png │ │ │ │ ├── icon_ext.png │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ ├── loading-2.gif │ │ │ │ ├── textbg.png │ │ │ │ ├── xubox_ico0.png │ │ │ │ ├── xubox_loading0.gif │ │ │ │ ├── xubox_loading1.gif │ │ │ │ ├── xubox_loading2.gif │ │ │ │ ├── xubox_loading3.gif │ │ │ │ └── xubox_title0.png │ │ │ │ ├── layer.css │ │ │ │ ├── layer.ext.css │ │ │ │ └── moon │ │ │ │ ├── default.png │ │ │ │ └── style.css │ │ │ ├── slimscroll │ │ │ └── jquery.slimscroll.min.js │ │ │ ├── validate │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.metadata.js │ │ │ ├── jquery.validate.min.js │ │ │ └── messages_zh.min.js │ │ │ └── webuploader │ │ │ ├── Uploader.swf │ │ │ ├── webuploader.custom.js │ │ │ ├── webuploader.custom.min.js │ │ │ ├── webuploader.fis.js │ │ │ ├── webuploader.flashonly.js │ │ │ ├── webuploader.flashonly.min.js │ │ │ ├── webuploader.html5only.js │ │ │ ├── webuploader.html5only.min.js │ │ │ ├── webuploader.js │ │ │ ├── webuploader.min.js │ │ │ ├── webuploader.noimage.js │ │ │ ├── webuploader.noimage.min.js │ │ │ ├── webuploader.nolog.js │ │ │ ├── webuploader.nolog.min.js │ │ │ ├── webuploader.withoutimage.js │ │ │ └── webuploader.withoutimage.min.js │ └── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── fontawesome-webfont.woff2 │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 ├── CustomBootstrapper.cs ├── Excel │ └── TaskExcelImport.cs ├── Modules │ ├── BaseModule.cs │ ├── ConfigModule.cs │ ├── ErrorModule.cs │ ├── ExcelModule.cs │ ├── HomeModule.cs │ ├── LogModule.cs │ ├── LoginModule.cs │ ├── TagsModule.cs │ ├── TaskModule.cs │ └── ToolModule.cs ├── Properties │ └── AssemblyInfo.cs ├── Startup.cs ├── TaskManagerWeb.csproj ├── Template │ ├── Entity.vm │ └── Excel │ │ └── 任务批量导入.xls ├── Views │ ├── Config │ │ └── Grid.cshtml │ ├── Error │ │ └── NotFound.html │ ├── Home │ │ ├── DestTop.cshtml │ │ └── Index.cshtml │ ├── Login │ │ └── Index.cshtml │ ├── Shared │ │ └── _Layout.cshtml │ ├── Task │ │ ├── Edit.cshtml │ │ └── Grid.cshtml │ ├── Tool │ │ ├── CommandLine.cshtml │ │ ├── CronExpress.cshtml │ │ ├── ExceptionLog.cshtml │ │ ├── SysLog.cshtml │ │ └── TableList.cshtml │ └── _ViewStart.cshtml ├── app.config └── packages.config ├── YwdSoft.ConsoleHosting ├── App_Data │ └── TaskManager.db ├── Config │ └── Config.config ├── DLL │ └── HttpHelper.dll ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── YwdSoft.ConsoleHosting.csproj ├── app.config ├── favicon.ico └── packages.config ├── YwdSoft.Service ├── DapperDemoService.cs ├── Properties │ └── AssemblyInfo.cs ├── TableListService.cs ├── YwdSoft.Service.csproj └── app.config ├── Ywdsoft.MessageTransmit ├── LogMessageTransmit.cs ├── Properties │ └── AssemblyInfo.cs ├── Ywdsoft.MessageTransfers.csproj ├── app.config └── packages.config ├── Ywdsoft.Model ├── Common │ ├── Tags.cs │ └── UserAccount.cs ├── ExpressCompany.cs ├── Properties │ └── AssemblyInfo.cs ├── RabbitMQ │ ├── LogMessage.cs │ └── MQMessage.cs ├── Ywdsoft.Model.csproj └── packages.config ├── Ywdsoft.Task ├── Properties │ └── AssemblyInfo.cs ├── TaskSet │ ├── ConfigJob.cs │ ├── LogClearJob.cs │ ├── MQSendJob.cs │ └── TestJob.cs ├── Utils │ └── TaskLog.cs ├── Ywdsoft.Task.csproj ├── app.config └── packages.config ├── Ywdsoft.Utility ├── Admin │ ├── AdminRun.cs │ └── MachineNumber.cs ├── Auth │ ├── UserInfo.cs │ └── UserService.cs ├── Command │ ├── ClsCommand.cs │ ├── CommandHelp.cs │ ├── ExitCommand.cs │ ├── HelpCommand.cs │ ├── HttpCommand.cs │ ├── ICommand.cs │ ├── LogCommand.cs │ ├── PortCommand.cs │ ├── RestartCommand.cs │ └── WebResourceUpdateCommand.cs ├── Config │ ├── ConfigInit.cs │ └── SysConfig.cs ├── ConfigHandler │ ├── Config │ │ ├── LogConfig.cs │ │ ├── RabbitConfig.cs │ │ ├── SystemConfig.cs │ │ └── TaskConfig.cs │ ├── ConfigAttribute.cs │ ├── ConfigDescription.cs │ ├── ConfigManager.cs │ ├── ConfigOption.cs │ ├── ConfigTypeAttribute.cs │ ├── IConfigService.cs │ └── Options.cs ├── DB │ ├── ConvertExt.cs │ ├── DapperHelper.cs │ ├── DbHelper.cs │ ├── Reflection │ │ ├── DynamicMethodEmit.cs │ │ ├── MethodWrapper.cs │ │ ├── PropertyWrapper.cs │ │ └── ReflectionExtensions.cs │ ├── SQLHelper.cs │ └── Xml │ │ ├── MyCDATA.cs │ │ ├── XmlCommandItem.cs │ │ ├── XmlCommandManager.cs │ │ └── XmlHelper.cs ├── Encrypt │ └── DESEncrypt.cs ├── EntityCode │ └── EntityCodeHelper.cs ├── Enum │ └── EnumHelper.cs ├── Excel │ ├── ColumnInfo.cs │ ├── ExcelImporMapper.cs │ ├── ExcelImport.cs │ ├── ExcelInfo.cs │ ├── ExcelUtil.cs │ └── NpoiHelper.cs ├── File │ └── FileHelper.cs ├── Filter │ ├── ApiResult.cs │ ├── Pagination.cs │ └── QueryCondition.cs ├── Http │ └── MimeHelper.cs ├── Log │ └── LogHelper.cs ├── Mef │ └── MefConfig.cs ├── NVelocity │ └── FileGen.cs ├── Properties │ └── AssemblyInfo.cs ├── Quartz │ ├── CustomTriggerListener.cs │ ├── QuartzHelper.cs │ └── TaskUtil.cs ├── RabbitMQ │ ├── MessageTransmit.cs │ ├── MessageTransmitAction.cs │ └── RabbitMQClient.cs ├── Regex │ └── RegexHelper.cs ├── StaticExtend │ ├── DataTableListHelper.cs │ └── StringExt.cs ├── Tags │ ├── ITagService.cs │ └── TagsSourceType.cs ├── Time │ └── TimeHelper.cs ├── Ywdsoft.Utility.csproj ├── Zip │ └── SharpZip.cs ├── app.config ├── log4net.config └── packages.config ├── Ywdsoft.WindowService ├── Program.cs ├── ProjectInstaller.Designer.cs ├── ProjectInstaller.cs ├── ProjectInstaller.resx ├── Properties │ └── AssemblyInfo.cs ├── TaskManagerService.Designer.cs ├── TaskManagerService.cs ├── Ywdsoft.WindowService.csproj ├── app.config ├── favicon.ico ├── packages.config ├── 关闭服务.bat ├── 删除服务.bat ├── 安装启动服务.bat ├── 服务安装卸载工具.exe └── 部署说明.txt └── Ywdsoft.XmlCommand ├── Properties └── AssemblyInfo.cs ├── Tool └── Table.config └── Ywdsoft.XmlCommand.csproj /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | .idea 4 | *.log 5 | bin 6 | obj 7 | .vs 8 | packages 9 | *.csproj.user 10 | DailyBuild -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/.nuget/NuGet.exe -------------------------------------------------------------------------------- /Dapper.SimpleCRUD/Dapper.SimpleCRUD.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B8DFFA5B-823E-48F2-B271-8374438F40BE} 8 | Library 9 | Properties 10 | Dapper.SimpleCRUD 11 | Dapper.SimpleCRUD 12 | v4.0 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\Dapper.1.50.2\lib\net40\Dapper.dll 35 | True 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 60 | -------------------------------------------------------------------------------- /Dapper.SimpleCRUD/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Dapper.SimpleCRUD")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Dapper.SimpleCRUD")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("b8dffa5b-823e-48f2-b271-8374438f40be")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Dapper.SimpleCRUD/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TaskManager 2 | 任务管理平台 3 | 1. 系统简介 4 | 你曾经需要应用执行一个任务吗?这个任务每天或每周星期二晚上11:30,或许仅仅每个月的最后一天执行。一个自动执行而无须干预的任务在执行过程中如果发生一个严重错误,应用能够知到其执行失败并尝试重新执行吗?你和你的团队是用.NET编程吗?如果这些问题中任何一个你回答是,那么你可以使用Quartz.NET调度器。 Quartz.NET允许开发人员根据时间间隔(或天)来调度作业。它实现了作业和触发器的多对多关系,还能把多个作业与不同的触发器关联。 5 | 6 | 本系统通过window服务来集成Quartz.net,通过修改配置文件和添加相应Job即可完成作业添加,使用简单方便。 7 | 8 | 2. 项目结构 9 | 系统目前包含六个项目,如下图所示 10 | 11 | 3. 开发过程 12 | 添加一个新任务步骤如下 13 |  在Mysoft.Task项目TaskSet文件夹下添加继承IJob接口的任务类,可以参照现有的IpProxyJob 14 | 15 | 16 |  修改TaskConfig.xml配置文件 17 | 添加好具体的任务实现之后,需要配置任务的相关执行参数了。TaskConfig.xml在Mysoft.Task项目下 18 | 19 | 每个节点的意思都清楚的注释了,现在为我们刚加上的TestJob任务添加相关配置 20 | 21 | 2 22 | 测试任务,输出当前时间 23 | 24 | 25 | * */30 * * * ? 26 | Mysoft.Task.TaskSet 27 | TestJob 28 | true 29 | 30 | 31 | 最重要的部分运行频率CronExpressionString需要怎么写?这里也替大家考虑到了,可以使用在线Cron生成器来生成,地址http://jason.hahuachou.com/cron/index.htm 32 | 33 |  完成以上两步,即完成了一个新任务的添加,是不是很简单呢。 34 | 4. 安装部署 35 | 由于项目使用的是Window服务来搭载Quartz.net,那么项目的安装即安装Window服务。 36 | 本来可以通过批处理来完成服务安装卸载的,本人嫌这个太麻烦,于是写了Windows服务安装卸载小工具,源码在WSWinForm项目里面。 37 | 38 | 生成整个解决方案以后,右键以管理员方式打开WSWinForm.exe文件,选择TaskManager服务进行安装运行 39 | 40 | 运行成功后会生成Logs文件夹,记录执行日志的 41 | 42 | 5. 其它说明 43 | 目前系统内置了三个定时任务 44 | 1. 代理ip爬虫 45 | 每隔一小时从网站上爬取最新的代理IP信息,爬下来的数据存在p_IPProxy表 46 | 47 | 2. 快递进度查询 48 | 可以查询目前各种快递的进度信息,相关表p_ExpressCompany(快递公司表) 49 | p_ExpressInfo(快递信息表) p_ExpressHistoryInfo(快递信息历史记录表) 50 | p_ExpressProcessDetail(快递进度信息表) 51 | 52 | 目前使用该任务需要自己手工网表p_ExpressInfo里面插入数据 53 | INSERT INTO dbo.p_ExpressInfo( ExpressNo ,ExpressCompanyCode ,Receiver ) 54 | SELECT '880373857190629830' AS ExpressNo,'yuantong' AS ExpressCompanyCode,'youemail@qq.com' AS Receiver 55 | UNION ALL 56 | SELECT '9940055317546' AS ExpressNo,'youzhengguonei' AS ExpressCompanyCode,'youemail@qq.com' AS Receiver 57 | 58 | 其中youemail@qq.com为接收进度信息变更邮箱地址,只要有进度变更,系统会自动发邮件提醒。 59 | ExpressNo:为快递单号 60 | ExpressCompanyCode:快递公司Code 该值可从p_ExpressCompany表里面进行查询 61 | 62 | CompanyCode即为ExpressCompanyCode 63 | 64 | 3. 消息通知(邮件) 65 | 消息通知相关表p_Message(待发送消息表),p_MessageHistory(已发送或者发送失败消息表) 66 | 67 | 目前快递任务有信息变更会插入一条消息,消息通知任务3分钟轮询一次p_Message表,对于每个消息最多会进行三次发送(前两次都失败),发送完成将p_Message数据插入到p_MessageHistory 68 | 69 | 快递进度信息收到的邮件效果如下,方便你随时跟踪你的快递信息 70 | 71 | 72 | 73 | 4. 系统配置 74 | 当然系统要正常运行还需要进行相关配置,配置文件在Config\ Config.xml里面,目前只有两条相关配置 75 | 76 | 数据库连接信息 77 | 使用者可以拿从SVN下载代码MyDocument项目下的任务系统”SQL合并脚本_20150911.sql”执行创建相关表和初始数据 78 | 79 | 邮件服务器信息 80 | 系统发邮件的功能时使用的SMTP服务器,目前可使用的有163邮箱,QQ邮箱,关于C#使用SMTP发邮件相关配置可自行百度。配置好这些内容以后 81 | 就可以使用windows安装卸载工具来启动任务系统了。 82 | -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/icon.css: -------------------------------------------------------------------------------- 1 | .icon-blank{ 2 | background:url('icons/blank.gif') no-repeat center center; 3 | } 4 | .icon-add{ 5 | background:url('icons/edit_add.png') no-repeat center center; 6 | } 7 | .icon-edit{ 8 | background:url('icons/pencil.png') no-repeat center center; 9 | } 10 | .icon-remove{ 11 | background:url('icons/edit_remove.png') no-repeat center center; 12 | } 13 | .icon-save{ 14 | background:url('icons/filesave.png') no-repeat center center; 15 | } 16 | .icon-cut{ 17 | background:url('icons/cut.png') no-repeat center center; 18 | } 19 | .icon-ok{ 20 | background:url('icons/ok.png') no-repeat center center; 21 | } 22 | .icon-no{ 23 | background:url('icons/no.png') no-repeat center center; 24 | } 25 | .icon-cancel{ 26 | background:url('icons/cancel.png') no-repeat center center; 27 | } 28 | .icon-reload{ 29 | background:url('icons/reload.png') no-repeat center center; 30 | } 31 | .icon-search{ 32 | background:url('icons/search.png') no-repeat center center; 33 | } 34 | .icon-print{ 35 | background:url('icons/print.png') no-repeat center center; 36 | } 37 | .icon-help{ 38 | background:url('icons/help.png') no-repeat center center; 39 | } 40 | .icon-undo{ 41 | background:url('icons/undo.png') no-repeat center center; 42 | } 43 | .icon-redo{ 44 | background:url('icons/redo.png') no-repeat center center; 45 | } 46 | .icon-back{ 47 | background:url('icons/back.png') no-repeat center center; 48 | } 49 | .icon-sum{ 50 | background:url('icons/sum.png') no-repeat center center; 51 | } 52 | .icon-tip{ 53 | background:url('icons/tip.png') no-repeat center center; 54 | } 55 | 56 | .icon-mini-add{ 57 | background:url('icons/mini_add.png') no-repeat center center; 58 | } 59 | .icon-mini-edit{ 60 | background:url('icons/mini_edit.png') no-repeat center center; 61 | } 62 | .icon-mini-refresh{ 63 | background:url('icons/mini_refresh.png') no-repeat center center; 64 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/index.css: -------------------------------------------------------------------------------- 1 | /*登录页*/ 2 | .login_box{width:650px;height:310px;background: #fff;margin:0 auto;box-shadow: 3px 8px 10px rgba(0,0,0,0.4);border-radius: 10px;} 3 | .login_box .left{background: #ddf1fb;width:305px;height:310px;border-top-left-radius: 10px;border-bottom-left-radius: 10px;padding-top: 30px;border-right: 2px solid #55b6ed;} 4 | .login{display: inline-block;width:300px;margin-left: 30px;padding-top: 40px;} 5 | .item input{width:280px;height:40px;margin-bottom: 20px;border-radius: 5px;border:1px solid #bbb;outline: none;padding-left: 32px;background: #ecf5fa;color: #333;} 6 | .item input:focus{border:2px solid #4098ca;} 7 | .login button{height:40px;width:120px;background: #4098ca;border:0;border-radius: 6px;color:#fff;font-size: 16px;margin-left: 80px;margin-top: 10px;} 8 | .login button:hover{background: #55b6ed;} 9 | 10 | /*首页*/ 11 | .header{position:absolute;top:0;width:100%;height:50px;background: url(../Image/head-bg.png) repeat-x;background-size: cover;padding: 0 20px;color:#fff;line-height: 50px;z-index: 2;} 12 | .header a{color:#fff;} 13 | .header h1{font-size: 20px;} 14 | .header_right>li{padding:0 21px;cursor: pointer;transition:all 0.2s;} 15 | .header_right>li:last-child:hover{background: #55b6ed;} 16 | .personal_information{position: relative;} 17 | .personal_information:hover ul{display: block;} 18 | .personal_information span{padding-left: 8px;} 19 | .personal_information ul{position: absolute;top:50px;background: #006FC1;line-height: 32px;display: none;padding: 0 30px;z-index: 100;} 20 | 21 | /*中间内容区*/ 22 | .content{position: absolute;bottom:35px;top:50px;width:100%;overflow:auto;} 23 | /*导航*/ 24 | .nav{width:200px;background:#F0F9FD;height:100%;color:#fff;line-height: 40px;border-right: 1px solid #B7D5DF;position:absolute;left:0;} 25 | .nav a{display: block;color: #333;} 26 | .menu_a{background: #D4E7F0;border-bottom: 1px solid #B9CAD3;font-size: 16px;} 27 | .menu_a>a{padding-left: 50px;} 28 | .menu_a:last-child{border: 0;} 29 | .menu_a .fa{color:#6BB4D5;margin-right:10px;} 30 | .menu_b{background: #F0F9FD;width:199px;font-size: 14px;display: none;line-height: 32px;} 31 | .menu_b a{padding-left: 72px;} 32 | .menu_b .current a{background: #3EAFE0;color:#fff;border-left: 3px solid #EA2020;} 33 | .arr_r{width: 0; height: 0; border-top: 10px solid transparent; border-right: 14px solid #F0F9FD; border-bottom: 10px solid transparent;margin-top: 6px;} 34 | /*主体内容区*/ 35 | #right{width:100%;padding:10px;padding-left:210px;height:100%;} 36 | iframe{width:100%;height:100%;overflow: auto;} 37 | /*底部*/ 38 | .myfooter{height:35px;background: #F0F9FD;border-top: 1px solid #B9CAD3;position: absolute;bottom: 0;width:100%;text-align: center;line-height: 35px;color:#999;} 39 | -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/login.css: -------------------------------------------------------------------------------- 1 | /* 登录 */ 2 | .login_ico,.login_area ul li span{background: url(../image/login_ico.gif) 0 0 no-repeat;} 3 | body{background:url(../image/login_bg.jpg) center top #3c99c4 no-repeat; } 4 | .login_wrap h2{font-size: 28px; font-weight: normal; color: #fff; margin-top: 50px;text-align:center;} 5 | .login_box {width: 432px; margin: 0 auto;} 6 | .login_box .head{position: relative; height: 180px;} 7 | .login_box .bubble{width: 175px; height: 105px;background-position: 0 0; position: absolute; right:20px; text-align: center;} 8 | .login_box .t_head{width: 90px; height: 100px; position: absolute;top: 80px;left: 172px;} 9 | .teacher .t_head{background-position: 0 -105px;} 10 | 11 | .login_area{background: #fff; border-radius: 20px; padding: 20px;} 12 | .login_area ul li{border-bottom: 1px solid #cecece; padding: 10px 0;} 13 | .login_area ul li span{display: inline-block;width: 30px; height: 30px;} 14 | .login_area .school span{background-position: 0 -309px;} 15 | .login_area .user span{background-position: -43px -309px;} 16 | .login_area .pword span{background-position: -85px -308px;} 17 | 18 | .login_area li div{ position: relative;width: 346px;float: right;} 19 | .login_area li input{height: 28px;width: 100%; font-size: 20px;border: 0;line-height: 28px;} 20 | .login_area li select{height: 30px;font-size: 20px;margin-left: 10px; border:0;width: 347px; color: #2983af;} 21 | .login_wrap .btn_area{text-align: center; margin-top: 40px;} 22 | .login_wrap .btn_area .btn{padding: 10px;border-radius: 50px; background: transparent; border: 2px solid #fff; color: #fff; font-weight: bold; font-size: 20px;width:100%;text-align:center;} 23 | -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/plugins/jqgrid/ui.jqgrid.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Css/plugins/jqgrid/ui.jqgrid.css -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/plugins/webuploader/webuploader.css: -------------------------------------------------------------------------------- 1 | .webuploader-container { 2 | position: relative; 3 | } 4 | .webuploader-element-invisible { 5 | position: absolute !important; 6 | clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ 7 | clip: rect(1px,1px,1px,1px); 8 | } 9 | .webuploader-pick { 10 | position: relative; 11 | display: inline-block; 12 | cursor: pointer; 13 | background: #00b7ee; 14 | padding: 10px 15px; 15 | color: #fff; 16 | text-align: center; 17 | border-radius: 3px; 18 | overflow: hidden; 19 | } 20 | .webuploader-pick-hover { 21 | background: #00a2d4; 22 | } 23 | 24 | .webuploader-pick-disable { 25 | opacity: 0.6; 26 | pointer-events:none; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/themes/bootstrap/images/panel_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Css/themes/bootstrap/images/panel_tools.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/themes/bootstrap/images/spinner_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Css/themes/bootstrap/images/spinner_arrows.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/themes/bootstrap/images/tabs_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Css/themes/bootstrap/images/tabs_icons.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Css/themes/icon.css: -------------------------------------------------------------------------------- 1 | .icon-blank{ 2 | background:url('icons/blank.gif') no-repeat center center; 3 | } 4 | .icon-add{ 5 | background:url('icons/edit_add.png') no-repeat center center; 6 | } 7 | .icon-edit{ 8 | background:url('icons/pencil.png') no-repeat center center; 9 | } 10 | .icon-remove{ 11 | background:url('icons/edit_remove.png') no-repeat center center; 12 | } 13 | .icon-save{ 14 | background:url('icons/filesave.png') no-repeat center center; 15 | } 16 | .icon-cut{ 17 | background:url('icons/cut.png') no-repeat center center; 18 | } 19 | .icon-ok{ 20 | background:url('icons/ok.png') no-repeat center center; 21 | } 22 | .icon-no{ 23 | background:url('icons/no.png') no-repeat center center; 24 | } 25 | .icon-cancel{ 26 | background:url('icons/cancel.png') no-repeat center center; 27 | } 28 | .icon-reload{ 29 | background:url('icons/reload.png') no-repeat center center; 30 | } 31 | .icon-search{ 32 | background:url('icons/search.png') no-repeat center center; 33 | } 34 | .icon-print{ 35 | background:url('icons/print.png') no-repeat center center; 36 | } 37 | .icon-help{ 38 | background:url('icons/help.png') no-repeat center center; 39 | } 40 | .icon-undo{ 41 | background:url('icons/undo.png') no-repeat center center; 42 | } 43 | .icon-redo{ 44 | background:url('icons/redo.png') no-repeat center center; 45 | } 46 | .icon-back{ 47 | background:url('icons/back.png') no-repeat center center; 48 | } 49 | .icon-sum{ 50 | background:url('icons/sum.png') no-repeat center center; 51 | } 52 | .icon-tip{ 53 | background:url('icons/tip.png') no-repeat center center; 54 | } 55 | 56 | .icon-mini-add{ 57 | background:url('icons/mini_add.png') no-repeat center center; 58 | } 59 | .icon-mini-edit{ 60 | background:url('icons/mini_edit.png') no-repeat center center; 61 | } 62 | .icon-mini-refresh{ 63 | background:url('icons/mini_refresh.png') no-repeat center center; 64 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Image/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Image/404.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Image/500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Image/500.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Image/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Image/favicon.ico -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Image/head-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Image/head-bg.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Image/login_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Image/login_bg.jpg -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Image/login_ico.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Image/login_ico.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Image/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Image/user.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/iCheck/custom.css: -------------------------------------------------------------------------------- 1 | /* iCheck plugin Square skin, green 2 | ----------------------------------- */ 3 | .icheckbox_square-green, 4 | .iradio_square-green { 5 | display: inline-block; 6 | *display: inline; 7 | vertical-align: middle; 8 | margin: 0; 9 | padding: 0; 10 | width: 22px; 11 | height: 22px; 12 | background: url(green.png) no-repeat; 13 | border: none; 14 | cursor: pointer; 15 | } 16 | 17 | .icheckbox_square-green { 18 | background-position: 0 0; 19 | } 20 | .icheckbox_square-green.hover { 21 | background-position: -24px 0; 22 | } 23 | .icheckbox_square-green.checked { 24 | background-position: -48px 0; 25 | } 26 | .icheckbox_square-green.disabled { 27 | background-position: -72px 0; 28 | cursor: default; 29 | } 30 | .icheckbox_square-green.checked.disabled { 31 | background-position: -96px 0; 32 | } 33 | 34 | .iradio_square-green { 35 | background-position: -120px 0; 36 | } 37 | .iradio_square-green.hover { 38 | background-position: -144px 0; 39 | } 40 | .iradio_square-green.checked { 41 | background-position: -168px 0; 42 | } 43 | .iradio_square-green.disabled { 44 | background-position: -192px 0; 45 | cursor: default; 46 | } 47 | .iradio_square-green.checked.disabled { 48 | background-position: -216px 0; 49 | } 50 | 51 | /* HiDPI support */ 52 | @media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { 53 | .icheckbox_square-green, 54 | .iradio_square-green { 55 | background-image: url(green@2x.png); 56 | -webkit-background-size: 240px 24px; 57 | background-size: 240px 24px; 58 | } 59 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/iCheck/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/iCheck/green.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/iCheck/green@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/iCheck/green@2x.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/laydate/skins/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/laydate/skins/default/icon.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/laydate/skins/default/laydate.css: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name: laydate皮肤:墨绿 4 | @Author:贤心 5 | @Site:http://sentsin.com/layui/laydate 6 | 7 | **/ 8 | 9 | .laydate-icon{border:1px solid #ccc; background-image:url(icon.png)} 10 | 11 | .laydate_body .laydate_bottom #laydate_hms, 12 | .laydate_body .laydate_time{border:1px solid #ccc;} 13 | 14 | .laydate_body .laydate_box, 15 | .laydate_body .laydate_ym .laydate_yms, 16 | .laydate_body .laydate_time{box-shadow: 2px 2px 5px rgba(0,0,0,.1);} 17 | 18 | .laydate_body .laydate_box{border-top:none; border-bottom:none; background-color:#fff; color:#00625A;} 19 | .laydate_body .laydate_box input{background:none!important; color:#fff;} 20 | .laydate_body .laydate_box .laydate_void{color:#00E8D7!important;} 21 | .laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{color:#00625A;} 22 | .laydate_body .laydate_box a:hover{color:#666;} 23 | .laydate_body .laydate_click{background-color:#009F95!important; color:#fff!important;} 24 | .laydate_body .laydate_top{border-top:1px solid #009F95; background-color:#009F95} 25 | .laydate_body .laydate_ym{border:1px solid #009F95; background-color:#009F95;} 26 | .laydate_body .laydate_ym .laydate_yms{border:1px solid #009F95; background-color:#009F95; color:#fff;} 27 | .laydate_body .laydate_y .laydate_yms a{border-bottom:1px solid #009F95;} 28 | .laydate_body .laydate_y .laydate_yms .laydate_chdown{border-top:1px solid #009F95; border-bottom:none;} 29 | .laydate_body .laydate_choose{border-left:1px solid #009F95;} 30 | .laydate_body .laydate_chprev{border-left:none; border-right:1px solid #009F95;} 31 | .laydate_body .laydate_choose:hover, 32 | .laydate_body .laydate_y .laydate_yms a:hover{background-color:#00C1B3;} 33 | .laydate_body .laydate_chtop cite{border-bottom-color:#fff;} 34 | .laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{border-top-color:#fff;} 35 | .laydate_body .laydate_chprev cite{border-right-style:solid; border-right-color:#fff;} 36 | .laydate_body .laydate_chnext cite{border-left-style:solid; border-left-color:#fff;} 37 | .laydate_body .laydate_table{width: 240px!important; margin: 0!important; border:1px solid #ccc; border-top:none; border-bottom:none;} 38 | .laydate_body .laydate_table td{border:none; height:21px!important; line-height:21px!important; background-color:#fff; color:#00625A;} 39 | .laydate_body .laydate_table .laydate_nothis{color:#999;} 40 | .laydate_body .laydate_table thead{border-bottom:1px solid #ccc; height:21px!important; line-height:21px!important;} 41 | .laydate_body .laydate_table thead th{} 42 | .laydate_body .laydate_bottom{border:1px solid #ccc; border-top:none;} 43 | .laydate_body .laydate_bottom #laydate_hms{background-color:#fff;} 44 | .laydate_body .laydate_time{background-color:#fff;} 45 | .laydate_body .laydate_time1{width: 226px!important; height: 152px!important;} 46 | .laydate_body .laydate_bottom .laydate_sj{width:31px!important; border-right:1px solid #ccc; background-color:#fff;} 47 | .laydate_body .laydate_bottom input{background-color:#fff; color:#00625A;} 48 | .laydate_body .laydate_bottom .laydte_hsmtex{border-bottom:1px solid #ccc;} 49 | .laydate_body .laydate_bottom .laydate_btn{border-right:1px solid #ccc;} 50 | .laydate_body .laydate_bottom .laydate_v{color:#999} 51 | .laydate_body .laydate_bottom .laydate_btn a{border: 1px solid #ccc; border-right:none; background-color:#fff;} 52 | .laydate_body .laydate_bottom .laydate_btn a:hover{background-color:#F6F6F6; color:#00625A;} 53 | 54 | .laydate_body .laydate_m .laydate_yms span:hover, 55 | .laydate_body .laydate_time .laydate_hmsno span:hover, 56 | .laydate_body .laydate_y .laydate_yms ul li:hover, 57 | .laydate_body .laydate_table td:hover{background-color:#00C1B3; color:#fff;} 58 | 59 | 60 | -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/layim/data/chatlog.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": 1, 3 | "msg": "ok", 4 | "data": [ 5 | { 6 | "id": "100001", 7 | "name": "Beaut-zihan", 8 | "time": "10:23", 9 | "face": "img/a1.jpg" 10 | }, 11 | { 12 | "id": "100002", 13 | "name": "慕容晓晓", 14 | "time": "昨天", 15 | "face": "img/a2.jpg" 16 | }, 17 | { 18 | "id": "1000033", 19 | "name": "乔峰", 20 | "time": "2014-4.22", 21 | "face": "img/a3.jpg" 22 | }, 23 | { 24 | "id": "10000333", 25 | "name": "高圆圆", 26 | "time": "2014-4.21", 27 | "face": "img/a4.jpg" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/layim/data/friend.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": 1, 3 | "msg": "ok", 4 | "data": [ 5 | { 6 | "name": "销售部", 7 | "nums": 36, 8 | "id": 1, 9 | "item": [ 10 | { 11 | "id": "100001", 12 | "name": "郭敬明", 13 | "face": "img/a5.jpg" 14 | }, 15 | { 16 | "id": "100002", 17 | "name": "作家崔成浩", 18 | "face": "img/a6.jpg" 19 | }, 20 | { 21 | "id": "1000022", 22 | "name": "韩寒", 23 | "face": "img/a7.jpg" 24 | }, 25 | { 26 | "id": "10000222", 27 | "name": "范爷", 28 | "face": "img/a8.jpg" 29 | }, 30 | { 31 | "id": "100002222", 32 | "name": "小马哥", 33 | "face": "img/a9.jpg" 34 | } 35 | ] 36 | }, 37 | { 38 | "name": "大学同窗", 39 | "nums": 16, 40 | "id": 2, 41 | "item": [ 42 | { 43 | "id": "1000033", 44 | "name": "苏醒", 45 | "face": "img/a9.jpg" 46 | }, 47 | { 48 | "id": "10000333", 49 | "name": "马云", 50 | "face": "img/a8.jpg" 51 | }, 52 | { 53 | "id": "100003", 54 | "name": "鬼脚七", 55 | "face": "img/a7.jpg" 56 | }, 57 | { 58 | "id": "100004", 59 | "name": "谢楠", 60 | "face": "img/a6.jpg" 61 | }, 62 | { 63 | "id": "100005", 64 | "name": "徐峥", 65 | "face": "img/a5.jpg" 66 | } 67 | ] 68 | }, 69 | { 70 | "name": "H+后台主题", 71 | "nums": 38, 72 | "id": 3, 73 | "item": [ 74 | { 75 | "id": "100006", 76 | "name": "柏雪近在它香", 77 | "face": "img/a4.jpg" 78 | }, 79 | { 80 | "id": "100007", 81 | "name": "罗昌平", 82 | "face": "img/a3.jpg" 83 | }, 84 | { 85 | "id": "100008", 86 | "name": "Crystal影子", 87 | "face": "img/a2.jpg" 88 | }, 89 | { 90 | "id": "100009", 91 | "name": "艺小想", 92 | "face": "img/a1.jpg" 93 | }, 94 | { 95 | "id": "100010", 96 | "name": "天猫", 97 | "face": "img/a8.jpg" 98 | }, 99 | { 100 | "id": "100011", 101 | "name": "张泉灵", 102 | "face": "img/a7.jpg" 103 | } 104 | ] 105 | } 106 | ] 107 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/layim/data/group.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": 1, 3 | "msg": "ok", 4 | "data": [ 5 | { 6 | "name": "H+交流群", 7 | "nums": 36, 8 | "id": 1, 9 | "item": [ 10 | { 11 | "id": "101", 12 | "name": "H+ Bug反馈", 13 | "face": "http://tp2.sinaimg.cn/2211874245/180/40050524279/0" 14 | }, 15 | { 16 | "id": "102", 17 | "name": "H+ 技术交流", 18 | "face": "http://tp3.sinaimg.cn/1820711170/180/1286855219/1" 19 | } 20 | ] 21 | }, 22 | { 23 | "name": "Bootstrap", 24 | "nums": 16, 25 | "id": 2, 26 | "item": [ 27 | { 28 | "id": "103", 29 | "name": "Bootstrap中文", 30 | "face": "http://tp2.sinaimg.cn/2211874245/180/40050524279/0" 31 | }, 32 | { 33 | "id": "104", 34 | "name": "Bootstrap资源", 35 | "face": "http://tp3.sinaimg.cn/1820711170/180/1286855219/1" 36 | } 37 | ] 38 | }, 39 | { 40 | "name": "WebApp", 41 | "nums": 106, 42 | "id": 3, 43 | "item": [ 44 | { 45 | "id": "105", 46 | "name": "移动开发", 47 | "face": "http://tp2.sinaimg.cn/2211874245/180/40050524279/0" 48 | }, 49 | { 50 | "id": "106", 51 | "name": "H5前言", 52 | "face": "http://tp3.sinaimg.cn/1820711170/180/1286855219/1" 53 | } 54 | ] 55 | } 56 | ] 57 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/layim/data/groups.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": 1, 3 | "msg": "ok", 4 | "data": [ 5 | { 6 | "id": "100001", 7 | "name": "無言的蒁説", 8 | "face": "img/a1.jpg" 9 | }, 10 | { 11 | "id": "100002", 12 | "name": "婷宝奢侈品", 13 | "face": "img/a2.jpg" 14 | }, 15 | { 16 | "id": "100003", 17 | "name": "忆恨思爱", 18 | "face": "img/a3.jpg" 19 | }, 20 | { 21 | "id": "100004", 22 | "name": "天涯奥拓慢", 23 | "face": "img/a4.jpg" 24 | }, 25 | { 26 | "id": "100005", 27 | "name": "雨落无声的天空", 28 | "face": "img/a5.jpg" 29 | }, 30 | { 31 | "id": "100006", 32 | "name": "李越LycorisRadiate", 33 | "face": "img/a6.jpg" 34 | }, 35 | { 36 | "id": "100007", 37 | "name": "冯胖妞张直丑", 38 | "face": "img/a7.jpg" 39 | }, 40 | { 41 | "id": "100008", 42 | "name": "陈龙hmmm", 43 | "face": "img/a8.jpg" 44 | }, 45 | { 46 | "id": "100009", 47 | "name": "别闹哥胆儿小", 48 | "face": "img/a9.jpg" 49 | }, 50 | { 51 | "id": "100010", 52 | "name": "锅锅锅锅萌哒哒 ", 53 | "face": "img/a10.jpg" 54 | } 55 | ] 56 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/layim/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/layim/loading.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/icon-ext.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/icon.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/icon_ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/icon_ext.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/loading-0.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/loading-1.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/loading-2.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/textbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/textbg.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_ico0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_ico0.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading0.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading1.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading2.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_loading3.gif -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_title0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/default/xubox_title0.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/layer.ext.css: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | @Name: layer拓展样式 4 | @Date: 2012.12.13 5 | @Author: 贤心 6 | @blog: sentsin.com 7 | 8 | */.layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span{text-overflow:ellipsis;white-space:nowrap}.layui-layer-iconext{background:url(default/icon-ext.png) no-repeat}html #layui_layer_skinlayerextcss{display:none;position:absolute;width:1989px}.layui-layer-prompt .layui-layer-input{display:block;width:220px;height:30px;margin:0 auto;line-height:30px;padding:0 5px;border:1px solid #ccc;box-shadow:1px 1px 5px rgba(0,0,0,.1) inset;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;border-bottom:1px solid #ccc;background-color:#eee;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;cursor:default;overflow:hidden}.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px;border-left:1px solid #ccc;border-right:1px solid #ccc;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block}.xubox_tabclose{position:absolute;right:10px;top:5px;cursor:pointer}.layui-layer-photos{-webkit-animation-duration:1s;animation-duration:1s;background:url(default/xubox_loading1.gif) center center no-repeat #000}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal} -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/layer/skin/moon/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/layer/skin/moon/default.png -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/validate/messages_zh.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery Validation Plugin - v1.13.1 - 10/14/2014 2 | * http://jqueryvalidation.org/ 3 | * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */ 4 | ! function (a) { 5 | "function" == typeof define && define.amd ? define(["jquery", "jquery.validate.min"], a) : a(jQuery) 6 | }(function (a) { 7 | var icon = " "; 8 | // 中文字三个字节 9 | a.validator.addMethod("byteMaxLength", function (value, element, param) { 10 | var length = value.length; 11 | for (var i = 0; i < value.length; i++) { 12 | if (value.charCodeAt(i) > 127) { 13 | length = length + 2; 14 | } 15 | } 16 | return this.optional(element) || (length <= param[0]); 17 | }, a.validator.format(icon + "最多输入{0}个字节(一个中文字算3个字节)")); 18 | 19 | // 中文字三个字节 20 | a.validator.addMethod("alnum", function (value, element, param) { 21 | return this.optional(element) || /^[a-zA-Z0-9]+$/.test(value); 22 | }, a.validator.format(icon + "只能包括英文字母和数字")); 23 | 24 | a.extend(a.validator.messages, { 25 | required: icon + "必填", 26 | remote: icon + "请修正此栏位", 27 | email: icon + "请输入有效的电子邮件", 28 | url: icon + "请输入有效的网址", 29 | date: icon + "请输入有效的日期", 30 | dateISO: icon + "请输入有效的日期 (YYYY-MM-DD)", 31 | number: icon + "请输入正确的数字", 32 | digits: icon + "只能输入数字", 33 | creditcard: icon + "请输入有效的信用卡号码", 34 | equalTo: icon + "你的输入不相同", 35 | extension: icon + "请输入有效的后缀", 36 | alnum: icon + "只能包括英文字母和数字", 37 | ip: icon + "Ip地址格式错误", 38 | repaswd: icon + "确认密码与新密码不一致!", 39 | maxlength: a.validator.format(icon + "最多 {0} 个字"), 40 | minlength: a.validator.format(icon + "最少 {0} 个字"), 41 | rangelength: a.validator.format(icon + "请输入长度为 {0} 至 {1} 之间的字串"), 42 | range: a.validator.format(icon + "请输入 {0} 至 {1} 之间的数值"), 43 | max: a.validator.format(icon + "请输入不大于 {0} 的数值"), 44 | min: a.validator.format(icon + "请输入不小于 {0} 的数值"), 45 | ipv4: a.validator.format(icon + "请输入正确的ipv4地址") 46 | }) 47 | }); -------------------------------------------------------------------------------- /TaskManagerWeb/Content/Scripts/plugins/webuploader/Uploader.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/Scripts/plugins/webuploader/Uploader.swf -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Content/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /TaskManagerWeb/Modules/BaseModule.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 模块名: Excel导出模块 3 | * 作者: 杜冬军 4 | * 创建日期: 2016/3/31 10:47:22 5 | * 博客地址:http://yanweidie.cnblogs.com 6 | */ 7 | 8 | using Nancy; 9 | using Nancy.Security; 10 | using Ywdsoft.Model.Common; 11 | using Ywdsoft.Utility.ConfigHandler; 12 | 13 | namespace Ywdsoft.Modules 14 | { 15 | public class BaseModule : NancyModule 16 | { 17 | public UserAccount UserAccountInfo = null; 18 | 19 | public BaseModule() 20 | { 21 | this.RequiresAuthentication(); 22 | Init(); 23 | } 24 | 25 | public BaseModule(string modulePath) : base(modulePath) 26 | { 27 | this.RequiresAuthentication(); 28 | Init(); 29 | } 30 | 31 | private void Init() 32 | { 33 | Before += ctx => 34 | { 35 | //静态资源版本 36 | ViewBag.Version = SystemConfig.StaticVersion; 37 | UserAccountInfo = Session["UserInfo"] as UserAccount; 38 | return null; 39 | }; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Modules/ConfigModule.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 模块名: 主页模块 3 | * 描述: 主页系统框架 4 | * 作者: 杜冬军 5 | * 创建日期: 2016/2/23 8:50:22 6 | * 博客地址:http://yanweidie.cnblogs.com 7 | */ 8 | using AutoMapper; 9 | using Nancy; 10 | using Nancy.ModelBinding; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using Ywdsoft.Model.Common; 14 | using Ywdsoft.Utility; 15 | using Ywdsoft.Utility.ConfigHandler; 16 | using Ywdsoft.Utility.Mef; 17 | 18 | namespace Ywdsoft.Modules 19 | { 20 | public class ConfigModule : BaseModule 21 | { 22 | private static ConfigManager manager { get; set; } 23 | 24 | public ConfigModule() : base("Config") 25 | { 26 | //列表 27 | Get["/Grid"] = r => 28 | { 29 | manager = MefConfig.TryResolve(); 30 | return View["Grid"]; 31 | }; 32 | 33 | //取数接口API 34 | #region 35 | 36 | ///// 37 | ///// 获取所有配置信息 38 | ///// 39 | ///// 所有配置信息 40 | Get["/GetAllOption"] = r => 41 | { 42 | ITagService tagService = MefConfig.TryResolve(); 43 | IEnumerable listTags = tagService.GetTags(TagsSourceType.ConfigHandler); 44 | 45 | var list = manager.GetAllOption(); 46 | List listDto = new List(); 47 | ConfigViewModel configModel = null; 48 | foreach (var item in list) 49 | { 50 | configModel = Mapper.DynamicMap(item); 51 | configModel.TagList = listTags.Where(e => e.SourceId == item.Group.GroupType).ToList(); 52 | listDto.Add(configModel); 53 | } 54 | return Response.AsJson(listDto); 55 | }; 56 | 57 | ///// 58 | ///// 获取指定项配置信息 59 | ///// 60 | ///// 分组项 61 | ///// 所有配置信息 62 | Get["/GetOptionByGroup"] = r => 63 | { 64 | string GroupType = Request.Query["GroupType"].ToString(); 65 | var model = manager.GetOptionByGroup(GroupType); 66 | ConfigViewModel configModel = Mapper.DynamicMap(model); 67 | ITagService tagService = MefConfig.TryResolve(); 68 | configModel.TagList = tagService.GetTags(TagsSourceType.ConfigHandler, GroupType); 69 | return Response.AsJson(configModel); 70 | }; 71 | 72 | ///// 73 | ///// 保存数据 74 | ///// 75 | Post["/"] = r => 76 | { 77 | ConfigViewModel value = this.Bind(); 78 | ITagService tagService = MefConfig.TryResolve(); 79 | //保存标签信息 80 | if (value.TagList == null || value.TagList.Count == 0) 81 | { 82 | //删除标签 83 | tagService.DeleteTags(TagsSourceType.ConfigHandler, value.Group.GroupType); 84 | } 85 | else 86 | { 87 | //保存标签 88 | tagService.SaveTags(value.TagList, TagsSourceType.ConfigHandler, value.Group.GroupType, "admin"); 89 | } 90 | return Response.AsJson(manager.Save(Mapper.DynamicMap(value))); 91 | }; 92 | 93 | #endregion 94 | } 95 | } 96 | 97 | /// 98 | /// 自定义标签参数配置项 99 | /// 100 | public class ConfigViewModel : OptionViewModel 101 | { 102 | /// 103 | /// 自定义标签列表 104 | /// 105 | public List TagList { get; set; } 106 | } 107 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Modules/ErrorModule.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 模块名: 全局错误模块 3 | * 作者: 杜冬军 4 | * 创建日期: 2016/2/23 8:50:22 5 | * 博客地址:http://yanweidie.cnblogs.com 6 | */ 7 | 8 | using Nancy; 9 | 10 | namespace Ywdsoft.Modules 11 | { 12 | public class ErrorModule : NancyModule 13 | { 14 | public ErrorModule():base("Error") 15 | { 16 | //404 17 | Get["/NotFound"] = r => 18 | { 19 | return View["NotFound"]; 20 | }; 21 | 22 | //500 23 | Get["/ISE"] = r => 24 | { 25 | var model = "我是 Razor 引擎"; 26 | return View["ISE", model]; 27 | }; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Modules/HomeModule.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 模块名: 主页模块 3 | * 描述: 主页系统框架 4 | * 作者: 杜冬军 5 | * 创建日期: 2016/2/23 8:50:22 6 | * 博客地址:http://yanweidie.cnblogs.com 7 | */ 8 | using Nancy; 9 | using Ywdsoft.Utility; 10 | using Ywdsoft.Utility.ConfigHandler; 11 | using Ywdsoft.Utility.Mef; 12 | 13 | namespace Ywdsoft.Modules 14 | { 15 | public class HomeModule : BaseModule 16 | { 17 | public HomeModule() 18 | { 19 | //主页 20 | Get["/"] = r => 21 | { 22 | return Response.AsRedirect("/Home/Index"); 23 | }; 24 | 25 | //主页 26 | Get["/Home/Index"] = r => 27 | { 28 | return View["index", new { UserName = UserAccountInfo.UserName, Title = SystemConfig.SystemTitle, ProgramName = SystemConfig.ProgramName }]; 29 | }; 30 | 31 | ///桌面 32 | Get["/DestTop"] = r => 33 | { 34 | return View["DestTop", MachineNumber.GetMachineInfo()]; 35 | }; 36 | 37 | //修改密码 38 | Post["/Home/ChgPwd"] = r => 39 | { 40 | ApiResult result = new ApiResult(); 41 | string PasswordOne = this.Request.Form.PasswordOne; 42 | string PasswordTwo = this.Request.Form.PasswordTwo; 43 | IUserService UserService = MefConfig.TryResolve(); 44 | if (string.IsNullOrEmpty(PasswordOne) || string.IsNullOrEmpty(PasswordTwo) || !PasswordOne.Equals(PasswordTwo)) 45 | { 46 | result.HasError = true; 47 | result.Message = "两次密码不一致"; 48 | } 49 | else 50 | { 51 | UserService.ChgPwd(UserAccountInfo.UserGUID, DESEncrypt.Encrypt(PasswordOne)); 52 | } 53 | return result; 54 | }; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Modules/LoginModule.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 模块名: 登录模块 3 | * 描述: 用于登录 退出登录 4 | * 作者: 杜冬军 5 | * 创建日期: 2016/2/23 8:50:22 6 | * 博客地址:http://yanweidie.cnblogs.com 7 | */ 8 | 9 | using Nancy; 10 | using Nancy.Authentication.Forms; 11 | using Nancy.Extensions; 12 | using System; 13 | using Ywdsoft.Model.Common; 14 | using Ywdsoft.Utility; 15 | using Ywdsoft.Utility.ConfigHandler; 16 | using Ywdsoft.Utility.Mef; 17 | 18 | namespace Ywdsoft.Modules 19 | { 20 | public class LoginModule : NancyModule 21 | { 22 | public LoginModule() : base("Login") 23 | { 24 | Get["/"] = r => 25 | { 26 | var ErrorMsg = this.Request.Query.ErrorMsg; 27 | var UserCode = this.Request.Query.UserCode; 28 | return View["index", new 29 | { 30 | ErrorMsg = ErrorMsg, 31 | UserCode = UserCode, 32 | Title = SystemConfig.SystemTitle, 33 | ProgramName = SystemConfig.ProgramName, 34 | ShowOriginalAccountInfo = SystemConfig.ShowOriginalAccountInfo ? "1" : "0" 35 | }]; 36 | }; 37 | 38 | Post["/"] = r => 39 | { 40 | string UserCode = this.Request.Form.UserCode; 41 | string Password = this.Request.Form.Password; 42 | IUserService UserService = MefConfig.TryResolve(); 43 | if (string.IsNullOrEmpty(UserCode) || string.IsNullOrEmpty(Password)) 44 | { 45 | 46 | return this.Context.GetRedirect("~/Login?ErrorMsg=" + Uri.EscapeDataString("用户名或密码不能为空") + "&UserCode=" + UserCode); 47 | } 48 | UserAccount account = UserService.GetUserInfo(UserCode, DESEncrypt.Encrypt(Password)); 49 | if (account == null) 50 | { 51 | return this.Context.GetRedirect("~/Login?ErrorMsg=" + Uri.EscapeDataString("用户名或密码错误") + "&UserCode=" + UserCode); 52 | } 53 | else 54 | { 55 | Guid guid = Guid.ParseExact(account.UserGUID, "N"); 56 | Session["UserInfo"] = account; 57 | return this.Login(guid, DateTime.Now.AddMinutes(30)); 58 | } 59 | }; 60 | 61 | //退出登录 62 | Get["/Exit"] = r => 63 | { 64 | Session.DeleteAll(); 65 | return this.Context.GetRedirect("~/Login"); 66 | }; 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Modules/TagsModule.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 模块名: 标签模块 3 | * 描述: 标签模块 4 | * 作者: 杜冬军 5 | * 创建日期: 2016/2/23 8:50:22 6 | * 博客地址:http://yanweidie.cnblogs.com 7 | */ 8 | using Ywdsoft.Utility; 9 | using Nancy; 10 | using Ywdsoft.Utility.Mef; 11 | 12 | namespace Ywdsoft.Modules 13 | { 14 | public class TagsModule : BaseModule 15 | { 16 | public TagsModule() : base("Tags") 17 | { 18 | 19 | #region "取数接口API" 20 | 21 | //立即运行一次任务 22 | Get["/UpdateTagHeat"] = r => 23 | { 24 | string TagGUID = Request.Query["TagGUID"].ToString(); 25 | ITagService tagService = MefConfig.TryResolve(); 26 | return Response.AsText(tagService.UpdateHeat(TagGUID).ToString()); 27 | }; 28 | 29 | 30 | #endregion 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("TaskManagerWeb")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("TaskManagerWeb")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("ff2274df-e2d0-4e7a-a6ac-4f0d6e7668a7")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /TaskManagerWeb/Startup.cs: -------------------------------------------------------------------------------- 1 | using Nancy.Hosting.Self; 2 | using System; 3 | using System.Net; 4 | using Ywdsoft.Utility; 5 | using Ywdsoft.Utility.ConfigHandler; 6 | 7 | namespace Owin_Nancy 8 | { 9 | public class Startup 10 | { 11 | private static NancyHost _host = null; 12 | /// 13 | /// 监听端口 启动站点 14 | /// 15 | /// 监听ip端口列表 16 | public static NancyHost Start(int port) 17 | { 18 | try 19 | { 20 | //返回content-length 21 | HostConfiguration configuration = new HostConfiguration(); 22 | configuration.AllowChunkedEncoding = false; 23 | _host = new NancyHost(configuration, new Uri(string.Format("http://localhost:{0}", port))); 24 | _host.Start(); 25 | LogHelper.WriteLog("Web管理站点启动成功,请打开 http://127.0.0.1:" + port + "进行浏览"); 26 | 27 | if (SystemConfig.WebPort != port) 28 | { 29 | //更新系统参数配置表监听端口 30 | SystemConfig.WebPort = port; 31 | ConfigManager.UpdateValueByKey("SystemConfig", "WebPort", port.ToString()); 32 | } 33 | return _host; 34 | } 35 | catch (HttpListenerException ex) 36 | { 37 | LogHelper.WriteLog("Web管理站点启动失败", ex); 38 | Random random = new Random(); 39 | port = random.Next(port - 1000, port + 1000); 40 | Console.WriteLine(" 重新尝试端口:" + port); 41 | return Start(port); 42 | } 43 | catch (Exception ex) 44 | { 45 | LogHelper.WriteLog("Web管理站点启动失败", ex); 46 | throw ex; 47 | } 48 | } 49 | 50 | /// 51 | /// 回收资源 52 | /// 53 | public static void Dispose() 54 | { 55 | //回收资源 56 | if (_host != null) 57 | { 58 | _host.Stop(); 59 | _host.Dispose(); 60 | _host = null; 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /TaskManagerWeb/Template/Entity.vm: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace Ywdsoft.Model.Entity 8 | { 9 | /// 10 | ///$TableNameDesc 11 | /// 12 | [Table("$TableName")] 13 | public class $EntityName 14 | { 15 | #foreach($p in $ColumnList) 16 | /// 17 | ///#if($p.FieldNameDesc="")$p.FieldNameDesc 18 | #else $p.FieldName 19 | #end 20 | /// 21 | #if($p.IsPK=="1")[Key]#end 22 | 23 | [Column("$p.FieldName")] 24 | public $ConvertType.GetDotNetType($p.DataType) $p.FieldName 25 | { 26 | get; 27 | set; 28 | } 29 | #end 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /TaskManagerWeb/Template/Excel/任务批量导入.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/TaskManagerWeb/Template/Excel/任务批量导入.xls -------------------------------------------------------------------------------- /TaskManagerWeb/Views/Error/NotFound.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 请求的页面去火星啦(404) 8 | 38 | 39 | 40 |
41 | 42 | 45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /TaskManagerWeb/Views/Home/DestTop.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase 2 | @{ 3 | ViewBag.Title = "桌面"; 4 | 5 | } 6 | @section style{ 7 | 8 | } 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
系统运行状态
状态名状态值
应用程序名称@Model.ProgramName
进程名称@Model.ProcessName
处理器个数@Model.CPUCount
程序运行时间@Model.ProgramRunTime
CPU占用率@Model.CPUUseRate
工作集@(Model.WorkSet)MB
最大虚拟内存量@(Model.PeakVirtualMEmorySize)MB
虚拟内存量@(Model.VirtuaMemorySize)MB
最大物理内存量@(Model.PeakWorkingSet)MB
内存占用@Model.MemoryInfo
分区信息@Html.Raw(Model.HardDiskInfo)
线程数@Model.ThreadsCount
句柄数@Model.HandleCount
进程ID@Model.ProcessId
主机名称@Model.MachineName
系统版本@Model.OSVersion
系统目录@Model.SystemDirectory
用户域名@Model.UserDomainName
用户名@Model.UserName
CLR版本@Model.CLRVersion
工作目录@Model.CurrentDirectory
41 | 42 | 43 | @section scripts{ 44 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Views/Login/Index.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase 2 | 3 | @{ 4 | ViewBag.Title = "登录-" + @Model.Title; 5 | } 6 | @section style{ 7 | 8 | } 9 | 37 | 38 | @section scripts{ 39 | 68 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | @ViewBag.Title 15 | 16 | 17 | 18 | 19 | @RenderSection("style", required: false) 20 | 21 | 22 | @RenderBody() 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | @RenderSection("scripts", required: false) 31 | 32 | 33 | @{ 34 | var qs = Context.Request.Query; 35 | foreach (var key in Request.Query) 36 | { 37 | 38 | } 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /TaskManagerWeb/Views/Tool/CommandLine.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase 2 | 3 | @{ 4 | ViewBag.Title = "命令行执行工具"; 5 | } 6 | 7 | @section style{ 8 | 9 | } 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 28 | 29 | 30 |
执行结果
18 | 19 |
23 |
24 | 25 | 26 |
27 |
31 | 32 | @section scripts{ 33 | 70 | } -------------------------------------------------------------------------------- /TaskManagerWeb/Views/Tool/ExceptionLog.cshtml: -------------------------------------------------------------------------------- 1 | @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase 2 | @{ 3 | ViewBag.Title = "异常消息"; 4 | } 5 | 6 | @section style{ 7 | 12 | } 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
22 | 异常消息 23 | 24 |
序号消息内容操作
32 |
33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | @{ int i = 1; string firstBorder = "border-top:none;"; } 41 | @foreach (long key in Model.Keys) 42 | { 43 | 44 | 45 | 46 | 47 | 48 | i++; 49 | } 50 |
@i@Html.Raw(Model[key])删除
51 |
52 | @section scripts{ 53 | 54 | 89 | } 90 | -------------------------------------------------------------------------------- /TaskManagerWeb/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "/Shared/_Layout.cshtml"; 3 | } -------------------------------------------------------------------------------- /TaskManagerWeb/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /TaskManagerWeb/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/App_Data/TaskManager.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/YwdSoft.ConsoleHosting/App_Data/TaskManager.db -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/Config/Config.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/DLL/HttpHelper.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/YwdSoft.ConsoleHosting/DLL/HttpHelper.dll -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/Program.cs: -------------------------------------------------------------------------------- 1 | using Ywdsoft.Utility; 2 | using Nancy.Hosting.Self; 3 | using Owin_Nancy; 4 | using System; 5 | using System.Diagnostics; 6 | using Ywdsoft.Utility.Mef; 7 | using Ywdsoft.Utility.ConfigHandler; 8 | using Ywdsoft.Utility.Command; 9 | using System.Runtime.InteropServices; 10 | using Ywdsoft.Utility.RabbitMQ; 11 | using Ywdsoft.Utility.Extensions.Xml; 12 | using YwdSoft.Service; 13 | 14 | namespace Ywdsoft.ConsoleHosting 15 | { 16 | class Program 17 | { 18 | public delegate bool ControlCtrlDelegate(int CtrlType); 19 | [DllImport("kernel32.dll")] 20 | private static extern bool SetConsoleCtrlHandler(ControlCtrlDelegate HandlerRoutine, bool Add); 21 | private static ControlCtrlDelegate cancelHandler = new ControlCtrlDelegate(HandlerRoutine); 22 | 23 | public static bool HandlerRoutine(int CtrlType) 24 | { 25 | switch (CtrlType) 26 | { 27 | case 0: 28 | case 2: 29 | return true; 30 | } 31 | return false; 32 | } 33 | 34 | static void Main(string[] args) 35 | { 36 | AdminRun.Run(); 37 | 38 | if (!SetConsoleCtrlHandler(cancelHandler, true)) 39 | { 40 | Console.WriteLine("程序监听系统按键异常"); 41 | } 42 | try 43 | { 44 | //1.MEF初始化 45 | MefConfig.Init(); 46 | 47 | //2.数据库初始化连接 48 | ConfigInit.InitConfig(); 49 | 50 | //3.系统参数配置初始化 51 | ConfigManager configManager = MefConfig.TryResolve(); 52 | configManager.Init(); 53 | 54 | Console.Title = SystemConfig.ProgramName; 55 | Console.CursorVisible = false; //隐藏光标 56 | 57 | //4.任务启动 58 | QuartzHelper.InitScheduler(); 59 | QuartzHelper.StartScheduler(); 60 | 61 | //5.加载SQL信息到缓存中 62 | XmlCommandManager.LoadCommnads(SysConfig.XmlCommandFolder); 63 | //开发时监听资源文件变化,用于实时更新 64 | DevelperHelper.WatcherResourceChange(); 65 | 66 | //测试dapper orm框架 67 | //DapperDemoService.Test(); 68 | 69 | //启动站点 70 | using (NancyHost host = Startup.Start(SystemConfig.WebPort)) 71 | { 72 | //调用系统默认的浏览器 73 | string url = string.Format("http://127.0.0.1:{0}", SystemConfig.WebPort); 74 | Process.Start(url); 75 | Console.WriteLine("系统已启动,当前监听站点地址:{0}", url); 76 | try 77 | { 78 | //4.消息队列启动 79 | RabbitMQClient.InitClient(); 80 | } 81 | catch (Exception ex) 82 | { 83 | Console.WriteLine(ex); 84 | } 85 | //5.系统命令初始化 86 | CommandHelp.Init(); 87 | } 88 | } 89 | catch (Exception ex) 90 | { 91 | Console.WriteLine(ex); 92 | } 93 | Console.Read(); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Ywdsoft.ConsoleHosting")] 8 | [assembly: AssemblyDescription("任务管理容器TaskManager")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("焰尾迭:http://yanweidie.cnblogs.com")] 11 | [assembly: AssemblyProduct("Ywdsoft.ConsoleHosting")] 12 | [assembly: AssemblyCopyright("Copyright 焰尾迭© 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("d3df0ff9-f2f0-4b84-86b8-b4909b4a0f84")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/YwdSoft.ConsoleHosting/favicon.ico -------------------------------------------------------------------------------- /YwdSoft.ConsoleHosting/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /YwdSoft.Service/DapperDemoService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Ywdsoft.Model.Entity; 3 | using Ywdsoft.Utility.DB; 4 | 5 | namespace YwdSoft.Service 6 | { 7 | public class DapperDemoService 8 | { 9 | public static void Test() 10 | { 11 | //查询 12 | Console.WriteLine("查询所有数据"); 13 | var list = DapperHelper.GetList(); 14 | foreach (var item in list) 15 | { 16 | Console.WriteLine(item.CompanyCode + "||" + item.CompanyName); 17 | } 18 | 19 | //条件查询 20 | Console.WriteLine("查询快递公司名称为“顺丰快递”的数据"); 21 | foreach (var item in DapperHelper.GetList(new { CompanyName = "顺丰快递" })) 22 | { 23 | Console.WriteLine(item.CompanyCode + "||" + item.CompanyName); 24 | } 25 | 26 | //条件查询 27 | Console.WriteLine("查询快递公司名称中包含为“快递”的数据"); 28 | string likename = "%快递%"; 29 | foreach (var item in DapperHelper.GetList("where CompanyName like @CompanyName", new { CompanyName = likename })) 30 | { 31 | Console.WriteLine(item.CompanyCode + "||" + item.CompanyName); 32 | } 33 | 34 | //分页查询 35 | Console.WriteLine("查询快递公司名称中包含为“快递”的第一页前10条数据"); 36 | likename = "%快递%"; 37 | foreach (var item in DapperHelper.GetListPaged(1, 10, "where CompanyName like @CompanyName", "CompanyName desc", new { CompanyName = likename })) 38 | { 39 | Console.WriteLine(item.CompanyCode + "||" + item.CompanyName); 40 | } 41 | 42 | //新增 43 | Console.WriteLine("插入一条名称为“测试快递公司”的数据"); 44 | ExpressCompany itemNew = new ExpressCompany 45 | { 46 | CompanyName = "测试快递公司", 47 | CompanyCode = "TestCode" 48 | }; 49 | var strCompanyGUID = DapperHelper.Insert(itemNew); 50 | Console.WriteLine("插入的数据主键为:" + strCompanyGUID); 51 | //更新 52 | Console.WriteLine("更新刚插入的数据名称为“测试快递公司New”"); 53 | itemNew.CompanyGUID = strCompanyGUID; 54 | itemNew.CompanyName = "测试快递公司New"; 55 | DapperHelper.Update(itemNew); 56 | Console.WriteLine("查询刚更新的数据名称:" + DapperHelper.Get(strCompanyGUID).CompanyName); 57 | 58 | //删除 59 | Console.WriteLine("删除刚插入的数据"); 60 | DapperHelper.Delete(strCompanyGUID); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /YwdSoft.Service/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("YwdSoft.Service")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("YwdSoft.Service")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("691817d2-1e85-4c90-ba6a-db21b7fb4080")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /YwdSoft.Service/TableListService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Ywdsoft.Utility.DB; 3 | using Ywdsoft.Utility.Extensions.Xml; 4 | 5 | namespace YwdSoft.Service 6 | { 7 | /// 8 | /// Sql Server表服务 9 | /// 10 | public class TableListService 11 | { 12 | /// 13 | /// 获取数据库所有表 14 | /// 15 | /// 所有表 16 | public static IEnumerable GetAllTable() 17 | { 18 | return DapperHelper.Query(XmlCommandManager.GetCommand("Table:GetAllTable").CommandText); 19 | } 20 | 21 | /// 22 | /// 获取数据库表列相关信息 23 | /// 24 | /// 表名集合 25 | /// 每张表列信息 26 | public static IEnumerable GetTableInfo(string[] tableNameList) 27 | { 28 | string strSQL = XmlCommandManager.GetCommand("Table:GetAllTableInfo").CommandText; 29 | strSQL = string.Format(strSQL, string.Join("','", tableNameList)); 30 | return DapperHelper.Query(strSQL); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /YwdSoft.Service/YwdSoft.Service.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {691817D2-1E85-4C90-BA6A-DB21B7FB4080} 8 | Library 9 | Properties 10 | YwdSoft.Service 11 | YwdSoft.Service 12 | v4.0 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | {8F936E5F-F5F4-43A4-8624-DAB5D4128049} 49 | Ywdsoft.Model 50 | 51 | 52 | {d2aaedff-9f30-49a6-b242-f655503c24f3} 53 | Ywdsoft.Utility 54 | 55 | 56 | 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /YwdSoft.Service/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Ywdsoft.MessageTransmit/LogMessageTransmit.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using System.Threading; 5 | using Ywdsoft.Model.RabbitMQ; 6 | using Ywdsoft.Utility; 7 | using Ywdsoft.Utility.RabbitMQ; 8 | 9 | namespace Ywdsoft.MessageTransfers 10 | { 11 | [Export(typeof(MessageTransmitAction))] 12 | public class LogMessageTransmit : MessageTransmitAction 13 | { 14 | private static List listType = new List { "LogTest" }; 15 | 16 | public override List MessageDataType 17 | { 18 | get 19 | { 20 | return listType; 21 | } 22 | } 23 | 24 | /// 25 | /// 消息处理 26 | /// 27 | /// 28 | public override void Action(string message) 29 | { 30 | var mqMessage = JsonConvert.DeserializeObject>(message); 31 | //模拟进行业务处理 32 | foreach (var item in mqMessage.Data) 33 | { 34 | //item.Text 35 | } 36 | //延时1s 37 | Thread.Sleep(1000); 38 | LogHelper.WriteLog("接收到MQ日志消息,消息内容:" + message); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ywdsoft.MessageTransmit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Ywdsoft.MessageTransfers")] 8 | [assembly: AssemblyDescription("MQ消息分发处理")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("焰尾迭:http://yanweidie.cnblogs.com")] 11 | [assembly: AssemblyProduct("Ywdsoft.MessageTransfers")] 12 | [assembly: AssemblyCopyright("Copyright 焰尾迭© 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("9a0d9ae4-d2f6-4bbc-8f1a-3347c2d73ac7")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Ywdsoft.MessageTransmit/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Ywdsoft.MessageTransmit/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Ywdsoft.Model/Common/Tags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ywdsoft.Model.Common 4 | { 5 | /// 6 | ///标签定义表 7 | /// 8 | public class Tags 9 | { 10 | /// 11 | ///标签ID 12 | /// 13 | public string TagGUID { get; set; } 14 | 15 | /// 16 | ///标签类型 17 | /// 18 | public string TagType { get; set; } 19 | 20 | /// 21 | ///关联表主键 22 | /// 23 | public string SourceId { get; set; } 24 | 25 | /// 26 | ///标签名称 层级标签通过/进行分割(名称不能含有特殊字符) 27 | /// 28 | public string TagName { get; set; } 29 | 30 | /// 31 | ///标签热度 32 | /// 33 | public int? TagHeat { get; set; } 34 | 35 | /// 36 | ///创建日期 37 | /// 38 | public DateTime? CreatedTime { get; set; } 39 | 40 | /// 41 | ///创建人(用户代码) 42 | /// 43 | public string Creator { get; set; } 44 | 45 | /// 46 | ///修改日期 47 | /// 48 | public DateTime? ModifiedTime { get; set; } 49 | 50 | /// 51 | ///修改人(用户代码) 52 | /// 53 | public string Modifier { get; set; } 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /Ywdsoft.Model/Common/UserAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ywdsoft.Model.Common 4 | { 5 | /// 6 | /// 用户基础信息 7 | /// 8 | [Serializable] 9 | public class UserAccount 10 | { 11 | /// 12 | /// 用户GUID 13 | /// 14 | public string UserGUID { get; set; } 15 | 16 | /// 17 | /// 用户代码 18 | /// 19 | public string UserCode { get; set; } 20 | 21 | /// 22 | /// 用户名 23 | /// 24 | public string UserName { get; set; } 25 | 26 | /// 27 | /// 密码 28 | /// 29 | public string Password { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Ywdsoft.Model/ExpressCompany.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System; 3 | 4 | namespace Ywdsoft.Model.Entity 5 | { 6 | /// 7 | /// 8 | /// 9 | [Table("p_ExpressCompany")] 10 | public class ExpressCompany 11 | { 12 | /// 13 | /// CompanyGUID 14 | /// 15 | [Key] 16 | [Column("CompanyGUID")] 17 | public Guid CompanyGUID 18 | { 19 | get; 20 | set; 21 | } 22 | /// 23 | /// CompanyName 24 | /// 25 | 26 | [Column("CompanyName")] 27 | public string CompanyName 28 | { 29 | get; 30 | set; 31 | } 32 | /// 33 | /// CompanyCode 34 | /// 35 | 36 | [Column("CompanyCode")] 37 | public string CompanyCode 38 | { 39 | get; 40 | set; 41 | } 42 | /// 43 | /// CreatedOn 44 | /// 45 | [ReadOnly(true)] 46 | [Column("CreatedOn")] 47 | public DateTime CreatedOn 48 | { 49 | get; 50 | set; 51 | } 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Ywdsoft.Model/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Ywdsoft.Model")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Ywdsoft.Model")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("8f936e5f-f5f4-43a4-8624-dab5d4128049")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Ywdsoft.Model/RabbitMQ/LogMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Ywdsoft.Model.RabbitMQ 2 | { 3 | public class LogMessage : BaseMessage 4 | { 5 | public string Text { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Ywdsoft.Model/RabbitMQ/MQMessage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Model: MQ消息实体定义 3 | * Desctiption: 描述 4 | * Author: 杜冬军 5 | * Created: 2016/3/17 13:39:17 6 | */ 7 | using System; 8 | using System.Collections.Generic; 9 | 10 | namespace Ywdsoft.Model.RabbitMQ 11 | { 12 | /// 13 | /// MQ消息格式实体定义 14 | /// 15 | public class MQMessage where T : BaseMessage 16 | { 17 | /// 18 | /// 用来区分消息类型,必须传值 19 | /// 20 | public string DataType { get; set; } 21 | 22 | /// 23 | /// 消息内容,支持发送多条同类型消息 24 | /// 25 | /// 26 | /// 比如批量导入布控数据,这个时候发送的是多条布控数据 27 | /// 28 | public List Data { get; set; } 29 | 30 | /// 31 | /// 消息发送的时间 32 | /// 33 | public string ReportedTime 34 | { 35 | get 36 | { 37 | return DateTime.Now.ToString("yyyyMMddHHmmss"); 38 | } 39 | } 40 | } 41 | 42 | /// 43 | /// 单条消息基类 44 | /// 45 | public class BaseMessage 46 | { 47 | /// 48 | /// 数据操作类型 49 | /// 50 | public string ChangeType { get; set; } 51 | 52 | public string Id { get; set; } 53 | } 54 | 55 | 56 | /// 57 | /// 数据操作类型 58 | /// 59 | public class ChangeType 60 | { 61 | /// 62 | /// 新增数据 63 | /// 64 | public const string Insert = "Insert"; 65 | /// 66 | /// 更新数据 67 | /// 68 | public const string Update = "Update"; 69 | /// 70 | /// 删除数据 71 | /// 72 | public const string Delete = "Delete"; 73 | } 74 | } -------------------------------------------------------------------------------- /Ywdsoft.Model/Ywdsoft.Model.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8F936E5F-F5F4-43A4-8624-DAB5D4128049} 8 | Library 9 | Properties 10 | Ywdsoft.Model 11 | Ywdsoft.Model 12 | v4.0 13 | 512 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | ..\packages\Dapper.1.50.2\lib\net40\Dapper.dll 41 | True 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | {b8dffa5b-823e-48f2-b271-8374438f40be} 65 | Dapper.SimpleCRUD 66 | 67 | 68 | 69 | 76 | -------------------------------------------------------------------------------- /Ywdsoft.Model/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Ywdsoft.Task/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Ywdsoft.Task")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("焰尾迭:http://yanweidie.cnblogs.com")] 11 | [assembly: AssemblyProduct("Ywdsoft.Task")] 12 | [assembly: AssemblyCopyright("Copyright © 焰尾迭 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("168d7545-28b8-4b3a-88cf-d84afd03f19b")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Ywdsoft.Task/TaskSet/LogClearJob.cs: -------------------------------------------------------------------------------- 1 | using Ywdsoft.Utility; 2 | using Quartz; 3 | using System; 4 | using System.IO; 5 | using Ywdsoft.Utility.ConfigHandler; 6 | 7 | namespace Ywdsoft.Task.TaskSet 8 | { 9 | /// 10 | /// 11 | /// 12 | ///DisallowConcurrentExecution属性标记任务不可并行,要是上一任务没运行完即使到了运行时间也不会运行 13 | [DisallowConcurrentExecution] 14 | public class LogClearJob : IJob 15 | { 16 | public void Execute(IJobExecutionContext context) 17 | { 18 | try 19 | { 20 | string LogDir = FileHelper.GetAbsolutePath("/Logs"); 21 | string[] files = Directory.GetFiles(LogDir, "*.*", SearchOption.AllDirectories); 22 | FileInfo fi = null; 23 | foreach (var item in files) 24 | { 25 | fi = new FileInfo(item); 26 | if ((DateTime.Now - fi.CreationTime).TotalDays > LogConfig.Days) 27 | { 28 | try 29 | { 30 | File.Delete(item); 31 | } 32 | catch { } 33 | } 34 | } 35 | } 36 | catch (Exception ex) 37 | { 38 | JobExecutionException e2 = new JobExecutionException(ex); 39 | LogHelper.WriteLog("日志清理任务异常", ex); 40 | //1.立即重新执行任务 41 | e2.RefireImmediately = true; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ywdsoft.Task/TaskSet/MQSendJob.cs: -------------------------------------------------------------------------------- 1 | using Ywdsoft.Utility; 2 | using Quartz; 3 | using System; 4 | using Ywdsoft.Utility.RabbitMQ; 5 | using System.Collections.Generic; 6 | using Ywdsoft.Model.RabbitMQ; 7 | 8 | namespace Ywdsoft.Task.TaskSet 9 | { 10 | /// 11 | /// 12 | /// 13 | ///DisallowConcurrentExecution属性标记任务不可并行,要是上一任务没运行完即使到了运行时间也不会运行 14 | [DisallowConcurrentExecution] 15 | public class MQSendJob : IJob 16 | { 17 | public void Execute(IJobExecutionContext context) 18 | { 19 | try 20 | { 21 | MQMessage messageList = new MQMessage(); 22 | messageList.DataType = "LogTest"; 23 | messageList.Data = new List(); 24 | messageList.Data.Add(new LogMessage 25 | { 26 | ChangeType = ChangeType.Insert, 27 | Id = Guid.NewGuid().ToString("N"), 28 | Text = "我是测试日志消息,报告当前时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") 29 | }); 30 | RabbitMQClient.SendMessage(messageList); 31 | } 32 | catch (Exception ex) 33 | { 34 | JobExecutionException e2 = new JobExecutionException(ex); 35 | LogHelper.WriteLog("消息队列MQ测试任务异常", ex); 36 | //1.立即重新执行任务 37 | e2.RefireImmediately = true; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ywdsoft.Task/TaskSet/TestJob.cs: -------------------------------------------------------------------------------- 1 | using Ywdsoft.Utility; 2 | using Quartz; 3 | using System; 4 | 5 | namespace Ywdsoft.Task.TaskSet 6 | { 7 | /// 8 | /// 测试任务 9 | /// 10 | ///DisallowConcurrentExecution属性标记任务不可并行,要是上一任务没运行完即使到了运行时间也不会运行 11 | [DisallowConcurrentExecution] 12 | public class TestJob : IJob 13 | { 14 | public void Execute(IJobExecutionContext context) 15 | { 16 | try 17 | { 18 | LogHelper.WriteLog("测试任务,当前系统时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); 19 | } 20 | catch (Exception ex) 21 | { 22 | JobExecutionException e2 = new JobExecutionException(ex); 23 | LogHelper.WriteLog("测试任务异常", ex); 24 | //1.立即重新执行任务 25 | e2.RefireImmediately = true; 26 | //2 立即停止所有相关这个任务的触发器 27 | //e2.UnscheduleAllTriggers=true; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Ywdsoft.Task/Utils/TaskLog.cs: -------------------------------------------------------------------------------- 1 | using Ywdsoft.Utility; 2 | 3 | namespace Ywdsoft.Task.Utils 4 | { 5 | /// 6 | /// 获取任务记录日志ILog 7 | /// 8 | public class TaskLog 9 | { 10 | /// 11 | /// 快递进度普通日志 12 | /// 13 | public static LogHelper ExpressProgressLogInfo = new LogHelper("ExpressProgressJob", "info"); 14 | 15 | /// 16 | /// 快递进度异常日志 17 | /// 18 | public static LogHelper ExpressProgressLogError = new LogHelper("ExpressProgressJob", "error"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ywdsoft.Task/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Ywdsoft.Task/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Admin/AdminRun.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ywdsoft.Utility 4 | { 5 | public class AdminRun 6 | { 7 | /// 8 | /// 以管理员方式运行程序 9 | /// 10 | public static void Run() 11 | { 12 | /** 13 | * 当前用户是管理员的时候,直接启动应用程序 14 | * 如果不是管理员,则使用启动对象启动程序,以确保使用管理员身份运行 15 | */ 16 | //获得当前登录的Windows用户标示 17 | System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent(); 18 | System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity); 19 | //判断当前登录用户是否为管理员 20 | //如果不是管理员,则以管理员方式运行 21 | if (!principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) 22 | { 23 | //创建启动对象 24 | System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); 25 | startInfo.UseShellExecute = true; 26 | startInfo.WorkingDirectory = Environment.CurrentDirectory; 27 | startInfo.FileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; 28 | //设置启动动作,确保以管理员身份运行 29 | startInfo.Verb = "runas"; 30 | try 31 | { 32 | System.Diagnostics.Process.Start(startInfo); 33 | } 34 | catch (Exception ex) 35 | { 36 | LogHelper.WriteLog("程序以管理员方式运行被取消", ex); 37 | Console.Read(); 38 | } 39 | System.Environment.Exit(0); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Auth/UserInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Ywdsoft.Utility.Auth 5 | { 6 | /// 7 | /// 用户信息 8 | /// 9 | [Serializable] 10 | public class UserInfo 11 | { 12 | /// 13 | /// 当前登录用户GUID 14 | /// 15 | public string UserGUID { get; set; } 16 | 17 | /// 18 | /// 当前登录用户Code 19 | /// 20 | public string UserCode { get; set; } 21 | 22 | /// 23 | /// 当前登录用户名称 24 | /// 25 | public string UserName { get; set; } 26 | 27 | /// 28 | /// 是否超级管理员 29 | /// 30 | public bool IsAdmin { get; set; } 31 | 32 | /// 33 | /// 当前登录用户部门GUID 34 | /// 35 | public string DepartmentID { get; set; } 36 | 37 | /// 38 | /// 用户拥有的权限 39 | /// 40 | public List PermissionList{ get; set; } 41 | } 42 | 43 | /// 44 | /// 权限明细 45 | /// 46 | [Serializable] 47 | public class Permission 48 | { 49 | public string ActionCode 50 | { 51 | get; 52 | set; 53 | } 54 | public string FunctionCode 55 | { 56 | get; 57 | set; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Auth/UserService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Composition; 3 | using Ywdsoft.Model.Common; 4 | 5 | namespace Ywdsoft.Utility 6 | { 7 | /// 8 | /// 用户服务接口 9 | /// 10 | public interface IUserService 11 | { 12 | /// 13 | /// 获取用户信息 14 | /// 15 | /// 用户GUID 16 | /// 用户信息 17 | UserAccount GetUserInfo(string UserGUID); 18 | 19 | /// 20 | /// 获取用户信息 21 | /// 22 | /// 用户Code 23 | /// 密码 24 | /// 用户信息 25 | UserAccount GetUserInfo(string UserCode, string Password); 26 | 27 | /// 28 | /// 修改用户密码 29 | /// 30 | /// 用户Id 31 | /// 用户密码 32 | void ChgPwd(string UserGUID, string Pwd); 33 | } 34 | 35 | /// 36 | /// 用户服务 37 | /// 38 | [Export(typeof(IUserService))] 39 | public class UserService : IUserService 40 | { 41 | /// 42 | /// 修改用户密码 43 | /// 44 | /// 用户Id 45 | /// 用户密码 46 | public void ChgPwd(string UserGUID, string Pwd) 47 | { 48 | string strSQL = "update p_User set Password=@Password WHERE UserGUID = @UserGUID"; 49 | SQLHelper.ExecuteNonQuery(strSQL, new { UserGUID = UserGUID, Password = Pwd }); 50 | } 51 | 52 | /// 53 | /// 获取用户信息 54 | /// 55 | /// 用户GUID 56 | /// 用户信息 57 | public UserAccount GetUserInfo(string UserGUID) 58 | { 59 | string strSQL = "SELECT * from p_User WHERE UserGUID = @UserGUID limit 1 offset 0"; 60 | return SQLHelper.Single(strSQL, new { UserGUID = UserGUID }); 61 | } 62 | 63 | /// 64 | /// 获取用户信息 65 | /// 66 | /// 用户Code 67 | /// 密码 68 | /// 用户信息 69 | public UserAccount GetUserInfo(string UserCode, string Password) 70 | { 71 | string strSQL = "SELECT * from p_User WHERE UserCode = @UserCode and Password=@Password limit 1 offset 0"; 72 | return SQLHelper.Single(strSQL, new { UserCode = UserCode, Password = Password }); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Command/ClsCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | 5 | namespace Ywdsoft.Utility.Command 6 | { 7 | /// 8 | /// 清屏命令 9 | /// 10 | [Export(typeof(ICommand))] 11 | public class ClsCommand : ICommand 12 | { 13 | private static Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase){ 14 | { CommandKey.CLS,"清除屏幕" } 15 | }; 16 | 17 | /// 18 | /// 处理的命令-清屏命令 19 | /// 20 | public string GetCommandKey() 21 | { 22 | return CommandKey.CLS; 23 | } 24 | 25 | /// 26 | /// 命令-及参数描述 27 | /// 28 | /// 命令-及参数描述 29 | public Dictionary GetCommandRemark() 30 | { 31 | return dict; 32 | } 33 | 34 | /// 35 | /// 具体命令执行函数 36 | /// 37 | /// 参数 38 | /// 执行结果 39 | public string Excute(params string[] args) 40 | { 41 | Console.Clear(); 42 | return string.Empty; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Command/CommandHelp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Ywdsoft.Utility.Mef; 5 | 6 | namespace Ywdsoft.Utility.Command 7 | { 8 | /// 9 | /// 系统命令初始化构造器 10 | /// 11 | public class CommandHelp 12 | { 13 | /// 14 | /// 所有命令 15 | /// 16 | private static Dictionary CommandDict = null; 17 | 18 | /// 19 | /// 获取系统所有命令 20 | /// 21 | /// 系统所有命令 22 | public static Dictionary GetAllCommand() 23 | { 24 | if (CommandDict == null) 25 | { 26 | CommandDict = new Dictionary(StringComparer.OrdinalIgnoreCase); 27 | string key = string.Empty; 28 | var listCommand = MefConfig.ResolveMany().OrderBy(e => e.GetCommandKey()).ToList(); 29 | foreach (var item in listCommand) 30 | { 31 | key = item.GetCommandKey(); 32 | if (!string.IsNullOrEmpty(key)) 33 | { 34 | CommandDict[key] = item; 35 | } 36 | } 37 | } 38 | return CommandDict; 39 | } 40 | 41 | /// 42 | /// 命令初始化 43 | /// 44 | public static void Init() 45 | { 46 | Console.WriteLine("可以输入【Help】查看系统所有命令"); 47 | GetAllCommand(); 48 | while (true) 49 | { 50 | string strCommand = Console.ReadLine(); 51 | if (string.IsNullOrEmpty(strCommand)) 52 | { 53 | continue; 54 | } 55 | else 56 | { 57 | strCommand = strCommand.Trim(); 58 | } 59 | ExcuteCommad(strCommand); 60 | } 61 | } 62 | 63 | public static string ExcuteCommad(string strCommand) 64 | { 65 | ICommand command = null; 66 | var listCommand = strCommand.Split(' ').Where(e => !string.IsNullOrEmpty(e)).ToList(); 67 | if (listCommand.Count == 0) 68 | { 69 | return string.Empty; 70 | } 71 | if (CommandDict.TryGetValue(listCommand[0], out command)) 72 | { 73 | listCommand.RemoveAt(0); 74 | try 75 | { 76 | return command.Excute(listCommand.ToArray()); 77 | } 78 | catch (Exception ex) 79 | { 80 | Console.WriteLine(ex.ToString()); 81 | return ex.Message; 82 | } 83 | } 84 | else 85 | { 86 | string msg = string.Format("'{0}' 不是可识别的命令", listCommand[0]); 87 | Console.WriteLine(msg); 88 | return msg; 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Command/ExitCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | 5 | namespace Ywdsoft.Utility.Command 6 | { 7 | /// 8 | /// 退出程序命令 9 | /// 10 | [Export(typeof(ICommand))] 11 | public class ExitCommand : ICommand 12 | { 13 | private static Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase){ 14 | { CommandKey.EXIT,"退出程序" } 15 | }; 16 | 17 | /// 18 | /// 处理的命令-退出程序 19 | /// 20 | public string GetCommandKey() 21 | { 22 | return CommandKey.EXIT; 23 | } 24 | 25 | /// 26 | /// 命令-及参数描述 27 | /// 28 | /// 命令-及参数描述 29 | public Dictionary GetCommandRemark() 30 | { 31 | return dict; 32 | } 33 | 34 | /// 35 | /// 具体命令执行函数 36 | /// 37 | /// 参数 38 | /// 执行结果 39 | public string Excute(params string[] args) 40 | { 41 | QuartzHelper.StopSchedule(); 42 | System.Environment.Exit(0); 43 | return string.Empty; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Command/HttpCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using System.Diagnostics; 5 | using Ywdsoft.Utility.ConfigHandler; 6 | 7 | namespace Ywdsoft.Utility.Command 8 | { 9 | /// 10 | /// 打开监听端口网页命令 11 | /// 12 | [Export(typeof(ICommand))] 13 | public class HttpCommand : ICommand 14 | { 15 | private static Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase){ 16 | { CommandKey.HTTP,"在浏览器中打开 系统 设置页面" } 17 | }; 18 | 19 | /// 20 | /// 处理的命令-打开监听端口网页命令 21 | /// 22 | public string GetCommandKey() 23 | { 24 | return CommandKey.HTTP; 25 | } 26 | 27 | /// 28 | /// 命令-及参数描述 29 | /// 30 | /// 命令-及参数描述 31 | public Dictionary GetCommandRemark() 32 | { 33 | return dict; 34 | } 35 | 36 | /// 37 | /// 具体命令执行函数 38 | /// 39 | /// 参数 40 | /// 执行结果 41 | public string Excute(params string[] args) 42 | { 43 | //调用系统默认的浏览器 44 | string url = string.Format("http://127.0.0.1:{0}", SystemConfig.WebPort); 45 | Process.Start(url); 46 | return string.Empty; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Command/ICommand.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ywdsoft.Utility.Command 4 | { 5 | /// 6 | /// 控制台提供命令执行接口 7 | /// 8 | public interface ICommand 9 | { 10 | /// 11 | /// 处理的命令 12 | /// 13 | string GetCommandKey(); 14 | 15 | /// 16 | /// 命令-及参数描述 17 | /// 18 | /// 命令-及参数描述 19 | Dictionary GetCommandRemark(); 20 | 21 | /// 22 | /// 具体命令执行函数 23 | /// 24 | /// 参数 25 | /// 执行结果 26 | string Excute(params string[] args); 27 | } 28 | 29 | /// 30 | /// 命令key 31 | /// 32 | public class CommandKey 33 | { 34 | /// 35 | /// 清屏命令 36 | /// 37 | public const string CLS = "Cls"; 38 | 39 | /// 40 | /// 打开设置页面命令 41 | /// 42 | public const string HTTP = "Http"; 43 | 44 | /// 45 | /// 帮助命令 46 | /// 47 | public const string HELP = "Help"; 48 | 49 | /// 50 | /// 退出程序命令 51 | /// 52 | public const string EXIT = "Exit"; 53 | 54 | /// 55 | /// 重启程序命令 56 | /// 57 | public const string RESTART = "Restart"; 58 | 59 | /// 60 | /// 日志相关命令 61 | /// 62 | public const string LOG = "Log"; 63 | 64 | /// 65 | /// 查看站点绑定端口 66 | /// 67 | public const string PORT = "Port"; 68 | 69 | /// 70 | /// 查看站点绑定端口 71 | /// 72 | public const string WRU = "WRU"; 73 | 74 | /// 75 | /// 每个命令样例 76 | /// 77 | public const string EXAMPLE = "Example"; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Command/PortCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using Ywdsoft.Utility.ConfigHandler; 5 | 6 | namespace Ywdsoft.Utility.Command 7 | { 8 | /// 9 | /// 退出程序命令 10 | /// 11 | [Export(typeof(ICommand))] 12 | public class PortCommand : ICommand 13 | { 14 | private static Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase){ 15 | { CommandKey.PORT,"查看站点绑定端口" } 16 | }; 17 | 18 | /// 19 | /// 处理的命令-退出程序 20 | /// 21 | public string GetCommandKey() 22 | { 23 | return CommandKey.PORT; 24 | } 25 | 26 | /// 27 | /// 命令-及参数描述 28 | /// 29 | /// 命令-及参数描述 30 | public Dictionary GetCommandRemark() 31 | { 32 | return dict; 33 | } 34 | 35 | /// 36 | /// 具体命令执行函数 37 | /// 38 | /// 参数 39 | /// 执行结果 40 | public string Excute(params string[] args) 41 | { 42 | string msg = string.Format("端口号:{0}", SystemConfig.WebPort); 43 | Console.WriteLine(msg); 44 | return msg; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Command/RestartCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using System.Windows.Forms; 5 | 6 | namespace Ywdsoft.Utility.Command 7 | { 8 | /// 9 | /// 重启程序命令 10 | /// 11 | [Export(typeof(ICommand))] 12 | public class RestartCommand : ICommand 13 | { 14 | private static Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase){ 15 | { CommandKey.RESTART,"重启程序" } 16 | }; 17 | 18 | /// 19 | /// 处理的命令-重启程序 20 | /// 21 | public string GetCommandKey() 22 | { 23 | return CommandKey.RESTART; 24 | } 25 | 26 | /// 27 | /// 命令-及参数描述 28 | /// 29 | /// 命令-及参数描述 30 | public Dictionary GetCommandRemark() 31 | { 32 | return dict; 33 | } 34 | 35 | /// 36 | /// 具体命令执行函数 37 | /// 38 | /// 参数 39 | /// 执行结果 40 | public string Excute(params string[] args) 41 | { 42 | Application.Restart(); 43 | System.Environment.Exit(0); 44 | return string.Empty; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Config/SysConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Ywdsoft.Utility 2 | { 3 | /// 4 | /// 缓存系统所有配置信息,以键值对形式存在 5 | /// 6 | /// 7 | /// 系统相关配置信息都应该通过此类的静态属性读取 8 | /// 9 | /// 10 | /// 获取连接字符串 SysConfig.SqlConnect 11 | /// 12 | /// 13 | /// 系统的配置 14 | /// 15 | public class SysConfig 16 | { 17 | /// 18 | /// Sqlite数据库连接信息 19 | /// 20 | [PathMap(Key = "SqliteConnect", AppDataDirectoryConvert = true)] 21 | public static string SqliteConnect { get; set; } 22 | 23 | /// 24 | /// SqlServer数据库连接信息 25 | /// 26 | [PathMap(Key = "SqlServerConnect")] 27 | public static string SqlServerConnect { get; set; } 28 | 29 | /// 30 | /// Sql语句存放目录信息 31 | /// 32 | [PathMap(Key = "YwdsoftExt:XmlCommandFolder")] 33 | public static string XmlCommandFolder { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/Config/LogConfig.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | 3 | namespace Ywdsoft.Utility.ConfigHandler 4 | { 5 | /// 6 | /// 日志清理配置信息 7 | /// 8 | [Export(typeof(ConfigOption))] 9 | 10 | [ConfigType(Group = "LogConfig", GroupCn = "日志清理", ImmediateUpdate = true)] 11 | public class LogConfig : ConfigOption 12 | { 13 | /// 14 | /// 删除X天之前的日志 15 | /// 16 | [Config(Name = "删除X天之前的日志", DefaultValue = "3", ValidateRule = "min=1 digits=true")] 17 | public static int Days { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/Config/RabbitConfig.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Model: 模块名称 3 | * Desctiption: 描述 4 | * Author: 杜冬军 5 | * Created: 2016/3/21 15:34:13 6 | * Copyright:武汉中科通达高新技术股份有限公司 7 | */ 8 | 9 | using System.ComponentModel.Composition; 10 | 11 | namespace Ywdsoft.Utility.ConfigHandler 12 | { 13 | /// 14 | /// MQ消息队列配置信息 15 | /// 16 | [Export(typeof(ConfigOption))] 17 | 18 | [ConfigType(Group = "RabbitMQConfig", GroupCn = "消息队列配置", ImmediateUpdate = false)] 19 | public class RabbitMQConfig : ConfigOption 20 | { 21 | /// 22 | /// 任务队列名称 23 | /// 24 | [Config(Name = "任务队列名称", DefaultValue = "Ywdsoft.Queue.Task")] 25 | public static string QueueName { get; set; } 26 | 27 | /// 28 | /// MQ主机IP 29 | /// 30 | [Config(Name = "主机地址", ValidateRule = "ipv4=true", DefaultValue = "127.0.0.1")] 31 | public static string Host { get; set; } 32 | 33 | /// 34 | /// MQ连接用户名 35 | /// 36 | [Config(Name = "用户名", DefaultValue = "admin")] 37 | public static string UserName { get; set; } 38 | 39 | /// 40 | /// MQ连接密码 41 | /// 42 | [Config(Name = "密码", ValueType = ConfigValueType.Password, DefaultValue = "admin")] 43 | public static string Password { get; set; } 44 | 45 | /// 46 | /// MQ连接端口 47 | /// 48 | [Config(Name = "端口", DefaultValue = "5672", ValidateRule = "min=0 digits=true")] 49 | public static int Port { get; set; } 50 | 51 | /// 52 | /// 消息队列持久化 53 | /// 54 | [Config(Name = "消息队列持久化", DefaultValue = true)] 55 | public static bool Durable { get; set; } 56 | 57 | /// 58 | /// 消息回执 59 | /// 60 | [Config(Name = "消息回执", DefaultValue = true)] 61 | public static bool Ack { get; set; } 62 | 63 | } 64 | } -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/Config/SystemConfig.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | 3 | namespace Ywdsoft.Utility.ConfigHandler 4 | { 5 | /// 6 | /// 系统基础配置信息 7 | /// 8 | [Export(typeof(ConfigOption))] 9 | 10 | [ConfigType(Group = "SystemConfig", GroupCn = "系统基础配置", ImmediateUpdate = true)] 11 | public class SystemConfig : ConfigOption 12 | { 13 | /// 14 | /// 系统页面标题 15 | /// 16 | [Config(Name = "系统页面标题", DefaultValue = "任务管理平台TaskManager")] 17 | public static string SystemTitle { get; set; } 18 | 19 | /// 20 | /// 应用程序名称 21 | /// 22 | [Config(Name = "应用程序名称", DefaultValue = "TaskScheduler-任务执行容器")] 23 | public static string ProgramName { get; set; } 24 | 25 | /// 26 | /// 系统静态资源文件版本管理 27 | /// 28 | [Config(Name = "静态资源版本", DefaultValue = "20160322195917")] 29 | public static string StaticVersion { get; set; } 30 | 31 | /// 32 | /// 登录页是否显示初始信息 33 | /// 34 | [Config(Name = "登录页是否显示初始信息", DefaultValue = true)] 35 | public static bool ShowOriginalAccountInfo { get; set; } 36 | 37 | /// 38 | /// 是否显示异常信息 39 | /// 40 | [Config(Name = "是否显示异常", DefaultValue = true)] 41 | public static bool ShowException { get; set; } 42 | 43 | /// 44 | /// 是否显示异常信息 45 | /// 46 | [Config(Name = "接口允许跨域访问", DefaultValue = false)] 47 | public static bool ApiCros { get; set; } 48 | 49 | /// 50 | /// MQ连接端口 51 | /// 52 | [Config(Name = "管理站点端口", DefaultValue = "9000", ValidateRule = "min=0 digits=true")] 53 | public static int WebPort { get; set; } 54 | } 55 | } -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/Config/TaskConfig.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | 3 | namespace Ywdsoft.Utility.ConfigHandler 4 | { 5 | /// 6 | /// 任务配置信息 7 | /// 8 | [Export(typeof(ConfigOption))] 9 | 10 | [ConfigType(Group = "TaskConfig", GroupCn = "任务配置", ImmediateUpdate = false)] 11 | public class TaskConfig : ConfigOption 12 | { 13 | /// 14 | /// 任务线程数 15 | /// 16 | [Config(Name = "任务线程数", DefaultValue = "50", ValidateRule = "min=1 max=1000 digits=true")] 17 | public static int TaskThreadCount { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/ConfigAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Model: 系统参数配置接口 3 | * Desctiption: 描述 4 | * Author: 杜冬军 5 | * Created: 2016/3/21 9:03:25 6 | */ 7 | 8 | using System; 9 | 10 | namespace Ywdsoft.Utility.ConfigHandler 11 | { 12 | 13 | [AttributeUsageAttribute(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] 14 | public class ConfigAttribute : Attribute 15 | { 16 | /// 17 | /// 对应数据库的键 18 | /// 19 | public string Key { get; set; } 20 | 21 | /// 22 | /// 每项值中文说明,表单前面的说明 23 | /// 24 | public string Name { get; set; } 25 | 26 | /// 27 | /// 默认值 28 | /// 29 | public object DefaultValue { get; set; } 30 | 31 | /// 32 | /// 每项值中文说明,表单前面的说明 33 | /// 34 | public ConfigValueType ValueType { get; set; } 35 | 36 | /// 37 | /// 默认为必填 38 | /// 39 | private bool _required = true; 40 | /// 41 | /// 值是否必填 42 | /// 43 | public bool Required 44 | { 45 | get 46 | { 47 | return _required; 48 | } 49 | set 50 | { 51 | _required = value; 52 | } 53 | } 54 | 55 | /// 56 | /// 字段前端校验规则-对应jquery.validate的校验规则 57 | /// 58 | public string ValidateRule { get; set; } 59 | 60 | /// 61 | /// 界面鼠标放上去Title 62 | /// 63 | public string Title { get; set; } 64 | } 65 | 66 | /// 67 | /// 每项数值类型 68 | /// 69 | public enum ConfigValueType 70 | { 71 | /// 72 | /// 整形 73 | /// 74 | Number = 1, 75 | 76 | /// 77 | /// 字符串 78 | /// 79 | String = 2, 80 | 81 | /// 82 | /// 布尔型 83 | /// 84 | Bool = 3, 85 | 86 | /// 87 | /// 密码 88 | /// 89 | Password = 4, 90 | 91 | /// 92 | /// 多行文本 93 | /// 94 | TextArea = 5 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/ConfigOption.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Model: 系统参数配置接口 3 | * Desctiption: 描述 4 | * Author: 杜冬军 5 | * Created: 2016/3/21 9:03:25 6 | */ 7 | 8 | 9 | using System.Collections.Generic; 10 | 11 | namespace Ywdsoft.Utility.ConfigHandler 12 | { /// 13 | /// 系统配置参数基类 14 | /// 15 | public abstract class ConfigOption 16 | { 17 | /// 18 | /// 当前配置项所属分组 19 | /// 20 | public virtual string GroupType { get; set; } 21 | 22 | /// 23 | /// 参数配置项保存前处理逻辑 24 | /// 25 | /// 当前保存的参数 26 | public virtual VerifyResult BeforeSave(OptionViewModel value) 27 | { 28 | return new VerifyResult(); 29 | } 30 | 31 | /// 32 | /// 参数配置项保存后处理逻辑,一般用于重要配置项 发消息通知其他系统进行配置项更新 33 | /// 34 | /// 当前保存的参数 35 | public virtual void AfterSave(List listOptions) 36 | { 37 | 38 | } 39 | 40 | /// 41 | /// 动态设置属性的默认值,初始化时调用 42 | /// 43 | /// 属性 44 | /// 用于解决默认值是经过其它条件计算出来,不能初始化设置的问题 45 | public virtual void SetDefaultValue(ConfigAttribute ca) 46 | { 47 | 48 | } 49 | } 50 | 51 | /// 52 | /// 保存前校验结果 53 | /// 54 | public class VerifyResult 55 | { 56 | public VerifyResult() 57 | { 58 | IsSusscess = true; 59 | } 60 | 61 | /// 62 | /// 是否校验成功 63 | /// 64 | public bool IsSusscess { get; set; } 65 | 66 | /// 67 | /// 校验错误,对应的错误信息 68 | /// 69 | public string ErrorMessage { get; set; } 70 | } 71 | } -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/ConfigTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Model: 系统参数配置接口 3 | * Desctiption: 描述 4 | * Author: 杜冬军 5 | * Created: 2016/3/21 9:03:25 6 | */ 7 | 8 | using System; 9 | 10 | namespace Ywdsoft.Utility.ConfigHandler 11 | { 12 | 13 | [AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 14 | public class ConfigTypeAttribute : Attribute 15 | { 16 | /// 17 | /// 分组类型-用来区分数据 18 | /// 19 | public string Group { get; set; } 20 | 21 | /// 22 | /// 分组名称 23 | /// 24 | public string GroupCn { get; set; } 25 | 26 | /// 27 | /// 自定义页面地址,不为空的化则跳转到自定义配置页面 28 | /// 29 | public string CustomPage { get; set; } 30 | 31 | /// 32 | /// 是否立即进行服务间同步配置,并且立即应用配置,默认为是 33 | /// 34 | private bool _immediateUpdate = true; 35 | 36 | /// 37 | /// 是否立即进行服务间同步配置,并且立即应用配置,默认为是 为是会发送MQ消息 38 | /// 39 | public bool ImmediateUpdate 40 | { 41 | get 42 | { 43 | return _immediateUpdate; 44 | } 45 | set 46 | { 47 | _immediateUpdate = value; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/IConfigService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Model: 模块名称 3 | * Desctiption: 描述 4 | * Author: 杜冬军 5 | * Created: 2016/3/22 9:26:12 6 | */ 7 | 8 | using System.Collections.Generic; 9 | using System.ComponentModel.Composition; 10 | 11 | namespace Ywdsoft.Utility.ConfigHandler 12 | { 13 | /// 14 | /// 系统配置接口 15 | /// 16 | public interface IConfigService 17 | { 18 | /// 19 | /// 获取所有配置项 20 | /// 21 | /// 所有配置项 22 | List GetAllOptions(string GroupType = ""); 23 | } 24 | 25 | [Export(typeof(IConfigService))] 26 | public class ConfigService : IConfigService 27 | { 28 | /// 29 | /// 获取所有配置项 30 | /// 31 | /// 所有配置项 32 | public List GetAllOptions(string GroupType = "") 33 | { 34 | string strSQL = "select * from Configuration_Options"; 35 | if (!string.IsNullOrEmpty(GroupType)) 36 | { 37 | strSQL += string.Format(" where OPTIONTYPE='{0}'", GroupType); 38 | } 39 | return SQLHelper.ToList(strSQL); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Ywdsoft.Utility/ConfigHandler/Options.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Model: 系统配置 3 | * Desctiption: 描述 4 | * Author: 杜冬军 5 | * Created: 2016/3/21 15:34:13 6 | */ 7 | 8 | using System.Collections.Generic; 9 | 10 | namespace Ywdsoft.Utility.ConfigHandler 11 | { 12 | /// 13 | ///系统参数配置选项表 14 | /// 15 | public class Options 16 | { 17 | /// 18 | ///选项ID 19 | /// 20 | public string OptionId { get; set; } 21 | 22 | /// 23 | ///选项类型 24 | /// 25 | public string OptionType { get; set; } 26 | 27 | /// 28 | ///选项名称 29 | /// 30 | public string OptionName { get; set; } 31 | 32 | /// 33 | ///参数Key值 34 | /// 35 | public string Key { get; set; } 36 | 37 | /// 38 | ///选项值 39 | /// 40 | public string Value { get; set; } 41 | 42 | /// 43 | ///值类型(0:整形 1:字符串 2:布尔型 3:密码) 44 | /// 45 | public string ValueType { get; set; } 46 | 47 | /// 48 | ///是否必填,默认为是 49 | /// 50 | public bool Required { get; set; } 51 | 52 | /// 53 | ///是否立即进行服务间同步配置,并且立即应用配置,默认为是 为是会发送MQ消息 54 | /// 55 | public bool ImmediateUpdate { get; set; } 56 | 57 | /// 58 | /// 字段校验规则 59 | /// 60 | public string ValidateRule { get; set; } 61 | 62 | /// 63 | /// 鼠标悬浮Title 64 | /// 65 | public string Title { get; set; } 66 | } 67 | 68 | /// 69 | /// 配置分组 70 | /// 71 | public class OptionGroup 72 | { 73 | /// 74 | /// 配置分组 75 | /// 76 | public string GroupType { get; set; } 77 | 78 | /// 79 | /// 分组中文 80 | /// 81 | public string GroupName { get; set; } 82 | 83 | /// 84 | /// 是否立即进行服务间同步配置,并且立即应用配置,默认为是 为是会发送MQ消息 85 | /// 86 | public bool ImmediateUpdate { get; set; } 87 | 88 | /// 89 | /// 自定义页面地址,不为空的化则跳转到自定义配置页面 90 | /// 91 | public string CustomPage { get; set; } 92 | } 93 | 94 | /// 95 | /// configViewModel 96 | /// 97 | public class OptionViewModel 98 | { 99 | public OptionGroup Group { get; set; } 100 | 101 | public List ListOptions { get; set; } 102 | } 103 | } 104 | 105 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/DB/ConvertExt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ywdsoft.Utility.DB 4 | { 5 | internal static class ConvertExt 6 | { 7 | internal static object Convert(this object value, Type targetType) 8 | { 9 | if (value == null) 10 | return null; 11 | 12 | if (targetType == typeof(string)) 13 | return value.ToString(); 14 | 15 | Type type = Nullable.GetUnderlyingType(targetType) ?? targetType; 16 | if (value.GetType() == type) 17 | { 18 | return value; 19 | } 20 | 21 | if (type == typeof(Guid) && value.GetType() == typeof(string)) 22 | { 23 | return new Guid(value.ToString()); 24 | } 25 | if (type == typeof(DateTime)) 26 | { 27 | DateTime result; 28 | if (DateTime.TryParse(value.ToString(), out result)) 29 | { 30 | return result; 31 | } 32 | else 33 | { 34 | return null; 35 | } 36 | } 37 | if (type.IsEnum) 38 | { 39 | type = Enum.GetUnderlyingType(type); 40 | } 41 | 42 | return System.Convert.ChangeType(value, type); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/DB/Xml/MyCDATA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Serialization; 3 | using System.Xml.Schema; 4 | using System.Xml; 5 | 6 | namespace Ywdsoft.Utility.Extensions.Xml 7 | { 8 | /// 9 | /// 支持CDATA序列化的包装类 10 | /// 11 | [Serializable] 12 | public class MyCDATA : IXmlSerializable 13 | { 14 | private string _value; 15 | 16 | /// 17 | /// 构造函数 18 | /// 19 | public MyCDATA() { } 20 | 21 | /// 22 | /// 构造函数 23 | /// 24 | /// 初始值 25 | public MyCDATA(string value) 26 | { 27 | this._value = value; 28 | } 29 | 30 | /// 31 | /// 原始值。 32 | /// 33 | public string Value 34 | { 35 | get { return _value; } 36 | } 37 | 38 | XmlSchema IXmlSerializable.GetSchema() 39 | { 40 | return null; 41 | } 42 | 43 | void IXmlSerializable.ReadXml(XmlReader reader) 44 | { 45 | this._value = reader.ReadElementContentAsString(); 46 | } 47 | 48 | void IXmlSerializable.WriteXml(XmlWriter writer) 49 | { 50 | writer.WriteCData(this._value); 51 | } 52 | 53 | /// 54 | /// ToString() 55 | /// 56 | /// 57 | public override string ToString() 58 | { 59 | return this._value; 60 | } 61 | 62 | /// 63 | /// 重载操作符,支持隐式类型转换。 64 | /// 65 | /// 66 | /// 67 | public static implicit operator MyCDATA(string text) 68 | { 69 | return new MyCDATA(text); 70 | } 71 | 72 | /// 73 | /// 重载操作符,支持隐式类型转换。 74 | /// 75 | /// 76 | /// 77 | public static implicit operator string(MyCDATA text) 78 | { 79 | return text.ToString(); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/DB/Xml/XmlCommandItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Serialization; 3 | 4 | namespace Ywdsoft.Utility.Extensions.Xml 5 | { 6 | /// 7 | /// 表示*.config文件中的一个XmlCommand配置项。 8 | /// 9 | [XmlType("XmlCommand")] 10 | [Serializable] 11 | public class XmlCommandItem 12 | { 13 | /// 14 | /// 命令的名字,这个名字将在XmlCommand.From时被使用。 15 | /// 16 | [XmlAttribute("Name")] 17 | public string CommandName; 18 | 19 | /// 20 | /// 命令的文本。是一段可运行的SQL脚本或存储过程名称。 21 | /// 22 | [XmlElement] 23 | public MyCDATA CommandText; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/DB/Xml/XmlHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Xml.Serialization; 4 | using System.IO; 5 | using System.Xml; 6 | 7 | namespace Ywdsoft.Utility.Extensions.Xml 8 | { 9 | /// 10 | /// 用于XML序列化/反序列化的工具类 11 | /// 12 | public static class XmlHelper 13 | { 14 | private static void XmlSerializeInternal(Stream stream, object o, Encoding encoding) 15 | { 16 | if( o == null ) 17 | throw new ArgumentNullException("o"); 18 | if( encoding == null ) 19 | throw new ArgumentNullException("encoding"); 20 | 21 | XmlSerializer serializer = new XmlSerializer(o.GetType()); 22 | 23 | XmlSerializerNamespaces xmlns = new XmlSerializerNamespaces(); 24 | xmlns.Add(string.Empty, string.Empty); 25 | 26 | XmlWriterSettings settings = new XmlWriterSettings(); 27 | settings.Indent = true; 28 | settings.NewLineChars = "\r\n"; 29 | settings.Encoding = encoding; 30 | settings.IndentChars = " "; 31 | 32 | using( XmlWriter writer = XmlWriter.Create(stream, settings) ) { 33 | serializer.Serialize(writer, o, xmlns); 34 | writer.Close(); 35 | } 36 | } 37 | 38 | /// 39 | /// 将一个对象序列化为XML字符串 40 | /// 41 | /// 要序列化的对象 42 | /// 编码方式 43 | /// 序列化产生的XML字符串 44 | public static string XmlSerialize(object o, Encoding encoding) 45 | { 46 | using( MemoryStream stream = new MemoryStream() ) { 47 | XmlSerializeInternal(stream, o, encoding); 48 | 49 | stream.Position = 0; 50 | using( StreamReader reader = new StreamReader(stream, encoding) ) { 51 | return reader.ReadToEnd(); 52 | } 53 | } 54 | } 55 | 56 | /// 57 | /// 将一个对象按XML序列化的方式写入到一个文件 58 | /// 59 | /// 要序列化的对象 60 | /// 保存文件路径 61 | /// 编码方式 62 | public static void XmlSerializeToFile(object o, string path, Encoding encoding) 63 | { 64 | if( string.IsNullOrEmpty(path) ) 65 | throw new ArgumentNullException("path"); 66 | 67 | using( FileStream file = new FileStream(path, FileMode.Create, FileAccess.Write) ) { 68 | XmlSerializeInternal(file, o, encoding); 69 | } 70 | } 71 | 72 | /// 73 | /// 从XML字符串中反序列化对象 74 | /// 75 | /// 结果对象类型 76 | /// 包含对象的XML字符串 77 | /// 编码方式 78 | /// 反序列化得到的对象 79 | public static T XmlDeserialize(string s, Encoding encoding) 80 | { 81 | if( string.IsNullOrEmpty(s) ) 82 | throw new ArgumentNullException("s"); 83 | if( encoding == null ) 84 | throw new ArgumentNullException("encoding"); 85 | 86 | XmlSerializer mySerializer = new XmlSerializer(typeof(T)); 87 | using( MemoryStream ms = new MemoryStream(encoding.GetBytes(s)) ) { 88 | using( StreamReader sr = new StreamReader(ms, encoding) ) { 89 | return (T)mySerializer.Deserialize(sr); 90 | } 91 | } 92 | } 93 | 94 | /// 95 | /// 读入一个文件,并按XML的方式反序列化对象。 96 | /// 97 | /// 结果对象类型 98 | /// 文件路径 99 | /// 编码方式 100 | /// 反序列化得到的对象 101 | public static T XmlDeserializeFromFile(string path, Encoding encoding) 102 | { 103 | if( string.IsNullOrEmpty(path) ) 104 | throw new ArgumentNullException("path"); 105 | if( encoding == null ) 106 | throw new ArgumentNullException("encoding"); 107 | 108 | string xml = File.ReadAllText(path, encoding); 109 | return XmlDeserialize(xml, encoding); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Encrypt/DESEncrypt.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/Ywdsoft.Utility/Encrypt/DESEncrypt.cs -------------------------------------------------------------------------------- /Ywdsoft.Utility/Excel/ColumnInfo.cs: -------------------------------------------------------------------------------- 1 | using NPOI.SS.UserModel; 2 | 3 | namespace Ywdsoft.Utility.Excel 4 | { 5 | /// 6 | /// DataGrid信息 7 | /// 8 | public class ColumnInfo 9 | { 10 | /// 11 | /// 文本对齐方式 12 | /// 13 | public string Align { get; set; } 14 | 15 | /// 16 | /// 标题头 17 | /// 18 | public string Header { get; set; } 19 | 20 | /// 21 | /// 绑定列 22 | /// 23 | public string Field { get; set; } 24 | 25 | /// 26 | /// 内容对齐方式 27 | /// 28 | public ICellStyle Style { get; set; } 29 | 30 | /// 31 | /// 是否在数据集中存在对应列 32 | /// 33 | public bool IsMapDT { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Excel/ExcelImporMapper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | 3 | namespace Ywdsoft.Utility.Excel 4 | { 5 | /// 6 | /// Excel导入数据对应类型枚举 7 | /// 8 | public enum ExcelImportType 9 | { 10 | /// 11 | /// 任务批量添加 12 | /// 13 | Task = 0, 14 | } 15 | 16 | public class ExcelImporMapper 17 | { 18 | /// 19 | /// 业务类型模板文件路径缓存 20 | /// 21 | private static ConcurrentDictionary _fileMappingDict = null; 22 | 23 | /// 24 | /// 根据业务类型获取模版文件路径 25 | /// 26 | /// 业务类型 27 | /// 模版文件路径 28 | public static string GetTemplatePath(ExcelImportType type) 29 | { 30 | InitMapping(); 31 | return _fileMappingDict[type]; 32 | } 33 | 34 | 35 | /// 36 | /// 初始化模版文件路径缓存 37 | /// 38 | private static void InitMapping() 39 | { 40 | if (_fileMappingDict == null) 41 | { 42 | _fileMappingDict = new ConcurrentDictionary(); 43 | _fileMappingDict.TryAdd(ExcelImportType.Task, FileHelper.GetAbsolutePath("/Template/Excel/任务批量导入.xls")); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Excel/ExcelInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data; 3 | 4 | namespace Ywdsoft.Utility.Excel 5 | { 6 | /// 7 | /// Execl相关信息 8 | /// 9 | public class ExcelInfo 10 | { 11 | /// 12 | /// Execl列信息 13 | /// 14 | public List ColumnInfoList { get; set; } 15 | 16 | /// 17 | /// Execl文件名 18 | /// 19 | public string FileName { get; set; } 20 | 21 | /// 22 | /// 应用程序根目录 23 | /// 24 | public string RootPath { get; set; } 25 | 26 | /// 27 | ///获取数据源的方法信息 28 | /// 29 | public string Api { get; set; } 30 | 31 | /// 32 | /// 获取数据请求类型 post get 33 | /// 34 | public string Type { get; set; } 35 | 36 | /// 37 | /// 查询条件 38 | /// 39 | public QueryCondition Condition { get; set; } 40 | 41 | /// 42 | /// 需要导出的数据 43 | /// 44 | public DataTable Data { get; set; } 45 | 46 | private bool isExportSelectData = false; 47 | /// 48 | /// 是否为导出当前选中数据 49 | /// 如果wei true 则不进行远程查询 50 | /// 51 | public bool IsExportSelectData 52 | { 53 | get { return isExportSelectData; } 54 | set { isExportSelectData = value; } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Excel/ExcelUtil.cs: -------------------------------------------------------------------------------- 1 | using CsharpHttpHelper; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Data; 5 | using System.IO; 6 | 7 | namespace Ywdsoft.Utility.Excel 8 | { 9 | /// 10 | /// Execl操作帮助类 11 | /// 12 | public static class ExcelUtil 13 | { 14 | private static HttpHelper http = new HttpHelper(); 15 | 16 | /// 17 | /// 拓展方法,生成EXECL 18 | /// 19 | /// EXECL相关信息 20 | /// Execl路径 21 | public static string ExportExecl(this ExcelInfo info) 22 | { 23 | //1.获取列表对应数据 24 | 25 | //2.创建Execl文档 26 | 27 | //3.列映射 28 | 29 | //4.保存Execl 30 | return "/temp/" + info.FileName + ".xls"; 31 | } 32 | 33 | /// 34 | /// 拓展方法,生成EXECL 35 | /// 36 | /// EXECL相关信息 37 | /// 用户认证令牌 38 | /// Execl路径 39 | public static MemoryStream ExportExeclStream(this ExcelInfo info) 40 | { 41 | //1.获取列表对应数据 42 | DataTable dt = GetGirdData(info); 43 | //2.创建Execl文档 44 | return NPOIHelper.Export(dt, info.ColumnInfoList); 45 | } 46 | 47 | 48 | /// 49 | /// 从WebAPI中获取列表数据 50 | /// 51 | /// 52 | private static DataTable GetGirdData(ExcelInfo info) 53 | { 54 | if (info.IsExportSelectData) 55 | { 56 | if (info.Data == null) 57 | { 58 | info.Data = new DataTable(); 59 | } 60 | return info.Data; 61 | } 62 | try 63 | { 64 | if (info.Type.Equals("post", StringComparison.OrdinalIgnoreCase)) 65 | { 66 | //创建Httphelper参数对象 67 | HttpItem item = new HttpItem() 68 | { 69 | URL = info.Api,//URL 必需项 70 | Method = "post",//可选项 默认为Get 71 | ContentType = "application/json; charset=utf-8",//返回类型 72 | Postdata = JsonConvert.SerializeObject(info.Condition) 73 | }; 74 | 75 | //请求的返回值对象 76 | HttpResult result = http.GetHtml(item); 77 | var responseJson = JsonConvert.DeserializeObject>(result.Html); 78 | if (!responseJson.HasError && responseJson.Message != "logout") 79 | { 80 | return responseJson.Result; 81 | } 82 | else 83 | { 84 | DataTable dt = new DataTable(); 85 | dt.Columns.Add(info.ColumnInfoList[0].Field); 86 | DataRow dr = dt.NewRow(); 87 | //接口报错 88 | if (responseJson.HasError) 89 | { 90 | dr[0] = responseJson.Message; 91 | } 92 | if (responseJson.Message == "logout") 93 | { 94 | dr[0] = "登录超时,请刷新页面重试"; 95 | } 96 | dt.Rows.Add(dr); 97 | return dt; 98 | } 99 | } 100 | else 101 | { 102 | throw new ArgumentOutOfRangeException("不支持Get协议获取数据"); 103 | } 104 | } 105 | catch (Exception ex) 106 | { 107 | throw ex; 108 | } 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Filter/ApiResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ywdsoft.Utility 4 | { 5 | /// 6 | /// 服务器端接口返回值 7 | /// 8 | /// 9 | public class ApiResult 10 | { 11 | /// 12 | /// 执行是否成功:true false 13 | /// 14 | /// 15 | public bool HasError { get; set; } 16 | 17 | /// 18 | /// 数据总条数 19 | /// 20 | public int? TotalCount { get; set; } 21 | 22 | /// 23 | /// 数据总页数 24 | /// 25 | public int? TotalPage { get; set; } 26 | 27 | /// 28 | /// 执行返回消息 29 | /// 30 | /// 31 | public string Message { get; set; } 32 | 33 | /// 34 | /// 数据实体 35 | /// 36 | /// 37 | public T Result { get; set; } 38 | 39 | 40 | public ApiResult() 41 | { 42 | Result = default(T); 43 | HasError = false; 44 | } 45 | 46 | /// 47 | /// 根据每页显示数与总记录数计算出总页数 48 | /// 49 | /// 每页显示数 50 | /// 结果总记录数 51 | /// 是否分页 如果分页则进行计算 不分页则返回null 52 | /// 53 | public int? CalculateTotalPage(int rows, int totalRecord, bool isPagination) 54 | { 55 | if (isPagination && rows > 0) 56 | { 57 | return Convert.ToInt32(Math.Ceiling((double)totalRecord / (double)rows)); 58 | } 59 | else 60 | { 61 | return null; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Mef/MefConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using System.ComponentModel.Composition.Hosting; 5 | 6 | namespace Ywdsoft.Utility.Mef 7 | { 8 | public class MefConfig 9 | { 10 | private static CompositionContainer _container; 11 | public static void Init() 12 | { 13 | //1.Mef接管 14 | DirectoryCatalog catalog = new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory, "Ywdsoft.*.dll"); 15 | _container = new CompositionContainer(catalog); 16 | _container.ComposeParts(); 17 | } 18 | 19 | /// 20 | /// 获取解析类型 21 | /// 22 | /// 23 | /// 24 | public static T TryResolve() 25 | { 26 | return _container.GetExportedValueOrDefault(); 27 | } 28 | 29 | /// 30 | /// 获取解析类型 31 | /// 32 | /// 33 | /// 34 | public static IEnumerable ResolveMany() 35 | { 36 | return _container.GetExportedValues(); 37 | } 38 | 39 | public static T Resolve() 40 | { 41 | return _container.GetExportedValue(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/NVelocity/FileGen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using NVelocity.App; 4 | using Commons.Collections; 5 | using NVelocity.Runtime; 6 | using NVelocity; 7 | using NVelocity.Context; 8 | using System.IO; 9 | using System.Collections; 10 | 11 | namespace Ywdsoft.Utility 12 | { 13 | /// 14 | /// NVelocity读取模版文件生成 15 | /// 16 | public class FileGen 17 | { 18 | /// 19 | /// 通过模版文件路径读取文件内容 20 | /// 21 | /// 模版文件路径 22 | /// 模版文件的参数 23 | /// StringWriter对象 24 | public static StringWriter GetFileText(string path, Hashtable ht) 25 | { 26 | if (String.IsNullOrEmpty(path)) 27 | { 28 | throw new ArgumentNullException("模版文件路径为空!"); 29 | } 30 | try 31 | { 32 | string tmpPath = path.Substring(0,path.LastIndexOf(@"\")); 33 | string filePath = path.Substring(path.LastIndexOf(@"\")+1); 34 | //创建NVelocity引擎的实例对象 35 | VelocityEngine velocity = new VelocityEngine(); 36 | ExtendedProperties props = new ExtendedProperties(); 37 | props.AddProperty(RuntimeConstants.RESOURCE_LOADER, "file"); 38 | props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, tmpPath); 39 | props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, true); 40 | props.AddProperty(RuntimeConstants.INPUT_ENCODING, "utf-8"); 41 | props.AddProperty(RuntimeConstants.OUTPUT_ENCODING, "utf-8"); 42 | velocity.Init(props); 43 | //从文件中读取模板 44 | Template temp = velocity.GetTemplate(filePath); 45 | IContext context = new VelocityContext(); 46 | foreach (string key in ht.Keys) 47 | { 48 | context.Put(key, ht[key]); 49 | } 50 | //合并模板 51 | StringWriter writer = new StringWriter(); 52 | temp.Merge(context, writer); 53 | return writer; 54 | } 55 | catch (Exception ex) 56 | { 57 | throw ex; 58 | } 59 | } 60 | 61 | /// 62 | /// 通过模版文件路径读取文件内容 63 | /// 64 | /// 模版文件路径 65 | /// 模版文件的参数 66 | /// 生成文件的输出路径,如c:\1.txt 67 | /// TextWriter对象 68 | public static void GetFile(string path, Hashtable ht,string strOutputPath) 69 | { 70 | if (String.IsNullOrEmpty(strOutputPath)) 71 | { 72 | throw new ArgumentNullException("模版文件输出路径为空!"); 73 | } 74 | try 75 | { 76 | StringWriter stringW=GetFileText(path, ht); 77 | StreamWriter sw = new StreamWriter(strOutputPath,false,Encoding.UTF8); 78 | sw.Write(stringW.ToString()); 79 | sw.Close(); 80 | } 81 | catch (Exception ex) 82 | { 83 | throw ex; 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Ywdsoft.Utility")] 8 | [assembly: AssemblyDescription("开发帮助库")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("焰尾迭:http://yanweidie.cnblogs.com")] 11 | [assembly: AssemblyProduct("Ywdsoft.Utility")] 12 | [assembly: AssemblyCopyright("Copyright © 焰尾迭 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | [assembly: log4net.Config.XmlConfigurator(ConfigFile = @"log4net.config", Watch = true)] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("ff874b58-e4ac-4c93-b8d1-ea9cefe7670e")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Quartz/CustomTriggerListener.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using System; 3 | 4 | namespace Ywdsoft.Utility.Quartz 5 | { 6 | /// 7 | /// 自定义触发器监听 8 | /// 9 | public class CustomTriggerListener : ITriggerListener 10 | { 11 | public string Name 12 | { 13 | get 14 | { 15 | return "All_TriggerListener"; 16 | } 17 | } 18 | 19 | /// 20 | /// Job执行时调用 21 | /// 22 | /// 触发器 23 | /// 上下文 24 | public void TriggerFired(ITrigger trigger, IJobExecutionContext context) 25 | { 26 | 27 | } 28 | 29 | 30 | /// 31 | /// //Trigger触发后,job执行时调用本方法。true即否决,job后面不执行。 32 | /// 33 | /// 34 | /// 35 | /// 36 | public bool VetoJobExecution(ITrigger trigger, IJobExecutionContext context) 37 | { 38 | TaskHelper.UpdateRecentRunTime(trigger.JobKey.Name, TimeZoneInfo.ConvertTimeFromUtc(context.NextFireTimeUtc.Value.DateTime, TimeZoneInfo.Local)); 39 | return false; 40 | } 41 | 42 | /// 43 | /// Job完成时调用 44 | /// 45 | /// 触发器 46 | /// 上下文 47 | /// 48 | public void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode) 49 | { 50 | TaskHelper.UpdateLastRunTime(trigger.JobKey.Name, TimeZoneInfo.ConvertTimeFromUtc(context.NextFireTimeUtc.Value.DateTime, TimeZoneInfo.Local)); 51 | } 52 | 53 | /// 54 | /// 错过触发时调用 55 | /// 56 | /// 触发器 57 | public void TriggerMisfired(ITrigger trigger) 58 | { 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Ywdsoft.Utility/RabbitMQ/MessageTransmit.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.Composition; 5 | 6 | namespace Ywdsoft.Utility.RabbitMQ 7 | { 8 | [Export] 9 | public class MessageTransmit 10 | { 11 | [ImportMany(typeof(MessageTransmitAction))] 12 | public IEnumerable Actions 13 | { 14 | get; 15 | set; 16 | } 17 | 18 | /// 19 | /// 消息分发 20 | /// 21 | /// 消息类容 22 | /// 路由键 23 | public void Transmit(string message, string routingKey) 24 | { 25 | JObject rabbitMQMessage = JObject.Parse(message); 26 | string datatype = rabbitMQMessage["DataType"].ToString(); 27 | 28 | foreach (var item in Actions) 29 | { 30 | if (item.GetKey().Contains(datatype)) 31 | { 32 | try 33 | { 34 | item.Action(message); 35 | } 36 | catch (Exception ex) 37 | { 38 | LogHelper.WriteLog("Rabbit消息接收处理异常", ex); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/RabbitMQ/MessageTransmitAction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ywdsoft.Utility.RabbitMQ 4 | { 5 | public abstract class MessageTransmitAction 6 | { 7 | /// 8 | /// 监听多个数据类型 9 | /// 10 | public abstract List MessageDataType 11 | { 12 | get; 13 | } 14 | 15 | /// 16 | /// 处理方法 17 | /// 18 | /// 消息内容 19 | public abstract void Action(string message); 20 | 21 | /// 22 | /// 获取监听的数据类型 23 | /// 24 | /// 25 | public List GetKey() 26 | { 27 | return MessageDataType; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Regex/RegexHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | 3 | namespace Ywdsoft.Utility 4 | { 5 | public class RegexHelper 6 | { 7 | /// 8 | /// 是否手机号码 9 | /// 10 | /// 要判断的手机号码 11 | /// 12 | public static bool IsMobile(string input) 13 | { 14 | if (!Regex.IsMatch(input, @"^[1][1-9]\d{9}$", RegexOptions.IgnoreCase)) 15 | return false; 16 | if (input.Length == 11 && (input.StartsWith("13") || input.StartsWith("14") || input.StartsWith("15") || input.StartsWith("18"))) 17 | { 18 | return true; 19 | } 20 | return false; 21 | } 22 | 23 | /// 24 | /// 是否e-mail 25 | /// 26 | /// 要判断的字符串 27 | /// 28 | public static bool IsEmail(string input) 29 | { 30 | if (!string.IsNullOrEmpty(input)) 31 | { 32 | string EmailReg = @"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"; 33 | 34 | return Regex.IsMatch(input, EmailReg, RegexOptions.IgnoreCase); 35 | } 36 | return false; 37 | } 38 | 39 | /// 40 | /// 是否中文汉字 41 | /// 42 | /// 43 | /// 44 | public static bool IsChinese(string input) 45 | { 46 | if (string.IsNullOrEmpty(input)) 47 | return false; 48 | 49 | Regex rx = new Regex("^[\u4e00-\u9fa5]$"); 50 | for (int i = 0; i < input.Length; i++) 51 | { 52 | if (!rx.IsMatch(input[i].ToString())) 53 | return false; 54 | } 55 | return true; 56 | } 57 | 58 | /// 59 | /// 是否IP地址 60 | /// 61 | /// 待判断的IP地址 62 | /// 63 | public static bool IsIPAddress(string input) 64 | { 65 | if (string.IsNullOrEmpty(input) || input.Length < 7 || input.Length > 15) 66 | return false; 67 | 68 | Regex regex = new Regex(@"^([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])$", RegexOptions.IgnoreCase); 69 | return regex.IsMatch(input); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/StaticExtend/StringExt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ywdsoft.Utility 4 | { 5 | public static class StringExt 6 | { 7 | /// 8 | /// 格式化超过指定长度的字符串,显示截取后字符串加... 9 | /// 10 | /// 字符串 11 | /// 能显示的字节长度 12 | /// 13 | public static string FormatStringLength(this string str, int displayLength) 14 | { 15 | string result = string.Empty;// 最终返回的结果 16 | int byteLen = System.Text.Encoding.Default.GetByteCount(str);// 单字节字符长度 17 | int charLen = str.Length;// 把字符平等对待时的字符串长度 18 | int byteCount = 0;// 记录读取进度 19 | int pos = 0;// 记录截取位置 20 | if (byteLen > displayLength) 21 | { 22 | for (int i = 0; i < charLen; i++) 23 | { 24 | if (Convert.ToInt32(str.ToCharArray()[i]) > 255)// 按中文字符计算加2 25 | byteCount += 2; 26 | else// 按英文字符计算加1 27 | byteCount += 1; 28 | if (byteCount > displayLength)// 超出时只记下上一个有效位置 29 | { 30 | pos = i; 31 | break; 32 | } 33 | else if (byteCount == displayLength)// 记下当前位置 34 | { 35 | pos = i + 1; 36 | break; 37 | } 38 | } 39 | 40 | if (pos >= 0) 41 | result = str.Substring(0, pos); 42 | } 43 | else 44 | result = str; 45 | 46 | return result; 47 | 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Tags/TagsSourceType.cs: -------------------------------------------------------------------------------- 1 | namespace Ywdsoft.Utility 2 | { 3 | /// 4 | /// 标签源 5 | /// 6 | public class TagsSourceType 7 | { 8 | /// 9 | /// 系统参数配置 10 | /// 11 | public const string ConfigHandler = "ConfigHandler"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/Time/TimeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ywdsoft.Utility 4 | { 5 | public static class TimeHelper 6 | { 7 | /// 8 | /// 计算两个日期相隔的天数和小时数 9 | /// 10 | /// 开始日期 11 | /// 截止日期 12 | /// 相隔的天数和小时数 13 | public static string GetDayAndHours(this DateTime dt1,DateTime dt2) 14 | { 15 | double jg = (dt1 - dt2).TotalDays; 16 | //取相隔天数 17 | double iDay = Math.Floor(jg); 18 | //取相隔小时数 19 | double iHour = Math.Ceiling((jg - iDay) * 24); 20 | return string.Format("{0}天{1}小时", iDay, iHour); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/log4net.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Ywdsoft.Utility/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceProcess; 2 | 3 | namespace TaskManager 4 | { 5 | static class Program 6 | { 7 | /// 8 | /// 应用程序的主入口点。 9 | /// 10 | static void Main() 11 | { 12 | ServiceBase[] ServicesToRun = new ServiceBase[] 13 | { 14 | new TaskManagerService() 15 | }; 16 | //运行window任务 17 | ServiceBase.Run(ServicesToRun); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/ProjectInstaller.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TaskManager 2 | { 3 | partial class ProjectInstaller 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); 32 | this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); 33 | // 34 | // serviceProcessInstaller1 35 | // 36 | this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; 37 | this.serviceProcessInstaller1.Password = null; 38 | this.serviceProcessInstaller1.Username = null; 39 | // 40 | // serviceInstaller1 41 | // 42 | this.serviceInstaller1.Description = "基于Quartz.NET的定时任务管理服务,可自定义Job添加自己的服务.服务介绍:http://www.cnblogs.com/yanweidie/p/3564" + 43 | "062.html"; 44 | this.serviceInstaller1.DisplayName = "定时任务管理服务"; 45 | this.serviceInstaller1.ServiceName = "YwdsoftTM"; 46 | this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic; 47 | // 48 | // ProjectInstaller 49 | // 50 | this.Installers.AddRange(new System.Configuration.Install.Installer[] { 51 | this.serviceProcessInstaller1, 52 | this.serviceInstaller1}); 53 | 54 | } 55 | 56 | #endregion 57 | 58 | private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; 59 | private System.ServiceProcess.ServiceInstaller serviceInstaller1; 60 | } 61 | } -------------------------------------------------------------------------------- /Ywdsoft.WindowService/ProjectInstaller.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace TaskManager 4 | { 5 | [RunInstaller(true)] 6 | public partial class ProjectInstaller : System.Configuration.Install.Installer 7 | { 8 | public ProjectInstaller() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("TaskManager")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("焰尾迭:http://yanweidie.cnblogs.com")] 11 | [assembly: AssemblyProduct("TaskManager")] 12 | [assembly: AssemblyCopyright("Copyright © 焰尾迭 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("82d42b7e-72a8-4c90-a873-ae0c7a03b6e9")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/TaskManagerService.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TaskManager 2 | { 3 | partial class TaskManagerService 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | components = new System.ComponentModel.Container(); 32 | this.ServiceName = "Service1"; 33 | } 34 | 35 | #endregion 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/TaskManagerService.cs: -------------------------------------------------------------------------------- 1 | using Ywdsoft.Utility; 2 | using Owin_Nancy; 3 | using System.ServiceProcess; 4 | using System.Threading; 5 | using Ywdsoft.Utility.ConfigHandler; 6 | using Ywdsoft.Utility.Mef; 7 | using Ywdsoft.Utility.Extensions.Xml; 8 | using Ywdsoft.Utility.Command; 9 | using System; 10 | using Nancy.Hosting.Self; 11 | using Ywdsoft.Utility.RabbitMQ; 12 | 13 | namespace TaskManager 14 | { 15 | /* 16 | * 功能介绍: TaskManager是基于Quartz.NET的一款开源任务管理系统, 17 | * 使用Window服务来承载。目前系统集成了四个常用任务,代理IP爬虫,快递进度,消息通知,动态修改Job任务 18 | * 19 | * 作者:焰尾迭 20 | * 博客地址:http://www.cnblogs.com/yanweidie/p/3564062.html 21 | */ 22 | public partial class TaskManagerService : ServiceBase 23 | { 24 | public TaskManagerService() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | protected override void OnStart(string[] args) 30 | { 31 | try 32 | { 33 | //1.MEF初始化 34 | MefConfig.Init(); 35 | 36 | //2.数据库初始化连接 37 | ConfigInit.InitConfig(); 38 | 39 | //3.系统参数配置初始化 40 | ConfigManager configManager = MefConfig.TryResolve(); 41 | configManager.Init(); 42 | 43 | //4.任务启动 44 | QuartzHelper.InitScheduler(); 45 | QuartzHelper.StartScheduler(); 46 | 47 | //5.加载SQL信息到缓存中 48 | XmlCommandManager.LoadCommnads(SysConfig.XmlCommandFolder); 49 | //开发时监听资源文件变化,用于实时更新 50 | DevelperHelper.WatcherResourceChange(); 51 | 52 | // 保持web服务运行 53 | ThreadPool.QueueUserWorkItem((o) => 54 | { 55 | //7.启动站点 56 | using (NancyHost host = Startup.Start(SystemConfig.WebPort)) 57 | { 58 | //调用系统默认的浏览器 59 | string url = string.Format("http://127.0.0.1:{0}", SystemConfig.WebPort); 60 | LogHelper.WriteLog(string.Format("系统已启动,当前监听站点地址:{0}", url)); 61 | try 62 | { 63 | //4.消息队列启动 64 | RabbitMQClient.InitClient(); 65 | } 66 | catch (Exception ex) 67 | { 68 | Console.WriteLine(ex); 69 | } 70 | //8.系统命令初始化 71 | CommandHelp.Init(); 72 | } 73 | }); 74 | } 75 | catch (Exception ex) 76 | { 77 | LogHelper.WriteLog("服务启动异常", ex); 78 | } 79 | } 80 | 81 | protected override void OnStop() 82 | { 83 | //回收资源 84 | Startup.Dispose(); 85 | Environment.Exit(0); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/Ywdsoft.WindowService/favicon.ico -------------------------------------------------------------------------------- /Ywdsoft.WindowService/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Ywdsoft.WindowService/关闭服务.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/Ywdsoft.WindowService/关闭服务.bat -------------------------------------------------------------------------------- /Ywdsoft.WindowService/删除服务.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/Ywdsoft.WindowService/删除服务.bat -------------------------------------------------------------------------------- /Ywdsoft.WindowService/安装启动服务.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/Ywdsoft.WindowService/安装启动服务.bat -------------------------------------------------------------------------------- /Ywdsoft.WindowService/服务安装卸载工具.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrazyJson/TaskManager/5b62c9c6f34540ea3e28fca8d0ea11858aa2d74c/Ywdsoft.WindowService/服务安装卸载工具.exe -------------------------------------------------------------------------------- /Ywdsoft.WindowService/部署说明.txt: -------------------------------------------------------------------------------- 1 | 1.右键以管理员方式运行 “安装启动服务.bat” 2 | 2.启动成功后查看Logs日志看是否存在异常日志 3 | 4 | 5 | 1.右键以管理员方式运行"服务安装卸载工具.exe" 6 | 2.选择当前目录下的“Ywdsoft.WindowService.exe” 点击安装 7 | 8 | 注意点:使用脚本安装,只能使用脚本卸载 9 | -------------------------------------------------------------------------------- /Ywdsoft.XmlCommand/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Ywdsoft.XmlCommand")] 8 | [assembly: AssemblyDescription("存放SQL的项目")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("焰尾迭:http://yanweidie.cnblogs.com")] 11 | [assembly: AssemblyProduct("Ywdsoft.XmlCommand")] 12 | [assembly: AssemblyCopyright("Copyright ©焰尾迭 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("9f25a64e-ee14-42b0-9cbd-0afbeadc3183")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Ywdsoft.XmlCommand/Tool/Table.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Ywdsoft.XmlCommand/Ywdsoft.XmlCommand.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {9F25A64E-EE14-42B0-9CBD-0AFBEADC3183} 8 | Library 9 | Properties 10 | Ywdsoft.XmlCommand 11 | Ywdsoft.XmlCommand 12 | v4.0 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 55 | --------------------------------------------------------------------------------