public async Task <object> PushCheck([FromBody] PushCheck pushCheck) { var context = HttpContext; string account = await _jwtUtil.GetMessageByToken(context); return(_approvalAppService.PushCheck(pushCheck, account)); }
public Result PushCheck(PushCheck pushCheck, string account) { Result result; Apply apply = _ctx.Apply.Find(pushCheck.ApplicationId); //找出当前用户的职位编号 Worker worker = _ctx.Worker.SingleOrDefault(w => w.Account.Equals(account)); //根据职位编号找出职位 Position position = _ctx.Position.Find(worker.PositionId); string remark = worker.Name + ":" + pushCheck.Remark + ";" + apply.Remark; apply.Remark = remark; if (position.ParentId == 0) { result = new Result { IsSuccess = false, Message = "提交失败,您目前没有上级管理!", Id = 0 } } ; else { Inform inform = new Inform() { WorkId = position.ParentId, ApplicationId = pushCheck.ApplicationId, IsLook = false, CreateTime = DateTime.Now.ToFileTime(), Content = "待审核的申请", }; Inform oldInfo = _ctx.Inform.SingleOrDefault(i => i.WorkId == worker.Id); _ctx.Inform.Remove(oldInfo); _ctx.Inform.Add(inform); _ctx.SaveChanges(); result = new Result { IsSuccess = true, Message = "提交成功!", Id = inform.WorkId }; } return(result); }
public object PushCheck(PushCheck pushCheck, string account) { return(_approvalManager.PushCheck(pushCheck, account)); }