本文整理汇总了C#中LocalReport.SetBasePermissionsForSandboxAppDomain方法的典型用法代码示例。如果您正苦于以下问题:C# LocalReport.SetBasePermissionsForSandboxAppDomain方法的具体用法?C# LocalReport.SetBasePermissionsForSandboxAppDomain怎么用?C# LocalReport.SetBasePermissionsForSandboxAppDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalReport
的用法示例。
在下文中一共展示了LocalReport.SetBasePermissionsForSandboxAppDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Cliente
public ActionResult Cliente(FormCollection frm)
{
try
{
LocalReport rp = new LocalReport();
string estado = frm["Estado"].ToString();
rp.ReportPath = System.AppDomain.CurrentDomain.BaseDirectory + "Reportes/Clientes.rdlc";
var adp = new RentaCarNew.Reportes.ReportTableAdapters.ClienteTableAdapter();
var dt = new RentaCarNew.Reportes.Report.ClienteDataTable();
if (string.IsNullOrEmpty(estado))
{
adp.FillBy(dt);
}
else
{
adp.FillByEstado(dt, estado);
}
ReportDataSource rdp = new ReportDataSource("dsCliente");
rdp.Value = dt;
rp.DataSources.Add(rdp);
//string ReportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;
string deviceInfo = @"<DeviceInfo>"
+ "<PageHeight>11in</PageHeight>"
+ "<PageWidth>8.5in</PageWidth>"
+ "<MarginTop>0in</MarginTop>" +
" <MarginLeft>0.10in</MarginLeft>" +
" <MarginRight>0in</MarginRight>" +
" <MarginBottom>0in</MarginBottom>"
+ "</DeviceInfo>";
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
rp.SetBasePermissionsForSandboxAppDomain(new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));
renderedBytes = rp.Render("pdf",
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
return File(renderedBytes, mimeType);
}
catch (Exception ex)
{
Funciones.LogError(ex);
return View();
}
}
示例2: Inventario
public ActionResult Inventario()
{
try
{
LocalReport rp = new LocalReport();
rp.ReportPath = System.AppDomain.CurrentDomain.BaseDirectory + "Reportes/Inventario.rdlc";
var adp = new RentaCarNew.Reportes.ReportTableAdapters.InventarioTableAdapter();
var dt = new RentaCarNew.Reportes.Report.InventarioDataTable();
adp.Fill(dt);
ReportDataSource rdp = new ReportDataSource("dsInventario");
rdp.Value = dt;
rp.DataSources.Add(rdp);
//string ReportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;
string deviceInfo = @"<DeviceInfo>"
+ "<PageHeight>8.5in</PageHeight>"
+ "<PageWidth>11in</PageWidth>"
+ "<MarginTop>0in</MarginTop>" +
" <MarginLeft>0.10in</MarginLeft>" +
" <MarginRight>0in</MarginRight>" +
" <MarginBottom>0in</MarginBottom>"
+ "</DeviceInfo>";
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
rp.SetBasePermissionsForSandboxAppDomain(new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));
renderedBytes = rp.Render("pdf",
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
return File(renderedBytes, mimeType);
}
catch (Exception ex)
{
Funciones.LogError(ex);
return View();
}
}
示例3: Exception
//.........这里部分代码省略.........
if (name == "_sortExpression")
request.SortExpression = v;
if (name == "_count")
request.PageSize = Convert.ToInt32(v);
if (name == "_template")
templateName = v;
}
else
if (v == "@Arguments_SelectedValues")
if ((args.SelectedValues != null) && (args.SelectedValues.Length > 0))
{
StringBuilder sb = new StringBuilder();
foreach (string key in args.SelectedValues)
{
if (sb.Length > 0)
sb.Append("$or$");
sb.Append(key);
}
filter.Add(String.Format("{0}:$in${1}", name, sb.ToString()));
}
else
return;
else
if (Regex.IsMatch(v, "^(\'|\").+(\'|\")$"))
filter.Add(String.Format("{0}:={1}", name, v.Substring(1, (v.Length - 2))));
else
if (args.Values != null)
foreach (FieldValue fv in args.Values)
if (fv.Name == v)
filter.Add(String.Format("{0}:={1}", name, fv.Value));
request.Filter = filter.ToArray();
}
}
// load report definition
string reportTemplate = Controller.CreateReportInstance(null, templateName, request.Controller, request.View);
ViewPage page = ControllerFactory.CreateDataController().GetPage(request.Controller, request.View, request);
DataTable table = page.ToDataTable();
// insert validation key
reportTemplate = _validationKeyRegex.Replace(reportTemplate, String.Format("/Blob.ashx?_validationKey={0}&", BlobAdapter.ValidationKey));
// figure report output format
if (this.Arguments == null)
{
Match m = Regex.Match(c, "^(ReportAs|Report)(Pdf|Excel|Image|Word|)$");
reportFormat = m.Groups[2].Value;
}
if (String.IsNullOrEmpty(reportFormat))
reportFormat = "Pdf";
// render a report
string mimeType = null;
string encoding = null;
string fileNameExtension = null;
string[] streams = null;
Warning[] warnings = null;
using (LocalReport report = new LocalReport())
{
report.EnableHyperlinks = true;
report.EnableExternalImages = true;
report.LoadReportDefinition(new StringReader(reportTemplate));
report.DataSources.Add(new ReportDataSource(request.Controller, table));
report.EnableExternalImages = true;
foreach (ReportParameterInfo p in report.GetParameters())
{
if (p.Name.Equals("FilterDetails") && !(String.IsNullOrEmpty(request.FilterDetails)))
report.SetParameters(new ReportParameter("FilterDetails", request.FilterDetails));
if (p.Name.Equals("BaseUrl"))
{
string baseUrl = String.Format("{0}://{1}{2}", context.Request.Url.Scheme, context.Request.Url.Authority, context.Request.ApplicationPath.TrimEnd('/'));
report.SetParameters(new ReportParameter("BaseUrl", baseUrl));
}
if (p.Name.Equals("Query") && !(String.IsNullOrEmpty(q)))
report.SetParameters(new ReportParameter("Query", HttpUtility.UrlEncode(q)));
}
report.SetBasePermissionsForSandboxAppDomain(new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));
byte[] reportData = report.Render(reportFormat, null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
if (this.Arguments != null)
{
this.Arguments.MimeType = mimeType;
this.Arguments.FileNameExtension = fileNameExtension;
this.Arguments.Encoding = encoding;
this.OutputStream.Write(reportData, 0, reportData.Length);
}
else
{
// send report data to the client
context.Response.Clear();
context.Response.ContentType = mimeType;
context.Response.AddHeader("Content-Length", reportData.Length.ToString());
AppendDownloadTokenCookie();
string fileName = FormatFileName(context, request, fileNameExtension);
if (String.IsNullOrEmpty(fileName))
{
fileName = String.Format("{0}_{1}.{2}", request.Controller, request.View, fileNameExtension);
if (args != null)
fileName = GenerateOutputFileName(args, fileName);
}
context.Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", fileName));
context.Response.OutputStream.Write(reportData, 0, reportData.Length);
}
}
}