コード例 #1
0
        //获取所有拥有权限的任务类型
        public List<MODEL.T_TaskType> GetAccessRightTaskTypeList()
        {
            List<MODEL.T_TaskType> listTaskType = new List<MODEL.T_TaskType>();

            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            if (iBLLSession.IProjectInformationBLL.GetListBy(proj => proj.ProjLeader == stuNum).Count > 0)
            {
                //添加项目任务
                listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10003)[0]);
            }

            List<MODEL.T_RoleAct> listRoleAct = iBLLSession.IRoleActBLL.GetListBy(ra => ra.RoleActor == stuNum);

            foreach(MODEL.T_RoleAct role in listRoleAct)
            {
                if (role.RoleId == 10001)//总裁
                {
                    listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10004)[0]);//学生讲座
                }
                if (role.RoleId == 10002)//部长
                {
                    listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10002)[0]);//开发任务
                }
                if (role.RoleId == 10003)//团长
                {
                    listTaskType.Add(iBLLSession.ITaskTypeBLL.GetListBy(tp => tp.TaskTypeId == 10001)[0]);//学习任务
                }
            }

            return listTaskType;
        }
コード例 #2
0
        /// <summary>
        /// 删除任务
        /// </summary>
        /// <param name="taskId"></param>
        /// <returns></returns>
        public string DeleteTask(int taskId)
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            //删除操作的验证在BLL层唷~~
            if (iBLLSession.ITaskInformationBLL.DeleteTask(taskId, stuNum))
            {
                return "ok";
            }
            return "nook";
        }
コード例 #3
0
        /// <summary>
        /// 任务评价
        /// </summary>
        /// <returns></returns>
        public ActionResult TaskEvaluate(int taskId)
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            List<MODEL.ViewModel.Task.TaskEvaluateModel> listTaskEvaluate = iBLLSession.ITaskInformationBLL.GetPagedTaskEvaluateList(1, 10, stuNum,taskId);

            ViewData["taskEvaluateCount"] = iBLLSession.ITaskInformationBLL.GetTaskEvaluateCount(stuNum,taskId);

            ViewData["listTaskEvaluate"] = listTaskEvaluate;

            return View();
        }
コード例 #4
0
        /// <summary>
        /// 评阅任务 + public ActionResult TaskCorrect(int taskId,string taskReciver)
        /// </summary>
        /// <param name="taskId"></param>
        /// <param name="taskReciver"></param>
        /// <returns></returns>
        public ActionResult TaskCorrect(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.TaskReceiver == taskReciver && t.TaskId == taskId)[0];

                ViewData["taskParticipation"] = taskParticipation;

                ViewData["taskDetail"] = taskDetail;

                ViewData["taskEvaluate"] = taskEvaluate;

                ViewData["LoginUser"] = user.StuName;

                return View();
            }
            else
            {
                return null;
            }
        }
コード例 #5
0
        /// <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";
        }
コード例 #6
0
        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";
            }
        }
コード例 #7
0
        public string SaveTaskResponse(FormCollection form)
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            if (form["StuNum"] != null && form["TaskId"] != null && form["TaskResponse"] != null)
            {
                string taskReceiver = form["StuNum"];
                string strTaskId = form["TaskId"];
                string taskResponse = form["TaskResponse"];
                int taskId;
                if (int.TryParse(strTaskId, out taskId))
                {
                    //保存任务评价,权限的验证放在了BLL层中喔~~
                    if (iBLLSession.ITaskInformationBLL.SaveTaskResponse(stuNum, taskReceiver, taskId, taskResponse))
                    {
                        return "ok";
                    }
                }
            }

            return "nook";
        }
コード例 #8
0
        public string SaveTaskInfo(FormCollection form)
        {
            MODEL.T_TaskInformation taskInfo = new MODEL.T_TaskInformation();
            int taskTypeId = 0, projId = 10001, projPhasesId = 10001;
            System.DateTime taskBegTime, taskEndTime;

            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            string[] members = null;
            //TaskName,TaskBegTime,TaskEndTime,TaskContent,TaskTypeId
            //ProjId,ProjPhasesId,Members
            if (form["TaskName"] != null && form["TaskContent"] != null && form["Members"] != null)
            {
                if (!(int.TryParse(form["TaskTypeId"], out taskTypeId)
                    && System.DateTime.TryParse(form["TaskBegTime"], out taskBegTime)
                    && System.DateTime.TryParse(form["TaskEndTime"], out taskEndTime)))
                {
                    return "nook";
                }
                else
                {
                    if (taskTypeId == 10003)
                    {
                        if (!int.TryParse(form["ProjId"], out projId) || !int.TryParse(form["ProjPhasesId"], out projPhasesId))
                        {
                            return "nook";
                        }
                    }
                    taskInfo.TaskSender = stuNum;
                    taskInfo.TaskTypeId = taskTypeId;
                    taskInfo.TaskName = form["TaskName"];
                    taskInfo.TaskBegTime = taskBegTime;
                    taskInfo.TaskEndTime = taskEndTime;
                    taskInfo.TaskContent = form["TaskContent"];
                    taskInfo.ProjId = projId;
                    taskInfo.ProjPhaseId = projPhasesId;
                    taskInfo.TaskAttachmentPath = form["TaskFile"] + taskInfo.TaskAttachmentPath;
                    members = form["Members"].Split(new char[] { ',' });

                    #region ##任务修改代码
                    int oldTaskId;

                    if (form["TaskId"] != null)//如果TaskId不为空则说明是修改任务,需要先删除久的任务
                    {
                        if (int.TryParse(form["TaskId"], out oldTaskId))
                        {
                            if (DeleteTask(oldTaskId) != "ok")
                            {
                                return "nook";
                            }
                        }
                    }
                    #endregion

                    if (iBLLSession.ITaskInformationBLL.SaveTask(taskInfo, members))
                    {
                        return "ok";
                    }
                    else
                    {
                        return "nook";
                    }
                }
            }
            return "nook";
        }
コード例 #9
0
        public ActionResult GetMyTaskJsonData(string strPageIndex, string strPageSize, bool complete)
        {
            int pageIndex = 1;
            int pageSize = 4;
            int taskTypeId = 10001;//初始化

            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            List<MyTask> myTaskList = new List<MyTask>();

            if (int.TryParse(strPageIndex, out pageIndex)
                && int.TryParse(strPageSize, out pageSize))
            {

                myTaskList = iBLLSession.ITaskInformationBLL.GetPagedTaskList(pageIndex, pageSize, stuNum, complete);

                return Json(myTaskList, JsonRequestBehavior.AllowGet);//允许Get请求
            }
            else
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }
        }
コード例 #10
0
 /// <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";
     }
 }
コード例 #11
0
        public string SaveTaskCorret(FormCollection form)
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;
            if (form["TaskId"]!=null&&form["TaskReceiver"]!=null&&form["TaskScore"]!=null&&form["TaskRemark"]!=null)
            {
                string taskStrId = form["TaskId"];
                string taskReceiver = form["TaskReceiver"];
                int taskScore = Convert.ToInt32( form["TaskScore"]);
                string taskRemark = form["TaskRemark"];
                int taskId;
                if (int.TryParse(taskStrId,out taskId))
                {
                    if (iBLLSession.ITaskInformationBLL.SaveTaskCorrect(stuNum,taskReceiver,taskId,taskRemark,taskScore))
                    {
                        return "ok";
                    }
                }
            }

            return "nook";
        }
コード例 #12
0
        public ActionResult ReleaseHistory()
        {
            int pageIndex = 1;
            int pageSize = 10;

            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            //获取我的任务列表
            List<MODEL.T_TaskInformation> taskList = iBLLSession.ITaskInformationBLL.TaskGetPagedList<DateTime>(pageIndex, pageSize, task => task.TaskSender == stuNum,task => task.TaskEndTime, true);

            //任务我发布的任务条数
            int taskCount = iBLLSession.ITaskInformationBLL.GetReleaseHistoryCount(stuNum);

            List<MODEL.T_TaskType> taskTypeList = iBLLSession.ITaskTypeBLL.GetListBy(t => true);

            //以"taskType"+id:name的形式传到视图,以便@ViewData["taskType"+TaskTypeId]直接获取任务类型名称
            foreach(MODEL.T_TaskType taskType in taskTypeList)
            {
                ViewData["taskType" + taskType.TaskTypeId] = taskType.TaskTypeName;
            }

            List<int> taskIds = taskList.Select(task => task.TaskId).ToList();

            ViewData["canBeModify"] = iBLLSession.ITaskInformationBLL.CanByModify(taskIds);//查看每一个任务是否能被修改

            ViewData["taskList"] = taskList;

            ViewData["taskCount"] = taskCount;

            //列表大小
            ViewData["listSize"] = 10;

            return View();
        }
コード例 #13
0
        /// <summary>
        /// 修改任务,主要是查询任务信息,让后传到视图上去
        /// 比较懒,修改和发布任务的视图差不多,所以在修改视图上就用了发布视图的JS和CSS并做了扩展
        /// </summary>
        /// <param name="taskId"></param>
        /// <returns></returns>
        public ActionResult ModifyTask(int taskId)
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            //权限验证
            if (!iBLLSession.ITaskInformationBLL.CanByModify(taskId)
                || iBLLSession.ITaskInformationBLL.GetListBy(t => t.TaskId==taskId
                    && t.TaskSender == stuNum).Count <= 0)
            {
                return null;
            }
            //任务信息
            MODEL.T_TaskInformation taskInfo = iBLLSession.ITaskInformationBLL.GetListBy(t => t.TaskId == taskId && t.TaskSender == stuNum)[0];
            //任务类型List
            List<MODEL.T_TaskType> listTaskType = iBLLSession.ITaskTypeBLL.GetListBy(t => true);
            //项目阶段List
            List<MODEL.T_ProjPhase> listProjPhase = iBLLSession.IProjPhaseBLL.GetListBy(p => true);
            //项目信息List
            List<MODEL.T_ProjectInformation> listProjectInfo = iBLLSession.IProjectInformationBLL.GetListBy(p => p.ProjLeader == stuNum);
            //成员信息List
            List<MODEL.T_MemberInformation> listMemberInfo = iBLLSession.IMemberInformationBLL.GetListBy(m => true);

            ViewData["taskInfo"] = taskInfo;
            //当前任务的参与人List
            List<MODEL.T_TaskParticipation> listTaskParticipation = iBLLSession.ITaskParticipationBLL.GetListBy(tp => tp.TaskId == taskId);

            string jsonMembers = "";
            jsonMembers+="[";
            foreach(MODEL.T_TaskParticipation taskParticipation in listTaskParticipation){
                jsonMembers+="{";
                jsonMembers+="StuNum:"+taskParticipation.TaskReceiver.ToString();
                jsonMembers+="},";
            }
            jsonMembers=jsonMembers.Substring(0,jsonMembers.Length-1)+"]";

            ViewData["listTaskType"] = listTaskType;
            ViewData["listProjPhase"] = listProjPhase;
            ViewData["listProjectInfo"] = listProjectInfo;
            ViewData["listMemberInfo"] = listMemberInfo;
            ViewData["jsonMembers"] = jsonMembers;
            return View();
        }
コード例 #14
0
        public ActionResult GetReleaseHistoryJsonData(string strPageIndex, string strPageSize)
        {
            int pageIndex = 1;
            int pageSize = 10;

            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            List<MODEL.T_TaskInformation> taskList = new List<MODEL.T_TaskInformation>();
            List<MODEL.T_TaskType> taskTypeList = new List<MODEL.T_TaskType>();

            if (int.TryParse(strPageIndex, out pageIndex)
                && int.TryParse(strPageSize, out pageSize))
            {

                taskList = iBLLSession.ITaskInformationBLL.TaskGetPagedList<int>(pageIndex, pageSize, task => task.TaskSender == stuNum, task => task.TaskId, true);

                taskTypeList = iBLLSession.ITaskTypeBLL.GetListBy(t => true);
                List<int> taskIds = taskList.Select(task => task.TaskId).ToList();
                bool[] canBeModify = iBLLSession.ITaskInformationBLL.CanByModify(taskIds);

                var list = from tl in taskList
                           join ttl in taskTypeList on tl.TaskTypeId equals ttl.TaskTypeId
                           select new
                           {
                               TaskId = tl.TaskId,
                               TaskName = tl.TaskName,
                               TaskTypeId = ttl.TaskTypeId,
                               TaskTypeName = ttl.TaskTypeName,
                               TaskBegTime = tl.TaskBegTime.ToString("yyyy年MM月dd日"),
                               TaskEndTime = tl.TaskEndTime.ToString("yyyy年MM月dd日"),
                           };
                var jsonData = new { TaskList = list, CanBeModify = canBeModify };
                return Json(jsonData, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }
        }
コード例 #15
0
        /// <summary>
        /// 获取任务评价分页数据,就是查询数据库,转Json格式数据没什么的,权限的验证
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ActionResult GetPagedTaskEvaluateList(int pageIndex, int pageSize,int taskId)
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            List<MODEL.ViewModel.Task.TaskEvaluateModel> listTaskEvaluate = iBLLSession.ITaskInformationBLL.GetPagedTaskEvaluateList(pageIndex, pageSize, stuNum,taskId);

            return Json(listTaskEvaluate, JsonRequestBehavior.AllowGet);
        }
コード例 #16
0
        /// <summary>
        ///  发布任务
        /// </summary>
        /// <returns></returns>
        public ActionResult TaskRelease()
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            //获取有权限发布的任务类型
            List<MODEL.T_TaskType> listTaskType = new TaskOperateHelper().GetAccessRightTaskTypeList();

            //获取项目阶段
            List<MODEL.T_ProjPhase> listProjPhase = iBLLSession.IProjPhaseBLL.GetListBy(p => true);

            //获取用户所管理的项目
            List<MODEL.T_ProjectInformation> listProjectInfo = iBLLSession.IProjectInformationBLL.GetListBy(p => p.ProjLeader==stuNum);

            //获取实验室成员信息
            List<MODEL.T_MemberInformation> listMemberInfo = iBLLSession.IMemberInformationBLL.GetListBy(m => true);

            ViewData["listTaskType"] = listTaskType;
            ViewData["listProjPhase"] = listProjPhase;
            ViewData["listProjectInfo"] = listProjectInfo;
            ViewData["listMemberInfo"] = listMemberInfo;

            return View();
        }
コード例 #17
0
        /// <summary>
        /// 任务提交 + public ActionResult TaskSubmit(int taskId)
        /// </summary>
        /// <param name="taskId"></param>
        /// <returns></returns>
        public ActionResult TaskSubmit(int taskId)
        {
            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);

                ViewData["taskDetail"] = taskDetail;

                return View();
            }
            else
            {
                return null;
            }
        }
コード例 #18
0
        public string SaveTaskGrade(FormCollection form)
        {
            MODEL.T_MemberInformation user = new OperateContext().Usr;
            string stuNum = user.StuNum;

            if (form["StuNum"] != null && form["TaskId"] != null && form["TaskGrade"] != null)
            {
                string taskReceiver = form["StuNum"];
                string strTaskId = form["TaskId"];
                string strGrade = form["TaskGrade"];
                int taskId;
                int grade;
                //格式验证
                if (int.TryParse(strTaskId, out taskId) && int.TryParse(strGrade,out grade) && (grade.Equals("优") || grade.Equals("良") || grade.Equals("不合格")))
                {
                    //保存评价,评价权限验证放在BLL层惹
                    if (iBLLSession.ITaskInformationBLL.SaveTaskGrade(stuNum, taskReceiver, taskId, grade))
                    {
                        return "ok";
                    }
                }
            }

            return "nook";
        }