public JasperResult Folder(string Path, JasperReportFolderAction Action) { return Folder(Path, Action, new JasperDescriptor()); }
public JasperResult Folder(string Path, JasperReportFolderAction Action, JasperDescriptor Descriptor) { JasperHttpMethod method = JasperHttpMethod.GET; switch (Action) { case JasperReportFolderAction.CREATE: { method = JasperHttpMethod.POST; } break; case JasperReportFolderAction.DELETE: { method = JasperHttpMethod.DELETE; } break; case JasperReportFolderAction.UPDATE: { method = JasperHttpMethod.POST; } break; default: break; } WebClient web = new WebClient(); web.Credentials = new NetworkCredential(Auth.GetUsuario(), Auth.GetPassword()); web.Headers.Add("Content-Type", " application/repository.folder+json"); string url = string.Format("{0}resources{1}", Config.GetBaseUrl(), Path); try { string response = web.UploadString(url, method.ToString(), Descriptor.ToJson()); return new JasperResult(url, null, JasperStatus.Success, response); } catch (WebException ex) { return new JasperResult(url, Descriptor, JasperStatus.Error, ex.Message); } }