Example #1
0
        public ActionResult PingList(int id, string clientName, int p = 1, DateTime?date = null)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var now = DateTime.Now;

            var config     = SysUpdateHelper.GetSystemConfig(id);
            var clientApps = SystemUpdaterCollection.GetClientApps(id)
                             .Where(c => string.IsNullOrEmpty(clientName) || c.ClientId.Contains(clientName));

            var model = new SystemPingListViewModel
            {
                ClientApps = clientApps,
                Config     = config,
                System     = system,
                ClientName = clientName
            };

            return(View(model));
        }
Example #2
0
        public ActionResult Log(int id, int p = 1, DateTime?date = null)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            if (date == null)
            {
                date = DateTime.Now;
            }

            var perPage    = 50;
            var pageResult = SysUpdateHelper.GetSystemLogFiles(id, p, perPage, date.Value);

            var model = new SystemLogViewModel
            {
                System    = system,
                Date      = date.Value,
                LogFiles  = pageResult.Item1,
                TotalPage = (int)Math.Ceiling((pageResult.Item2 * 1.0 / perPage)),
                CurrPage  = p,
            };

            return(View(model));
        }
Example #3
0
        public ActionResult Config(int id)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var config = SysUpdateHelper.GetSystemConfig(id);

            ViewBag.Title    = $"系统更新设置-{system.Name}";
            ViewBag.SystemId = id;

            return(View(config));
        }
Example #4
0
        public ActionResult Edit(int id)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var model = new SystemEditViewModel
            {
                Mode     = 2,
                SystemId = id,
                Name     = system.Name,
            };

            return(View("SystemEdit", model));
        }
Example #5
0
        public ActionResult DownloadLog(int id, string fileName, DateTime?date)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var file = SysUpdateHelper.GetSystemLogFile(id, date ?? DateTime.Now, fileName);

            if (file == null)
            {
                return(NotFound());
            }

            return(File(file.FullName, "text/plain", file.Name));
        }
Example #6
0
        public ActionResult System(int id, int p = 1)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var perPage    = 10;
            var pageResult = SysUpdateHelper.GetSystemPkgs(id, p, perPage);

            var model = new SystemViewModel
            {
                System    = system,
                Packages  = pageResult.Item1,
                TotalPage = (int)Math.Ceiling((pageResult.Item2 * 1.0 / perPage)),
                CurrPage  = p,
            };

            return(View(model));
        }
Example #7
0
        public ActionResult LogContent(int id, string fileName, DateTime?date)
        {
            var system = SysUpdateHelper.GetSystem(id);

            if (system == null)
            {
                return(NotFound());
            }

            var file = SysUpdateHelper.GetSystemLogFile(id, date ?? DateTime.Now, fileName);

            if (file == null)
            {
                return(NotFound());
            }

            using (var reader = file.OpenText())
            {
                ViewBag.LogContent = reader.ReadToEnd();

                return(View());
            }
        }