/// <summary> /// 添加任务书 /// </summary> /// <param name="annualTask">任务书实体</param> public AnnualTask AddAnnualTask(AnnualTask annualTask) { var addannualTask = _context.AnnualTasks.Add(annualTask); _context.SaveChanges(); return(addannualTask); }
public HttpResponseMessage InstReviewAnnualReport(int id, [FromUri] bool pass) { try { string comment = Request.Content.ReadAsStringAsync().Result; AnnualTask task = _repository.Get(id); task = _repository.ChangeAnnualTaskStatus(task, AnnualTaskStatus.INST_REVIEW_ANNUAL_REPORT, pass ? AnnualTaskStatus.DEPART_REVIEW_ANNUAL_REPORT : AnnualTaskStatus.INST_REJECT_ANNUAL_REPORT, pass ? "" : "单位管理员驳回原因:" + comment); var result = Mapper.Map <GetAnnualTaskBasicInfoDTO>(task); //if (pass) //{ // //单位管理员审核年度报告通过 // //通知打点:发给负责相关领域的院管理员 // //_noticeService.AddNoticeList( // // _noticeService.GetDepartManagerIdListByProjectTypeId(task.Project.ProjectTypeId.Value), 56); // //通知信打点:发给用户 // _noticeService.AddNotice( // _noticeService.GetUserIdByPersonId(task.LeaderId.Value), 33); //} //else //{ // //单位管理员审核年度报告不通过 // //通知信打点:发给用户 // _noticeService.AddNotice( // _noticeService.GetUserIdByPersonId(task.LeaderId.Value), 34); //} return(ResponseWrapper.SuccessResponse(result)); } catch (Exception e) { return(ResponseWrapper.ExceptionResponse(e)); } }
public AnnualTask Get(int?annualTaskId) { AnnualTask task = _context.AnnualTasks.FirstOrDefault(at => at.AnnualTaskId == annualTaskId); if (null == task) { throw new NotFoundException("没有找到任务书"); } return(task); }
public AnnualTask ChangeAnnualTaskStatus(AnnualTask task, AnnualTaskStatus from, AnnualTaskStatus to, string commnet = "") { if (task.Status == from) { task.Status = to; task.Comment = commnet; _context.SaveChanges(); } else { throw new OtherException("任务书状态不符合条件"); } return(task); }
private AnnualTask AddAnnualTask(Project project, Consultation consultaion) { AnnualTask task = new AnnualTask { ProjectId = project.ProjectId, CurrentBudget = consultaion.CurrentYearBudget, EditTime = DateTime.Now, LeaderId = project.LeaderId, InstituteId = project.InstituteId, Year = SystemConfig.ApplicationStartYear, Name = string.Format("{0}({1})年度任务", project.Name, SystemConfig.ApplicationStartYear) }; task = _ctx.AnnualTasks.Add(task); _ctx.SaveChanges(); var jionInsts = _ctx.ProjectMembers .Where(pm => pm.ProjectId == project.ProjectId) .Select(pm => pm.Person.InstituteId) .Distinct(); foreach (var instId in jionInsts) { AnnualTaskInstBudget atis = new AnnualTaskInstBudget { AnnualTaskId = task.AnnualTaskId, InstituteId = instId, Amount = 0 }; _ctx.AnnualTaskInstBudgets.Add(atis); } var subjects = _ctx.AccountingSubjects.ToList(); foreach (var subject in subjects) { AnnualTaskBudgetItem item = new AnnualTaskBudgetItem { SubjectId = subject.SubjectCode, AnnualTaskId = task.AnnualTaskId, Reason = "", Amount = 0 }; _ctx.AnnualTaskBudgetItems.Add(item); } _ctx.SaveChanges(); return(task); }
public HttpResponseMessage DepartReviewAnnualTask(int id, [FromUri] bool pass) { try { string comment = Request.Content.ReadAsStringAsync().Result; AnnualTask task = _repository.Get(id); task = _repository.ChangeAnnualTaskStatus(task, AnnualTaskStatus.DEPART_CHECK, pass ? AnnualTaskStatus.UPLOAD_ANNUAL_REPORT:AnnualTaskStatus.DEPART_REJECT, comment); var result = Mapper.Map <GetAnnualTaskBasicInfoDTO>(task); ////院管理员审核任务书通过和不通过的情况 //if (pass) //{ // //院管理员审核任务书通过 // //通知打点:发给用户所在的单位管理员 // //_noticeService.AddNoticeList( // // _noticeService.GetInstituteManagerIdList(task.InstituteId.Value) , 47); // //通知信打点:发给用户 // _noticeService.AddNotice( // _noticeService.GetUserIdByPersonId(task.LeaderId.Value), 29); // //院管理员审核任务书通过,通知其上传年度报告 // //通知打点:发给用户 // _noticeService.AddNotice( // _noticeService.GetUserIdByPersonId(task.LeaderId.Value), 31); //} //else //{ // //院管理员审核任务书不通过 // //通知打点:发给用户所在的单位管理员 // //_noticeService.AddNoticeList( // // _noticeService.GetInstituteManagerIdList(task.InstituteId.Value), 48); // //通知信打点:发给用户 // _noticeService.AddNotice( // _noticeService.GetUserIdByPersonId(task.LeaderId.Value), 30); //} return(ResponseWrapper.SuccessResponse(result)); } catch (Exception e) { return(ResponseWrapper.ExceptionResponse(e)); } }
a.Status == ProjectStatus.ACTIVE;//已经结题或终止的项目不用上传文档 public static bool UserEditAnnualTask(CurrentUser user, AnnualTask task) { return(true); }