public JsonResult TechnologyDetaile(ResignationDto dto) { OperationResult oper = _resignationContract.Update(dto); if (oper.ResultType == OperationResultType.Success) { if (dto.ToExamineResult == 3) { oper = _administratorContract.Disable(dto.ResignationId.Value); } ResignationToExamine ete = new ResignationToExamine(); ete.AdminId = AuthorityHelper.OperatorId.Value; ete.Reason = ""; ete.ResignationId = dto.Id; ete.AuditStatus = 2; ete.AuditTime = DateTime.Now; ete.OperatorId = AuthorityHelper.OperatorId; oper = _resignationToExamineContract.Insert(ete); if (oper.ResultType == OperationResultType.Success) { var dtoM = _resignationContract.Resignations.Where(x => x.Id == dto.Id).FirstOrDefault(); string title = string.Empty; string orgContent = string.Empty; List <int> AuthorityList = new List <int>() { 3, 7 }; var dicPC = new Dictionary <string, object>(); dicPC.Add("entryName", dtoM.ResignationModel?.Member?.RealName ?? string.Empty); dicPC.Add("entryDep", dtoM.Department?.DepartmentName ?? string.Empty); dicPC.Add("ToExamine", AuthorityHelper.RealName); var dtoNoti = new NotificationDto() { IsEnableApp = true, NoticeType = (int)NoticeFlag.Immediate, //NoticeTargetType = mod.EnabledPerNotifi ? (int)NoticeTargetFlag.Admin : (int)NoticeTargetFlag.Department }; if (dto.ToExamineResult == 3) { int NotificationId = _templateNotificationContract.templateNotifications.Where(x => x.Name == "离职通知-财务审核").Select(x => x.Id).FirstOrDefault(); var mod = _templateContract.Templates.Where(x => !x.IsDeleted && x.IsEnabled && x.TemplateNotificationId == NotificationId).Select(s => new { s.Id, s.TemplateHtml, s.TemplateName, s.EnabledPerNotifi }).FirstOrDefault(); orgContent = mod.TemplateHtml; title = mod.TemplateName; dicPC.Add("time", dto.ResignationDate.ToLongDateString()); if (mod.EnabledPerNotifi) { var receiveAdminIds = _administratorContract.Administrators.Where(x => x.IsEnabled && !x.IsDeleted).Select(s => s.Id).ToList(); dtoNoti.AdministratorIds = receiveAdminIds; } else { var depids = _templateContract.GetNotificationDepartIds(mod.Id); dtoNoti.DepartmentIds = depids; } dtoNoti.NoticeTargetType = mod.EnabledPerNotifi ? (int)NoticeTargetFlag.Admin : (int)NoticeTargetFlag.Department; } else { int NotificationId = _templateNotificationContract.templateNotifications.Where(x => x.Name == "离职通知").Select(x => x.Id).FirstOrDefault(); var mod = _templateContract.Templates.Where(x => !x.IsDeleted && x.IsEnabled && x.TemplateNotificationId == NotificationId).Select(s => new { s.Id, s.TemplateHtml, s.TemplateName, s.EnabledPerNotifi }).FirstOrDefault(); orgContent = mod.TemplateHtml; title = mod.TemplateName; if (mod.EnabledPerNotifi) { var receiveAdminIds = _administratorContract.Administrators.Where(x => x.IsEnabled && !x.IsDeleted && AuthorityList.Contains(x.JobPosition.Auditauthority.Value)).Select(s => s.Id).ToList(); dtoNoti.AdministratorIds = receiveAdminIds; } else { var depids = _templateContract.GetNotificationDepartIds(mod.Id); dtoNoti.DepartmentIds = depids; } dtoNoti.NoticeTargetType = mod.EnabledPerNotifi ? (int)NoticeTargetFlag.Admin : (int)NoticeTargetFlag.Department; } var content = NVelocityHelper.Generate(orgContent, dicPC, "Entry_PC"); dtoNoti.Title = title; dtoNoti.Description = content; _notificationContract.Insert(sendNotificationAction, dtoNoti); } } return(Json(oper)); }