Ejemplo n.º 1
0
        public ActionResult Dashboard()
        {
            ViewBag.Title      = "Dashboard " + Environment.GetEnvironmentVariable("INSTANCETITLE");
            ViewBag.Instance   = Environment.GetEnvironmentVariable("INSTANCENAME");
            ViewBag.appVersion = typeof(DevCDRController).Assembly.GetCustomAttribute <AssemblyFileVersionAttribute>().Version;
            ViewBag.Route      = "/Chat";

            int itotalDeviceCount = -1;

            itotalDeviceCount = new JainDBController(_env, _cache).totalDeviceCount(Path.Combine(_env.WebRootPath, "JainDB\\_Chain"));

            int iDefault      = ClientCount("Default");
            int iOnlineCount  = iDefault;
            int iOfflineCount = itotalDeviceCount - iOnlineCount;

            if (iOfflineCount < 0)
            {
                iOfflineCount = 0;
            }

            if (iOnlineCount > itotalDeviceCount)
            {
                itotalDeviceCount = iOnlineCount;
            }

            ViewBag.TotalDeviceCount   = itotalDeviceCount;
            ViewBag.OnlineDeviceCount  = iOnlineCount;
            ViewBag.OfflineDeviceCount = iOfflineCount;
            ViewBag.TotalDefault       = iDefault;
            return(View());
        }
Ejemplo n.º 2
0
        internal List <string> GetAllMACAddresses()
        {
            List <string> lResult = new List <string>();
            var           tItems  = new JainDBController(_env, _cache).Query("$select=@MAC");
            JArray        jMacs   = tItems.Result;

            foreach (var jTok in jMacs.SelectTokens("..@MAC"))
            {
                if (jTok.Type == JTokenType.String)
                {
                    lResult.Add(jTok.Value <string>());
                }
                if (jTok.Type == JTokenType.Array)
                {
                    lResult.AddRange(jTok.Values <string>().ToList());
                }
            }

            return(lResult);
        }
Ejemplo n.º 3
0
        public ActionResult Dashboard()
        {
            ViewBag.Title    = "Dashboard";
            ViewBag.Instance = "";
            ViewBag.Route    = "/Chat";
            var cCache            = new Cache();
            var itotalDeviceCount = (int)(cCache.Get("totalDeviceCount") ?? -1);

            if (itotalDeviceCount == -1)
            {
                itotalDeviceCount = new JainDBController().totalDeviceCount(HttpContext.Server.MapPath("~/App_Data/JainDB/_Chain"));
            }

            int iZander       = ClientCount("Zander");
            int ixLab         = ClientCount("xLab");
            int iTest         = ClientCount("Test");
            int iDefault      = ClientCount("Default");
            int iOnlineCount  = iZander + ixLab + iTest + iDefault;
            int iOfflineCount = itotalDeviceCount - iOnlineCount;

            if (iOfflineCount < 0)
            {
                iOfflineCount = 0;
            }

            if (iOnlineCount > itotalDeviceCount)
            {
                itotalDeviceCount = iOnlineCount;
            }

            ViewBag.TotalDeviceCount   = itotalDeviceCount;
            ViewBag.OnlineDeviceCount  = iOnlineCount;
            ViewBag.OfflineDeviceCount = iOfflineCount;
            ViewBag.TotalZander        = iZander;
            ViewBag.TotalxLab          = ixLab;
            ViewBag.TotalTest          = iTest;
            ViewBag.TotalDefault       = iDefault;
            return(View());
        }