コード例 #1
0
        public JsonResult ApplyResignation(ResignationDto dto, int AdminId)
        {
            dto.ResignationId = AdminId;
            OperationResult oper = _resignationContract.Insert(dto);

            return(Json(oper));
        }
コード例 #2
0
        public JsonResult Create(ResignationDto dto)
        {
            dto.ToExamineResult = 0;
            dto.operationId     = AuthorityHelper.OperatorId;
            OperationResult oper = _resignationContract.Insert(dto);

            if (oper.ResultType == OperationResultType.Success)
            {
                int NotificationId = _templateNotificationContract.templateNotifications.Where(x => x.Name == "离职通知").Select(x => x.Id).FirstOrDefault();
                var orgContent     = _templateContract.Templates.Where(x => !x.IsDeleted && x.IsEnabled && x.TemplateNotificationId == NotificationId)
                                     .Select(x => x.TemplateHtml).FirstOrDefault();
                var title = _templateContract.Templates.Where(x => !x.IsDeleted && x.IsEnabled && x.TemplateNotificationId == NotificationId)
                            .Select(x => x.TemplateName).FirstOrDefault();
                List <int> AuthorityList = new List <int>()
                {
                    1, 4, 5, 7
                };
                var resign = _administratorContract.Administrators.Where(x => x.Id == dto.ResignationId).FirstOrDefault();
                var dicPC  = new Dictionary <string, object>();
                dicPC.Add("entryName", resign?.Member?.RealName ?? string.Empty);
                dicPC.Add("entryDep", resign?.Department?.DepartmentName ?? string.Empty);
                dicPC.Add("ToExamine", "");
                var content         = NVelocityHelper.Generate(orgContent, dicPC, "Entry_PC");
                var receiveAdminIds = _administratorContract.Administrators.Where(x => x.IsEnabled && !x.IsDeleted &&
                                                                                  AuthorityList.Contains(x.JobPosition.Auditauthority.Value)).Select(s => s.Id).ToList();
                _notificationContract.Insert(sendNotificationAction, new NotificationDto()
                {
                    Title            = title,
                    AdministratorIds = receiveAdminIds,
                    Description      = content,
                    IsEnableApp      = true,
                    NoticeTargetType = (int)NoticeTargetFlag.Admin,
                    NoticeType       = (int)NoticeFlag.Immediate
                });
            }
            return(Json(oper));
        }