Exemplo n.º 1
0
 //联合查询
 public JsonResult GetList(int id)
 {
     try
     {
         var           temp = new LineBusiness().GetList(id);
         List <object> list = new List <object>();
         foreach (var item in temp)
         {
             list.Add(new
             {
                 item.Id,
                 item.Name,
                 item.LineIP,
                 LineType        = item.LineType.GetDescription(),
                 ServiceProvider = item.ServiceProvider.GetDescription(),
                 ConnectState    = item.ConnectState ? "连通" : "断开",
                 item.Log,
                 CheckDate = item.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")
             });
         }
         return(Json(list));
     }
     catch (Exception ex)
     {
         return(Json(new { State = false, ex.Message }));
     }
 }
Exemplo n.º 2
0
 public JsonResult GetOrganLines(int id)
 {
     try
     {
         var           itemOrgan = _business.GetItem(id);
         var           temp      = new LineBusiness().GetList(id);
         List <object> list      = new List <object>();
         foreach (var item in temp)
         {
             list.Add(new {
                 item.Id,
                 item.Name,
                 item.LineIP,
                 item.Description,
                 LineType        = item.LineType.GetDescription(),
                 ServiceProvider = item.ServiceProvider.GetDescription(),
                 item.OrganizationName,
                 item.ParentOrganizationName,
                 ConnectState = item.ConnectState ? "连通" : "断开"
             });
         }
         return(Json(new { State = true, Items = list, Name = itemOrgan.Name, Des = itemOrgan.Description }));
     }
     catch (Exception ex)
     {
         return(Json(new { State = false, Message = ex.Message }));
     }
 }
Exemplo n.º 3
0
        public IActionResult Index()
        {
            var user = CookieHelper.GetInstance(HelperKeys.UserIdCookieKey).GetCookie <UserModel>(Request);

            ViewBag.AlarmCount = new AlarmBusiness().GetList(user.OrganId).Count();
            ViewBag.OrganCount = new OrganBusiness().GetChildren(user.OrganId).Count();
            var list      = new LineBusiness().GetAllItems();
            int lineCount = user.RoleId == UserType.SysAdmin ?list.Count():list.Where(n => n.OrganizationId == user.OrganId).Count();

            ViewBag.LineCount = lineCount;

            //if (user.RoleId == UserType.OrganAdmin)
            //{
            //    return Redirect($"/Login/Index/");
            //}
            return(View());
        }