Esempio n. 1
0
 public virtual void Delete(Monitor_Config cfg)
 {
     try
     {
         MonitorConfigDao.Delete(cfg);
     }
     catch (DalException ex)
     {
         throw new BOException("删除实体出错", ex);
     }
 }
        public JsonResult EditConfigSave(int cfg_id, string cfg_hostname, string cfg_hostip, string cfg_file, string Enable, string cfg_usedate)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };
            Monitor_Config monitorConfig = null;
            if (cfg_id == 0)
            {
                monitorConfig = new Monitor_Config();
                monitorConfig.cfg_createdate = DateTime.Now;
            }
            else
            {
                monitorConfig = BoFactory.GetMonitorBO.Get(cfg_id);
            }
            monitorConfig.cfg_hostname = cfg_hostname;
            monitorConfig.cfg_hostip = cfg_hostip;
            monitorConfig.cfg_file = cfg_file;
            monitorConfig.cfg_isuse = Enable;
            if (!String.IsNullOrEmpty(cfg_usedate))
                monitorConfig.cfg_usedate = DateTime.Parse(cfg_usedate);

            BoFactory.GetMonitorBO.Save(monitorConfig);
            return Json(data);
        }
Esempio n. 3
0
 public virtual int Save(Monitor_Config cfg)
 {
     if (MonitorConfigDao.Get(cfg.cfg_id) == null)
         return MonitorConfigDao.Insert(cfg);
     else
         return MonitorConfigDao.Update(cfg);
 }
        public JsonResult MonitorConfigAddPost(int cfg_id, string cfg_hostname, string cfg_hostip, string cfg_file, string cfg_isuse)
        {
            Hashtable result = new Hashtable();
            Monitor_Config config = new Monitor_Config();
            config.cfg_id = cfg_id;
            config.cfg_hostname = cfg_hostname;
            config.cfg_hostip = cfg_hostip;
            config.cfg_file = Server.HtmlDecode(cfg_file);
            config.cfg_file = System.Text.RegularExpressions.Regex.Replace(config.cfg_file, ">[\\s]+", ">");
            config.cfg_file = System.Text.RegularExpressions.Regex.Replace(config.cfg_file, "[\\s]+<", "<");
            config.cfg_file = System.Text.RegularExpressions.Regex.Replace(config.cfg_file, "[\\s]+", " ");
            config.cfg_isuse = cfg_isuse;
            config.cfg_updatedate = DateTime.Now;
            config.cfg_updateman = CurrentUser.FullName;
            if (config.cfg_id == 0)
            {
                config.cfg_createdate = DateTime.Now;
                config.cfg_createman = CurrentUser.FullName;
            }

            if (config.cfg_isuse == "1")
                config.cfg_usedate = DateTime.Now;
            bool r = Bo.BoFactory.GetMonitorBO.Save(config) > 0;
            result["d"] = r ? "保存成功!" : "保存失败!";
            result["r"] = r;

            return Json(result);
        }
        public ActionResult MonitorConfigAdd()
        {
            MonitorBO monitorBO = BoFactory.GetMonitorBO;
            Monitor_Config config = null;
            string id = Request.QueryString["id"];
            if (!String.IsNullOrEmpty(id))
                config = monitorBO.Get(int.Parse(id));
            if (config == null)
                config = new Monitor_Config();

            string entity = Newtonsoft.Json.JsonConvert.SerializeObject(config, Newtonsoft.Json.Formatting.Indented).Replace("\\r\\n", "");
            this.ViewData["entity"] = entity;
            return View(config);
        }