コード例 #1
0
        public ActionResult Index()
        {
            DirectoryInfo dir = new DirectoryInfo(Request.PhysicalApplicationPath + "App_Data\\log\\");

            var model = new LogIndexModel()
            {
                Files = dir.GetFiles()
            };

            return(View(model));
        }
コード例 #2
0
        public static LogIndexModel GetLogIndexModel()
        {
            LogIndexModel model = new LogIndexModel()
            {
                LogCount = LogsRepository.GetLogCount()
            };

            if (model.LogCount > 0)
            {
                model.Log           = LogsRepository.GetFirstOrDefaultLog();
                model.CountStoryLog = LogsRepository.GetLogCountByStoryName(model.Log.StoryName);
            }
            model.Succeeded = true;
            return(model);
        }
コード例 #3
0
        public ActionResult Index(LogIndexModel model, int?page)
        {
            int total                  = 0;
            int pagesize               = 10;
            int currentPageIndex       = page.HasValue ? page.Value - 1 : 0;
            ILogSystemService logSrv   = IoC.Resolve <ILogSystemService>();
            string            kw       = !string.IsNullOrEmpty(model.keyword) ? model.keyword.Trim() : null;
            DateTime          DateFrom = String.IsNullOrEmpty(model.fromdate) ? DateTime.MinValue : DateTime.ParseExact(model.fromdate, "dd/MM/yyyy", null);
            DateTime          DateTo   = String.IsNullOrEmpty(model.todate) ? DateTime.MaxValue : DateTime.ParseExact(model.todate, "dd/MM/yyyy", null);

            if (DateFrom == DateTo)
            {
                DateTo = DateFrom.AddHours(12);
            }
            var list = logSrv.GetByFilter(kw, DateFrom, DateTo, currentPageIndex, pagesize, out total);

            model.LogData = new PagedList <LogData>(list, currentPageIndex, pagesize, total);
            return(View(model));
        }
コード例 #4
0
        /// <summary>
        /// Главная страница лога
        /// </summary>
        public ActionResult Index(LogFiltersModel filters)
        {
            filters = filters ?? new LogFiltersModel();

            var model = new LogIndexModel()
            {
                ComponentId = filters.ComponentId,
                LogLevel    = filters.LogLevel,
                Context     = filters.Context,
                Date        = filters.Date,
                Text        = filters.Text,
                Id          = filters.Id
            };

            if (model.ComponentId.HasValue)
            {
                var componentRepository = CurrentAccountDbContext.GetComponentRepository();
                model.Component = componentRepository.GetById(model.ComponentId.Value);
            }

            return(View(model));
        }
コード例 #5
0
        public ActionResult Index()
        {
            LogIndexModel logIndexModel;

            try
            {
                logIndexModel = LogsLogic.GetLogIndexModel();
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StoryName  = "ManagementSystem/LogsController/Index",
                    StackTrace = e.StackTrace
                });
                logIndexModel              = new LogIndexModel();
                logIndexModel.Succeeded    = false;
                logIndexModel.ErrorMessage = Error.ServerNotRespond;
            }
            return(View(logIndexModel));
        }