本文整理汇总了C#中ReportDataSource类的典型用法代码示例。如果您正苦于以下问题:C# ReportDataSource类的具体用法?C# ReportDataSource怎么用?C# ReportDataSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReportDataSource类属于命名空间,在下文中一共展示了ReportDataSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt;
if (Request.QueryString["sdt"] != null || Request.QueryString["edt"] != null)
{
DateTime Sdt = Convert.ToDateTime(Request.QueryString["sdt"].ToString());
DateTime Edt = Convert.ToDateTime(Request.QueryString["edt"].ToString());
dt = DAL.DbHelper.ExecuteDataTable("P_AssessmentWeek_ByAllseller", Sdt, Edt);
ReportDataSource rds = new ReportDataSource("sellerAssessment_Data_DataTable1", dt);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
if (dt.Rows.Count == 0)
{
ReportViewer1.Visible = false;
div_nodata.Visible = true;
}
else
{
div_nodata.Visible = false;
}
}
else
{
Library.Script.ClientMsgUrl("错误的参数。", "reportCustomer.aspx");
}
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
txtFechaInicial.Text = DateTime.Now.ToShortDateString();
txtFechaFinal.Text = DateTime.Now.ToShortDateString();
lblFechaInicial.Text = DateTime.Parse(txtFechaInicial.Text).Year.ToString("0000") + DateTime.Parse(txtFechaInicial.Text).Month.ToString("00") + DateTime.Parse(txtFechaInicial.Text).Day.ToString("00");
lblFechaFinal.Text = DateTime.Parse(txtFechaFinal.Text).Year.ToString("0000") + DateTime.Parse(txtFechaFinal.Text).Month.ToString("00") + DateTime.Parse(txtFechaFinal.Text).Day.ToString("00");
ListarSucursal();
if (ddlAlmacen.SelectedIndex == 0)
{
lblAlmacen.Text = "";
}
else
{
lblAlmacen.Text = ddlAlmacen.SelectedItem.Text;
}
ReportViewer1.LocalReport.ReportPath = "VentasPorCategoria.rdlc";
ReportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rds = new ReportDataSource();
rds.Name = "DataSet1";
SqlDataAdapter da = new SqlDataAdapter("Play_VentasxCategoria_Reporte '" + lblFechaInicial.Text + "','" + lblFechaFinal.Text + "','" + lblAlmacen.Text + "'", conexion);
DataTable dt = new DataTable();
da.Fill(dt);
rds.Value = dt;
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
}
}
示例3: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
int year = Convert.ToInt32(DropDownList2.SelectedValue);
int month=Convert.ToInt32(DropDownList1.SelectedValue);
var dt = new DataTable();
dt.Columns.Add("TagDate", typeof(DateTime));
dt.Columns.Add("TagName");
dt.Columns.Add("TagVal", typeof(float));
var datasource = NyData.Getdata(year, month);
foreach (var source in datasource)
{
DataRow dr = dt.NewRow();
dr[0] = source.TagDate;
dr[1] = source.TagName;
// dr[2] = string.IsNullOrEmpty(source.Tagval)?"0":source.Tagval;
dr[2] = source.Tagval;
dt.Rows.Add(dr);
}
var hh = new ReportDataSource("Message", dt);
var localreport = this.ReportViewer1.LocalReport;
localreport.DataSources.Clear();
localreport.DataSources.Add(hh);
//localreport.SetParameters(new ReportParameter("rDate",new DateTime(2015,8,1).ToShortDateString()));
localreport.Refresh();
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//提取数据
string queryWord = "";
if (Request.QueryString["queryWord"] != null && Request.QueryString["queryWord"].Trim() != "" && Request.QueryString["queryWord"].Trim() != "null")
queryWord = Request.QueryString["queryWord"].Trim();
YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
ynPage.SetPageSize(500); //pageRows;
ynPage.SetCurrentPage(1); //pageNumber;
List<AscmSupplier> listAscmSupplier = AscmSupplierService.GetInstance().GetList(ynPage, "", "", queryWord, null);
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierReport.rdlc");
ReportDataSource rds1 = new ReportDataSource();
rds1.Name = "DataSet1";
rds1.Value = listAscmSupplier;
ReportViewer1.LocalReport.DataSources.Clear();//好像不clear也可以
ReportViewer1.LocalReport.DataSources.Add(rds1);
string companpyTitle = "美的中央空调";
string title = companpyTitle + "供应商";
ReportParameter[] reportParameters = new ReportParameter[] {
new ReportParameter("ReportParameter_Title", title),
new ReportParameter("ReportParameter_ReportTime", "打印时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"))
};
ReportViewer1.LocalReport.SetParameters(reportParameters);
ReportViewer1.LocalReport.Refresh();
}
}
示例5: btnGenerar_Click
private void btnGenerar_Click(object sender, EventArgs e)
{
objDetalleReservaBL = new DetalleReservaBL();
DateTime fechaInicio = dtpInicio.Value.Date;
DateTime fechaFin = dtpFin.Value.Date.Add(TimeSpan.Parse("23:59:59"));
try
{
reportViewer1.ProcessingMode = ProcessingMode.Local;
reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource Reporte = new ReportDataSource("DataSet1", objDetalleReservaBL.ListarFacturacion(fechaInicio, fechaFin));
reportViewer1.LocalReport.DataSources.Add(Reporte);
reportViewer1.LocalReport.ReportEmbeddedResource = "MadScienceGUI.reportFacturacion.rdlc";
List<ReportParameter> parametros = new List<ReportParameter>();
parametros.Add(new ReportParameter("FechaInicio", "" + fechaInicio));
parametros.Add(new ReportParameter("FechaFin", "" + fechaFin));
//Añado parametros al reportviewer
this.reportViewer1.LocalReport.SetParameters(parametros);
reportViewer1.RefreshReport();
reportViewer1.Focus();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例6: btnGenerar_Click
private void btnGenerar_Click(object sender, EventArgs e)
{
DateTime fechaInicio = dtpInicio.Value.Date;
DateTime fechaFin = dtpFin.Value.Date.Add(TimeSpan.Parse("23:59:59"));
int codigoTrabajador = Convert.ToInt16(cboTrabajador.SelectedValue.ToString());
asiginacionBL = new AsignacionBL();
try
{
reportViewer1.ProcessingMode = ProcessingMode.Local;
reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource Reporte = new ReportDataSource("dataPagoDetalle", asiginacionBL.ReportePagoDetalle(fechaInicio, fechaFin, codigoTrabajador));
reportViewer1.LocalReport.DataSources.Add(Reporte);
reportViewer1.LocalReport.ReportEmbeddedResource = "MadScienceGUI.reportPagoDetalle.rdlc";
List<ReportParameter> parametros = new List<ReportParameter>();
parametros.Add(new ReportParameter("FechaInicio", "" + fechaInicio));
parametros.Add(new ReportParameter("FechaFin", "" + fechaFin));
//Añado parametros al reportviewer
this.reportViewer1.LocalReport.SetParameters(parametros);
reportViewer1.RefreshReport();
reportViewer1.Focus();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例7: btnCreateReport_Click
protected void btnCreateReport_Click(object sender, EventArgs e)
{
/*
TreasureLandDataClassesDataContext db = new TreasureLandDataClassesDataContext();
IEnumerable <reportData> ds = from l in db.LineItems
join rd in db.ReservationDetailBillings
on l.ReservationDetailBillingID equals rd.ReservationDetailBillingID
join m in db.MenuItems
on l.MenuItemID equals m.MenuItemID
join d in db.FoodDrinkCategories
on m.MenuItemID equals d.FoodDrinkCategoryID
where rd.ReservationDetailBillingID == Convert.ToInt16(ddlTransactions.SelectedValue)
select new reportData{ LineItemAmount = l.LineItemAmount, LineItemTransactionID = l.LineItemTransactionID, MenuItemName = m.MenuItemName};
*/
if(ddlTransactions.SelectedIndex>-1)
{
ReportViewer1.Visible = true;
ReportDataSource rds = new ReportDataSource("reportDatasource", sdsReport);
//Resets the ReportViewer, adds the new datasource, and changes the name of the report
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.DisplayName = "reportDatasource";
ReportViewer1.DataBind();
}
}
示例8: bindReport
private void bindReport()
{
int clientID = Core.SessionHelper.getClientId();
List<CRM.Data.Entities.vw_OpenClaimsListing> reportData = null;
using (RerportManager report = new RerportManager()) {
reportData = report.claimsOpenListing(clientID);
}
if (reportData != null) {
reportViewer.Reset();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.EnableExternalImages = true;
ReportDataSource reportDataSource = new ReportDataSource();
reportDataSource.Name = "DataSet1";
reportDataSource.Value = reportData;
reportViewer.LocalReport.DataSources.Add(reportDataSource);
reportViewer.LocalReport.ReportPath = Server.MapPath("~/Protected/Reports/ClaimOpen/ClaimsOpenListing.rdlc");
}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt;
if (Request.QueryString["sellerId"] != null || Request.QueryString["tag"] != null || Request.QueryString["id"] != null)
{
int sellerId = Convert.ToInt32(Request.QueryString["sellerId"].ToString());
int tag = Convert.ToInt32(Request.QueryString["tag"].ToString());
int id = Convert.ToInt32(Request.QueryString["id"].ToString());
dt = logic.assessmentWeek.P_AssessmentWeek(sellerId, tag, id);
ReportDataSource rds = new ReportDataSource("sellerAssessment_Data_DataTable1", dt);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
if (dt.Rows.Count == 0)
{
ReportViewer1.Visible = false;
div_nodata.Visible = true;
}
else
{
div_nodata.Visible = false;
}
}
else
{
Library.Script.ClientMsgUrl("错误的参数。", "sellerAssessment_Allist.aspx");
}
}
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string actividadid = Request.QueryString["id"].ToString();
ReportDataSource rds = new ReportDataSource();
rptActividades.LocalReport.DataSources.Clear();
rptActividades.LocalReport.ReportPath = "Actividades_Valores_PlanOperativo.rdlc";
rds.Name = "DataSet1";
var actividad = (from i in new Model.ESMBDDataContext().Actividades
where i.Id == Convert.ToInt32(actividadid)
select i).Single();
rptActividades.LocalReport.SetParameters(new ReportParameter("indicador", actividad.Actividad));
rptActividades.LocalReport.SetParameters(new ReportParameter("meta", actividad.Presupuesto.ToString()));
odsActividadesMetas.FilterExpression = "actividad_id = " + actividadid;
rds.DataSourceId = "odsActividadesMetas";
rptActividades.LocalReport.DataSources.Add(rds);
rptActividades.LocalReport.Refresh();
}
}
示例11: frmRelatorios
public frmRelatorios(DataTable pSource, eStatusForm tipo)
{
InitializeComponent();
ReportDataSource report = new ReportDataSource();
report.Name = "DataSet1";
report.Value = pSource;
rpwViewer.LocalReport.DataSources.Add(report);
statusForm = tipo;
switch (statusForm)
{
case eStatusForm.alunos:
rpwViewer.LocalReport.ReportEmbeddedResource = "matriculasControl.rptListaAlunos.rdlc";
break;
case eStatusForm.disciplinas:
rpwViewer.LocalReport.ReportEmbeddedResource = "matriculasControl.rptListaDisciplinas.rdlc";
break;
case eStatusForm.matriculas:
rpwViewer.LocalReport.ReportEmbeddedResource = "matriculasControl.rptListaMatriculados.rdlc";
break;
case eStatusForm.semestres:
break;
default:
break;
}
rpwViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
rpwViewer.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth;
this.rpwViewer.RefreshReport();
}
示例12: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
int idprov = _idver;
String vehiculo = _vehiculo;
Conexion conectar = new Conexion();
Ordenes ordenes = new Ordenes();
this.reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource source = new ReportDataSource();
if (vehiculo.Equals(""))
{
source = new ReportDataSource("ConReporteTabla", ordenes.getOrdenesDetallesProveedorDG(idprov, conectar.con));
}
else
{
source = new ReportDataSource("ConReporteTabla", ordenes.getOrdenesDetallesProveedorVehiculo(idprov, vehiculo, conectar.con));
}
reportViewer1.LocalReport.DataSources.Add(source);
source = new ReportDataSource("Proveedor", ordenes.getProveedoresRep(idprov, conectar.con));
reportViewer1.LocalReport.DataSources.Add(source);
this.reportViewer1.RefreshReport();
}
示例13: LoadReport
public void LoadReport(int agentId, DateTime fromDate, DateTime toDate)
{
//Reset report viewer control
reportViewer.Reset();
//Initializes report viewer and set report as embedded resource
Common.SetReportEmbeddedResource(reportViewer, "TCESS.ESales.CommonLayer.Reports.ConsolidatedBookingandSaleReport.rdlc");
//Set datasource for cash collection report
IList<DispatchReportDTO> lstDispatchReportRpt = ESalesUnityContainer.Container.Resolve<IReportService>()
.GetDispatchReport(Convert.ToInt32(agentId), Convert.ToDateTime(fromDate),
Convert.ToDateTime(toDate));
ReportDataSource CashCollectionDataSource = new ReportDataSource("dsConsBookingSale", lstDispatchReportRpt);
reportViewer.LocalReport.DataSources.Add(CashCollectionDataSource);
string agentName = "";
if (agentId > 0)
{
AgentDTO _agentName = ESalesUnityContainer.Container.Resolve<IAgentService>().GetAgentByAgentId(agentId);
agentName = _agentName.Agent_Name;
}
else
{
agentName = "ALL";
}
//Set report parameters
ReportParameter fromDt = new ReportParameter("FromDate", Convert.ToDateTime(fromDate).ToString("dd/MM/yyyy"));
ReportParameter toDt = new ReportParameter("ToDate", Convert.ToDateTime(toDate).ToString("dd/MM/yyyy"));
ReportParameter agent = new ReportParameter("agent", Convert.ToString(agentName));
reportViewer.LocalReport.SetParameters(new ReportParameter[] { fromDt, toDt, agent });
}
示例14: RenderStatement
private void RenderStatement(int penaltyID, int loanID)
{
try
{
ReportParameter rpPenaltyID = new ReportParameter("PenaltyID", penaltyID.ToString());
ReportParameter[] parameters = new ReportParameter[] { };
DataTable dtPenalty = LoansBLL.GetPenalty(penaltyID, loanID).Tables[0];
ReportDataSource rdsPenalty = new ReportDataSource("PenaltyDS", dtPenalty);
ReportDataSource[] sources = new ReportDataSource[] { rdsPenalty };
byte[] bytes = Statements.RenderStatement("PenaltyNotice.rdlc", sources, parameters);
// Variables
string mimeType = string.Empty;
// Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=" + "PenaltyNotice_" + penaltyID.ToString() + ".pdf");
Response.BinaryWrite(bytes); // create the file
Response.Flush(); // send it to the client to download
}
catch (Exception ex)
{
}
}
示例15: CandidateRDLSReportPrint_Load
private void CandidateRDLSReportPrint_Load(object sender, EventArgs e)
{
ReportDataSource rds = new ReportDataSource();
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("UNIRecruitmentSoft_CandidateDetail", _candidatesFroPrint.ToList()));
this.reportViewer1.RefreshReport();
}