本文整理汇总了C#中ReportType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ReportType.ToString方法的具体用法?C# ReportType.ToString怎么用?C# ReportType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportType
的用法示例。
在下文中一共展示了ReportType.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Report
public Report(ReportType reportType)
{
try
{
this.reporttype = reportType;
dal = new Dal();
switch (this.reporttype)
{
case ReportType.IncomeExpenses:
this.reporttitle = "Income & Expenses";
updateEntries();
break;
case ReportType.ProductSales:
this.reporttitle = "Product Sales";
updateEntries();
break;
}
}
catch (Exception ex)
{
throw new Exception("Unable to load report " + reportType.ToString(), ex);
}
}
示例2: FileRender
public byte[] FileRender(ReportType Type, string ReportPath, string ReportFile, string ReportName, ReportDataSource Data)
{
_ReportName = ReportName;
_ReportPath = ReportPath;
_ReportFile = ReportFile;
_DS = Data;
Microsoft.Reporting.WebForms.LocalReport DirectReport = new LocalReport();
DirectReport.ReportPath = this.Context.Server.MapPath(_ReportPath + _ReportFile);
DirectReport.DataSources.Add(_DS);
Microsoft.Reporting.WebForms.Warning[] warnings;
string[] streamids;
string encoding, extension;
return DirectReport.Render(Type.ToString(), null, out _MimeType, out encoding, out extension, out streamids, out warnings);
}
示例3: GenerateReport
public byte[] GenerateReport(List<ReportDataSource> reportDataSources, ReportType type)
{
foreach (var reportDataSource in reportDataSources)
{
_localReport.DataSources.Add(reportDataSource);
}
string reportType = type.ToString();
string encoding;
string mimeType;
string fileNameExtension;
Warning[] warnings;
string[] streams;
string deviceInfo = DefinePropertiesOfDevice(type);
byte[] renderedBytes = _localReport.Render(reportType, deviceInfo, out mimeType, out encoding,
out fileNameExtension, out streams, out warnings);
return renderedBytes;
}
示例4: updateReport
/// <summary>
/// Update an existing scheduled report
/// </summary>
/// <param name="idReport">The ID of the report to update</param>
/// <param name="idSite">ID of the piwik site</param>
/// <param name="description">Description of the report</param>
/// <param name="period">A piwik period</param>
/// <param name="hour">Defines the hour at which the report will be sent</param>
/// <param name="reportType">The report type</param>
/// <param name="reportFormat">The report format</param>
/// <param name="includedStatistics">The included statistics</param>
/// <param name="emailMe">true if the report should be sent to the own user</param>
/// <param name="additionalEmails">A string array of additional email recipients</param>
/// <returns>True if update was successful</returns>
public Boolean updateReport(
int idReport,
int idSite,
string description,
PiwikPeriod period,
int hour,
ReportType reportType,
ReportFormat reportFormat,
List<Statistic> includedStatistics,
Boolean emailMe,
string[] additionalEmails = null
)
{
Dictionary<string, Object> additionalParameters = new Dictionary<string, Object>()
{
{ "emailMe", emailMe.ToString().ToLower() },
{ "displayFormat", 1 },
{ "additionalEmails", additionalEmails }
};
Parameter[] p =
{
new SimpleParameter("idReport", idReport),
new SimpleParameter("idSite", idSite),
new SimpleParameter("description", description),
new PeriodParameter("period", period),
new SimpleParameter("hour", hour),
new SimpleParameter("reportType", reportType.ToString()),
new SimpleParameter("reportFormat", reportFormat.ToString()),
new ArrayParameter("reports", includedStatistics.Select(i => i.ToString()).ToArray(), false),
new DictionaryParameter("parameters", additionalParameters)
};
return this.sendRequest<Boolean>("updateReport", new List<Parameter>(p));
}
示例5: Report
public static void Report(string msg, ReportType rtype = ReportType.OK)
{
Console.Write("[ ");
Colorful.Console.Write(rtype.ToString(), Style[rtype]);
Console.Write($" ] {msg}\n");
}
示例6: GetReportInternal
private byte[] GetReportInternal(ReportType reportType, ReportFormat format, ES.ParameterValue[] parameters)
{
//Reading configuration File
string reportServerUrl = ConfigurationManager.AppSettings["ReportServerURL"];
string reportServerFolder = ConfigurationManager.AppSettings["ReportServerFolder"];
//
using (var reportService = new RS.ReportingService2005())
{
using (var reportExecutionService = new ES.ReportExecutionService())
{
reportService.Url = String.Format(@"{0}/ReportService2005.asmx", reportServerUrl);
reportExecutionService.Url = String.Format(@"{0}/ReportExecution2005.asmx", reportServerUrl);
var environment = SafeConvert.ToEnum<DvsEnvironment>(ConfigurationManager.AppSettings["Environment"]);
if (environment.HasValue && (environment.Value == DvsEnvironment.Staging || environment.Value == DvsEnvironment.Production))
{
reportService.Credentials = new System.Net.NetworkCredential("ReportSeverUser", "Password10");
reportExecutionService.Credentials = new System.Net.NetworkCredential("ReportSeverUser", "Password10");
}
else
{
reportService.Credentials = System.Net.CredentialCache.DefaultCredentials;
reportExecutionService.Credentials = System.Net.CredentialCache.DefaultCredentials;
}
Dictionary<string, string> metadata = new Dictionary<string, string>();
RS.ReportParameter[] reportParameters = null;
string fullReportName = String.Format("{0}/{1}", reportServerFolder, reportType.ToString());
reportParameters = reportService.GetReportParameters(fullReportName, null, false, null, null);
ES.ExecutionInfo execInfo = reportExecutionService.LoadReport(fullReportName, null);
if (reportParameters.Count() > 0)
{
List<ES.ParameterValue> execParams = new List<ES.ParameterValue>();
foreach (RS.ReportParameter reportParam in reportParameters)
{
if (metadata.ContainsKey(reportParam.Name))
execParams.Add(new ES.ParameterValue()
{
Label = reportParam.Name,
Name = reportParam.Name,
Value = metadata[reportParam.Name]
});
}
foreach (var item in parameters)
{
execParams.Add(item);
}
reportExecutionService.SetExecutionParameters(execParams.ToArray(), "en-us");
}
string encoding = String.Empty;
string mimeType = String.Empty;
string extension = String.Empty;
ES.Warning[] warnings = null;
string[] streamIDs = null;
byte[] readyReport = reportExecutionService.Render(format.ToString("G"), null, out extension, out mimeType, out encoding, out warnings, out streamIDs);
return readyReport;
}
}
}
示例7: GetXsltArgumentList
private XsltArgumentList GetXsltArgumentList(ReportType reportType, ReportViewType reportView)
{
var xsltArgumentList = new XsltArgumentList();
switch (reportView)
{
case ReportViewType.Html:
xsltArgumentList.AddParam("decimalFormat", "", "### ###.00");
xsltArgumentList.AddParam("csvExportUrl", "", String.Format("reports.aspx?reportType={0}&View={1}",
reportType.ToString(),
"csv").ToLower());
break;
default:
break;
}
return xsltArgumentList;
}
示例8: GetXSLTMarking
private String GetXSLTMarking(ReportType reportType, ReportViewType reportView)
{
var folderPath = HttpContext.Current.Server.MapPath(@"~\products\crm\reports\");
var filePath = String.Empty;
switch (reportType)
{
case ReportType.SalesByStage:
filePath = String.Format("{0}/{1}.{2}.xsl", folderPath, reportType.ToString().ToLower(),
reportView.ToString());
break;
default:
filePath = String.Format("{0}/{1}.{2}.xsl", folderPath, "sales",
reportView.ToString());
break;
}
return File.ReadAllText(filePath);
}
示例9: CreateExcel
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="source">数据源,DataTable</param>
/// <param name="modelPath">模板文件夹路径</param>
/// <param name="filePath">新文件存放路径</param>
/// <param name="reportType">报表类型</param>
/// <returns>新文件全称</returns>
public override string CreateExcel(System.Data.DataTable source, string modelPath, string filePath, ReportType reportType)
{
string newPath = string.Empty;
try
{
newPath = filePath + Guid.NewGuid() + ".xlsx";
//调用的模板文件
System.IO.FileInfo mode = new System.IO.FileInfo(string.Format("{0}{1}.xlsx", modelPath, reportType.ToString("F")));
//mode.IsReadOnly = false;
Excel.Application app = new Excel.Application();
if (app == null)
{
return string.Empty;
}
app.Application.DisplayAlerts = false;
app.Visible = false;
if (mode.Exists)
{
Excel.Workbook tworkbook;
Object missing = System.Reflection.Missing.Value;
app.Workbooks.Add(missing);
//调用模板
tworkbook = app.Workbooks.Open(mode.FullName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
Excel.Worksheet tworksheet = (Excel.Worksheet)tworkbook.Sheets[1];
Excel.Range r = tworksheet.get_Range("A2", missing);
string[,] objData = null;
if (objData == null)
return string.Empty;
r = r.get_Resize(objData.GetLength(0), objData.GetLength(1));
r.Value = objData;
tworksheet.SaveAs(newPath, missing, missing, missing, missing, missing, missing, missing, missing, missing);
tworkbook.Close(false, mode.FullName, missing);
app.Workbooks.Close();
app.Quit();
}
else
return string.Empty;
}
catch
{
return string.Empty;
}
return newPath;
}
示例10: RunReport
//.........这里部分代码省略.........
// if (!IsDemo)
// FileUtility.CopyFile(AppNEnvConfig.GetReportsProcessingPath + AppNEnvConfig.GetFileSeperator + CurrentRunningReportType.ToEnumDesc<ReportXlsmType>(), AppNEnvConfig.GetReportsPath, toMove: true);
// FileUtility.CleanReportsProcessingDir(new List<string> { ReportXmlType.eOR.ToEnumDesc<ReportXmlType>() });
// //System.Threading.Thread.Sleep(5000);
// CurrentRunningReportType = ReportXlsmType.eCheckup;
// if (IsDemo)
// FileUtility.CreateReport(new List<string> { ReportXmlType.eCheckup.ToEnumDesc<ReportXmlType>(), CurrentRunningReportType.ToEnumDesc<ReportXlsmType>() });
// else
// eAudITUtility.GenerateReport(RequestInfo.SSCTechActivity.SourceMAFGuid, workbookDetails, CurrentRunningReportType, RequestInfo.SSCTechActivity.SourceMAFName);
// if (!IsDemo)
// FileUtility.CopyFile(AppNEnvConfig.GetReportsProcessingPath + AppNEnvConfig.GetFileSeperator + CurrentRunningReportType.ToEnumDesc<ReportXlsmType>(), AppNEnvConfig.GetReportsPath, toMove: true);
// FileUtility.CleanReportsProcessingDir(new List<string> { ReportXmlType.eCheckup.ToEnumDesc<ReportXmlType>() });
// MsgUtility.ShowMessageBox("Reports generated successfully.", MessageType.Info);
// if (IsDemo)
// RequestInfo.IsReportGenerated = false;
// }
// //}
// };
// worker.RunWorkerCompleted += (s, e) =>
// {
// if (e.Error != null)
// {
// IsProgressBarVisible = false;
// IsBusy = false;
// SSCLog.HandleError(e.Error);
// }
// IsProgressBarVisible = false;
// IsBusy = false;
// };
// IsBusy = true;
// worker.RunWorkerAsync();
// }
//}
private void RunReport(List<WorkbookDetail> workbookDetails, ReportType reportType, DispatcherTimer dt)
{
//dt.Stop();
//ProgressBarMsg = string.Format("Generating Report {0}", reportType.ToString());
pMsg = string.Format("Generating Report {0}", reportType.ToString());
currentStartTimmer = 0;
//dt.Start();
using (BackgroundWorker worker = new BackgroundWorker())
{
worker.DoWork += (s, e) =>
{
CurrentRunningReportType = reportType;
if (IsDemo)
FileUtility.CreateReport(new List<string> { reportType.ToEnumAttr<ReportType, ReportAttribute>().XmlFileName, CurrentRunningReportType.ToEnumAttr<ReportType, ReportAttribute>().XlsmFileName });
else
{
//Thread.Sleep(50000);
eAudITUtility.GenerateReport(RequestInfo.SSCTechActivity.SourceMAFGuid, workbookDetails, CurrentRunningReportType);
}
if (!IsDemo)
FileUtility.CopyFile(AppNEnvConfig.GetReportsProcessingPath + AppNEnvConfig.GetFileSeperator + CurrentRunningReportType.ToEnumAttr<ReportType, ReportAttribute>().XlsmFileName, FilePathType.Reports.DirPath(), toMove: false);
FileUtility.CleanReportsProcessingDir(new List<string> {
reportType.ToEnumAttr<ReportType, ReportAttribute>().XlsmFileName,
reportType.ToEnumAttr<ReportType, ReportAttribute>().XmlFileName });
};
worker.RunWorkerCompleted += (s, e) =>
{
if (e.Error != null)
{
dt.Stop();
IsReportInProgress = false;
IsProgressBarVisible = false;
IsBusy = false;
SSCLog.HandleError(e.Error);
}
else
{
if (reportType == ReportType.eOR)
{
SSCTechInfo.TimeInSecToGenerateReporteOR = currentStartTimmer;
RunReport(workbookDetails, ReportType.eCheckup, dt);
}
else if (reportType == ReportType.eCheckup)
{
SSCTechInfo.TimeInSecToGenerateReporteCheckup = currentStartTimmer;
dt.Stop();
IsReportInProgress = false;
IsProgressBarVisible = false;
IsBusy = false;
if (Directory.EnumerateFiles(this.ReportsViewModel.DirPath).Any())
{
MsgUtility.ShowMessageBox("Reports generated successfully.", MessageType.Info);
}
}
}
};
worker.RunWorkerAsync();
}
}