Ejemplo n.º 1
0
 public ResponseJson GroupRequest(string token, ReportFilter filter)
 {
     if (AuthData.GetRole(token) == Role.NoLogin)
     {
         return ResponseJson.GetResponseJson(string.Empty, false);
     }
     if (filter == null) filter = new ReportFilter();
     var data = DataProcess.GetGroupScheduleRequestLogs(filter);
     var total = DataProcess.GetCountGroupScheduleRequestLogs(filter);
     var resultObject = new ScheduleReport() { ScheduleLogs = data, Total = total, NumberOfPages = (total + filter.GetCorrectSize() - 1) / filter.GetCorrectSize() };
     return ResponseJson.GetResponseJson(resultObject);
 }
Ejemplo n.º 2
0
 public static List<ScheduleRequestLog> GetGroupScheduleRequestLogs(ReportFilter filter)
 {
     return SQLiteProcess.GetGroupScheduleRequestLogs(filter, false);
 }
Ejemplo n.º 3
0
        public static List<ScheduleRequestLog> GetGroupScheduleRequestLogs(ReportFilter filter, bool isFailRequest = false)
        {
            if (filter == null) filter = new ReportFilter();
            List<ScheduleRequestLog> schedules = new List<ScheduleRequestLog>();

            using (var sql_con = new SQLiteConnection(ReportConnectString))
            {
                sql_con.Open();
                using (var sql_cmd = sql_con.CreateCommand())
                {
                    sql_cmd.CommandText = filter.GenSelectCommand(isFailRequest);
                    var myParameters = sql_cmd.Parameters;
                    using (var reader = sql_cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var scheduleRequestLog = new ScheduleRequestLog();
                            if (!filter.NoChannelKey || (filter.IsAllFalse)) scheduleRequestLog.ChannelKey = (reader["ChannelKey"] ?? "").ToString();
                            if (!filter.NoCurrentDate || (filter.IsAllFalse)) scheduleRequestLog.CurrentDate = (reader["CurrentDate"] ?? "").ToString();
                            if (!filter.NoDateOn || (filter.IsAllFalse)) scheduleRequestLog.DateOn = (reader["DateOn"] ?? "").ToString();
                            if (!filter.NoDeviceId || (filter.IsAllFalse)) scheduleRequestLog.DeviceId = (reader["DeviceId"] ?? "").ToString();
                            if (!filter.NoOpenKey || (filter.IsAllFalse)) scheduleRequestLog.OpenKey = (reader["OpenKey"] ?? "").ToString();
                            if (!filter.NoAppVersion || (filter.IsAllFalse)) scheduleRequestLog.AppVersion = (reader["AppVersion"] ?? "").ToString();

                            scheduleRequestLog.NumberOfRequests = Int32.Parse((reader["NumberOfRequests"] ?? "").ToString());
                            schedules.Add(scheduleRequestLog);
                        }
                    }
                }
                sql_con.Close();
            }

            return schedules;
        }
Ejemplo n.º 4
0
 public static int GetCountGroupScheduleFailedRequestLogs(ReportFilter filter)
 {
     return SQLiteProcess.GetCountGroupScheduleRequestLogs(filter, true);
 }
Ejemplo n.º 5
0
        public static int GetCountGroupScheduleRequestLogs(ReportFilter filter, bool isFailRequest = false)
        {
            if (filter == null) filter = new ReportFilter();
            int count = 0;

            using (var sql_con = new SQLiteConnection(ReportConnectString))
            {
                sql_con.Open();
                using (var sql_cmd = sql_con.CreateCommand())
                {
                    sql_cmd.CommandText = filter.GenCountCommand(isFailRequest);
                    var myParameters = sql_cmd.Parameters;
                    using (var reader = sql_cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            count = reader.GetInt32(0);
                            break;
                        }
                    }
                }
                sql_con.Close();
            }

            return count;
        }