Beispiel #1
0
        //
        // GET: /Risk/
        /// <summary>
        /// 监控配置列表
        /// </summary>
        /// <returns></returns>
        public ActionResult MonitoringconfigList()
        {
            List <JMP.MDL.jmp_channel_filter_config> list    = new List <JMP.MDL.jmp_channel_filter_config>();
            List <JMP.MDL.jmp_channel_filter_config> listall = new List <JMP.MDL.jmp_channel_filter_config>();

            JMP.BLL.jmp_channel_filter_config bll = new JMP.BLL.jmp_channel_filter_config();
            int    pageCount  = 0;
            int    pageIndexs = string.IsNullOrEmpty(Request["pageIndexs"]) ? 1 : Int32.Parse(Request["pageIndexs"]); //当前页
            int    PageSize   = string.IsNullOrEmpty(Request["PageSize"]) ? 20 : Int32.Parse(Request["PageSize"]);    //每页显示数量
            int    TypeId     = string.IsNullOrEmpty(Request["TypeId"]) ? -1 : Int32.Parse(Request["TypeId"]);
            int    TargetId   = string.IsNullOrEmpty(Request["TargetId"]) ? -1 : Int32.Parse(Request["TargetId"]);
            int    type       = string.IsNullOrEmpty(Request["searchType"]) ? 0 : Int32.Parse(Request["searchType"]); //查询条件选择
            string sea_name   = string.IsNullOrEmpty(Request["sea_name"]) ? "" : Request["sea_name"];                 //查询条件内容

            list = bll.SelectList(type, sea_name, TypeId, TargetId, pageIndexs, PageSize, out pageCount);
            JMP.BLL.jmp_channel_filter_config yybll = new JMP.BLL.jmp_channel_filter_config();
            DataTable yydt = yybll.GetList("").Tables[0];//获取应用类型在用信息
            List <JMP.MDL.jmp_channel_filter_config> yylist = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_channel_filter_config>(yydt);

            listall            = yylist;
            ViewBag.pageIndexs = pageIndexs;
            ViewBag.PageSize   = PageSize;
            ViewBag.pageCount  = pageCount;
            ViewBag.list       = list;
            ViewBag.listall    = listall;
            ViewBag.TypeId     = TypeId;
            ViewBag.TargetId   = TargetId;
            ViewBag.sea_name   = sea_name;
            ViewBag.type       = type;
            string locUrl        = "";
            bool   getlocuserAdd = bll_limit.GetLocUserLimitVoids("/Risk/AddMonitoringconfig", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//添加

            if (getlocuserAdd)
            {
                locUrl += "<li onclick=\"AddSdl()\"><i class='fa fa-plus'></i>添加监控配置</li>";
            }

            ViewBag.locUrl = locUrl;

            return(View());
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult AddMonitoringconfig()
        {
            int TypeId    = string.IsNullOrEmpty(Request["TypeId"]) ? -1 : int.Parse(Request["TypeId"]);
            int TargetId  = string.IsNullOrEmpty(Request["TargetId"]) ? -1 : int.Parse(Request["TargetId"]);
            int RelatedId = string.IsNullOrEmpty(Request["RelatedId"]) ? -1 : int.Parse(Request["RelatedId"]);
            var list      = new List <JMP.MDL.jmp_channel_filter_config>();
            var model     = new MonitoringconfigViewModel();

            if (TypeId >= 0 && TargetId >= 0 && RelatedId >= 0)
            {
                JMP.BLL.jmp_channel_filter_config yybll = new JMP.BLL.jmp_channel_filter_config();
                string where = " TypeId=" + TypeId + " and  TargetId=" + TargetId + " and RelatedId=" + RelatedId + "";
                DataTable yydt = yybll.GetList(where).Tables[0];//获取应用类型在用信息
                List <JMP.MDL.jmp_channel_filter_config> yylist = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_channel_filter_config>(yydt);
                list = yylist;

                model.RelatedId         = list[0].RelatedId;
                model.IntervalOfRecover = list[0].IntervalOfRecover;
                model.TypeId            = list[0].TypeId;
                model.TargetId          = list[0].TargetId;
                model.Id = list[0].Id;
            }
            for (int i = 0; i < 24; i++)
            {
                var hourConfig = new WhichHourList
                {
                    Threshold = 0,
                    WhichHour = i,
                };
                var filter = list.FirstOrDefault(x => x.WhichHour == i);
                if (filter != null)
                {
                    hourConfig.Threshold = filter.Threshold;
                }
                model.WhichHourLists.Add(hourConfig);
            }
            ViewBag.mo = model;
            return(View());
        }