diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/EmailManagementController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/EmailManagementController.cs index d55d1de9f..950a65f05 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/EmailManagementController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/EmailManagementController.cs @@ -112,12 +112,22 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers /// 启用 /// /// 主键 + /// 启用标识:1启用0禁用 /// [HttpPost] [AjaxOnly] - public ActionResult DoEnabled(string keyValue) + public ActionResult DoEnabled(string keyValue,string status) { - emailManagementIBLL.DoEnabled(keyValue); + if (status == "1")//启用 + { + //判断是否已有启用项 + var model = emailManagementIBLL.GetEmailManagementEntityEnabled(); + if (model != null) + { + return Fail("已有启用项,请禁用后再操作!"); + } + } + emailManagementIBLL.DoEnabled(keyValue,status); return Success("操作成功!"); } #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.cshtml index b1ec3cca2..d0779cd41 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.cshtml @@ -3,33 +3,41 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
+
+
SMTP服务器*
+
+
+
+
SMTP服务端口*
+ +
+
发件邮箱账号*
-
-
发件邮箱密码*
- +
+
发件邮箱密码
+ +
+
+
客户端授权码*
+
-
+
发件邮箱名称*
定时发送小时*
-
+
定时发送分钟
-
+
-
-
启用
-
-
-
+
备注
- +
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/EmailManagement/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.js index b1027098f..f5207db3f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.js @@ -15,12 +15,9 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { - $('#F_EnabledMark').lrRadioCheckbox({ - type: 'radio', - code: 'YesOrNoInt', - }); $('#F_Hour').lrselect({ data: getArray(24), allowSearch: true }); - $('#F_Minute').lrselect({ data: getArray(60), allowSearch: true }); + $('#F_Minute').lrselect({ data: getArray(60), allowSearch: true }); + $('#F_SMTPServer').lrDataItemSelect({ code: 'SMTPServer' }); }, initData: function () { if (!!keyValue) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.cshtml index 37b2aa3d6..3f51df50a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.cshtml @@ -17,6 +17,7 @@  编辑  删除  启用 +  禁用
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.js index f241ed76d..ff1102b80 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.js @@ -81,9 +81,28 @@ var bootstrap = function ($, learun) { return false; } - learun.layerConfirm('启用操作将会对已启用的项目进行禁用,是否确认启用该项!', function (res) { + learun.layerConfirm('是否确认启用该项!', function (res) { if (res) { - learun.postForm(top.$.rootUrl + '/PersonnelManagement/EmailManagement/DoEnabled', { keyValue: keyValue }, function () { + learun.postForm(top.$.rootUrl + '/PersonnelManagement/EmailManagement/DoEnabled', { keyValue: keyValue,status:1 }, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 禁用 + $('#lr_unenabled').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_Id'); + if (learun.checkrow(keyValue)) { + var F_EnabledMark = $('#gridtable').jfGridValue('F_EnabledMark'); + if (F_EnabledMark != "1") { + learun.alert.warning("当前项未启用!"); + return false; + } + + learun.layerConfirm('是否确认禁用该项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/PersonnelManagement/EmailManagement/DoEnabled', { keyValue: keyValue,status:0 }, function () { refreshGirdData(); }); } @@ -93,11 +112,14 @@ var bootstrap = function ($, learun) { }, // 初始化列表 initGird: function () { - $('#gridtable').lrAuthorizeJfGrid({ + $('#gridtable').jfGrid({ url: top.$.rootUrl + '/PersonnelManagement/EmailManagement/GetPageList', headData: [ + { label: "SMTP服务器", name: "F_SMTPServer", width: 100, align: "left"}, + { label: "SMTP服务器端口", name: "F_SMTPPort", width: 100, align: "left"}, { label: "发件邮箱账号", name: "F_Account", width: 200, align: "left"}, { label: "发件邮箱密码", name: "F_Password", width: 200, align: "left"}, + { label: "客户端授权码", name: "F_AuthorizeCode", width: 200, align: "left"}, { label: "发件邮箱名称", name: "F_SenderName", width: 200, align: "left"}, { label: "定时发送小时", name: "F_Hour", width: 150, align: "left"}, { label: "定时发送分钟", name: "F_Minute", width: 150, align: "left"}, @@ -109,7 +131,8 @@ var bootstrap = function ($, learun) { }, ], mainId:'F_Id', - isPage: true + isPage: true, + sidx:'F_CreatorTime desc' }); page.search(); }, diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementBLL.cs index 47cebe65b..7df3284e8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementBLL.cs @@ -67,6 +67,30 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 获取EmailManagement表实体数据 + /// + /// 主键 + /// + public EmailManagementEntity GetEmailManagementEntityEnabled() + { + try + { + return emailManagementService.GetEmailManagementEntityEnabled(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion #region 提交数据 @@ -123,11 +147,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 启用 /// /// 主键 - public void DoEnabled(string keyValue) + public void DoEnabled(string keyValue, string status) { try { - emailManagementService.DoEnabled(keyValue); + emailManagementService.DoEnabled(keyValue,status); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementEntity.cs index 219bbbbdd..7cbc68796 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementEntity.cs @@ -84,6 +84,21 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// [Column("F_DAYOFWEEK")] public int? F_DayOfWeek { get; set; } + /// + /// 客户端授权码 + /// + [Column("F_AUTHORIZECODE")] + public string F_AuthorizeCode { get; set; } + /// + /// SMTP服务器 + /// + [Column("F_SMTPSERVER")] + public string F_SMTPServer { get; set; } + /// + /// SMTP服务器端口 + /// + [Column("F_SMTPPORT")] + public int? F_SMTPPort { get; set; } #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementIBLL.cs index dfe15ba04..256eaf988 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementIBLL.cs @@ -27,6 +27,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 主键 /// EmailManagementEntity GetEmailManagementEntity(string keyValue); + /// + /// 获取EmailManagement表实体数据 + /// + /// 主键 + /// + EmailManagementEntity GetEmailManagementEntityEnabled(); #endregion #region 提交数据 @@ -46,7 +52,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 启用 /// /// 主键 - void DoEnabled(string keyValue); + void DoEnabled(string keyValue, string status); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementService.cs index 83bd5bb7c..6404e5392 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementService.cs @@ -30,16 +30,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement try { var strSql = new StringBuilder(); - strSql.Append("SELECT "); - strSql.Append(@" - t.F_Id, - t.F_Account, - t.F_Password, - t.F_SenderName, - t.F_Hour, - t.F_Minute, - t.F_EnabledMark - "); + strSql.Append("SELECT t.*"); strSql.Append(" FROM EmailManagement t "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); @@ -84,6 +75,30 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 获取EmailManagement表实体数据 + /// + /// 主键 + /// + public EmailManagementEntity GetEmailManagementEntityEnabled() + { + try + { + return this.BaseRepository().FindEntity(x=>x.F_EnabledMark == 1); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion #region 提交数据 @@ -148,21 +163,23 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 启用 /// /// 主键 - public void DoEnabled(string keyValue) + public void DoEnabled(string keyValue, string status) { - var db = this.BaseRepository().BeginTrans(); try { - //禁用,已启用项目 - db.ExecuteBySql("update EmailManagement set F_EnabledMark=0 where F_EnabledMark=1 "); - //启用 - db.ExecuteBySql($"update EmailManagement set F_EnabledMark=1 where F_Id='{keyValue}' "); - - db.Commit(); + if (status == "1") + { + //启用 + this.BaseRepository().ExecuteBySql($"update EmailManagement set F_EnabledMark=1 where F_Id='{keyValue}' "); + } + else + { + //禁用 + this.BaseRepository().ExecuteBySql($"update EmailManagement set F_EnabledMark=0 where F_Id='{keyValue}' "); + } } catch (Exception ex) { - db.Rollback(); if (ex is ExceptionEx) { throw;