Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #3
0
        //----------发布任务-----------------------
        public ActionResult test(String a, String b, String u)
        {
            if (String.IsNullOrWhiteSpace(a))
            {
                return(Fail("error"));
            }


            T_TaskDAO T_Taskdao = new T_TaskDAO();
            String    d         = Convert.ToString(Session["uid"]);
            T_Task    task      = new T_Task()
            {
                title    = b,
                content  = a,
                statusId = 1,
                userId   = d,
            };
            int id = T_Taskdao.Add(task);
            T_Task_HistoryDAO histdao = new T_Task_HistoryDAO();
            var            time       = System.DateTime.Now.ToString("d");
            T_Task_History history    = new T_Task_History()
            {
                content  = "发布任务,任务内容为:" + a,
                userName = u,
                taskId   = id,
                descr    = "发布任务",
                userId   = d,
            };

            histdao.Add(history);



            return(Success("ok", null));
        }
Beispiel #4
0
        //----------发起任务视图-----------------------
        public ActionResult ClientBList()
        {
            int page = 1;

            if (!String.IsNullOrEmpty(Request["p"]))
            {
                page = Convert.ToInt32(Request["p"]);
            }

            String search_criteria = "";

            if (!String.IsNullOrEmpty(Request.QueryString["s"]))
            {
                search_criteria = Request.QueryString["s"];
            }

            int    total;
            T_Task entity = new T_Task();

            if (!String.IsNullOrEmpty(Request.QueryString["status"]))
            {
                entity.statusId = Int32.Parse(Request.QueryString["status"]);
            }

            List <T_Task> entitys =
                entityDao.Search(entity, page, this.pageSize, search_criteria, T_Task.Columns.statusId, AscDesc.ASC, out total);

            T_Task_StatusDAO sdao = new T_Task_StatusDAO();

            T_UserDAO udao = new T_UserDAO();

            T_TaskDAO tdao = new T_TaskDAO();


            String uid = Convert.ToString(Session["uid"]);

            T_User q = udao.GetByModel(new T_User()
            {
                id = uid
            });

            Session["roleid"] = q.roleId;

            ViewBag.status = sdao.GetAllByModel(null);


            ViewBag.total = total;

            ViewBag.pageSize = this.pageSize;

            ViewBag.status = sdao.GetAllByModel(null);



            ViewBag.list = entitys;

            return(View(entitys));
        }
Beispiel #5
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("操作失败,请重试。"));
                }
            }
        }
Beispiel #6
0
        //----------任务详情视图-----------------------
        public ActionResult Task()
        {
            String taskid = Request["id"];
            String uid    = Convert.ToString(Session["uid"]);
            String roleid = Convert.ToString(Session["roleid"]);

            if (String.IsNullOrWhiteSpace(taskid) || String.IsNullOrWhiteSpace(uid) || String.IsNullOrWhiteSpace(roleid))
            {
                return(Fail("参数不足,请重试"));
            }
            //参数不足会返回错误信息
            else
            {
                T_Task_HistoryDAO historydao = new T_Task_HistoryDAO();
                T_Task_History    history    = new T_Task_History()
                {
                    taskId = Convert.ToInt32(taskid)
                };
                List <T_Task_History> hislist = historydao.GetAllByModel(history);
                ViewBag.list = hislist;
                T_Task_History title = historydao.GetByModel(history);
                ViewBag.uid = uid;
                T_TaskDAO taskdao = new T_TaskDAO();
                T_Task    task    = new T_Task()
                {
                    id = Convert.ToInt32(taskid)
                };
                task                = taskdao.GetByModel(task);
                Session["title"]    = task.title;
                Session["tid"]      = task.id;
                Session["roleid"]   = roleid;
                ViewBag.content     = task.content;
                ViewBag.createtime  = task.createTime;
                ViewBag.begintime   = task.beginTime;
                ViewBag.endtime     = task.endTime;
                ViewBag.statusid    = task.statusId;
                Session["statusid"] = ViewBag.statusid;
                ViewBag.status      = task.statusIdEntity.descr;
                //根据任务编号返回跟任务相关的各种信息
                T_Task_UserDAO tuserdao = new T_Task_UserDAO();
                T_Task_User    tuser    = new T_Task_User()
                {
                    taskId = Convert.ToInt32(Request["id"])
                };
                List <T_Task_User> tuserlist = tuserdao.GetAllByModel(tuser);
                ViewBag.tuser = tuserlist;


                return(View());
            }
        }
Beispiel #7
0
        public ActionResult List()
        {
            String uid = Convert.ToString(Session["uid"]);

            if (String.IsNullOrWhiteSpace(uid))
            {
                return(Fail("没有足够的参数"));
            }
            else
            {
                //翻页,页数查询条件
                int page = 1;
                if (!String.IsNullOrEmpty(Request["p"]))
                {
                    page = Convert.ToInt32(Request["p"]);
                }
                //关键字模糊查询
                String search_criteria = "";
                if (!String.IsNullOrEmpty(Request.QueryString["s"]))
                {
                    search_criteria = Request.QueryString["s"];
                }

                int    total;
                T_Task entity = new T_Task();
                //任务状态查询
                if (!String.IsNullOrEmpty(Request.QueryString["status"]))
                {
                    entity.statusId = Int32.Parse(Request.QueryString["status"]);
                }
                T_TaskDAO     entityDao = new T_TaskDAO();
                List <T_Task> entitys   =
                    entityDao.Search(entity, page, this.pageSize, search_criteria, T_Task.Columns.statusId, AscDesc.ASC, out total);
                ViewBag.list = entitys;

                T_UserDAO udao = new T_UserDAO();
                T_User    q    = udao.GetByModel(new T_User()
                {
                    id = uid
                });
                T_Task_StatusDAO sdao = new T_Task_StatusDAO();
                ViewBag.uid = uid;

                Session["roleid"] = q.roleId;
                ViewBag.status    = sdao.GetAllByModel(null);
                //ViewBag.list = taskList;
                return(View());
            }
        }
Beispiel #8
0
        public JsonResult LoginCheck()
        {
            String account = Request["account"];
            String pass    = Request["password"];

            if (String.IsNullOrWhiteSpace(account) || String.IsNullOrWhiteSpace(pass))
            {
                return(Fail("没有足够的参数"));
            }
            T_User entity = new T_User()
            {
                account = account, password = pass
            };

            entity = entityDao.GetByModel(entity);
            if (entity == null)
            {
                return(Fail("用户名和密码不匹配"));
            }
            else
            {
                pass                = "";
                entity.password     = "";
                Session["uid"]      = entity.id;
                Session["username"] = entity.name;
                Session["descr"]    = entity.descr;
                Session["create"]   = entity.createTime;
                Session["phone"]    = entity.phone;
                Session["dept"]     = entity.roleIdEntity.descr;
                Session["roleid"]   = entity.roleId;

                //登录成功后,将用户信息用Session存起来,方便调用。


                //   var tempEntity = new { roleid=entity.roleId };
                //    string json5 = JsonConvert.SerializeObject(tempEntity);

                pass = "";
                //登录后密码清空。
                T_TaskDAO tdao = new T_TaskDAO();
                tdao.updateStatus();



                return(Success("登录成功", entity));
                //
            }
        }
Beispiel #9
0
        public ActionResult test(String a, String b, String u, String t)
        {
            if (String.IsNullOrWhiteSpace(a))
            {
                return(Fail("error"));
            }
            T_TaskDAO T_Taskdao = new T_TaskDAO();
            String    uid       = Convert.ToString(Session["uid"]);
            T_Task    task      = new T_Task()
            {
                title    = b,
                content  = a,
                userId   = uid,
                statusId = 2
            };
            int id = T_Taskdao.Add(task);
            //int id = (int)T_Taskdao.GetByModel(task).id;
            T_Task_HistoryDAO histdao = new T_Task_HistoryDAO();
            var            time       = t;
            T_Task_History history    = new T_Task_History()
            {
                content  = "发布任务,任务内容为:" + a,
                userName = u,
                taskId   = id,
                descr    = "发布任务",
                userId   = uid,
            };

            histdao.Add(history);
            T_Task_History history2 = new T_Task_History()
            {
                content  = "通过任务的审核,等待任务分发",
                userName = u,
                taskId   = id,
                descr    = "审核任务",
                userId   = uid,
            };

            histdao.Add(history2);

            //管理员用户发起任务默认通过已通过审核,同时在添加两条历史记录

            return(Success("ok", null));
        }
Beispiel #10
0
        public ActionResult Distribute()
        {
            String uid = Convert.ToString(Session["uid"]);

            if (String.IsNullOrWhiteSpace(uid))
            {
                return(Fail("没有足够的参数"));
            }
            else
            {
                T_TaskDAO taskdao = new T_TaskDAO();
                T_Task    task    = new T_Task()
                {
                    statusId = 2
                };
                List <T_Task> tasklist = taskdao.GetAllByModel(task);

                T_UserDAO userdao = new T_UserDAO();
                T_User    user    = new T_User()
                {
                    roleId = 3
                };
                List <T_User> userlist = userdao.GetAllByModel(user);

                T_User q = userdao.GetByModel(new T_User()
                {
                    id = uid
                });

                Session["username"] = q.name;

                Session["dept"] = q.dept;

                Session["roleid"] = q.roleId;


                ViewBag.tasklist = tasklist;
                ViewBag.userlist = userlist;

                ViewBag.uid = uid;
                return(View());
            }
        }
Beispiel #11
0
        //----------任务列表视图-----------------------
        public ActionResult List()
        {
            uid = Request["uid"];
            if (String.IsNullOrWhiteSpace(Request["uid"]))
            {
                return(Fail("没有足够的参数"));
            }
            else
            {
                T_Task_HistoryDAO historydao = new T_Task_HistoryDAO();
                T_Task_History    history    = new T_Task_History()
                {
                    descr = uid
                };
                List <T_Task_History> HistoryList = historydao.GetAllByModel(history);

                T_TaskDAO T_taskdao = new T_TaskDAO();
                taskList = new List <T_Task>();
                T_Task_StatusDAO statusdao = new T_Task_StatusDAO();
                foreach (T_Task_History item in HistoryList)
                {
                    T_Task task = new T_Task()
                    {
                        id = item.taskId
                    };
                    T_Task t = T_taskdao.GetByModel(task);

                    T_Task_Status status = new T_Task_Status()
                    {
                        id = t.statusId
                    };
                    T_Task_Status s = statusdao.GetByModel(status);

                    item.taskIdEntity.content = s.descr;
                }

                ViewBag.uid  = uid;
                ViewBag.list = HistoryList;
                return(View());
            }
        }
Beispiel #12
0
        public ActionResult Check()
        {
            String uid = Convert.ToString(Session["uid"]);

            if (String.IsNullOrWhiteSpace(uid))
            {
                return(Fail("没有足够的参数"));
            }
            else
            {
                T_TaskDAO taskdao = new T_TaskDAO();
                T_Task    task    = new T_Task()
                {
                    statusId = 2
                };
                List <T_Task> tasklist = taskdao.GetAllByModel(task);

                T_Task_HistoryDAO historydao = new T_Task_HistoryDAO();
                foreach (T_Task item in tasklist)
                {
                    T_Task_History history = new T_Task_History()
                    {
                        taskId = item.id, content = "发起任务"
                    };
                    T_Task_History hislist = historydao.GetByModel(history);
                    if (hislist == null)
                    {
                    }
                    else
                    {
                        item.statusIdEntity.descr = hislist.userName;
                    }
                }

                ViewBag.list = tasklist;
                ViewBag.uid  = uid;
                return(View());
            }
        }
Beispiel #13
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 #14
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));
        }
Beispiel #15
0
        public ActionResult List()
        {
            int page = 1;

            if (!String.IsNullOrEmpty(Request["p"]))
            {
                page = Convert.ToInt32(Request["p"]);
            }

            String search_criteria = "";

            if (!String.IsNullOrEmpty(Request.QueryString["s"]))
            {
                search_criteria = Request.QueryString["s"];
            }

            int    total;
            T_Task entity = new T_Task();

            if (!String.IsNullOrEmpty(Request.QueryString["status"]))
            {
                entity.statusId = Int32.Parse(Request.QueryString["status"]);
            }

            List <T_Task> entitys =
                entityDao.Search(entity, page, this.pageSize, search_criteria, T_Task.Columns.statusId, AscDesc.ASC, out total);

            T_Task_StatusDAO sdao = new T_Task_StatusDAO();

            T_UserDAO udao = new T_UserDAO();

            T_TaskDAO tdao = new T_TaskDAO();


            String uid = Convert.ToString(Session["uid"]);

            T_User q = udao.GetByModel(new T_User()
            {
                id = uid
            });

            Session["username"] = q.name;

            Session["dept"] = q.dept;

            Session["roleid"] = q.roleId;


            ViewBag.total = total;

            ViewBag.pageSize = this.pageSize;

            ViewBag.status = sdao.GetAllByModel(null);



            ViewBag.list = entitys;

            return(View(entitys));

            if (String.IsNullOrWhiteSpace(uid))
            {
                return(Fail("没有足够的参数"));
            }
            else
            {
                T_TaskDAO taskdao = new T_TaskDAO();
                T_Task    task    = new T_Task()
                {
                };
                List <T_Task> tasklist = taskdao.GetAllByModel(task);

                T_Task_StatusDAO statusdao = new T_Task_StatusDAO();
                T_Task_Status    status    = new T_Task_Status()
                {
                };
                List <T_Task_Status> statuslist = statusdao.GetAllByModel(status);

                ViewBag.uid        = Session["uid"];
                ViewBag.list       = tasklist;
                ViewBag.statuslist = statuslist;
                return(View());
            }
        }
Beispiel #16
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));
                }
            }
        }