Пример #1
0
        //----------通过任务审核-----------------------

        public ActionResult adopt(String tid, String u)
        {
            if (String.IsNullOrWhiteSpace(tid))
            {
                return(Fail("error"));
            }
            String            uid      = Convert.ToString(Session["uid"]);
            DateTime          time     = DateTime.Now;
            T_Task_HistoryDAO adoptdao = new T_Task_HistoryDAO();
            T_Task_History    adopt    = new T_Task_History()
            {
                taskId   = Convert.ToInt32(tid),
                userName = u,
                content  = "通过任务的审核,等待任务分发",
                descr    = "审核任务",
                userId   = uid,
            };
            int id = adoptdao.Add(adopt);

            T_TaskDAO Taskupdatedao = new T_TaskDAO();
            T_Task    task          = Taskupdatedao.GetById(Convert.ToInt32(tid));

            task.statusId = 2;
            Taskupdatedao.Update(task);

            //int Update Taskupdatedao = entityDao.Update(new T_Task(){id = Convert.ToInt32(tid)});



            return(Success("ok", null));
        }
Пример #2
0
        //-----------通过任务验收,任务打上结束标记-----------------------
        public ActionResult finish(String tid, String u)
        {
            if (String.IsNullOrWhiteSpace(tid))
            {
                return(Fail("error"));
            }
            String            uid       = Convert.ToString(Session["uid"]);
            DateTime          time      = DateTime.Now;
            T_Task_HistoryDAO finishdao = new T_Task_HistoryDAO();
            T_Task_History    finish    = new T_Task_History()
            {
                taskId   = Convert.ToInt32(tid),
                userName = u,
                content  = "通过此任务的验收,任务完成",
                descr    = "验收任务",
                userId   = uid,
            };
            int id = finishdao.Add(finish);

            T_TaskDAO Taskupdatedao = new T_TaskDAO();

            T_Task task = Taskupdatedao.GetById(Convert.ToInt32(tid));

            task.endTime = DateTime.Now;

            task.statusId = 5;
            Taskupdatedao.Update(task);

            return(Success("ok", null));
        }
Пример #3
0
 [ValidateInput(false)]        //要加上这一句,否则会造成富文本里面的HTML代码危险警报
 public JsonResult Update(T_Task entity)
 {
     if (entityDao.Update(entity) > 0)
     {
         return(Success("更新成功!", null));
     }
     else
     {
         return(Fail("更新失败!"));
     }
 }
Пример #4
0
        public JsonResult doCheck()
        {
            String uid    = Convert.ToString(Session["uid"]);
            var    taskid = Convert.ToInt32(Request["id"]);
            var    time   = Request["time"];

            if (String.IsNullOrWhiteSpace(time))
            {
                return(Fail("请填写时间"));
            }
            else
            {
                T_TaskDAO taskdao = new T_TaskDAO();
                T_Task    task    = new T_Task()
                {
                    id = taskid
                };
                task           = taskdao.GetByModel(task);
                task.statusId  = 3;
                task.endTime   = Convert.ToDateTime(time);
                task.beginTime = DateTime.Now;
                int taskresult = taskdao.Update(task);
                if (taskresult > 0)
                {
                    T_UserDAO userdao = new T_UserDAO();
                    T_User    user    = new T_User()
                    {
                        id = uid
                    };
                    user = userdao.GetByModel(user);

                    T_Task_HistoryDAO historydao = new T_Task_HistoryDAO();
                    T_Task_History    history    = new T_Task_History()
                    {
                        taskId = taskid, userName = user.name, content = "接受任务", descr = uid
                    };
                    int result = historydao.Add(history);
                    if (result > 0)
                    {
                        return(Success("已通过!", null));
                    }
                    else
                    {
                        return(Success("已通过,但未记录", null));
                    }
                }
                else
                {
                    return(Fail("操作失败,请重试。"));
                }
            }
        }
Пример #5
0
        //-----提交任务进度-------------
        public JsonResult AddReport()
        {
            String uid     = Convert.ToString(Session["uid"]);
            var    title   = Request["taskTitle"];
            var    content = Request["content"];
            var    des     = Request["descr"];
            var    tid     = Session["tid"];

            if (!String.IsNullOrWhiteSpace(title) && !String.IsNullOrWhiteSpace(content) && !String.IsNullOrWhiteSpace(des))
            {
                T_UserDAO T_UserDao = new T_UserDAO();
                T_User    user      = new T_User()
                {
                    id = uid
                };
                user = T_UserDao.GetByModel(user); //user.name;
                String u = user.name;
                if (user == null)
                {
                    return(Fail("用户验证失败,请重新登录"));
                }
                else
                {
                    int       i;
                    T_TaskDAO T_TaskDao = new T_TaskDAO();
                    T_Task    task      = new T_Task()
                    {
                        title = title
                    };
                    task = T_TaskDao.GetByModel(task);// task.id;
                    String            descr             = "汇报任务";
                    T_Task_HistoryDAO T_Task_HistoryDao = new T_Task_HistoryDAO();
                    if (Convert.ToInt32(des) == 4)
                    {
                        //默认为汇报任务,当选择任务完成时,提交任务完成
                        descr = "任务完成";
                        T_Task_HistoryDAO finishdao = new T_Task_HistoryDAO();
                        T_Task_History    finish    = new T_Task_History()
                        {
                            taskId   = Convert.ToInt32(tid),
                            userName = user.name,
                            content  = "任务完成,等待验收",
                            descr    = descr,
                            userId   = uid,
                        };
                        i = finishdao.Add(finish);
                        T_TaskDAO Taskupdatedao = new T_TaskDAO();

                        T_Task takk = Taskupdatedao.GetById(Convert.ToInt32(tid));
                        takk.endTime = DateTime.Now;

                        takk.statusId = 4;
                        Taskupdatedao.Update(takk);

                        return(Success("提交成功,等待验收", null));
                    }
                    else
                    {
                        T_Task_History history = new T_Task_History();

                        //汇报完成同时生成一条历史记录
                        history.taskId   = task.id;
                        history.userName = user.name;
                        history.content  = Request["content"];
                        history.descr    = descr;
                        history.userId   = uid;

                        i = T_Task_HistoryDao.Add(history);
                    };
                    if (i > 0)
                    {
                        return(Success("汇报成功!", null));
                    }
                    else
                    {
                        return(Fail("添加失败,请重试。"));
                    }
                }
            }
            else
            {
                return(Fail("提交失败,请填写完各项再提交。"));
            }
        }
Пример #6
0
        public JsonResult doDistribute()
        {
            String uid       = Convert.ToString(Session["uid"]);
            var    title     = Request["title"];
            var    userid    = Request["userid"];
            var    name      = Request["name"];
            var    content   = Request["content"];
            var    starttime = Request["starttime"];
            var    endtime   = Request["endtime"];

            if (String.IsNullOrWhiteSpace(content) || String.IsNullOrWhiteSpace(name) || String.IsNullOrWhiteSpace(userid) || String.IsNullOrWhiteSpace(title))
            {
                return(Fail("参数不完整,请填写完毕再提交。"));
            }
            else
            {
                T_TaskDAO taskdao = new T_TaskDAO();
                T_Task    task    = new T_Task()
                {
                    id = Convert.ToInt32(title)
                };
                task           = taskdao.GetByModel(task);
                task.beginTime = Convert.ToDateTime(starttime);
                task.endTime   = Convert.ToDateTime(endtime);
                task.statusId  = 3;
                if (taskdao.Update(task) > 0)
                {
                    T_Task_UserDAO taskuserdao = new T_Task_UserDAO();
                    T_Task_User    taskuser    = new T_Task_User()
                    {
                        userId = userid, taskId = task.id, descr = content
                    };
                    if (taskuserdao.Add(taskuser) > 0)
                    {
                        T_Task_HistoryDAO historydao = new T_Task_HistoryDAO();
                        T_Task_History    history    = new T_Task_History()
                        {
                            taskId = task.id, descr = "分配任务"
                        };
                        history = historydao.GetByModel(history);
                        if (history == null)
                        {
                            T_UserDAO userdao = new T_UserDAO();
                            T_User    user    = new T_User()
                            {
                                id = uid
                            };
                            user    = userdao.GetByModel(user);
                            history = new T_Task_History()
                            {
                                taskId = task.id, userName = user.name, descr = "分配任务", content = "任务已分配。"
                            };
                            if (historydao.Add(history) > 0)
                            {
                                return(Success("已成功分发任务给" + name, null));
                            }
                            else
                            {
                                return(Fail("已分配,但未记录到任务历史中。"));
                            }
                        }
                        else
                        {
                            return(Success("已成功分发任务给" + name, null));
                        }
                    }
                    else
                    {
                        return(Fail("任务还没成功分配给" + name));
                    }
                }
                else
                {
                    return(Fail("任务还没成功分配给" + name));
                }
            }
        }