// // 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 static tb_node_model GetOneNode(DbConn PubConn, int id) { tb_node_dal dal = new tb_node_dal(); DataRow dr = dal.GetOneNode(PubConn, id); tb_node_model model = CreateModelForNode(dr); return(model); }
public static List <tb_node_model> GetNodeList(DbConn PubConn, string keyword, int pagesize, int pageindex, out int count) { DataSet ds = new tb_node_dal().GetList(PubConn, keyword, pagesize, pageindex, out count); List <tb_node_model> Model = new List <tb_node_model>(); foreach (DataRow dr in ds.Tables[0].Rows) { tb_node_model m = CreateModelForNode(dr); Model.Add(m); } return(Model); }
public static int GetAvailableNode() { lock (k) { using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); int id = new tb_node_dal().GetAvailableNode(PubConn); return(id); } } }
public ActionResult Update(int id) { return(this.Visit(EnumUserRole.Admin, () => { tb_node_dal dal = new tb_node_dal(); using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); tb_node_model model = dal.GetOneNode(PubConn, id); return View(model); } })); }
public void tt() { string TaskConnectString = "Server=localhost;Database=dyd_bs_task;Uid=root;Pwd=123456;"; using (DbConn PubConn = DbConn.CreateConn(TaskConnectString)) { tb_node_dal dal = new tb_node_dal(); PubConn.Open(); int count; List <tb_node_model> List = dal.GetList(PubConn, null, null, null, 2, 1, out count); Console.WriteLine("list.count" + List.Count); } }
public ActionResult Update(int id) { return(this.Visit(Core.EnumUserRole.Admin, () => { using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); tb_command_dal dal = new tb_command_dal(); tb_command_model_Ex model = dal.GetOneCommand(PubConn, id); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); ViewBag.Node = Node; return View(model); } })); }
public ActionResult Add() { return(this.Visit(Core.EnumUserRole.Admin, () => { using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); List <tb_task_model> Task = new tb_task_dal().GetListAll(PubConn); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); ViewBag.Node = Node; ViewBag.Task = Task; return View(); } })); }
public ActionResult Update(tb_node_model model) { return(this.Visit(EnumUserRole.Admin, () => { tb_node_dal Dal = new tb_node_dal(); model.nodecreatetime = DateTime.Now; model.nodelastupdatetime = DateTime.Now; using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); Dal.Update(PubConn, model); } return RedirectToAction("index"); })); }
protected override void Run() { SqlHelper.ExcuteSql(GlobalConfig.TaskDataBaseConnectString, (c) => { var sqldatetime = c.GetServerDate(); tb_node_dal nodedal = new tb_node_dal(); nodedal.AddOrUpdate(c, new Domain.Model.tb_node_model() { nodecreatetime = sqldatetime, nodeip = System.Net.Dns.GetHostName(), nodelastupdatetime = sqldatetime, nodename = "新增节点", id = GlobalConfig.NodeID }); }); }
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 static tb_node_model GetNode(int id, DbConn conn = null) { tb_node_dal dal = new tb_node_dal(); if (conn == null) { using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); return(dal.Get(PubConn, id)); } } else { return(dal.Get(conn, id)); } }
// // GET: /Node/ public ActionResult Index(string keyword, string CStime, string CEtime, int pagesize = 10, int pageindex = 1) { return(this.Visit(EnumUserRole.Admin, () => { ViewBag.sqldatetimenow = DateTime.Now; tb_node_dal dal = new tb_node_dal(); PagedList <tb_node_model> pageList = null; int count = 0; using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString)) { PubConn.Open(); List <tb_node_model> List = dal.GetList(PubConn, keyword, CStime, CEtime, pagesize, pageindex, out count); pageList = new PagedList <tb_node_model>(List, pageindex, pagesize, count); ViewBag.sqldatetimenow = PubConn.GetServerDate(); } return View(pageList); })); }
public override void Run() { List <tb_node_model> models = new List <tb_node_model>(); SqlHelper.ExcuteSql(Config.TaskConnectString, (c) => { Domain.Dal.tb_node_dal dal = new tb_node_dal(); models = dal.GetAllStopNodesWithNeedCheckState(c); }); foreach (var m in models) { LogHelper.AddError(new tb_error_model() { errorcreatetime = DateTime.Now, errortype = (int)XXF.BaseService.TaskManager.SystemRuntime.EnumTaskLogType.SystemError, msg = string.Format("当前节点:{0}【{1}】运行已经停止,请及时检查!", m.nodename, m.id), nodeid = m.id, taskid = 0 }); } }
public JsonResult Delete(int id) { return(this.Visit(EnumUserRole.Admin, () => { try { tb_node_dal dal = new tb_node_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 }); } })); }
// // GET: /Command/ public ActionResult Index(int taskid = -1, int commandstate = -1, int nodeid = -1, int pagesize = 10, int pageindex = 1) { return(this.Visit(Core.EnumUserRole.Admin, () => { ViewBag.taskid = taskid; ViewBag.commandstate = commandstate; ViewBag.nodeid = nodeid; ViewBag.pagesize = pagesize; ViewBag.pageindex = pageindex; tb_command_dal dal = new tb_command_dal(); PagedList <tb_command_model_Ex> pageList = null; int count = 0; using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); List <tb_command_model_Ex> List = dal.GetList(PubConn, commandstate, taskid, nodeid, pagesize, pageindex, out count); List <tb_task_model> Task = new tb_task_dal().GetListAll(PubConn); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); ViewBag.Node = Node; ViewBag.Task = Task; pageList = new PagedList <tb_command_model_Ex>(List, pageindex, pagesize, count); } return View(pageList); })); }
public ActionResult Log(string keyword, string CStime, string CEtime, int id = -1, int logtype = -1, int taskid = -1, int nodeid = -1, int pagesize = 10, int pageindex = 1) { return(this.Visit(Core.EnumUserRole.None, () => { ViewBag.keyword = keyword; ViewBag.CStime = CStime; ViewBag.CEtime = CEtime; ViewBag.id = id; ViewBag.logtype = logtype; ViewBag.taskid = taskid; ViewBag.nodeid = nodeid; ViewBag.pagesize = pagesize; ViewBag.pageindex = pageindex; int count = 0; using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString)) { PubConn.Open(); tb_log_dal dal = new tb_log_dal(); List <tb_loginfo_model> model = dal.GetList(PubConn, keyword, id, CStime, CEtime, logtype, taskid, nodeid, pagesize, pageindex, out count); PagedList <tb_loginfo_model> pageList = new PagedList <tb_loginfo_model>(model, pageindex, pagesize, count); List <tb_task_model> Task = new tb_task_dal().GetListAll(PubConn); List <tb_node_model> Node = new tb_node_dal().GetListAll(PubConn); ViewBag.Node = Node; ViewBag.Task = Task; return View(pageList); } })); }
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); })); }