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 new file mode 100644 index 000000000..d55d1de9f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/EmailManagementController.cs @@ -0,0 +1,126 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.PersonnelManagement; +using System.Web.Mvc; +using System.Collections.Generic; + +namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-21 09:52 + /// 描 述:学校邮箱管理 + /// + public class EmailManagementController : MvcControllerBase + { + private EmailManagementIBLL emailManagementIBLL = new EmailManagementBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = emailManagementIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var EmailManagementData = emailManagementIBLL.GetEmailManagementEntity( keyValue ); + var jsonData = new { + EmailManagement = EmailManagementData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + emailManagementIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, string strEntity) + { + EmailManagementEntity entity = strEntity.ToObject(); + emailManagementIBLL.SaveEntity(keyValue,entity); + return Success("保存成功!"); + } + /// + /// 启用 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DoEnabled(string keyValue) + { + emailManagementIBLL.DoEnabled(keyValue); + 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 new file mode 100644 index 000000000..b1ec3cca2 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.cshtml @@ -0,0 +1,35 @@ +@{ + ViewBag.Title = "学校邮箱管理"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
发件邮箱账号*
+ +
+
+
发件邮箱密码*
+ +
+
+
发件邮箱名称*
+ +
+
+
定时发送小时*
+
+
+
+
定时发送分钟
+
+
+
+
启用
+
+
+
+
备注
+ +
+
+@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 new file mode 100644 index 000000000..b1027098f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Form.js @@ -0,0 +1,67 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-10-21 09:52 + * 描 述:学校邮箱管理 + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + 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 }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/EmailManagement/GetFormData?keyValue=' + keyValue, function (data) { + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id ).jfGridSet('refreshdata', data[id]); + } + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/EmailManagement/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); + + +} + +function getArray(max) { + var aa = []; + for (var i = 0; i < max; i++) { + var item = { text: ''+i+'', id: ''+i+'' }; + aa.push(item); + } + return aa; +} \ No newline at end of file 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 new file mode 100644 index 000000000..37b2aa3d6 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.cshtml @@ -0,0 +1,27 @@ +@{ + ViewBag.Title = "学校邮箱管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/PersonnelManagement/Views/EmailManagement/Index.js") 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 new file mode 100644 index 000000000..a8ebbe2ff --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EmailManagement/Index.js @@ -0,0 +1,119 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-10-21 09:52 + * 描 述:学校邮箱管理 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/PersonnelManagement/EmailManagement/Form', + width: 800, + height: 600, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_Id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/PersonnelManagement/EmailManagement/Form?keyValue=' + keyValue, + width: 800, + height: 600, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').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.deleteForm(top.$.rootUrl + '/PersonnelManagement/EmailManagement/DeleteForm', { keyValue: keyValue}, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 启用 + $('#lr_enabled').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 }, function () { + refreshGirdData(); + }); + } + }); + } + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').lrAuthorizeJfGrid({ + url: top.$.rootUrl + '/PersonnelManagement/EmailManagement/GetPageList', + headData: [ + { label: "发件邮箱账号", name: "F_Account", width: 200, align: "left"}, + { label: "发件邮箱密码", name: "F_Password", 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"}, + { + label: "是否启用", name: "F_EnabledMark", width: 80, align: "center", + formatter: function (cellvalue) { + return cellvalue == "1" ? "" : ""; + } + }, + ], + mainId:'F_Id', + isPage: true + }); + page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 10967a5f4..bc51bcd13 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -845,6 +845,7 @@ + @@ -6619,6 +6620,10 @@ + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index 972ab02cc..b009e4f8f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -599,6 +599,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/PersonnelManagement/EmailManagementMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/PersonnelManagement/EmailManagementMap.cs new file mode 100644 index 000000000..c67387f75 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/PersonnelManagement/EmailManagementMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.PersonnelManagement; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-21 09:52 + /// 描 述:学校邮箱管理 + /// + public class EmailManagementMap : EntityTypeConfiguration + { + public EmailManagementMap() + { + #region 表、主键 + //表 + this.ToTable("EMAILMANAGEMENT"); + //主键 + this.HasKey(t => t.F_Id); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index cb76b3c66..9f76ba041 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -1823,6 +1823,10 @@ + + + + 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 new file mode 100644 index 000000000..47cebe65b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementBLL.cs @@ -0,0 +1,148 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.PersonnelManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-21 09:52 + /// 描 述:学校邮箱管理 + /// + public class EmailManagementBLL : EmailManagementIBLL + { + private EmailManagementService emailManagementService = new EmailManagementService(); + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return emailManagementService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取EmailManagement表实体数据 + /// + /// 主键 + /// + public EmailManagementEntity GetEmailManagementEntity(string keyValue) + { + try + { + return emailManagementService.GetEmailManagementEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + emailManagementService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, EmailManagementEntity entity) + { + try + { + emailManagementService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 启用 + /// + /// 主键 + public void DoEnabled(string keyValue) + { + try + { + emailManagementService.DoEnabled(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + } +} 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 new file mode 100644 index 000000000..219bbbbdd --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementEntity.cs @@ -0,0 +1,112 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.PersonnelManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-21 09:51 + /// 描 述:学校邮箱管理 + /// + public class EmailManagementEntity + { + #region 实体成员 + /// + /// 邮件账户主键 + /// + [Column("F_ID")] + public string F_Id { get; set; } + /// + /// 账户 + /// + [Column("F_ACCOUNT")] + public string F_Account { get; set; } + /// + /// 密码 + /// + [Column("F_PASSWORD")] + public string F_Password { get; set; } + /// + /// 发件人名称 + /// + [Column("F_SENDERNAME")] + public string F_SenderName { get; set; } + /// + /// 描述 + /// + [Column("F_DESCRIPTION")] + public string F_Description { get; set; } + /// + /// 有效标志 + /// + [Column("F_ENABLEDMARK")] + public int? F_EnabledMark { get; set; } + /// + /// 创建时间 + /// + [Column("F_CREATORTIME")] + public DateTime? F_CreatorTime { get; set; } + /// + /// 创建用户 + /// + [Column("F_CREATORUSERID")] + public string F_CreatorUserId { get; set; } + /// + /// 定时发送时间类型(天、周、月、年、) + /// + [Column("F_CRONTYPE")] + public string F_CronType { get; set; } + /// + /// 定时发送月 + /// + [Column("F_MONTH")] + public int? F_Month { get; set; } + /// + /// 定时发送日 + /// + [Column("F_DAY")] + public int? F_Day { get; set; } + /// + /// 定时发送时 + /// + [Column("F_HOUR")] + public int? F_Hour { get; set; } + /// + /// 定时发送分 + /// + [Column("F_MINUTE")] + public int? F_Minute { get; set; } + /// + /// 定时发送周 + /// + [Column("F_DAYOFWEEK")] + public int? F_DayOfWeek { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.F_Id = Guid.NewGuid().ToString(); + this.F_CreatorTime = DateTime.Now; + this.F_CreatorUserId = LoginUserInfo.Get().userId; + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.F_Id = keyValue; + } + #endregion + #region 扩展字段 + #endregion + } +} + 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 new file mode 100644 index 000000000..dfe15ba04 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementIBLL.cs @@ -0,0 +1,53 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.PersonnelManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-21 09:52 + /// 描 述:学校邮箱管理 + /// + public interface EmailManagementIBLL + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取EmailManagement表实体数据 + /// + /// 主键 + /// + EmailManagementEntity GetEmailManagementEntity(string keyValue); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, EmailManagementEntity entity); + /// + /// 启用 + /// + /// 主键 + void DoEnabled(string keyValue); + #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 new file mode 100644 index 000000000..83bd5bb7c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EmailManagement/EmailManagementService.cs @@ -0,0 +1,180 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Text; + +namespace Learun.Application.TwoDevelopment.PersonnelManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-21 09:52 + /// 描 述:学校邮箱管理 + /// + public class EmailManagementService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + 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(" FROM EmailManagement t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + return this.BaseRepository().FindList(strSql.ToString(),dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取EmailManagement表实体数据 + /// + /// 主键 + /// + public EmailManagementEntity GetEmailManagementEntity(string keyValue) + { + try + { + return this.BaseRepository().FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository().Delete(t=>t.F_Id == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, EmailManagementEntity entity) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository().Update(entity); + } + else + { + entity.Create(); + this.BaseRepository().Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 启用 + /// + /// 主键 + public void DoEnabled(string keyValue) + { + 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(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + } +}