示例#1
0
        public BotLogs()
        {
            this.RequiresAuthentication();
            Get("/botlogs", args =>
            {
                var model           = new DataLogsModel();
                model.BotLogsActive = "active";
                model.Title         = "Bot Logs";

                var page = int.Parse(Request.Query["page"].Value ?? "0");
                if (page < 0)
                {
                    page = 0;
                }
                var email = Request.Query["email"].Value ?? "";


                var logsFrom = page * 15;
                var logsTo   = 15;
                var futLogs  = email != "" ? FUTLogsDatabase.GetFUTBotLogsByEMail(email, logsFrom, logsTo) : FUTLogsDatabase.GetFUTBotLogs(logsFrom, logsTo);

                var checkNextPage     = FUTLogsDatabase.CheckNextPageFUTBotLogs(logsFrom + 15, logsTo);
                var checkPreviousPage = FUTLogsDatabase.CheckPreviousPageFUTBotLogs(logsFrom, logsTo);

                model.Logs = new List <DataLogsModel.SingleDataLog>();
                foreach (var futLog in futLogs)
                {
                    model.Logs.Add(new DataLogsModel.SingleDataLog()
                    {
                        ID = futLog.ID, Account = futLog.EMail, Data = futLog.Data, Timestamp = $"{Helper.TimestampToDateTime(futLog.Timestamp):d/M/yyyy HH:mm:ss}"
                    });