//
        // 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_user_model GetUserName(string userstaffno)
 {
     using (DbConn PubConn = DbConfig.CreateConn(Config.PlatformManageConnectString))
     {
         PubConn.Open();
         tb_user_dal dal = new tb_user_dal();
         return(dal.GetUserName(PubConn, userstaffno));
     }
 }
        //
        // GET: /Manage/User/

        public ActionResult Index()
        {
            using (DbConn PubConn = DbConfig.CreateConn(Config.PlatformManageConnectString))
            {
                PubConn.Open();
                List <tb_user_model> Model = new tb_user_dal().GetAllUsers(PubConn);
                return(View(Model));
            }
        }
Beispiel #4
0
 public static tb_user_model GetUser(string userstaffno, string userpsw)
 {
     using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString))
     {
         PubConn.Open();
         tb_user_dal dal = new tb_user_dal();
         return(dal.GetUser(PubConn, userstaffno, userpsw));
     }
 }
Beispiel #5
0
        //
        // GET: /Developers/

        public ActionResult Index()
        {
            return(this.Visit(EnumUserRole.Admin, () =>
            {
                using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString))
                {
                    PubConn.Open();
                    List <tb_user_model> Model = new tb_user_dal().GetAllUsers(PubConn);
                    return View(Model);
                }
            }));
        }
        public ActionResult Add(int?userid)
        {
            if (userid == null)
            {
                return(View());
            }
            using (DbConn PubConn = DbConfig.CreateConn(Config.PlatformManageConnectString))
            {
                PubConn.Open();
                tb_user_dal dal = new tb_user_dal();

                var model = dal.Get(PubConn, userid.Value);
                return(View(model));
            }
        }
Beispiel #7
0
        public override void Run()
        {
            GlobalConfig.MonitorPlatformManageConnectString = AppConfig["MonitorPlatformManageConnectString"];

            SqlHelper.ExcuteSql(GlobalConfig.MonitorPlatformManageConnectString, (c) =>
            {
                tb_database_config_dal dal = new tb_database_config_dal();
                var list = dal.GetModelList(c);
                UnityLogConnectString = XXF.BaseService.Monitor.SystemRuntime.DbShardingHelper.GetDataBase(list, XXF.BaseService.Monitor.SystemRuntime.DataBaseType.UnityLog);
            });

            List <tb_user_model> users = new List <tb_user_model>();

            SqlHelper.ExcuteSql(GlobalConfig.MonitorPlatformManageConnectString, (c) =>
            {
                tb_user_dal dal = new tb_user_dal();
                users           = dal.GetAllUsers(c);
            });
            foreach (var u in users)
            {
                if (!string.IsNullOrWhiteSpace(u.useremail))
                {
                    if (u.lastsenderrortime.AddMinutes(u.errorsendintervaltime) < DateTime.Now)
                    {
                        List <tb_error_log_model> errors = new List <tb_error_log_model>();
                        SqlHelper.ExcuteSql(UnityLogConnectString, (c) =>
                        {
                            tb_error_log_dal dal = new tb_error_log_dal();
                            if (u.userrole == (byte)XXF.BaseService.Monitor.SystemRuntime.EnumUserRole.Admin)
                            {
                                errors = dal.GetUserErrors(c, u.lastsenderrortime, "", "", 50);
                            }
                            else
                            {
                                errors = dal.GetUserErrors(c, u.lastsenderrortime, u.username.Trim(), u.userstaffno.Trim(), 50);
                            }
                        });
                        SendEmail(errors, u.useremail);
                        SqlHelper.ExcuteSql(GlobalConfig.MonitorPlatformManageConnectString, (c) =>
                        {
                            tb_user_dal dal = new tb_user_dal();
                            dal.UpdateLastErrorSendTime(c, u.id, DateTime.Now);
                        });
                    }
                }
            }
        }
 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)
 {
     try
     {
         tb_user_dal dal = new tb_user_dal();
         using (DbConn PubConn = DbConfig.CreateConn(Config.PlatformManageConnectString))
         {
             PubConn.Open();
             bool state = dal.Delete(PubConn, id);
             return(Json(new { code = 1, state = state }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { code = -1, msg = ex.Message }));
     }
 }
Beispiel #10
0
        public ActionResult Add(int?userid)
        {
            return(this.Visit(EnumUserRole.Admin, () =>
            {
                if (userid == null)
                {
                    return View();
                }
                using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString))
                {
                    PubConn.Open();
                    tb_user_dal dal = new tb_user_dal();

                    var model = dal.Get(PubConn, userid.Value);
                    return View(model);
                }
            }));
        }
        public override void Run()
        {
            var tempinfo = this.OpenOperator.GetDataBaseTempData <TaskManageErrorSendTaskTempInfo>();

            if (tempinfo == null)
            {
                tempinfo           = new TaskManageErrorSendTaskTempInfo();
                tempinfo.LastLogID = 0;
            }
            //扫描
            List <tb_senderror_model> senderrormodels = new List <tb_senderror_model>();
            List <tb_user_model>      usermodels      = new List <tb_user_model>();

            SqlHelper.ExcuteSql(this.SystemRuntimeInfo.TaskConnectString, (c) =>
            {
                tb_error_dal errordal = new tb_error_dal();
                senderrormodels       = errordal.GetErrors(c, tempinfo.LastLogID);
                tb_user_dal userdal   = new tb_user_dal();
                usermodels            = userdal.GetAllUsers(c);
            });
            foreach (var u in usermodels)
            {
                if (string.IsNullOrEmpty(u.useremail))
                {
                    continue;
                }
                if (u.userrole == (int)EnumUserRole.Admin)
                {
                    SendEmail(senderrormodels, u.useremail);
                }
                else
                {
                    SendEmail(senderrormodels.Where(c => c.taskcreateuserid == u.id).ToList(), u.useremail);
                }
            }
            if (senderrormodels.Count > 0)
            {
                int maxid = senderrormodels.Max(c => c.error_model.id);
                tempinfo.LastLogID = maxid;
                this.OpenOperator.Log(string.Format("本次处理错误日志{0}条", senderrormodels.Count));
            }
            this.OpenOperator.SaveDataBaseTempData(tempinfo);
        }
Beispiel #12
0
 public JsonResult Delete(int id)
 {
     return(this.Visit(EnumUserRole.Admin, () =>
     {
         try
         {
             tb_user_dal dal = new tb_user_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 Add(tb_user_model model)
 {
     using (DbConn PubConn = DbConfig.CreateConn(Config.PlatformManageConnectString))
     {
         PubConn.Open();
         tb_user_dal dal = new tb_user_dal();
         model.usercreatetime        = DateTime.Now;
         model.lastsenderrortime     = DateTime.Now;
         model.errorsendintervaltime = (model.errorsendintervaltime == 0?1:model.errorsendintervaltime);
         model.usertel   = model.usertel.NullToEmpty();
         model.useremail = model.useremail.NullToEmpty();
         if (model.id == 0)
         {
             dal.Add(PubConn, model);
         }
         else
         {
             dal.Edit(PubConn, model);
         }
     }
     return(RedirectToAction("index"));
 }
Beispiel #14
0
 public ActionResult Add(tb_user_model model)
 {
     return(this.Visit(EnumUserRole.Admin, () =>
     {
         using (DbConn PubConn = DbConn.CreateConn(Config.TaskConnectString))
         {
             PubConn.Open();
             tb_user_dal dal = new tb_user_dal();
             model.usercreatetime = DateTime.Now;
             model.usertel = model.usertel.NullToEmpty();
             model.useremail = model.useremail.NullToEmpty();
             if (model.id == 0)
             {
                 dal.Add(PubConn, model);
             }
             else
             {
                 dal.Edit(PubConn, model);
             }
         }
         return RedirectToAction("index");
     }));
 }
Beispiel #15
0
 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);
         }
     }));
 }
Beispiel #16
0
        //
        // 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);
            }));
        }