or
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using SistemaControlGuarderias.CJFBD;
using ModeloSolicitudesGuarderias;
using ClsGrals;
using System.Data.SqlClient;
using Reportes;
namespace SistemaControlGuarderias
{
public partial class ConsultaReporte : System.Web.UI.Page
{
string sScript;
byte circuito;
short estado,ciudad;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
var usuarioSession = (Usuario)Session["usuarioSesion"];
Label3.Text = usuarioSession.NombreNPM;
if (usuarioSession.RolRD == 2)
{
Label4.Text = "ADMINISTRADOR CENDI CENTRAL";
}
llenaComboEstatus();
llenaComboCto();
}
}
private void llenaComboCto()
{
RadComboBox2.Items.Insert(0, new RadComboBoxItem(" Seleccionar ", "0"));
RadComboBox2.Items.Insert(1, new RadComboBoxItem("1", "1"));
RadComboBox2.Items.Insert(2, new RadComboBoxItem("2", "2"));
RadComboBox2.Items.Insert(3, new RadComboBoxItem("3", "3"));
RadComboBox2.Items.Insert(4, new RadComboBoxItem("4", "4"));
RadComboBox2.Items.Insert(5, new RadComboBoxItem("5", "5"));
RadComboBox2.Items.Insert(6, new RadComboBoxItem("6", "6"));
RadComboBox2.Items.Insert(7, new RadComboBoxItem("7", "7"));
RadComboBox2.Items.Insert(8, new RadComboBoxItem("8", "8"));
RadComboBox2.Items.Insert(9, new RadComboBoxItem("9", "9"));
RadComboBox2.Items.Insert(10, new RadComboBoxItem("10", "10"));
RadComboBox2.Items.Insert(11, new RadComboBoxItem("11", "11"));
RadComboBox2.Items.Insert(12, new RadComboBoxItem("12", "12"));
RadComboBox2.Items.Insert(13, new RadComboBoxItem("13", "13"));
RadComboBox2.Items.Insert(14, new RadComboBoxItem("14", "14"));
RadComboBox2.Items.Insert(15, new RadComboBoxItem("15", "15"));
RadComboBox2.Items.Insert(16, new RadComboBoxItem("16", "16"));
RadComboBox2.Items.Insert(17, new RadComboBoxItem("17", "17"));
RadComboBox2.Items.Insert(18, new RadComboBoxItem("18", "18"));
RadComboBox2.Items.Insert(19, new RadComboBoxItem("19", "19"));
RadComboBox2.Items.Insert(20, new RadComboBoxItem("20", "20"));
RadComboBox2.Items.Insert(21, new RadComboBoxItem("21", "21"));
RadComboBox2.Items.Insert(22, new RadComboBoxItem("22", "22"));
RadComboBox2.Items.Insert(23, new RadComboBoxItem("23", "23"));
RadComboBox2.Items.Insert(24, new RadComboBoxItem("24", "24"));
RadComboBox2.Items.Insert(25, new RadComboBoxItem("25", "25"));
RadComboBox2.Items.Insert(26, new RadComboBoxItem("26", "26"));
RadComboBox2.Items.Insert(27, new RadComboBoxItem("27", "27"));
RadComboBox2.Items.Insert(28, new RadComboBoxItem("28", "28"));
RadComboBox2.Items.Insert(29, new RadComboBoxItem("29", "29"));
RadComboBox2.Items.Insert(30, new RadComboBoxItem("30", "30"));
RadComboBox2.Items.Insert(31, new RadComboBoxItem("31", "31"));
}
private void llenaComboEstatus()
{
RadComboBox1.Items.Insert(0, new RadComboBoxItem(" Seleccionar ", "0"));
}
protected void RadComboBox2_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
circuito = Convert.ToByte(RadComboBox2.SelectedValue);
if (RadComboBox2.SelectedIndex==0)
{
Session["RepCircuito"] = Convert.ToInt32(0);
}
Session["RepCircuito"] = circuito;
// Session["RepStatus"] = "";
var EdosContext = new BD_INSTEntities();
}
protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
//if(RadComboBox1.SelectedIndex ==0)
//{
// Session["RepStatus"] = null;
//}
//else
//{
Session["RepStatus"] = RadComboBox1.SelectedValue;
// Session["RepCircuito"] = "0";
//}
}
private void Alerta(string sMensaje)
{
sScript = "<
script
>javascript:alert(' :: ";
sScript += sMensaje;
sScript += " ::');</
script
>";
Controls.Add(new LiteralControl(sScript));
}
protected void btnGeneraRep_Click(object sender, EventArgs e)
{
if(Session["RepStatus"] != null && Session["fecha1"] == null && Session["fecha2"] == null )
{
Alerta("Elige un rango de fechas");
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
//Session["RepStatus"] = null;
//Session["RepCircuito"] = null;
return;
}
if (Session["RepStatus"] == null && Session["fecha1"] == null && Session["fecha2"] == null && Session["RepCircuito"] == null)
{
Alerta("Selecciona solo los campos que se te piden");
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
//Session["RepStatus"] = null;
//Session["RepCircuito"] = null;
return;
}
if (Session["RepStatus"] == null && Session["fecha1"] != null && Session["fecha2"] != null && Session["RepCircuito"] == null)
{
Alerta("Selecciona solo los campos que se te piden");
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
//Session["RepStatus"] = null;
//Session["RepCircuito"] = null;
return;
}
if (Session["RepCircuito"]!= null && Session["RepStatus"] == null && Session["fecha1"] == null && Session["fecha2"] == null)
{
Response.Write("<
script
type
=
'text/javascript'
>detailedresults=window.open('iuReportexCriterio.aspx');</
script
>");
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
return;
}
if (Session["RepStatus"].ToString() != "0" && Session["fecha1"] != null && Session["fecha2"] != null )
{
Response.Write("<
script
type
=
'text/javascript'
>detailedresults=window.open('iuReportexCriterio.aspx');</
script
>");
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
return;
}
if (Session["RepStatus"].ToString() != "0" && Session["fecha1"] != null && Session["fecha2"] != null && RadComboBox2.SelectedIndex!=0)
{
Response.Write("<
script
type
=
'text/javascript'
>detailedresults=window.open('iuReportexCriterio.aspx');</
script
>");
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
//Alerta("Selecciona solo los campos que se te piden");
//RadDatePicker1.SelectedDate = null;
//RadDatePicker2.SelectedDate = null;
//RadComboBox1.ClearSelection();
//RadComboBox2.ClearSelection();
////Session["RepStatus"] = null;
////Session["RepCircuito"] = null;
return;
}
if (Session["RepStatus"].ToString() != "0" && Session["fecha1"] != null && Session["fecha2"] != null )
{
Response.Write("<
script
type
=
'text/javascript'
>detailedresults=window.open('iuReportexCriterio.aspx');</
script
>");
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
//Session["RepCircuito"] = null;
//Session["fecha1"] = null;
//Session["fecha2"] = null;
//Session["RepStatus"] = null;
return;
}
else
{
Alerta("Selecciona un Estatus y rango de fechas ");
}
RadDatePicker1.SelectedDate = null;
RadDatePicker2.SelectedDate = null;
RadComboBox1.ClearSelection();
RadComboBox2.ClearSelection();
}
protected void RadDatePicker1_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
{
Session["fecha1"] = RadDatePicker1.SelectedDate;
}
protected void RadDatePicker2_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
{
Session["fecha2"] = RadDatePicker2.SelectedDate;
}
protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
{
if (e.Item.Text == "SALIR")
{
FormsAuthentication.SignOut();
Session.Abandon();
Response.Redirect("iuLogin.aspx");
}
}
protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
{
if (e.Item.Text == "Registrada")
{
e.Item.Text = "Registradas/En Lista de Espera";
}
}
}
}
public partial class iuReportexCriterio : System.Web.UI.Page
{
string parametro;
private DateTime fecha1, fecha2;
private string sScript;
protected void Page_Load(object sender, EventArgs e)
{
//int total = Convert.ToInt32(Session["ReportSource"].ToString());
//parametro = Convert.ToString(Session["RepStatus"].ToString());
int parametro2 = (Convert.ToInt32(Session["RepCircuito"]));
//string parametro = Session["RepStatus"].ToString();
//Session["RepStatus"] = "Registrada";
//if (parametro2 != 0&& Session["RepCircuito"] == null&&Session["fecha1"]== null&&Session["fecha2"] == null)
//{
// var report = new CriterioReporte2(parametro2);
// report.ReportParameters.Add("Circuito", ReportParameterType.Integer, parametro2);
// ReportViewer1.Report = report;
// Session["RepStatus"] = null;
// Session["RepCircuito"] = null;
// Session["fecha1"] = null;
// Session["fecha2"] = null;
// return;
//}
if (Session["RepStatus"]!=null && Session["fecha1"] != null && Session["fecha2"] != null )
{
parametro = Session["RepStatus"].ToString();
//fecha1 = (DateTime) Session["fecha1"];
//fecha2 = (DateTime) Session["fecha2"];
var concentrado = new RepConcentrado();
//if (total == 0)
////if (concentrado.Report.DataSource == null)
//{
// Alerta("NO hay registros con el criterio seleccionado");
// Response.Write("<
script
type
=
'text/javascript'
>detailedresults=window.close('iuReportexCriterio.aspx');</
script
>");
//}
ReportViewer1.Report = concentrado;
Session["RepStatus"] = null;
Session["RepCircuito"] = null;
Session["fecha1"] = null;
Session["fecha2"] = null;
return;
}
if (!IsPostBack)
{
if (parametro != "" )
{
var report = new CriterioReporte(parametro, fecha1, fecha2);
//var totales = new ReoTotales(parametro2, fecha1, fecha2);
//var concentrado = new RepConcentrado();
report.ReportParameters.Add("Estatus", ReportParameterType.String, parametro);
report.ReportParameters.Add("fecha1", ReportParameterType.DateTime, fecha1);
report.ReportParameters.Add("fecha2", ReportParameterType.DateTime, fecha2);
// totales.ReportParameters.Add("Circuito", ReportParameterType.Integer, parametro2);
ReportViewer1.Report = report;
}
if (parametro2 != 0 && parametro==null)
{
var report = new CriterioReporte2(parametro2);
report.ReportParameters.Add("Circuito", ReportParameterType.Integer, parametro2);
ReportViewer1.Report = report;
}
}
Session["RepCircuito"] = null;
Session["fecha1"] = null;
Session["fecha2"] = null;
Session["RepStatus"] = null;
}
private void Alerta(string sMensaje)
{
sScript = "<
script
>javascript:alert(' :: ";
sScript += sMensaje;
sScript += " ::');</
script
>";
Controls.Add(new LiteralControl(sScript));
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using ModeloSolicitudesGuarderias;
using System.Linq;
using System.Web;
namespace Reportes
{
/// <
summary
>
/// Summary description for CriterioReporte.
/// </
summary
>
public partial class CriterioReporte : Telerik.Reporting.Report
{
short claveEdo, claveCd;
int circuito;
//private List<
Menor
> RepMenores
//{
// get
// {
// if (HttpContext.Current.Session["RepMenores"] == null)
// {
// var _RepMenores = new List<
Menor
>();
// HttpContext.Current.Session["RepMenores"] = _RepMenores;
// }
// return (List<
Menor
>)HttpContext.Current.Session["RepMenores"];
// }
// set { HttpContext.Current.Session["RepMenores"] = value; }
//}
public CriterioReporte(string Estatus,DateTime fecha,DateTime fecha2)
{
InitializeComponent();
if (fecha != fecha2)
{
var bdsseguaReporte = new BD_SSEGUAEntities();
var query = from m in bdsseguaReporte.Menores
where
((m.Solicitud.CTEdoSolicitud.fcDescEdoSol == Estatus) &&
((m.fdFchRegMenor >= fecha.Date && m.fdFchRegMenor <= fecha2.Date)))
select m;
Report.DataSource = query;
//if (query.Count() > 0)
//{
// RepMenores.Add(query as Menor);
//}
}
//if (RepMenores.Count() == 0)
//{
// //Report.DataSource = null;
// HttpContext.Current.Session["ReportSource"] =RepMenores.Count();
//}
//else
//{
// Report.DataSource = RepMenores;
// return;
//}
if (fecha == fecha2)
{
var fech2 = fecha2.AddDays(1);
var bdsseguaReporte = new BD_SSEGUAEntities();
Report.DataSource = from m in bdsseguaReporte.Menores
where
((m.Solicitud.CTEdoSolicitud.fcDescEdoSol == Estatus) &&
((m.fdFchRegMenor >= fecha.Date && m.fdFchRegMenor <= fech2)))
select m;
}
textBox25.Value = "Periodo: del" +" "+ fecha.ToShortDateString() +" "+ "al" +" "+ fecha2.ToShortDateString();
textBox24.Value = "Fecha:"+" "+DateTime.Now.ToShortDateString();
//textBox31.Value = "Registradas/En Lista de Espera";
// TODO: Add any constructor code after InitializeComponent call
//
}
private void textBox8_ItemDataBound(object sender, EventArgs e)
{
claveEdo = Convert.ToInt16((sender as Telerik.Reporting.Processing.TextBox).Value);
var bdinstContext = new BD_INSTEntities();
var estado = (from edo in bdinstContext.Cat_Edo
where edo.cve_edo == claveEdo
select edo).First();
(sender as Telerik.Reporting.Processing.TextBox).Value = estado.nom_edo;
}
private void textBox9_ItemDataBound(object sender, EventArgs e)
{
claveCd = Convert.ToInt16((sender as Telerik.Reporting.Processing.TextBox).Value);
var bdinstContext = new BD_INSTEntities();
var ciudad = (from cd in bdinstContext.Cat_cd
where (cd.cve_cd == claveCd) && (cd.cve_edo == claveEdo)
select cd).First();
(sender as Telerik.Reporting.Processing.TextBox).Value = ciudad.nom_cd;
}
private void groupHeaderSection1_ItemDataBound(object sender, EventArgs e)
{
//var section = (sender as Telerik.Reporting.Processing.GroupSection);
//var txtCirc = (Telerik.Reporting.Processing.TextBox)section.ChildElements.Find("textBox28", false)[0];
//List<
int
> list = null;
//var circuito = Convert.ToInt32(txtCirc);
//list.Add(circuito);
//System.Web.HttpContext.Current.Session["txtCirc"] = txtCirc;
}
private void textBox31_ItemDataBound(object sender, EventArgs e)
{
//if(textBox31.Value=="Registrada")
//{
// textBox31.Value = "Registradas/En Lista de Espera";
//}
}
private void reportHeaderSection1_ItemDataBound(object sender, EventArgs e)
{
var section = (sender as Telerik.Reporting.Processing.ReportSection);
if (section != null)
{
var txtStatus = (Telerik.Reporting.Processing.TextBox)section.ChildElements.Find("textBox31", false)[0];
if (txtStatus.Text == "Registrada")
{
txtStatus.Value = "Registradas/En Lista de Espera";
}
}
}
}
}
An error has occured while processing Table 'crosstab1':
An error has occured while resolving 'MyObjectSource' data source: Ein Objekt muss IConvertible implementieren.
Sorry if I mistake with forum, I don't know where post this question.
So my question is, can I use Telerik Reporting with Oracle APEX.
Again sorry.
Thanks.