Esempio n. 1
0
 private void cargar()
 {
     if (dtpDsd.Value < dtpHst.Value)
     {
         DataTable tabla       = new DataTable();
         string    fecha_desde = dtpDsd.Value.Date.ToString("yyyy-MM-dd");
         string    fecha_hasta = dtpHst.Value.Date.ToString("yyyy-MM-dd");
         int       idPrac      = -1;
         if (cboPractica.SelectedIndex != -1)
         {
             idPrac = Convert.ToInt32(cboPractica.SelectedValue);
         }
         tabla = oConsultaService.estadisticasPrXConsulta(fecha_desde, fecha_hasta, idPrac);
         if (tabla.Rows.Count == 0)
         {
             string msj = "No existen datos en el período elegido";
             if (idPrac != -1)
             {
                 msj += " y/o del profesional seleccionado...";
             }
             MessageBox.Show(msj, "Estadística no creada", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             dtpDsd.Value = DateTime.Today;
             dtpHst.Value = DateTime.Today;
         }
         else
         {
             ReportDataSource ds = new ReportDataSource("dsPractica", tabla);
             reportViewer1.LocalReport.DataSources.Clear();
             reportViewer1.LocalReport.DataSources.Add(ds);
             this.reportViewer1.RefreshReport();
         }
     }
 }