public static clsPadre Padre_Comprobar_siExiste(string argDNI) { clsPadre mipadre = null; SqlConnection miConexion; miConexion = new SqlConnection(mdlCadenaConeccion.MiCadenaConexion); SqlCommand elComando; elComando = new SqlCommand("usp_Padre_comprobar_siExiste", miConexion); elComando.CommandType = System.Data.CommandType.StoredProcedure; elComando.Parameters.AddWithValue("@parNumDoc", argDNI); miConexion.Open(); SqlDataReader LOSDATOS; LOSDATOS = elComando.ExecuteReader(); //LOSDATOS.Read()==true quiere decir "Mientras haya datos" while (LOSDATOS.Read() == true) { clsIdentificacion aux1 = new clsIdentificacion(Convert.ToByte(LOSDATOS["Identificacion_Codigo"])); mipadre = new clsPadre( aux1, Convert.ToString(LOSDATOS["NDocumento"]), Convert.ToString(LOSDATOS["NombreCompleto"]), Convert.ToString(LOSDATOS["Direccion"]), Convert.ToString(LOSDATOS["NumeroCelular"]), Convert.ToString(LOSDATOS["Trabajo"]), Convert.ToString(LOSDATOS["Correo"]) ); } miConexion.Close(); return(mipadre); }
public clsEstudiante(string argNumeroDocumento, string argApellidosNombres, clsPadre argPadreApoderado_NumDoc, clsPadre argPadre_NumDoc, string argColegioProcedencia, float argPeso, short argTalla, string argCondicionSalud, DateTime argFechaNacimineto) { NumeroDocumento = argNumeroDocumento; ApellidosNombres = argApellidosNombres; PadreApoderado_NumDoc = argPadreApoderado_NumDoc; Padre_NumDoc = argPadre_NumDoc; ColegioProcedencia = argColegioProcedencia; Peso = argPeso; Talla = argTalla; CondicionSalud = argCondicionSalud; FechaNacimiento = argFechaNacimineto; }
public static clsPadre MostrarDatos(string argDNI) { clsPadre mipadre = null; SqlConnection miConexion; miConexion = new SqlConnection(mdlCadenaConeccion.MiCadenaConexion); SqlCommand elComando; elComando = new SqlCommand("usp_Padre_mostrar", miConexion); elComando.CommandType = System.Data.CommandType.StoredProcedure; elComando.Parameters.AddWithValue("@parNumDoc", argDNI); miConexion.Open(); SqlDataReader LOSDATOS; LOSDATOS = elComando.ExecuteReader(); //LOSDATOS.Read()==true quiere decir "Mientras haya datos" while (LOSDATOS.Read() == true) { clsDepartemento departemento = new clsDepartemento( Convert.ToByte(LOSDATOS["IDDep"]), Convert.ToString(LOSDATOS["DepNombre"])); clsProvincia provincia = new clsProvincia( Convert.ToByte(LOSDATOS["IDProvincia"]), Convert.ToString(LOSDATOS["PNombre"]), departemento); clsDistrito distrito = new clsDistrito( Convert.ToInt16(LOSDATOS["Distrito"]), Convert.ToString(LOSDATOS["DNombre"]), provincia); mipadre = new clsPadre( Convert.ToString(LOSDATOS["NDocumento"]), Convert.ToString(LOSDATOS["NombreCompleto"]), Convert.ToString(LOSDATOS["Direccion"]), distrito, Convert.ToString(LOSDATOS["NumeroCelular"]), Convert.ToString(LOSDATOS["Trabajo"]), Convert.ToString(LOSDATOS["Correo"]) ); } miConexion.Close(); return(mipadre); }
public static List <clsPadre> listar_porDNI(string argDNI) { List <clsPadre> milistado = new List <clsPadre>(); SqlConnection miConexion; miConexion = new SqlConnection(mdlCadenaConeccion.MiCadenaConexion); SqlCommand elComando; elComando = new SqlCommand("usp_Padre_Listar_por_DNI_o_NumeroDocumento", miConexion); elComando.CommandType = System.Data.CommandType.StoredProcedure; elComando.Parameters.AddWithValue("@parNumeroDoc", argDNI); miConexion.Open(); SqlDataReader LOSDATOS; LOSDATOS = elComando.ExecuteReader(); //LOSDATOS.Read()==true quiere decir "Mientras haya datos" while (LOSDATOS.Read() == true) { clsIdentificacion aux1 = new clsIdentificacion(Convert.ToByte(LOSDATOS["Identificacion_Codigo"])); clsPadre filaDeBaseDeDatos; filaDeBaseDeDatos = new clsPadre( aux1, Convert.ToString(LOSDATOS["NDocumento"]), Convert.ToString(LOSDATOS["NombreCompleto"]), Convert.ToString(LOSDATOS["Direccion"]), Convert.ToString(LOSDATOS["NumeroCelular"]), Convert.ToString(LOSDATOS["Trabajo"]), Convert.ToString(LOSDATOS["Correo"]) ); //Con esta lĂnea estamos agregando cada fila de la //base de datos capturado en un objeto de la clase //Cliente a Milistado milistado.Add(filaDeBaseDeDatos); } miConexion.Close(); return(milistado); }
public static clsEstudiante MostrarDatos(string argNDoc) { clsEstudiante elEstudiante = null; SqlConnection miconexion = new SqlConnection(mdlCadenaConeccion.MiCadenaConexion); SqlCommand elcomando = new SqlCommand("usp_Estudiante_mostrar", miconexion); elcomando.CommandType = System.Data.CommandType.StoredProcedure; elcomando.Parameters.AddWithValue("@parNumDoc", argNDoc); miconexion.Open(); SqlDataReader LosDatos = elcomando.ExecuteReader(); while (LosDatos.Read() == true) { clsPadre primerpadre = new clsPadre(Convert.ToString(LosDatos["Padre1"])); clsPadre segundopadre = null; if (LosDatos["Padre2"] != DBNull.Value) { segundopadre = new clsPadre(Convert.ToString(LosDatos["Padre2"])); } elEstudiante = new clsEstudiante( Convert.ToString(LosDatos["NDocumeto"]), Convert.ToString(LosDatos["ApellidosNombres"]), primerpadre, segundopadre, Convert.ToString(LosDatos["ColegioProcedencia"]), Convert.ToSingle(LosDatos["Peso"]), Convert.ToInt16(LosDatos["Talla"]), Convert.ToString(LosDatos["CondicionSalud"]), Convert.ToDateTime(LosDatos["FechaNacimiento"]) ); } miconexion.Close(); return(elEstudiante); }