public bool ActualizaCorreo(PersonaModel Per) { SqlConnection connection = null; connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand("PERSONAS_ACT", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@ACCION", 1); command.Parameters.AddWithValue("@USR", -1); command.Parameters.AddWithValue("@PER_SILICIO", Per.per_id); command.Parameters.AddWithValue("@TCO", 3); command.Parameters.AddWithValue("@VALOR", Per.correo); connection.Open(); int i = command.ExecuteNonQuery(); connection.Close(); if (i >= 1) { return(true); } else { return(false); } }
public PersonaModel BuscaPersonaPorPer(int per) { var model = new PersonaModel(); using (SqlConnection connection = new SqlConnection(connectionString)) using (SqlCommand command = new SqlCommand("", connection)) { connection.Open(); command.CommandText = "EXEC PERSONAS_SEL @ACCION, @PER"; command.Parameters.AddWithValue("@ACCION", 2); command.Parameters.AddWithValue("@PER", per); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { model.per_id = (int)reader["per_id"]; model.rut = (int)reader["rut"]; model.dv = (string)reader["dv"]; model.rutdv = (string)reader["rutdv"]; model.nombres = (string)reader["nombres"]; model.paterno = (string)reader["paterno"]; model.materno = (string)reader["materno"]; model.genero = (string)reader["genero"]; model.fecha_nacimiento = (DateTime)reader["fecha_nacimiento"]; model.celular = (string)reader["celular"]; model.correo = (string)reader["correo"]; } reader.Close(); connection.Close(); } return(model); }