// // GET: /Task/ public ActionResult Index(string taskid, string keyword, string CStime, string CEtime, int categoryid = -1, int nodeid = -1, int userid = -1, int state = -999, int pagesize = 10, int pageindex = 1) { return(this.Visit(Core.EnumUserRole.None, () => { ViewBag.taskid = taskid; ViewBag.keyword = keyword; ViewBag.CStime = CStime; ViewBag.CEtime = CEtime; ViewBag.categoryid = categoryid; ViewBag.nodeid = nodeid; ViewBag.userid = userid; ViewBag.state = state; ViewBag.pagesize = pagesize; ViewBag.pageindex = pageindex; tb_task_dal dal = new tb_task_dal(); PagedList <tb_tasklist_model> pageList = null; int count = 0; using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); List <tb_tasklist_model> List = dal.GetList(PubConn, taskid, keyword, CStime, CEtime, categoryid, nodeid, userid, state, pagesize, pageindex, out count); pageList = new PagedList <tb_tasklist_model>(List, pageindex, pagesize, count); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); List <tb_category_model> Category = new tb_category_dal().GetList(PubConn, ""); List <tb_user_model> User = new tb_user_dal().GetAllUsers(PubConn); ViewBag.Node = Node; ViewBag.Category = Category; ViewBag.User = User; } return View(pageList); })); }
public JsonResult Update(tb_category_model model) { return(this.Visit(EnumUserRole.Admin, () => { using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); tb_category_dal dal = new tb_category_dal(); dal.Update(PubConn, model); return Json(new { code = 1, msg = "Success" }); } })); }
public ActionResult Add(tb_category_model model) { return(this.Visit(EnumUserRole.Admin, () => { using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); tb_category_dal dal = new tb_category_dal(); dal.Add(PubConn, model.categoryname); return RedirectToAction("index"); } })); }
// // GET: /Category/ public ActionResult Index(string keyword) { return(this.Visit(EnumUserRole.Admin, () => { using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); tb_category_dal dal = new tb_category_dal(); List <tb_category_model> model = dal.GetList(PubConn, keyword); return View(model); } })); }
public ActionResult Add() { return(this.Visit(Core.EnumUserRole.Admin, () => { using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); List <tb_category_model> Category = new tb_category_dal().GetList(PubConn, ""); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); List <tb_user_model> User = new tb_user_dal().GetAllUsers(PubConn); ViewBag.Node = Node; ViewBag.Category = Category; ViewBag.User = User; return View(); } })); }
public JsonResult Delete(int id) { return(this.Visit(EnumUserRole.Admin, () => { try { tb_category_dal dal = new tb_category_dal(); using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); bool state = dal.DeleteOneNode(PubConn, id); return Json(new { code = 1, state = state }); } } catch (Exception ex) { return Json(new { code = -1, msg = ex.Message }); } })); }
public ActionResult Update(int taskid) { return(this.Visit(Core.EnumUserRole.None, () => { using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); tb_task_dal dal = new tb_task_dal(); tb_task_model model = dal.GetOneTask(PubConn, taskid); tb_tempdata_model tempdatamodel = new tb_tempdata_dal().GetByTaskID(PubConn, taskid); List <tb_version_model> Version = new tb_version_dal().GetTaskVersion(PubConn, taskid); List <tb_category_model> Category = new tb_category_dal().GetList(PubConn, ""); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); List <tb_user_model> User = new tb_user_dal().GetAllUsers(PubConn); ViewBag.Node = Node; ViewBag.Category = Category; ViewBag.Version = Version; ViewBag.User = User; ViewBag.TempData = tempdatamodel; return View(model); } })); }
// // GET: /Task/ public ActionResult Index(string taskid, string keyword, string CStime, string CEtime, int categoryid = -1, int nodeid = -1, int userid = -1, int state = -999, int pagesize = 10, int pageindex = 1) { return(this.Visit(EnumUserRole.None, () => { #region 保存查询信息,优化操作体验 var ps = Request.RequestParams(); ps.Remove("userid"); var sessionkey = "/task/index/"; if (ps.Count == 0) { if (HttpContext.Session.GetString(sessionkey) != null) { var ks = new BSF.Serialization.JsonProvider(BSF.Serialization.JsonAdapter.EnumJsonMode.Newtonsoft).Deserialize <List <KeyValuePair <string, object> > >(HttpContext.Session.GetString(sessionkey)); foreach (var k in ks) { if (!ViewData.ContainsKey(k.Key)) { ViewData.Add(k); } } taskid = (string)ViewBag.taskid; keyword = (string)ViewBag.keyword; CStime = (string)ViewBag.CStime; CEtime = (string)ViewBag.CEtime; categoryid = (int)ViewBag.categoryid; nodeid = (int)ViewBag.nodeid; userid = (int)ViewBag.userid; state = (int)ViewBag.state; pagesize = (int)ViewBag.pagesize; pageindex = (int)ViewBag.pageindex; } } ViewBag.taskid = taskid; ViewBag.keyword = keyword; ViewBag.CStime = CStime; ViewBag.CEtime = CEtime; ViewBag.categoryid = categoryid; ViewBag.nodeid = nodeid; ViewBag.userid = userid; ViewBag.state = state; ViewBag.pagesize = pagesize; ViewBag.pageindex = pageindex; HttpContext.Session.SetString(sessionkey, new BSF.Serialization.JsonProvider().Serializer(ViewData)); #endregion tb_task_dal dal = new tb_task_dal(); PagedList <tb_tasklist_model> pageList = null; int count = 0; using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); List <tb_tasklist_model> List = dal.GetList(PubConn, taskid, keyword, CStime, CEtime, categoryid, nodeid, userid, state, pagesize, pageindex, out count); pageList = new PagedList <tb_tasklist_model>(List, pageindex, pagesize, count); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); List <tb_category_model> Category = new tb_category_dal().GetList(PubConn, ""); List <tb_user_model> User = new tb_user_dal().GetAllUsers(PubConn); ViewBag.Node = Node; ViewBag.Category = Category; ViewBag.User = User; } return View(pageList); })); }