protected string ObtnerDatosMunicipio() { MostrarDatos md = new MostrarDatos(); string con = MostrarDatos.CadenaConexion; SqlConnection conexionSQL = new SqlConnection(con); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT MUNICIPIO, COUNT(MUNICIPIO) AS CANTIDAD FROM PACIENTES GROUP BY MUNICIPIO;"; cmd.CommandType = CommandType.Text; cmd.Connection = conexionSQL; conexionSQL.Open(); DataTable Datos = new DataTable(); Datos.Load(cmd.ExecuteReader()); conexionSQL.Close(); string strDatos; strDatos = "[['Genero', 'Cantidad'],"; foreach (DataRow dr in Datos.Rows) { strDatos = strDatos + "["; strDatos = strDatos + "'" + dr[0] + "'" + "," + dr[1]; strDatos = strDatos + "],"; } strDatos = strDatos + "]"; return(strDatos); }
private void mostrarDatosToolStripMenuItem_Click(object sender, EventArgs e) { MostrarDatos formulario = new MostrarDatos(); formulario.MdiParent = this; formulario.Show(); }
public MostrarDatos Controladorunescurre(string id) { MostrarDatos lista = (from ex in _context.Escurrido join b in _context.Bombo on ex.BomboId equals b.BomboId where ex.EscurridoId == Convert.ToInt32(id) && ex.Activo == true select new MostrarDatos { bombo = b.Num_bombo.ToString(), cantidad = ex.Cantidad, codigo = ex.CodigoLote, fecha = ex.Fecha }).First(); return(lista); }
protected string ObtnerDatosGeneroConRango() { MostrarDatos md = new MostrarDatos(); string con = MostrarDatos.CadenaConexion; SqlConnection conexionSQL = new SqlConnection(con); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT CASE P.GENERO WHEN 'Masculino' THEN 'Masculino' WHEN 'Femenino' THEN 'Femenino' ELSE '' END AS GENERO, " + "COUNT(case when DATEDIFF(YEAR, FECHA_NAC, GETDATE()) >= 0 AND DATEDIFF(YEAR, FECHA_NAC, GETDATE()) <= 10 then 1 end) AS DE_0_A_10," + " COUNT(case when DATEDIFF(YEAR, FECHA_NAC, GETDATE()) >= 11 AND DATEDIFF(YEAR, FECHA_NAC, GETDATE()) <= 25 then 1 end) AS DE_11_A_25, " + "COUNT(case when DATEDIFF(YEAR, FECHA_NAC, GETDATE()) >= 26 AND DATEDIFF(YEAR, FECHA_NAC, GETDATE()) <= 50 then 1 end) AS DE_26_A_50, " + "COUNT(case when DATEDIFF(YEAR, FECHA_NAC, GETDATE()) >= 51 AND DATEDIFF(YEAR, FECHA_NAC, GETDATE()) <= 65 then 1 end) AS DE_51_A_65, " + "COUNT(case when DATEDIFF(YEAR, FECHA_NAC, GETDATE()) >= 66 then 1 end) AS MAYOR_A_66 " + "FROM PACIENTES P group by GENERO"; cmd.CommandType = CommandType.Text; cmd.Connection = conexionSQL; conexionSQL.Open(); DataTable Datos = new DataTable(); Datos.Load(cmd.ExecuteReader()); conexionSQL.Close(); string strDatos; strDatos = "[['Genero', '0 - 10 Años', '11 - 25 Años', '26 - 50 Años', '51 - 65 Años', 'Mayor a 66 Años'],"; foreach (DataRow dr in Datos.Rows) { strDatos = strDatos + "["; strDatos = strDatos + "'" + dr[0] + "', " + dr[1] + ", " + dr[2] + ", " + dr[3] + ", " + dr[4] + ", " + dr[5]; strDatos = strDatos + "],"; } strDatos = strDatos + "]"; return(strDatos); }
protected string ObtnerDatosTurnosMedicos() { MostrarDatos md = new MostrarDatos(); string con = MostrarDatos.CadenaConexion; SqlConnection conexionSQL = new SqlConnection(con); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT(d.NOMBRE + ' ' + d.APELLIDO)AS MEDICO," + " COUNT (CASE WHEN t.ESTADO = 2 then 1 end) as Atendidos, " + "COUNT(CASE WHEN t.ESTADO = 3 then 1 end) as Suspendidos," + "COUNT(CASE WHEN t.ESTADO = 4 then 1 end) as Cancelados FROM MEDICO d " + "inner join TURNOS t on(t.ID_MEDICO = d.ID_MEDICO)" + " group by t.ID_MEDICO, d.NOMBRE, d.APELLIDO; "; cmd.CommandType = CommandType.Text; cmd.Connection = conexionSQL; conexionSQL.Open(); DataTable Datos = new DataTable(); Datos.Load(cmd.ExecuteReader()); conexionSQL.Close(); string strDatos; strDatos = "[['Medico', 'Atendidos', 'Suspendidos', 'Cancelados'],"; foreach (DataRow dr in Datos.Rows) { strDatos = strDatos + "["; strDatos = strDatos + "'" + dr[0] + "', " + dr[1] + ", " + dr[2] + ", " + dr[3]; strDatos = strDatos + "],"; } strDatos = strDatos + "]"; return(strDatos); }
protected string ObtnerDatosNiñoAdulto() { MostrarDatos md = new MostrarDatos(); string con = MostrarDatos.CadenaConexion; SqlConnection conexionSQL = new SqlConnection(con); SqlCommand cmd = new SqlCommand(); cmd.CommandText = " SELECT CASE P.GENERO WHEN 'Masculino' THEN 'Masculino' WHEN 'Femenino' THEN 'Femenino'" + " ELSE ''END AS GENERO," + "COUNT(CASE WHEN DATEDIFF(YEAR, FECHA_NAC, GETDATE()) < 18 then 1 end) as Niños," + "COUNT(CASE WHEN DATEDIFF(YEAR, FECHA_NAC, GETDATE()) >= 18 then 1 end) as Adultos" + " FROM PACIENTES P group by GENERO"; cmd.CommandType = CommandType.Text; cmd.Connection = conexionSQL; conexionSQL.Open(); DataTable Datos = new DataTable(); Datos.Load(cmd.ExecuteReader()); conexionSQL.Close(); string strDatos; strDatos = "[['Genero','Niños', 'Adultos'],"; foreach (DataRow dr in Datos.Rows) { strDatos = strDatos + "["; strDatos = strDatos + "'" + dr[0] + "'" + "," + dr[1] + "," + dr[2]; strDatos = strDatos + "],"; } strDatos = strDatos + "]"; return(strDatos); }
protected void rowUpdatingEvent(object sender, GridViewUpdateEventArgs e) { GridViewRow fila = Grid.Rows[e.RowIndex]; int codigo = Convert.ToInt32(Grid.DataKeys[e.RowIndex].Values[0]); string dpi = (fila.FindControl("TextDPI") as TextBox).Text; string nombre = (fila.FindControl("TextNOMBRE") as TextBox).Text; string apellido = (fila.FindControl("TextAPELLIDO") as TextBox).Text; string Genero = (fila.FindControl("TextGENERO") as TextBox).Text; string direccion = (fila.FindControl("TextDIRECCION") as TextBox).Text; string fechanac = (fila.FindControl("TextFECHANAC") as TextBox).Text; string depto = (fila.FindControl("TextDEPARTAMENTO") as TextBox).Text; string muni = (fila.FindControl("TextMUNICIPIO") as TextBox).Text; if (Grid.DataKeys[e.RowIndex].Value.ToString() == null) { } else { string sql = "update PACIENTES set DPI = '" + dpi + "', NOMBRE = '" + nombre + "', APELLIDO = '" + apellido + "', GENERO = '" + Genero + "', DIRECCION = '" + direccion + "', FECHA_NAC = '" + fechanac + "', DEPARTAMENTO = '" + depto + "', MUNICIPIO = '" + muni + "' where ID_PACIENTE = " + Grid.DataKeys[e.RowIndex].Value.ToString(); MostrarDatos clas_consulta = new MostrarDatos(); if (clas_consulta.non_query(sql)) { obtenerPaciente(); Response.Write("<script>alert('MODIFICACIÓN REALIZADA EXITOSAMENTE')</script>"); } else { Response.Write("<script>alert('NO SE HA PODIDO MODIFICAR')</script>"); } } Grid.EditIndex = -1; obtenerPaciente(); }
private void verDatosToolStripMenuItem_Click(object sender, EventArgs e) { MostrarDatos md = new MostrarDatos(arbol_conexiones); md.Show(); }