/// <summary> /// 传入项目ID 分组ID 得到此条件下的全部任务 列表 /// </summary> /// <param name="projId"></param> /// <param name="groupId"></param> /// <returns></returns> public ActionResult GetTaskByProjIdAndGroupId(int projId, int groupId) { RRWMEntities er = new RRWMEntities(); //获取这个groupID下的全部的用户ID List<string> idString = new List<string>(); UserService us = new UserService(); List<User> userList = us.FindUsersByGroupId(groupId); foreach (var u in userList) { idString.Add(u.Id); } //过滤结果 TaskService ts = new TaskService(er); List<Task> list = ts.FindByProjectID(projId).ToList(); List<Task> resultList = new List<Task>(); foreach (var l in list) { if (idString.Contains(l.TaskerID) && l.TaskProcessStatus == EnumTaskProcessStatus.None) { resultList.Add(l); } } List<ComplexTask> comList = ConvertToComplexTaskList(resultList); return Json(comList); }
/// <summary> /// 传入成员ID得到此成员全部状态任务列表 /// </summary> /// <param name="userId"></param> /// <returns></returns> public ActionResult GetTasksByUserId(string userId) { RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); List<Task> list = ts.FindByUserID(userId); List<ComplexTask> comList = ConvertToComplexTaskList(list); return Json(comList); }
//任意状态任务 /// <summary> /// 根据一个taskID得到一个task /// </summary> /// <param name="taskId"></param> /// <returns></returns> public ActionResult GetTaskByTaskId(string taskId) { RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); Task task = ts.FindById(taskId); List<Task> list = new List<Task>(); list.Add(task); List<ComplexTask> comList = ConvertToComplexTaskList(list); return Json(comList); }
/// <summary> /// 工时统计 按季度计算 /// </summary> /// <param name="teamId"></param> /// <param name="year"></param> /// <param name="quater"></param> /// <returns></returns> public JsonResult GetTaskHoursDataForQuaters(string teamId, string year, string quater) { RRWMEntities WMEntity = new RRWMEntities(); BonusService bs = new BonusService(WMEntity); IEnumerable<User> user = userService.FindUsersByGroupId(Convert.ToInt32(teamId)).AsEnumerable<User>(); List<UserBonus> list = bs.FindSeasonEachWeekBounusByUsers(user, Convert.ToInt32(year), Convert.ToInt32(quater)); //将查询到的结果进行处理,将用户的id换成真实姓名 for (int i = 0; i < list.Count(); i++) { string id = list[i].UserID; foreach (User u in user) { if (u.Id == id) { list[i].UserID = u.RealName; break; } } } return Json(list); }
/// <summary> /// 传入项目ID得到此项目全部状态任务列表 /// </summary> /// <param name="projId"></param> /// <returns></returns> public ActionResult GetTasksByProjId(int projId) { RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); List<Task> list = ts.FindByProjectID(projId).ToList(); List<ComplexTask> comList = ConvertToComplexTaskList(list); return Json(comList); }
//一个根据每页条数和页码数查出相应的页的任务的函数 //被分页的任务范围为“全部任务” //此函数在此region里三次被使用 public ActionResult ReturnAllTasks(int numOnePage, int pageIndex) { RRWMEntities re = new RRWMEntities(); TaskService ts = new TaskService(re); List<Task> resultList = new List<Task>(); IQueryable<Task> Ilist = ts.Repository.GetAllTasks(); IQueryable<Task> result = LinqEntityHelper.GetEntitySetByPage<Task>(Ilist, numOnePage, pageIndex); resultList = result.ToList(); List<ComplexTask> comList = ConvertToComplexTaskList(resultList); return Json(comList); }
/// <summary> /// 成员ID(memberId)、每页总数(numOnePage) 、当前页(pageIndex) ///后台返回:当前页符合要求的任务记录 ///memberId=0时为全部 /// </summary> /// <param name="userId"></param> /// <param name="numOnePage"></param> /// <param name="pageIndex"></param> /// <returns></returns> public ActionResult GetTaskByUserIdWithPgIno(string userId, int numOnePage, int pageIndex) { RRWMEntities re = new RRWMEntities(); TaskService ts = new TaskService(re); List<Task> resultList = new List<Task>(); if (userId != "0") { IQueryable<Task> Ilist = ts.FindByUserID_LINQ(userId); IQueryable<Task> result = LinqEntityHelper.GetEntitySetByPage<Task>(Ilist, numOnePage, pageIndex); resultList = result.ToList(); List<ComplexTask> comList = ConvertToComplexTaskList(resultList); return Json(comList); } return ReturnAllTasks(numOnePage, pageIndex); }
/// <summary> /// 项目ID(proId)proId=0时为全部 ,后台返回:符合要求的任务记录总数 /// </summary> /// <param name="projId"></param> /// <returns></returns> public int GetTaskCountByProjId(int projId) { RRWMEntities re = new RRWMEntities(); TaskService ts = new TaskService(re); int num = ts.FindByProjectID(projId).ToList().Count(); return num; }
/* 第三期需求 */ /// <summary> /// 前台传入:项目,后台返回:所有项目名称和项目ID /// </summary> /// <returns></returns> /// public JsonResult GetAllProjects() { RRWMEntities er = new RRWMEntities(); ProjectService ps = new ProjectService(er); er.Configuration.ProxyCreationEnabled = false; List<Project> list = ps.FindAll(); return Json(list); }
/// <summary> /// 传入分组ID得到此分组 待审核 任务列表 /// </summary> /// <param name="groupId"></param> /// <returns></returns> public ActionResult GetUncheckedTaskByGroupId(int groupId) { RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); List<Task> list = ts.FindByStatusAndUserGroup(groupId, EnumTaskProcessStatus.Confirmed); List<ComplexTask> comList = ConvertToComplexTaskList(list); return Json(comList); }
/// <summary> /// 传入项目ID 分组ID 得到此条件下的全部待审核任务 列表 /// </summary> /// <param name="projId"></param> /// <param name="groupId"></param> /// <returns></returns> public ActionResult GetUncheckedTaskByProjIdAnduserIdsAndStatus(int projId, int groupId) { EnumTaskProcessStatus status = EnumTaskProcessStatus.Confirmed; UserService us = new UserService(); List<string> userIdList = us.FindUserIDsByGroupId(groupId).ToList(); RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); List<Task> list = ts.FindByUserGroupAndProjectIdAndTaskPStatus(userIdList, projId, status); List<ComplexTask> comList = ConvertToComplexTaskList(list); for (int i = 0; i < comList.Count; i++) { comList[i].TaskStatus = list[i].TaskStatus; if (list[i].ConfirmedFinishTime == null) { comList[i].ConfirmedFinishTime = null; } else { comList[i].ConfirmedFinishTime = list[i].ConfirmedFinishTime.ToString(); } } return Json(comList); }
/// <summary> /// 传入项目ID(一个或全部) 、 任务审核者ID(一个或全部)得到待审核任务列表 /// </summary> /// <param name="proijId">可传入0,0表示忽略此条件</param> /// <param name="checkerId">可传入null,null表示忽略此条件</param> /// <param name="status">任务处理状态</param> /// <returns></returns> public ActionResult GetTasksUncheckedByProjAndChecker(int proijId, string checkerId) { RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); EnumTaskProcessStatus status = EnumTaskProcessStatus.Confirmed; List<Task> list = ts.FindByProjectIDCheckerIDTaskProcessStatus(proijId, checkerId, status); List<ComplexTask> comList = ConvertToComplexTaskList(list); for (int i = 0; i < comList.Count; i++) { comList[i].TaskStatus = list[i].TaskStatus; if (list[i].ConfirmedFinishTime == null) { comList[i].ConfirmedFinishTime = null; } else { comList[i].ConfirmedFinishTime = list[i].ConfirmedFinishTime.ToString(); } } return Json(comList); }
//待审核任务 /// <summary> /// 传入项目ID(一个或全部) 、 任务承担者ID(一个或全部)得到待审核任务列表 /// </summary> /// <param name="proijId">可传入0,0表示忽略此条件</param> /// <param name="userId">可传入null,null表示忽略此条件</param> /// <param name="status">任务处理状态</param> /// <returns></returns> public ActionResult GetTasksUncheckedByByProjAndUser(int proijId, string userId) { RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); EnumTaskProcessStatus status = EnumTaskProcessStatus.Confirmed; List<Task> list = ts.FindByProjectIDUserIDTaskProcessStatus(proijId, userId, status); List<ComplexTask> comList = ConvertToComplexTaskList(list); return Json(comList); }
///待确认任务查询 /// <summary> ///获取待确认全部任务列表 /// </summary> /// <returns></returns> public JsonResult GetAllTasksNotConfirmed() { RRWMEntities er = new RRWMEntities(); TaskService ts = new TaskService(er); List<Task> list = new List<Task>(); list = ts.FindNotConfirmed(); List<ComplexTask> comList = ConvertToComplexTaskList(list); return Json(comList); }
/// <summary> /// 获得团队所有 成员 某一周的 工时 /// </summary> /// <param name="teamId"></param> /// <param name="year"></param> /// <param name="month"></param> /// <param name="week"></param> /// <returns></returns> public JsonResult GetTaskHoursDataForWAvg(string teamId, string year, string month, string week) { RRWMEntities WMEntity = new RRWMEntities(); BonusService bs = new BonusService(WMEntity); IEnumerable<User> user = userService.FindUsersByGroupId(Convert.ToInt32(teamId)).AsEnumerable<User>(); List<UserBonus> list = bs.FindWeekBounusByUsers(user, Convert.ToInt32(year), Convert.ToInt32(month), Convert.ToInt32(week)); Dictionary<string, float> newData = new Dictionary<string, float>(); //将查询到的结果进行处理,将用户的id换成真实姓名 for (int i = 0; i < list.Count(); i++) { string id = list[i].UserID; foreach (User u in user) { if (u.Id == id) { list[i].UserID = u.RealName; break; } } } return Json(list); /* //将查询到的结果进行处理,将用户的id换成真实姓名,并将其中的计划工时去掉 for (int i = 0; i < list.Count(); i++) { string id = list[i].UserID; foreach (User u in user) { if (u.Id == id) { newData.Add(u.RealName,list[i].BonusCollection[0].SumBonus); break; } } } return Json(newData); */ }