Beispiel #1
0
        public ActionResult Show()
        {
            T_Task entity = new T_Task();

            try
            {
                if (!String.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    entity = entityDao.GetById(Convert.ToInt32(Request.QueryString["id"]));
                }
            }
            catch (Exception ex) { }

            return(View("Show", entity));
        }
Beispiel #2
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));
        }
Beispiel #3
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));
        }
Beispiel #4
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("提交失败,请填写完各项再提交。"));
            }
        }
Beispiel #5
0
        //---------------删除任务、删除任务记录--------------
        public ActionResult deleteC(String cid, String tid)
        {
            if (String.IsNullOrWhiteSpace(cid))
            {
                return(Fail("error"));
            }

            String            uid     = Convert.ToString(Session["uid"]);
            T_Task_HistoryDAO deledao = new T_Task_HistoryDAO();
            T_Task_History    deleC   = deledao.GetById(Convert.ToInt32(cid));

            deleC.id = Convert.ToInt32(cid);
            if (deleC.descr == "发布任务")
            {
                int roleid = Convert.ToInt32(Session["roleid"]);
                if (roleid == 2)
                {
                    List <T_Task_History> l = deledao.GetAllByModel(new T_Task_History()
                    {
                        taskId = Convert.ToInt32(tid)
                    });
                    //--------  一方管理员删除任务时,先删除所有的历史记录,再删除任务
                    foreach (T_Task_History t in l)
                    {
                        deledao.Del(Convert.ToInt32(t.id));
                    }

                    T_TaskDAO tdao  = new T_TaskDAO();
                    T_Task    deleT = tdao.GetById(Convert.ToInt32(tid));
                    deleT.id       = Convert.ToInt32(Session["tid"]);
                    Session["fid"] = tid;
                    int result = tdao.Del(Convert.ToInt32(Session["tid"]));
                    if (result > 0)
                    {
                        return(Success("已删除!", null));
                    }
                    else
                    {
                        return(Success("未通过!", null));
                    }
                }
                else
                {
                    deledao.Del(Convert.ToInt32(cid));
                    T_TaskDAO tdao  = new T_TaskDAO();
                    T_Task    deleT = tdao.GetById(Convert.ToInt32(tid));
                    deleT.id       = Convert.ToInt32(Session["tid"]);
                    Session["fid"] = tid;
                    int result = tdao.Del(Convert.ToInt32(Session["tid"]));
                    if (result > 0)
                    {
                        return(Success("已删除!", null));
                    }
                    else
                    {
                        return(Success("未通过!", null));
                    }
                }
            }
            else
            {
                //删除任务汇报
                deledao.Del(Convert.ToInt32(cid));
            }
            return(Success("已删除!", null));
        }