public string ElminarEstudiante(int ID_Estudiante, Estructuras.Adminstrador administrador) { string mensaje = ""; if (oAdministradorCl.ValidarSession(administrador.Username, administrador.password)) { if (oEstudianteCl.EstudianteRepetido(ID_Estudiante)) { Estructuras.EstudiantePerson oEstudiantePersona = new Estructuras.EstudiantePerson(); var data = oEstudianteCl.ObtenerEstudiante(ID_Estudiante); oEstudiantePersona.Cedula = Convert.ToInt32(data.Tables[0].Rows[0]["cedula"]); oEstudianteCl.EliminarEstudiante(ID_Estudiante); if (oEstudianteCl.IsError) { mensaje = oEstudianteCl.ErrorDescripcion; } oPersonalCl.EliminarPersona(oEstudiantePersona.Cedula); if (oPersonalCl.IsError) { mensaje = mensaje + oPersonalCl.ErrorDescripcion; } mensaje = mensaje + "Estudiante elimiado correctamente"; } else { mensaje = "Ese id de estudiante no existe"; } } else { mensaje = "Fallo al inicio de sesion"; } return mensaje; }
public Estructuras.EstudiantePerson ObtenerEstudiante(int ID_Estudiante) { Estructuras.EstudiantePerson oEstudiantePersona = new Estructuras.EstudiantePerson(); if (oEstudianteCl.EstudianteRepetido(ID_Estudiante)) { var data = oEstudianteCl.ObtenerEstudiante(ID_Estudiante); oEstudiantePersona.Cedula = Convert.ToInt32(data.Tables[0].Rows[0]["cedula"]); oEstudiantePersona.Nombre = data.Tables[0].Rows[0]["nombre"].ToString(); oEstudiantePersona.Apellidos = data.Tables[0].Rows[0]["apellidos"].ToString(); oEstudiantePersona.ID_Estudiante = Convert.ToInt32(data.Tables[0].Rows[0]["id_estudiante"]); oEstudiantePersona.Fecha_nacimiento=Convert.ToDateTime(data.Tables[0].Rows[0]["fecha_nacimiento"]); oEstudiantePersona.ID_Carrera = Convert.ToInt32(data.Tables[0].Rows[0]["id_carrera"]); oEstudiantePersona.Direccion = data.Tables[0].Rows[0]["direccion"].ToString(); } else { } return oEstudiantePersona; }