public ActionResult MyTaskDetail(int taskId, string taskReciver) { MODEL.T_TaskInformation info = new MODEL.T_TaskInformation(); MODEL.T_MemberInformation user = new OperateContext().Usr; string stuNum = user.StuNum; if ((iBLLSession.ITaskInformationBLL.GetListBy(t => t.TaskSender == stuNum && t.TaskId == taskId).Count > 0) || iBLLSession.ITaskParticipationBLL.GetListBy(t => t.TaskReceiver == stuNum && t.TaskId == taskId).Count > 0)//验证是否有查看此任务的权限 { MODEL.ViewModel.Task.TaskDetail taskDetail = iBLLSession.ITaskInformationBLL.GetTaskDetailById(taskId); MODEL.ViewModel.Task.TaskEvaluateModel taskEvaluate = iBLLSession.ITaskInformationBLL.GetTaskEvaluateList(taskReciver, taskId)[0]; MODEL.T_TaskParticipation taskParticipation = iBLLSession.ITaskParticipationBLL.GetListBy(t => t.TaskId == taskId & t.TaskReceiver == taskReciver).ToList()[0]; ViewData["taskDetail"] = taskDetail; ViewData["taskEvaluate"] = taskEvaluate; ViewData["taskParticipation"] = taskParticipation; return(View()); } else { return(null); } }
///// #region 保存上传文件 + public string SaveTaskFile(FormCollection form) /// <summary> /// 保存上传文件 + public string SaveTaskFile(FormCollection form) /// </summary> /// <param name="form"></param> /// <returns></returns> public string SaveTaskFile(FormCollection form) { MODEL.T_MemberInformation user = new OperateContext().Usr; string stuNum = user.StuNum; int taskId = int.Parse(form["strTaskId"]); MODEL.T_TaskParticipation taskParticipation = iBLLSession.ITaskParticipationBLL.GetListBy(t => t.TaskId == taskId && t.TaskReceiver == stuNum).FirstOrDefault(); taskParticipation.TaskAttachmentPath = form["filename"] + "," + taskParticipation.TaskAttachmentPath; if (iBLLSession.ITaskParticipationBLL.Modify(taskParticipation, "TaskAttachmentPath") > 0) { return("ok"); } else { return("nook"); } }
/// <summary> /// 确认任务已完成 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public string TaskCompleteConfirmation(int taskId) { MODEL.T_MemberInformation user = new OperateContext().Usr; string stuNum = user.StuNum; MODEL.T_TaskParticipation taskParticipation = new MODEL.T_TaskParticipation(); taskParticipation.TaskId = taskId; taskParticipation.TaskReceiver = stuNum; taskParticipation.IsComplete = true; taskParticipation.IsRead = true; if (iBLLSession.ITaskParticipationBLL.ModifyBy(taskParticipation, tp => tp.TaskId == taskParticipation.TaskId && tp.TaskReceiver == taskParticipation.TaskReceiver, "IsComplete", "IsRead") > 0) { return("ok"); } return("nook"); }
public string SaveTaskSubmit(FormCollection form) { MODEL.T_MemberInformation user = new OperateContext().Usr; string stuNum = user.StuNum; int taskId = int.Parse(form["taskId"]); string taskSubmition = form["TaskSubmition"]; DateTime taskFinishTime = DateTime.Parse(form["taskFinishTime"]); MODEL.T_TaskParticipation taskParticipation = iBLLSession.ITaskParticipationBLL.GetListBy(t => t.TaskId == taskId && t.TaskReceiver == stuNum).FirstOrDefault(); taskParticipation.TaskSubmition = taskSubmition; taskParticipation.IsComplete = true; taskParticipation.TaskFinishTime = taskFinishTime; taskParticipation.IsRead = true; if (iBLLSession.ITaskParticipationBLL.Modify(taskParticipation, "TaskSubmition", "IsComplete", "TaskFinishTime", "IsRead") > 0) { return("ok"); } else { return("nook"); } }
/// <summary> /// 保存任务信息 /// </summary> /// <param name="taskInfo"></param> /// <param name="members"></param> /// <returns></returns> public bool SaveTask(MODEL.T_TaskInformation taskInfo, string[] members) { db.Set <T_TaskInformation>().Add(taskInfo); if (db.SaveChanges() > 0) { foreach (string member in members) { MODEL.T_TaskParticipation tp = new MODEL.T_TaskParticipation(); tp.TaskReceiver = member; tp.TaskId = taskInfo.TaskId; tp.TaskGrade = 0; tp.TaskResponse = ""; tp.IsRead = false; tp.IsComplete = false; db.Set <T_TaskParticipation>().Add(tp); } return(db.SaveChanges() > 0); } else { return(false); } }
/// <summary> /// 确认任务已完成 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public string TaskCompleteConfirmation(int taskId) { MODEL.T_MemberInformation user = new OperateContext().Usr; string stuNum = user.StuNum; MODEL.T_TaskParticipation taskParticipation = new MODEL.T_TaskParticipation(); taskParticipation.TaskId = taskId; taskParticipation.TaskReceiver = stuNum; taskParticipation.IsComplete = true; taskParticipation.IsRead = true; if (iBLLSession.ITaskParticipationBLL.ModifyBy(taskParticipation, tp => tp.TaskId == taskParticipation.TaskId && tp.TaskReceiver == taskParticipation.TaskReceiver, "IsComplete", "IsRead") > 0) { return "ok"; } return "nook"; }