本文整理汇总了C#中ReportViewer.RefreshReport方法的典型用法代码示例。如果您正苦于以下问题:C# ReportViewer.RefreshReport方法的具体用法?C# ReportViewer.RefreshReport怎么用?C# ReportViewer.RefreshReport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportViewer
的用法示例。
在下文中一共展示了ReportViewer.RefreshReport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowReport
private void ShowReport(IObjectContainer container)
{
// #example: Run a report with db4o
var dataToShow = from Person p in container
where p.FirstName.Contains("o")
select p;
var reportViewer = new ReportViewer
{
ProcessingMode = ProcessingMode.Local
};
// Put the data into the datasource which you are using
// in your report. Here it's named 'MainData'
reportViewer.LocalReport.DataSources.Add(
new ReportDataSource("MainData", dataToShow));
reportViewer.Dock = DockStyle.Fill;
// The report can be an embedded resource
reportViewer.LocalReport.ReportEmbeddedResource = "Db4oDoc.Code.Reporting.ExampleReport.rdlc";
// or can be a file
// reportViewer.LocalReport.ReportPath = "path/to/your/report";
// After that you can use the report viewer in your app
this.Controls.Add(reportViewer);
reportViewer.RefreshReport();
// #end example
}
示例2: anteprimaStampaLoad
private void anteprimaStampaLoad(object sender, EventArgs e)
{
// Set Processing Mode
_reportViewer = new ReportViewer { ProcessingMode = ProcessingMode.Local };
// Set RDL file
if(_reportParameters.Foglio == "21")
_reportViewer.LocalReport.ReportEmbeddedResource = "Gipasoft.Stabili.UI.LettereCondomini.Reports.Labels21PerPage.rdlc";
else if(_reportParameters.Foglio == "36")
_reportViewer.LocalReport.ReportEmbeddedResource = "Gipasoft.Stabili.UI.LettereCondomini.Reports.Labels36PerPage.rdlc";
// Supply a DataTable corresponding to each report dataset
_reportViewer.LocalReport.DataSources.Add(new ReportDataSource("PersonaComunicazioneDTO", _distinta));
// Add the reportviewer to the form
Controls.Add(_reportViewer);
_reportViewer.Dock = DockStyle.Fill;
var parameterGrandezzaFont = new ReportParameter("GrandezzaFont", _reportParameters.GrandezzaFont.ToString());
var parameterFont = new ReportParameter("Font", _reportParameters.Font);
var parameterMargineSinistro = new ReportParameter("MargineSinistro", _reportParameters.MargineSinistro.ToString());
var parameterMargineDestro = new ReportParameter("MargineDestro", _reportParameters.MargineDestro.ToString());
var parameterMargineAlto = new ReportParameter("MargineAlto", _reportParameters.MargineAlto.ToString());
var parameterMargineBasso = new ReportParameter("MargineBasso", _reportParameters.MargineBasso.ToString());
try
{
_reportViewer.LocalReport.SetParameters(
new []
{
parameterGrandezzaFont,
parameterFont,
parameterMargineSinistro,
parameterMargineDestro,
parameterMargineAlto,
parameterMargineBasso
});
}
catch (Exception ex)
{
throw ex;
}
_reportViewer.RefreshReport();
}
示例3: anteprimaStampaLoad
private void anteprimaStampaLoad(object sender, EventArgs e)
{
var reportViewer = new ReportViewer {ProcessingMode = ProcessingMode.Local};
// Set Processing Mode
// Set RDL file
reportViewer.LocalReport.ReportEmbeddedResource = "Gipasoft.Stabili.UI.DisposizioniPagamento.Reports.LetteraBonifico.rdlc";
// Supply a DataTable corresponding to each report dataset
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReportPagamento", _datiPagamento));
reportViewer.LocalReport.EnableExternalImages = true;
// Add the reportviewer to the form
Controls.Add(reportViewer);
reportViewer.Dock = DockStyle.Fill;
var parameterAzienda = new ReportParameter("oggettoLettera", _reportParameters.OggettoLettera);
var parameterDataPagamento = new ReportParameter("dataPagamento", _reportParameters.DataPagamento.ToShortDateString());
var parameterLogo = new ReportParameter("logo", _documentService.SaveInLocalCache(new Business.Interface.DocumentInfo { Body = _aziendaService.GetLogo().LogoAzienda, FileName = "logo.jpg" }));
var firma = _documentService.SaveInLocalCache(new Business.Interface.DocumentInfo { Body = _aziendaService.GetLogo().FirmaAzienda, FileName = "firma.jpg" });
if (string.IsNullOrEmpty(firma))
firma = "NO";
var parameterFirma = new ReportParameter("firma", firma);
reportViewer.LocalReport.SetParameters(
new[]
{
parameterAzienda,
parameterDataPagamento,
parameterLogo,
parameterFirma
});
reportViewer.RefreshReport();
}
示例4: LoadDocumentReportViewer
private void LoadDocumentReportViewer(ReportViewer reportViewer)
{
using (var c = NestedContainer)
{
ReportDataSource reportDataSourceHeader = null;
ReportDataSource reportDataSourceLineItems = null;
ReportDataSource reportDataSourcePayments = null;
Stream stream = null;
Stream subReportStream = null;
string subReportName = null;
reportViewer.Reset();
switch (DocumentType)
{
case DocumentType.Order:
OrderReportContainer order = GetOrderData(DocumentId);
reportDataSourceHeader = new ReportDataSource("dsOrder", new List<OrderHeader> { order.DocumentHeader });
reportDataSourceLineItems = new ReportDataSource("dsLineItems", order.LineItems);
reportDataSourcePayments=new ReportDataSource("dsPayments",order.PaymentInfoList);
if (order.DocumentHeader.OrderTypeStr == OrderType.DistributorToProducer.ToString())
stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.PurchaseOrderDocumentReport);
else if(order.DocumentHeader.OrderTypeStr == OrderType.SalesmanToDistributor.ToString())
stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.StockistOrderDocumentReport);
else
stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.OrderDocumentReport);
reportViewer.LocalReport.DisplayName = "Orders Report";
subReportName = "rptCompanyLetterHeadLandscape.rdlc";
subReportStream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.CompanyLetterHeadLandscape);
break;
case DocumentType.DispatchNote:
OrderReportContainer dispatchNote = GetDispatchNote(SelectedDispatchNote.Id);
reportDataSourceHeader = new ReportDataSource("dsOrder", new List<OrderHeader> { dispatchNote.DocumentHeader });
reportDataSourceLineItems = new ReportDataSource("dsLineItems", dispatchNote.LineItems);
stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.DispatchNoteReport);
reportViewer.LocalReport.DisplayName = "Dispatch Note";
subReportName = "rptCompanyLetterHead.rdlc";
subReportStream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.CompanyLetterHead);
break;
case DocumentType.Invoice:
LoadInvoiceReportViewer(reportViewer);
return;
case DocumentType.Receipt:
ReceiptReportContainer receipt = GetReceipt(DocumentId);
reportDataSourceHeader = new ReportDataSource("dsReceiptHeader", new List<ReceiptReportHeader>{receipt.DocumentHeader});
reportDataSourceLineItems = new ReportDataSource("dsReceiptLineItems", receipt.LineItems);
stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.ReceiptReport);
reportViewer.LocalReport.DisplayName = "Receipt";
subReportName = "rptCompanyLetterHead.rdlc";
subReportStream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.CompanyLetterHead);
break;
case DocumentType.InventoryReceivedNote:
GRNReportContainer grn = GetGRNData(DocumentId);
reportDataSourceHeader = new ReportDataSource("dsGRN", new List<GRNHeader> {grn.DocumentHeader});
reportDataSourceLineItems = new ReportDataSource("dsLineItems", grn.LineItems);
stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.GRNReport);
reportViewer.LocalReport.DisplayName = "GRN";
subReportName = "rptCompanyLetterHead.rdlc";
subReportStream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.CompanyLetterHead);
break;
}
reportViewer.LocalReport.DataSources.Clear();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.LocalReport.EnableHyperlinks = true;
reportViewer.LocalReport.DataSources.Add(reportDataSourceHeader);
reportViewer.LocalReport.DataSources.Add(reportDataSourceLineItems);
if (reportDataSourcePayments !=null)
reportViewer.LocalReport.DataSources.Add(reportDataSourcePayments);
reportViewer.LocalReport.LoadSubreportDefinition(subReportName, subReportStream);
reportViewer.LocalReport.ShowDetailedSubreportMessages = true;
reportViewer.LocalReport.SubreportProcessing += LocalReport_SubreportProcessing;
reportViewer.LocalReport.LoadReportDefinition(stream);
reportViewer.LocalReport.Refresh();
reportViewer.RefreshReport();
Title = reportViewer.LocalReport.DisplayName;
}
}
示例5: anteprimaStampaLoad
private void anteprimaStampaLoad(object sender, EventArgs e)
{
// Set Processing Mode
var reportViewer = new ReportViewer {ProcessingMode = ProcessingMode.Local};
// Add a handler for SubreportProcessing
if(_reportParameters.AddebitiPersonali)
reportViewer.LocalReport.SubreportProcessing += localReportSubreportProcessing;
// Set RDL file
reportViewer.LocalReport.ReportEmbeddedResource = _reportParameters.AddebitiPersonali ? "Gipasoft.Stabili.UI.MovimentiContabili.Reports.RicevutaSpesaPersonali.rdlc" : "Gipasoft.Stabili.UI.MovimentiContabili.Reports.RicevutaSpesa.rdlc";
// Supply a DataTable corresponding to each report dataset
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("MovimentoContabileListaDTO", _movimenti));
reportViewer.LocalReport.EnableExternalImages = true;
// Add the reportviewer to the form
Controls.Add(reportViewer);
reportViewer.Dock = DockStyle.Fill;
var parameterCondominio1 = new ReportParameter("condominio1", _reportParameters.DescrizioneCondominioCompleta[0]);
var parameterCondominio2 = new ReportParameter("condominio2", _reportParameters.DescrizioneCondominioCompleta[1]);
var parameterCondominio3 = new ReportParameter("condominio3", _reportParameters.DescrizioneCondominioCompleta[2]);
var parameterCondominio4 = new ReportParameter("condominio4", _reportParameters.DescrizioneCondominioCompleta[3]);
var parameterAzienda = new ReportParameter("azienda", _reportParameters.DescrizioneAzienda);
var parameterIntestazioneStudio = new ReportParameter("intestazioneStudio", _reportParameters.IntestazioneStudio);
var parameterViaStudio = new ReportParameter("viaStudio", _reportParameters.ViaStudio);
var parameterCapStudio = new ReportParameter("capStudio", _reportParameters.CapStudio);
var parameterLocalitaStudio = new ReportParameter("localitaStudio", _reportParameters.LocalitaStudio);
var parameterData = new ReportParameter("data", _reportParameters.Data.ToShortDateString());
var parameterFornitore = new ReportParameter("nominativoFornitore", _reportParameters.NominativoFornitore);
var parameterNumeroRiferimento = new ReportParameter("numeroRiferimento", _reportParameters.NumeroRiferimento);
var parameterIdentificativoArchiviazione = new ReportParameter("identificativoArchiviazione", _reportParameters.IdentificativoArchiviazione);
var parameterDescrizioneCondominio = new ReportParameter("descrizioneCondominio", _reportParameters.DescrizioneCondominio);
var parameterAddebitiPersonali = new ReportParameter("addebitiPersonali", _reportParameters.AddebitiPersonali.ToString());
var parameterLogo = new ReportParameter("logo", _documentService.SaveInLocalCache(new Business.Interface.DocumentInfo { Body = _aziendaService.GetLogo().LogoAzienda, FileName = "logo.jpg" }));
try
{
reportViewer.LocalReport.SetParameters(
new[]
{
parameterCondominio1,
parameterCondominio2,
parameterCondominio3,
parameterCondominio4,
parameterAzienda,
parameterIntestazioneStudio,
parameterViaStudio,
parameterCapStudio,
parameterLocalitaStudio,
parameterData,
parameterDescrizioneCondominio,
parameterFornitore,
parameterNumeroRiferimento,
parameterIdentificativoArchiviazione,
parameterAddebitiPersonali,
parameterLogo
});
reportViewer.RefreshReport();
}
catch (Exception ex)
{
_log.Error("Errore nella stampa della ricevuta di movimenti - " + Gipasoft.Library.Utility.GetMethodDescription() + " - azienda:" + Security.Login.Instance.CurrentLogin().Azienda, ex);
throw;
}
}
示例6: SetDataBinding
/// <summary>
/// 하위리포트객체의 데이터까지 전부 해당되는 바인더와 바인딩시킴
/// </summary>
private void SetDataBinding(ref ReportViewer reporter)
{
if (isMainReport && Data!=null)
{
reporter.LocalReport.DataSources.Add(new ReportDataSource(DataSetName, Data));
}
if (SubReportList==null || SubReportList.Length<=0 )
{
return;
}
foreach (RDLC r in SubReportList)
{
isMainReport = false;
r.SetDataBinding(ref reporter);
}
reporter.LocalReport.SubreportProcessing += LocalReport_SubreportProcessing;
reporter.RefreshReport();
}
示例7: RenderCommodityPurchaseSummary
void RenderCommodityPurchaseSummary(string title,string reportPath)
{
WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
var reportViewer = new ReportViewer();
//reportViewer.ProcessingMode = ProcessingMode.Remote;
//reportViewer.ServerReport.ReportPath = reportPath;// "/DistributrReports/Losses";
//string url = "";
//string password = "";
//string username = "";
//using (var c = ObjectFactory.Container.GetNestedContainer())
//{
// var settingrepo = c.GetInstance<IGeneralSettingRepository>();
// GeneralSetting passsetting = settingrepo.GetByKey(GeneralSettingKey.ReportPassword);
// if (passsetting != null) password = VCEncryption.DecryptString(passsetting.SettingValue);
// GeneralSetting usersetting = settingrepo.GetByKey(GeneralSettingKey.ReportUsername);
// if (usersetting != null) username = usersetting.SettingValue;
// GeneralSetting reportUrl = settingrepo.GetByKey(GeneralSettingKey.ReportUrl);
// if (reportUrl != null) url = reportUrl.SettingValue;
//}
//reportViewer.ServerReport.ReportServerUrl = new Uri(url);
//reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new NetworkCredential(username, password);
windowsFormsHost.Child = reportViewer;
TabItem tab = new TabItem();
tab.Header = title;
Style style = this.FindResource("ClosableTabItemStyle") as Style;
tab.Style = style;
tab.Content = windowsFormsHost;
int i = ReportTab.Items.Add(tab);
ReportTab.SelectedIndex = i;
reportViewer.RefreshReport();
}
示例8: btnPrint_Click
private void btnPrint_Click(object sender, RoutedEventArgs e)
{
PlayerReport objReportPlayer = new PlayerReport();
List<PlayerReport> lstPlayerreport = new List<PlayerReport>();
if (lstplayernames.Count > 0)
{
ReportGenerate frmReportGenerate = new ReportGenerate();
int count = lstplayernames.Count;
string[] player = new string[50];
int i;
for (i = 0; i <= count-1; i++)
{
foreach (Player item in lstPlayers.SelectedItems)
{
if (lstPlayers.SelectedItem != null)
{
objReportPlayer.PlayerName = item.FirstName;
objReportPlayer.Address = item.Address;
objReportPlayer.DOB = item.DateOfBirth;
objReportPlayer.EmailId = item.Emaild;
objReportPlayer.Gender = item.Gender;
objReportPlayer.KSCAUID = item.KSCAUID;
objReportPlayer.PhoneNumber =item.MobileNo;
objReportPlayer.PlayerPhoto = item.PlayerImage;
lstPlayerreport.Add(objReportPlayer);
}
}
}
ReportViewer rv = new ReportViewer();
rv.LocalReport.ReportEmbeddedResource = @"Reports\PlayerId.rdlc";
//this.reportViewer1.LocalReport.ReportPath("");
ReportDataSource RDS = new ReportDataSource("PlayerId", lstPlayerreport);
rv.LocalReport.DataSources.Add(RDS);
rv.RefreshReport();
frmReportGenerate.Show();
}
}
示例9: ViewPendingOrders
public ReportViewer ViewPendingOrders()
{
var reportViewer = new ReportViewer();
Stream stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.PendingOrdersReport);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.LocalReport.EnableHyperlinks = true;
using (var c = ObjectFactory.Container.GetNestedContainer())
{
var orderReposiory = c.GetInstance<IMainOrderRepository>();
var startDatetime = StartTime;
var endDateTime = EndTime;
var salesmanId = SelectedSalesman != null ? SelectedSalesman.Id : Guid.Empty;
var data = orderReposiory.GetPendingOrderAndDateProcessedList(startDatetime, endDateTime,
salesmanId).ToList()
.OrderByDescending(p => p.DateProcessed);
//.ThenByDescending(n => n.OrderReference)
//.ThenByDescending(n => n.ExternalRefNo);
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSetApprovedOrder", data));
}
reportViewer.LocalReport.LoadReportDefinition(stream);
reportViewer.LocalReport.Refresh();
reportViewer.RefreshReport();
return reportViewer;
}
示例10: AddSalesTabWithReportView
void AddSalesTabWithReportView(string title, bool isReportServer = false)
{
WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
var reportViewer = new ReportViewer();
reportViewer.ProcessingMode = ProcessingMode.Remote;
string url = "";
string password = "";
string username = "";
string folder = "";
using (var c = ObjectFactory.Container.GetNestedContainer())
{
var settingrepo = c.GetInstance<IGeneralSettingRepository>();
GeneralSetting passsetting = settingrepo.GetByKey(GeneralSettingKey.ReportPassword);
if (passsetting != null) password = VCEncryption.DecryptString(passsetting.SettingValue);
GeneralSetting usersetting = settingrepo.GetByKey(GeneralSettingKey.ReportUsername);
if (usersetting != null) username = usersetting.SettingValue;
GeneralSetting reportUrl = settingrepo.GetByKey(GeneralSettingKey.ReportUrl);
if (reportUrl != null) url = reportUrl.SettingValue;
GeneralSetting reportfolder = settingrepo.GetByKey(GeneralSettingKey.ReportFolder);
if (reportfolder != null)
{
folder = "/" + reportfolder.SettingValue;
}
}
string distributorID = _vm.DistributorID.ToString();//.ToUpper();
//string distributorID = "167480A6-DC20-44B9-A1B6-0B523914B5CE";
var param = new ReportParameter();
param = new ReportParameter("distributorID", distributorID, false);
reportViewer.ServerReport.ReportPath = folder + _vm.GetReportPath();// "/DistributrReports/Losses";
reportViewer.ServerReport.ReportServerUrl = new Uri(url);
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new NetworkCredential(username, password);
// reportViewer.ShowParameterPrompts = false;
// param.Visible = false;
reportViewer.ServerReport.SetParameters(new ReportParameter[] { param });
reportViewer.Drillthrough += SalesDrillthroughEventHandler;
reportViewer.ServerReport.Refresh();
windowsFormsHost.Child = reportViewer;
TabItem tab = new TabItem();
tab.Header = title;
Style style = this.FindResource("ClosableTabItemStyle") as Style;
tab.Style = style;
var uri = isReportServer == true ? _vm.getReportServerUri() : _vm.getReportUri();
tab.Content = windowsFormsHost;
int i = tcReports.Items.Add(tab);
tcReports.SelectedIndex = i;
reportViewer.RefreshReport();
}
示例11: RenderReport
void RenderReport(string title, string reportPath)
{
WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
var reportViewer = new ReportViewer();
reportViewer.ProcessingMode = ProcessingMode.Remote;
string url = "";
string password = "";
string username = "";
Guid hubid = Guid.Empty;
string folder = "";
using (var c = ObjectFactory.Container.GetNestedContainer())
{
var settingrepo = c.GetInstance<IGeneralSettingRepository>();
GeneralSetting passsetting = settingrepo.GetByKey(GeneralSettingKey.ReportPassword);
if (passsetting != null) password = VCEncryption.DecryptString(passsetting.SettingValue);
GeneralSetting usersetting = settingrepo.GetByKey(GeneralSettingKey.ReportUsername);
if (usersetting != null) username = usersetting.SettingValue;
GeneralSetting reportUrl = settingrepo.GetByKey(GeneralSettingKey.ReportUrl);
if (reportUrl != null)
{
url = reportUrl.SettingValue;
}
GeneralSetting reportfolder = settingrepo.GetByKey(GeneralSettingKey.ReportFolder);
if (reportfolder != null)
{
folder = "/" + reportfolder.SettingValue;
}
hubid = c.GetInstance<IConfigService>().Load().CostCentreId;
}
reportViewer.ServerReport.ReportPath = folder + reportPath; // "/DistributrReports/Losses";
reportViewer.ServerReport.ReportServerUrl = new Uri(url);
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new NetworkCredential(username,
password);
try
{
ReportParameter hubidparam = new ReportParameter("hubId", hubid.ToString(), false);
reportViewer.ServerReport.SetParameters(new ReportParameter[] { hubidparam });
}
catch
{
}
//ReportParameter hubidparam = new ReportParameter("hubId", "E6834108-4BA7-4A1A-98CA-9DD4DF8D68E2", false);
reportViewer.Drillthrough += DrillthroughEventHandler;
//reportViewer.ServerReport.IsDrillthroughReport = true;
reportViewer.ServerReport.Refresh();
windowsFormsHost.Child = reportViewer;
TabItem tab = new TabItem();
tab.Header = title;
Style style = this.FindResource("ClosableTabItemStyle") as Style;
tab.Style = style;
// tab.AddHandler(TabItem.ContextMenuClosingEvent, new RoutedEventHandler(this.CloseTab));
tab.Content = windowsFormsHost;
int i = ReportTab.Items.Add(tab);
ReportTab.SelectedIndex = i;
reportViewer.RefreshReport();
}
示例12: Main
static void Main(string[] args)
{
try
{
//Load excel file as parameters
Microsoft.Office.Interop.Excel.Application xlApp;
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
string excelPath = "C:\\Users\\andrewa\\Desktop\\Applications Dev\\localApps\\DIR2016\\auto_DIR.xlsx";
object misValue = System.Reflection.Missing.Value;
xlApp = new Microsoft.Office.Interop.Excel.Application();
xlWorkBook = xlApp.Workbooks.Add(excelPath);
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
//Declare data table and load the excel file into an in-memory table
System.Data.DataTable sheet1 = new System.Data.DataTable();
OleDbConnectionStringBuilder csBuilder = new OleDbConnectionStringBuilder();
csBuilder.Provider = "Microsoft.ACE.OLEDB.12.0";
csBuilder.DataSource = excelPath;
csBuilder.Add("Extended Properties", "Excel 12.0 Xml;HDR=No;IMEX=1");
string selectSQL = @"Select * From [Parameters$]";
using (OleDbConnection connection = new OleDbConnection(csBuilder.ConnectionString))
using (OleDbDataAdapter adapter = new OleDbDataAdapter(selectSQL, connection))
{
connection.Open();
adapter.Fill(sheet1);
}
//Table Columns: Agency | ProgramAnalyst | ContractType | Program | ContractNumber | StartDate | MaxRecordNumber ~ always -1 | endDate ~ calced valued
int rowCount = sheet1.Rows.Count;
List<string> agencyList = parameterList(sheet1, 0, rowCount);
List<string> contractNumber = parameterList(sheet1, 4, rowCount);
ReportViewer rpv1 = new ReportViewer();
rpv1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
ServerReport srpt = rpv1.ServerReport;
rpv1.ServerReport.ReportServerUrl = new Uri("https://dw24.esserver.com/reportServer");
rpv1.ServerReport.ReportPath = "/HMIS Management Reports/Data Integrity Report (LAHSA)";
string userName = @"Dw24\MGudino";
string userPassword = @"4H#lping)ther$";
string userDomain = "";
NetworkCredential myCred = new NetworkCredential(userName, userPassword, userDomain);
rpv1.ServerReport.ReportServerCredentials.NetworkCredentials = myCred;
for (int i = 0; i < rowCount-1; i++)
{
try
{
Console.WriteLine("Currently on: " + (i+1).ToString() + " out of :" + (rowCount-1).ToString());
ArrayList reportParam = new ArrayList();
DateTime todaysDate = DateTime.Today;
DateTime endDate = new DateTime(todaysDate.Year, todaysDate.Month, DateTime.DaysInMonth(todaysDate.Year, todaysDate.Month));
DateTime reportEndDate = endDate.AddDays(-5);
string stgEndDate = reportEndDate.ToShortDateString();
reportParam = reportDefaultParam(agencyList, contractNumber, stgEndDate, i);
ReportParameter[] param = new ReportParameter[reportParam.Count];
for (int k = 0; k < reportParam.Count; k++)
{
param[k] = (ReportParameter)reportParam[k];
}
rpv1.ServerReport.Timeout = 3600000;
rpv1.ServerReport.SetParameters(param);
rpv1.RefreshReport();
//create a save file
string fileName = ExportReport(rpv1, agencyList, contractNumber, i);
//"C:\\Users\\andrewa\\Desktop\\Rene\\Data Integrity Report (LAHSA)_1.xlsx"
/*
string targetPath = fileName;
//Declare Data set to hold two data tables, dtDIRReport & dtTopFive Errors
System.Data.DataSet ds = new System.Data.DataSet("ds");
ds.Tables.Add("dirScores");
ds.Tables.Add("topFiveErrors");
updateSummaryTable(targetPath, ds);
SqlConnection sqlCon = new SqlConnection("Data Source=L1SQLHMIS;Initial Catalog=TestAndrew;Integrated Security=True");
SqlCommand sqlCom = new SqlCommand("sp_updateDIRInfo", sqlCon);
sqlCom.CommandType = System.Data.CommandType.StoredProcedure;
sqlCom.Parameters.AddWithValue("@agency", agencyList[i].ToString());
sqlCom.Parameters.AddWithValue("@dirScores", ds.Tables[0]);
sqlCom.Parameters.AddWithValue("@TopErrors", ds.Tables[1]);
//.........这里部分代码省略.........
示例13: ShowReport
public static System.Xml.Linq.XDocument ShowReport(ReportViewer reportviewer,
Modeling.Report report_model,
ViewingOptions viewingoptions,
System.Action<Viziblr.Reporting.RDL2005.Report> mod_report)
{
var report = CreateReport(report_model);
if (mod_report != null)
{
mod_report(report);
}
var new_dom = report.ReportToXMLDOM();
if (viewingoptions.SaveRDLFile)
{
string temp_rdl = viewingoptions.OutputRDLFilename;
new_dom.Save(temp_rdl);
}
reportviewer.LocalReport.DataSources.Clear();
var rep_ds = new Microsoft.Reporting.WinForms.ReportDataSource(report_model.DatasetName, report_model.DataTable);
reportviewer.LocalReport.DataSources.Add(rep_ds);
reportviewer.ProcessingMode = ProcessingMode.Local;
var mem_stream = SaveXMLToMemoryStream(new_dom);
//reportviewer.LocalReport.ReportPath = temp_rdl;
reportviewer.LocalReport.LoadReportDefinition(mem_stream);
reportviewer.RefreshReport();
return new_dom;
}
示例14: LoadInvoiceReportViewer
void LoadInvoiceReportViewer(ReportViewer reportViewer)
{
reportViewer.Reset();
ReportDataSource reportDataSourceHeader = null;
ReportDataSource reportDataSourceLineItems = null;
Stream stream = null;
Stream subReportStream = null;
string subReportName = null;
var invoiceReport = GetInvoice(DocumentId);
reportDataSourceHeader = new ReportDataSource("dsInvoiceHeader",
new List<InvoiceReportHeader> { invoiceReport.InvoiceHeader });
reportDataSourceLineItems = new ReportDataSource("dsInvoiceLineItems", invoiceReport.InvoiceLineItems);
var reportDataSourcePaymentLineItems = new ReportDataSource("dsInvoicePayments", invoiceReport.PaymentInformationLineItems);
var reportDataSourceDeductions = new ReportDataSource("dsInvoiceDeductions", invoiceReport.InvoiceDeductionsLineItems);
stream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.InvoiceReport);
reportViewer.LocalReport.DisplayName = "Invoice";
subReportName = "rptCompanyLetterHead.rdlc";
subReportStream = Assembly.GetEntryAssembly().GetManifestResourceStream(ReportCollective.CompanyLetterHead);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.LocalReport.EnableHyperlinks = true;
reportViewer.LocalReport.DataSources.Add(reportDataSourceHeader);
reportViewer.LocalReport.DataSources.Add(reportDataSourceLineItems);
reportViewer.LocalReport.DataSources.Add(reportDataSourcePaymentLineItems);
reportViewer.LocalReport.DataSources.Add(reportDataSourceDeductions);
reportViewer.LocalReport.LoadSubreportDefinition(subReportName, subReportStream);
reportViewer.LocalReport.ShowDetailedSubreportMessages = true;
reportViewer.LocalReport.SubreportProcessing += LocalReport_SubreportProcessing;
reportViewer.LocalReport.LoadReportDefinition(stream);
reportViewer.LocalReport.Refresh();
reportViewer.RefreshReport();
Title = reportViewer.LocalReport.DisplayName;
}
示例15: PrintPackingList
public static void PrintPackingList(Order order)
{
ConfigurationValue oConVal = Configuration.GetValue(new string[] { order.ClientCode, "PackingList" });
if (oConVal == null || oConVal.Value == null)
{
return;
}
XmlReportSource oReport = new XmlReportSource();
oReport.Xml = (string)oConVal.Value;
// Adding the initial parameter values
oReport.Parameters.Add(new Telerik.Reporting.Parameter("OrderNumber", order.ClientOrderNo));
ReportViewer oReportViewer = new ReportViewer();
oReportViewer.ReportSource = oReport;
Form oForm = new Form();
oForm.Controls.Add(oReportViewer);
oReportViewer.Dock = DockStyle.Fill;
oReportViewer.RefreshReport();
oForm.StartPosition = FormStartPosition.CenterScreen;
oForm.WindowState = FormWindowState.Maximized;
oForm.ShowDialog();
}