public ReportFolderProxy[] GetFolders() { ReportFolders folders = new ReportFolders(TSAuthentication.GetLoginUser()); folders.LoadAll(TSAuthentication.OrganizationID); return(folders.GetReportFolderProxies()); }
public static string GetReportFolder(RestCommand command, int folderID) { ReportFolder reportFolder = ReportFolders.GetReportFolder(command.LoginUser, folderID); if (reportFolder.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(reportFolder.GetXml("ReportFolder", true)); }
public static string GetReportFolders(RestCommand command) { ReportFolders reportFolders = new ReportFolders(command.LoginUser); reportFolders.LoadByOrganizationID(command.Organization.OrganizationID); if (command.Format == RestFormat.XML) { return(reportFolders.GetXml("ReportFolders", "ReportFolder", true, command.Filters)); } else { throw new RestException(HttpStatusCode.BadRequest, "Invalid data format"); } }
public void MoveReports(string reportIDs, int?folderID) { if (folderID != null) { ReportFolder folder = ReportFolders.GetReportFolder(TSAuthentication.GetLoginUser(), (int)folderID); if (folder.OrganizationID != TSAuthentication.OrganizationID) { return; } } int[] ids = JsonConvert.DeserializeObject <int[]>(reportIDs); for (int i = 0; i < ids.Length; i++) { Reports.AssignFolder(TSAuthentication.GetLoginUser(), folderID, TSAuthentication.OrganizationID, ids[i]); } }
public bool DeleteFolder(int folderID) { ReportFolder folder = ReportFolders.GetReportFolder(TSAuthentication.GetLoginUser(), (int)folderID); if (TSAuthentication.IsSystemAdmin || folder.CreatorID == TSAuthentication.UserID) { try { Reports.UnassignFolder(TSAuthentication.GetLoginUser(), folderID); folder.Delete(); folder.Collection.Save(); return(true); } catch (Exception ex) { return(false); } } else { return(false); } }
public ReportFolderProxy SaveFolder(int?folderID, string name) { ReportFolder folder = null; if (folderID == null) { folder = (new ReportFolders(TSAuthentication.GetLoginUser())).AddNewReportFolder(); folder.OrganizationID = TSAuthentication.OrganizationID; folder.CreatorID = TSAuthentication.UserID; } else { folder = ReportFolders.GetReportFolder(TSAuthentication.GetLoginUser(), (int)folderID); if (!TSAuthentication.IsSystemAdmin && folder.CreatorID != TSAuthentication.UserID) { return(folder.GetProxy()); } } folder.Name = name.Trim(); folder.Collection.Save(); return(folder.GetProxy()); }