本文整理汇总了C#中ReportDocument.SetParameterValue方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.SetParameterValue方法的具体用法?C# ReportDocument.SetParameterValue怎么用?C# ReportDocument.SetParameterValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportDocument
的用法示例。
在下文中一共展示了ReportDocument.SetParameterValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnSearch_Click_1
private void btnSearch_Click_1(object sender, EventArgs e)
{
try
{
string DoctorName;
int MedicalShopID;
int ProductID;
string StartDate;
string EndDate;
DoctorName = Convert.ToString(cbDoctor.Text);
MedicalShopID = Convert.ToInt32(cbMedicalShop.SelectedValue.ToString());
ProductID = Convert.ToInt32(cbProduct.SelectedValue.ToString());
StartDate = Convert.ToString(dtpStartDate.Text);
EndDate = Convert.ToString(dtpEndDate.Text);
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
string ReportPath = ConfigurationManager.AppSettings["ReportPath"];
paramField.Name = "@DoctorName";
paramField.Name = "@MedicalShopID";
paramField.Name = "@ProductID";
paramField.Name = "@StartDate";
paramField.Name = "@EndDate";
paramDiscreteValue.Value = 1;
reportDocument.Load(ReportPath+"Report\\Commission_CrystalReport.rpt");
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM";
//connectionInfo.UserID = "wms";
//connectionInfo.Password = "wms";
connectionInfo.IntegratedSecurity = true;
SetDBLogonForReport(connectionInfo, reportDocument);
reportDocument.SetParameterValue("@DoctorName", DoctorName);
reportDocument.SetParameterValue("@MedicalShopID", MedicalShopID);
reportDocument.SetParameterValue("@ProductID", ProductID);
reportDocument.SetParameterValue("@StartDate", StartDate);
reportDocument.SetParameterValue("@EndDate", EndDate);
CommissionCrystalRpt.ReportSource = reportDocument;
CommissionCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
示例2: GenerateReport
protected void GenerateReport()
{
System.Console.Beep();
//Create report document
ReportDocument crystalReport = new ReportDocument();
if (txtStart.Text != "" && txtEnd.Text != "" )
{
//Load crystal report made in design view
crystalReport.Load(Server.MapPath("Reports/Notifications.rpt"));
//Set DataBase Login Info
crystalReport.SetDatabaseLogon("root", "123", @"localhost", "nsis");
//Provide parameter values
crystalReport.SetParameterValue("start", txtStart.Text.ToString());
crystalReport.SetParameterValue("end", txtEnd.Text.ToString());
//Set Report in to Report Viewer
crvReportViewer.ReportSource = crystalReport;
}
else
{
// lblError.ForeColor = Color.Red;
// lblError.Text = "Please Provide Valid Details";
}
}
示例3: btnSearch_Click
private void btnSearch_Click(object sender, EventArgs e)
{
string BcDate;
string DueDate;
BcDate = Convert.ToString(dtpfromdate.Text);
DueDate = Convert.ToString(dtpTodate.Text);
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
string ReportPath = ConfigurationManager.AppSettings["ReportPath"];
paramField.Name = "@BcDate";
paramField.Name = "@DueDate";
paramDiscreteValue.Value = 1;
reportDocument.Load(ReportPath + "Reports\\DateWiseTransactionReport.rpt");
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "DB_LoanApplication";
//connectionInfo.UserID = "wms";
//connectionInfo.Password = "wms";
connectionInfo.IntegratedSecurity = true;
SetDBLogonForReport(connectionInfo, reportDocument);
reportDocument.SetParameterValue("@BcDate", BcDate);
reportDocument.SetParameterValue("@DueDate", DueDate);
DatewisecrystalReport.ReportSource = reportDocument;
DatewisecrystalReport.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
}
示例4: cmdExportarExcel_Click
protected void cmdExportarExcel_Click(object sender, EventArgs e)
{
String regionCodigo = txtRegionCodigo.Text;
String zonaCodigo = txtZonaCodigo.Text;
try
{
String db_databaseName = connectionBL.getDataBaseName();
String db_serverName = connectionBL.getServerName();
String db_userID = connectionBL.getUserID();
String db_password = connectionBL.getPassword();
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("../CrystalReports/crReporteSeguimiento.rpt"));
rpt.SetDatabaseLogon("", "", ".", db_databaseName);
rpt.SetParameterValue("@regionCodigo", regionCodigo);
rpt.SetParameterValue("@zonaCodigo", zonaCodigo);
rpt.SetParameterValue("@estadoVerificiado", Convert.DBNull);
rpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "Reporte_seguimientos_" + DateFormatter.getTimestamp(DateTime.Now));
/*
rpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "Prueba_ExcelNormal");
//rpt.ExportToHttpResponse(ExportFormatType.ExcelRecord, Response, true, "Prueba_ExcelRecord");
*/
}
catch (Exception ex)
{
//System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
DataTable dtRepProveedores = null;
Double nTipCam = 0.0;
String cMes = "";
dtRepProveedores = (DataTable)Session["dtRepProveedores"];
nTipCam = Double.Parse((String)Session["nTipCam"]);
cMes = (String)Session["cMes"];
if (dtRepProveedores != null)
{
if (dtRepProveedores.Rows.Count != 0)
{
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("crRepProveedoresMes.rpt"));
rpt.FileName = Server.MapPath("crRepProveedoresMes.rpt");
rpt.SetDataSource(dtRepProveedores);
rpt.SetParameterValue("@TipCam", nTipCam);
rpt.SetParameterValue("@Mes", cMes);
CrystalReportViewer1.ReportSource = rpt;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
}
}
}
catch (Exception ex)
{
throw ex;
}
}
示例6: DivSchedule
private void DivSchedule()
{
string strExportFile = null;
strExportFile = Session["Report"].ToString();
ReportDocument crReportDocument = default(ReportDocument);
crReportDocument = new ReportDocument();
crReportDocument.Load(Server.MapPath(Session["Report"].ToString()));
CSBC.Components.Season.ClsSchedules oData = new CSBC.Components.Season.ClsSchedules();
//Pass the populated dataset to the report
crReportDocument.SetDataSource(oData.GetGames(1, 1, Convert.ToInt32(Session["ScheduleNo"]),
Convert.ToInt32(Session["TeamNbr"]), Session["ScheduleDesc"].ToString(), Session["TeamName"].ToString()));
crReportDocument.SetParameterValue("SeasonDesc", Session["SeasonDesc"]);
crReportDocument.SetParameterValue("CompanyName", Session["CompanyName"]);
crReportDocument.SetParameterValue("TeamName", Session["TeamName"]);
crReportDocument.SetParameterValue("Division", Session["ScheduleDesc"]);
System.IO.MemoryStream s =
(MemoryStream) crReportDocument.ExportToStream(ExportFormatType.PortableDocFormat);
var _with1 = HttpContext.Current.Response;
_with1.ClearContent();
_with1.ClearHeaders();
_with1.ContentType = "application/pdf";
_with1.AddHeader("Content-Disposition", "inline; filename=" + strExportFile);
_with1.BinaryWrite(s.ToArray());
_with1.End();
//CrystalReportViewer1.ReportSource = crReportDocument
crReportDocument = null;
oData = null;
}
示例7: Pedidoxcliente
public ActionResult Pedidoxcliente(int idCliente,string fecha1,string fecha2)
{
SqlConnection con = new SqlConnection("server=.;database=bdpastelelias;UID=sa;PWD=sql");
DataTable dt = new DataTable();
DateTime fec1 = Convert.ToDateTime(fecha1);
DateTime fec2 = Convert.ToDateTime(fecha2);
try
{
con.Open();
SqlCommand cmd = new SqlCommand("SELECT pe.idpedido,pro.idproducto,pro.nomProducto,pp.precio,pp.cantidad,pp.total,pe.contacto_nom,pe.contacto_ape,pe.contacto_mail,contacto_movil,pe.fechaPedido,pe.fechaentrega,pe.entrega_dir,pe.subTotal,pe.igv,pe.totalpedido,c.nombre as Cliente,d.descrip as Distrito,tc.descrip as 'Comprobante',tp.descrip as 'Tipo Pago',e.descrip as Estado FROM pedido pe inner join Cliente c on pe.idCliente=c.idCliente inner join distrito d on pe.iddistrito=d.iddistrito inner join tipo_compPago tc on pe.idtipo_compPago=tc.idtipo_compPago inner join TIPO_PAGO tp on pe.idtipopago=tp.idtipopago inner join estado e on pe.idestado=e.idestado inner join pedido_productos pp on pe.idpedido=pp.idpedido inner join producto pro on pp.idproducto=pro.idproducto", con);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(dt);
}
catch (Exception ex)
{
}
ReportDocument rpt = new ReportDocument();
// ReportClass rpt = new ReportClass();
// rpt.FileName = Server.MapPath("/Reportes/rptPedidos4.rpt");
rpt.Load(Path.Combine(Server.MapPath("~/Reportes"), "rptPedidos4.rpt"));
rpt.SetDatabaseLogon("sa", "sql");
// rpt.Load();
// rpt.SetDataSource(dt);
// rpt.SetDataSource(from pe in storeDB.pedido
// join c in storeDB.Cliente on pe.idCliente equals c.idCliente
// join d in storeDB.distrito on pe.iddistrito equals d.iddistrito
// join tc in storeDB.tipo_compPago on pe.idtipo_compPago equals tc.idtipo_compPago
// join tp in storeDB.TIPO_PAGO on pe.idtipopago equals tp.idtipopago
// join e in storeDB.estado on pe.idestado equals e.idestado
// join pp in storeDB.pedido_productos on pe.idpedido equals pp.idpedido
// join pro in storeDB.producto on pp.idproducto equals pro.idproducto
// select new {pe.idpedido,pro.idproducto,pro.nomProducto,pp.precio,pp.cantidad,pp.total,pe.contacto_nom,pe.contacto_ape,pe.contacto_mail,pe.contacto_movil,pe.fechaPedido,pe.fechaentrega,pe.entrega_dir,pe.subTotal,pe.igv,pe.totalpedido,Cliente=c.nombre,Distrito=d.descrip,Comprobante=tc.descrip,Tipo_Pago=tp.descrip,Estado=e.descrip});
// ParameterDiscreteValue idCli = new ParameterDiscreteValue();
// idCli.Value = idCliente;
// ParameterDiscreteValue fe1 = new ParameterDiscreteValue();
// fe1.Value = fecha1;
// ParameterDiscreteValue fe2 = new ParameterDiscreteValue();
// fe2.Value = fecha2;
rpt.SetParameterValue("@idCliente", idCliente);
rpt.SetParameterValue("@fecha1", fecha1);
rpt.SetParameterValue("@fecha2", fecha2);
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
Stream stream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf","ReporteDeClientes.pdf");
}
示例8: btnSearch_Click
private void btnSearch_Click(object sender, EventArgs e)
{
try
{
int DoctorID;
//string DoctorName;
string StartDate;
string EndDate;
DoctorID = Convert.ToInt32(cbDoctor.SelectedValue.ToString());
// DoctorName=Convert.ToString(cbDoctor.SelectedText.ToString());
StartDate = Convert.ToString(dtpStartDate.Text);
EndDate = Convert.ToString(dtpEndDate.Text);
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
string ReportPath = ConfigurationManager.AppSettings["ReportPath"];
paramField.Name = "@DoctorID";
//paramField.Name = "@DoctorName";
paramField.Name = "@StartDate";
paramField.Name = "@EndDate";
paramDiscreteValue.Value = 1;
if (chkdailyreport.Checked == true)
{
reportDocument.Load(ReportPath + "Report\\DoctorPay_CrystalReportNew1.rpt");
}
else
{
reportDocument.Load(ReportPath + "Report\\DoctorPayment_ReportNew.rpt");
}
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM";
//connectionInfo.UserID = "wms";
//connectionInfo.Password = "wms";
connectionInfo.IntegratedSecurity = true;
SetDBLogonForReport(connectionInfo, reportDocument);
reportDocument.SetParameterValue("@DoctorID", DoctorID);
//reportDocument.SetParameterValue("@DoctorName", DoctorName);
reportDocument.SetParameterValue("@StartDate", StartDate);
reportDocument.SetParameterValue("@EndDate", EndDate);
SupplierCrystalRpt.ReportSource = reportDocument;
SupplierCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument rd = new ReportDocument();
//if (!this.Page.IsPostBack)
//{
string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
//string orderBy = Request.QueryString["orderby"].ToString();//排序
string orderString = Request.QueryString["orderby"].ToString();//排序
string order = "DESC";//排序:升序
string orderBy = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "ProviderNo";//要排序的字段,如果为空,默认为"ID"
if (orderString.EndsWith("_a"))
{
order = "ASC";//排序:降序
}
orderBy = orderBy + " " + order;
string ProviderID = Request.QueryString["ProviderID"];
string ProductID = Request.QueryString["ProductID"];
string StartConfirmDate = Request.QueryString["StartConfirmDate"];
string EndConfirmDate = Request.QueryString["EndConfirmDate"];
DataTable dt = null;
if (Request.QueryString["dataSource"].ToString() == "Arrive")
{
dt = PurchaseArriveBus.PurchaseArriveCollectListPrint(ProviderID, ProductID, StartConfirmDate, EndConfirmDate, CompanyCD, orderBy);
}
else
{
dt = PurchaseArriveBus.PurchaseOrderCollectListPrint(ProviderID, ProductID, StartConfirmDate, EndConfirmDate, CompanyCD, orderBy);
}
rd.Load(Server.MapPath(@"~/OperatingModel/CrystalReport/PurchaseManager/PurchaseDetailCollect.rpt"));
//绑定数据
rd.SetDataSource(dt);
rd.Refresh();
this.CrystalReportViewer1.ReportSource = rd;
rd.SetParameterValue("creator", "制表人:" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName);
string DateParam = string.Empty;
if (!string.IsNullOrEmpty(StartConfirmDate))
{
DateParam += "起始日期:" + StartConfirmDate;
}
if (!string.IsNullOrEmpty(EndConfirmDate))
{
DateParam += " 终止日期:" + EndConfirmDate;
}
rd.SetParameterValue("StartEndDate", DateParam);
//}
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument rpt = new ReportDocument();
rpt.Load(Path.Combine(Server.MapPath("~/Reportes"), "rptPedidos4.rpt"));
// rpt.SetDatabaseLogon("sa", "sql");
rpt.SetParameterValue("@idCliente", 1);
rpt.SetParameterValue("@fecha1", "23/06/2015");
rpt.SetParameterValue("@fecha2", "29/06/2015");
crvClientes.ReportSource = rpt;
crvClientes.DataBind();
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
#region test
int intPartyID = Convert.ToInt32(Request.QueryString["code"]);
string bagLoans = Request.QueryString["bagLoans"];
string carryingCost = Request.QueryString["carryingCost"];
if (intPartyID > 0)
{
ReportManager rptManager = new ReportManager();
//_Party = new PartyManager.GetPartyByID(intPartyID);
_Party = rptManager.GetPartyByID(intPartyID);
// txtCode.Text = _Party.PartyID;
//txtserid.Text=_Party
//txtpartycode.Text = _Party.PartyID.ToString();
//txtCode.Text = _Party.PartyCode;
String name = _Party.PartyName;
String fName = _Party.FatherName;
string partType = _Party.PartyType;
String village = _Party.AreaVillageName;
String po = _Party.AreaPOName;
String cellNo = _Party.Cell;
string district = rptManager.getdist(Convert.ToInt32(_Party.DistrictID)).DistrictName;
string upazila = rptManager.getupzilla(Convert.ToInt32(_Party.UpazilaPSID)).UpazilaPSName;
ReportDocument rptDoc = new ReportDocument();
dsAgreementReport ds = new dsAgreementReport();
DataTable dt = new DataTable();
// dt.TableName = "Crystal Report Example";
//// dt = getAllOrders(); //This function is located below this function
// dt = getFakeDbOrders();
// ds.Tables[0].Merge(dt);
rptDoc.Load(Server.MapPath("../Delivery/rptDeliveryReport.rpt"));
rptDoc.FileName = Server.MapPath("../Delivery/rptDeliveryReport.rpt");
rptDoc.SetDataSource(ds);
//report.SetParameterValue("@Userid", userid);
rptDoc.SetParameterValue("CustomerCode", intPartyID);
rptDoc.SetParameterValue("CustomerName", name);
rptDoc.SetParameterValue("FatherName", fName);
rptDoc.SetParameterValue("MobileNo", cellNo);
rptDoc.SetParameterValue("village", village);
rptDoc.SetParameterValue("PO", po);
rptDoc.SetParameterValue("Bag Loans", bagLoans);
rptDoc.SetParameterValue("Carrying Cost", carryingCost);
rptDoc.SetParameterValue("District", district);
rptDoc.SetParameterValue("Upazila", upazila);
CrystalReportViewer1.ReportSource = rptDoc;
}
#endregion
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument rd = new ReportDocument();
int User = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID;
//设置行为参数
string orderString = Request.Params["orderby"];//排序
string order = "DESC";//排序:升序
string orderBy = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "ProductID";//要排序的字段,如果为空,默认为"ProductID"
if (orderString.EndsWith("_a"))
{
order = "ASC";//排序:降序
}
string ProductID = Request.Params["ProductID"];
string StartPurchaseDate = Request.Params["StartPurchaseDate"];
string EndPurchaseDate = Request.Params["EndPurchaseDate"];
orderBy = orderBy + " " + order;
//string temp = JsonClass.DataTable2Json();
DataTable dt = PurchaseOrderBus.SelectPurchaseHistoryAskPricePrint(orderBy, ProductID, StartPurchaseDate, EndPurchaseDate);
rd.Load(Server.MapPath(@"~/OperatingModel/CrystalReport/PurchaseManager/PurchaseHistoryAskPriceInfo.rpt"));
CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.V_PurchaseHistoryAskPriceInfo"));
//UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
//rd.DataDefinition.FormulaFields["Creator"].Text = "\"" + "制表人:" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName + "\"";
//绑定数据
rd.SetDataSource(dt);
rd.Refresh();
this.CrystalReportViewer1.ReportSource = rd;
string DateParam = string.Empty;
if (!string.IsNullOrEmpty(StartPurchaseDate))
{
DateParam += "起始日期:" + StartPurchaseDate;
}
if (!string.IsNullOrEmpty(EndPurchaseDate))
{
DateParam += " 终止日期:" + EndPurchaseDate;
}
rd.SetParameterValue("StartEndDate", DateParam);
rd.SetParameterValue("Creator", "" + "制表人:" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName + "");
}
示例13: btnSearch_Click
private void btnSearch_Click(object sender, EventArgs e)
{
int GroupId;
GroupId = Convert.ToInt32(cbgroupNames.SelectedValue.ToString());
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
string ReportPath = ConfigurationManager.AppSettings["ReportPath"];
paramField.Name = "@GroupId";
paramDiscreteValue.Value = 1;
reportDocument.Load(ReportPath + "Reports\\GroupWise_CrystalReport.rpt");
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "DB_LoanApplication";
//connectionInfo.UserID = "wms";
//connectionInfo.Password = "wms";
connectionInfo.IntegratedSecurity = true;
SetDBLogonForReport(connectionInfo, reportDocument);
reportDocument.SetParameterValue("@GroupId", GroupId);
GroupWisecrystalReport.ReportSource = reportDocument;
GroupWisecrystalReport.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
}
示例14: FormSupplierPayment_Print_Load
private void FormSupplierPayment_Print_Load(object sender, EventArgs e)
{
try
{
// int TransactionID;
//SaleTransactionID = Convert.ToInt32(cbSupplier.SelectedValue.ToString());
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
string ReportPath = ConfigurationManager.AppSettings["ReportPath"];
paramField.Name = "@SupplierPaymentID";
paramDiscreteValue.Value = @SupplierPaymentID;
reportDocument.Load(ReportPath+"SupplierPay_Print_CrystalReport.rpt");
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM";
//connectionInfo.UserID = "wms";
//connectionInfo.Password = "wms";
connectionInfo.IntegratedSecurity = true;
SetDBLogonForReport(connectionInfo, reportDocument);
reportDocument.SetParameterValue("@SupplierPaymentID", SupplierPaymentID);
SupplierPyCrystalPrint.ReportSource = reportDocument;
SupplierPyCrystalPrint.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
示例15: btninfoBitacora_Click
protected void btninfoBitacora_Click(object sender, EventArgs e)
{
string Ciclo = this.ddlCiclo.SelectedValue;
DBEstadisticas.Escolar db = new DBEstadisticas.Escolar();
var Bitacora = (from P in db.Bitacora
where P.Ciclo == Ciclo
group P by new { P.Z, P.P, P.Descripcion } into g
select new { Z = g.Key.Z, P = g.Key.P, g.Key.Descripcion, Fecha = g.Max(x => x.Fecha) }).OrderByDescending(x => x.Fecha).ToList();
if (Bitacora.Count == 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", string.Format("alert('{0}');", "No hay registros encontrados"), true);
return;
}
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("../Reportes/rptEstBitacora01.rpt"));
rptDoc.SetDataSource(Bitacora);
rptDoc.SetParameterValue("Ciclo", Ciclo);
MemoryStream stream = (MemoryStream)rptDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
rptDoc.Close();
rptDoc.Dispose();
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "inline; filename=rptEstBitacora01.xls");
Response.BinaryWrite(stream.ToArray());
Response.End();
stream.Close();
stream.Dispose();
}