public static string GetScheduledReport(RestCommand command, int id)
        {
            ScheduledReport scheduledReport = ScheduledReports.GetScheduledReport(command.LoginUser, id);

            if (scheduledReport.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(scheduledReport.GetXml("ScheduledReport", true));
        }
Пример #2
0
        public ScheduledReportProxy GetScheduledReport(int id)
        {
            ScheduledReportProxy proxy = new ScheduledReportProxy();

            try
            {
                ScheduledReport scheduledReport = ScheduledReports.GetScheduledReport(TSAuthentication.GetLoginUser(), id);
                proxy = scheduledReport.GetProxy();
            }
            catch (Exception ex)
            {
                ExceptionLogs.LogException(TSAuthentication.GetLoginUser(), ex, "ReportService.GetScheduledReport");
            }

            return(proxy);
        }
Пример #3
0
        public int[] DeleteScheduledReports(string reportIDs)
        {
            List <int> result = new List <int>();

            int[] ids = JsonConvert.DeserializeObject <int[]>(reportIDs);
            for (int i = 0; i < ids.Length; i++)
            {
                int             reportID        = ids[i];
                ScheduledReport scheduledReport = ScheduledReports.GetScheduledReport(TSAuthentication.GetLoginUser(), reportID);
                if (scheduledReport != null && scheduledReport.OrganizationId == TSAuthentication.OrganizationID && (TSAuthentication.UserID == scheduledReport.CreatorId || TSAuthentication.IsSystemAdmin))
                {
                    scheduledReport.Delete();
                    scheduledReport.Collection.Save();
                    result.Add(reportID);
                }
            }

            return(result.ToArray());
        }