public int add(GrupoEnt grupo) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "insertarGrupo"; sqlCommand.Parameters.AddWithValue("@Nombre", grupo.NOMBRE); sqlConnection.Open(); int id = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlConnection.Close(); return id; }
public void delete(GrupoEnt grupo) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Update Grupo Set Estado = @Estado Where Id = @Id"; sqlCommand.Parameters.AddWithValue("@Estado", grupo.ESTADO); sqlCommand.Parameters.AddWithValue("@Id", grupo.ID); sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); }
public DataTable search(GrupoEnt grupo) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Select Nombre From Grupo Where Estado = 1 And Id = @Id"; sqlCommand.Parameters.AddWithValue("@Id", grupo.ID); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); sqlDataAdapter.SelectCommand = sqlCommand; DataTable dataTable = new DataTable("Grupo"); sqlDataAdapter.Fill(dataTable); return dataTable; }
public int authenticate(GrupoEnt grupo) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Select Count(Id) From Grupo Where Estado = 1 And Nombre = @Nombre And Id <> @Id"; sqlCommand.Parameters.AddWithValue("@Nombre", grupo.NOMBRE); sqlCommand.Parameters.AddWithValue("@Id", grupo.ID); sqlConnection.Open(); int exists = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlConnection.Close(); return exists; }
public void update(GrupoEnt grupo) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Update Grupo Set Nombre = @Nombre Where Id = @Id"; sqlCommand.Parameters.AddWithValue("@Nombre", grupo.NOMBRE); sqlCommand.Parameters.AddWithValue("@Id", grupo.ID); sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); }
public void update(GrupoEnt grupo) { objetoGrupo.update(grupo); }
public DataTable search(GrupoEnt grupo) { return objetoGrupo.search(grupo); }
public void delete(GrupoEnt grupo) { objetoGrupo.delete(grupo); }
public int authenticate(GrupoEnt grupo) { return objetoGrupo.authenticate(grupo); }
public int add(GrupoEnt grupo) { return objetoGrupo.add(grupo); }