コード例 #1
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));
        }
コード例 #2
0
 [ValidateInput(false)]        //要加上这一句,否则会造成富文本里面的HTML代码危险警报
 public JsonResult Add(T_Task entity)
 {
     if (entityDao.Add(entity) > 0)
     {
         return(Success("新增成功!", null));
     }
     else
     {
         return(Fail("新增失败!"));
     }
 }
コード例 #3
0
ファイル: ClientBController.cs プロジェクト: taoboy/dne
        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));
        }