public void delete(ClienteEnt cliente)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Update Cliente Set Estado = 0 Where Id = @Id";
     sqlCommand.Parameters.AddWithValue("@Id", cliente.ID);
     sqlConnection.Open();
     sqlCommand.ExecuteNonQuery();
     sqlConnection.Close();
 }
 public DataTable getByCiONit(ClienteEnt cliente)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Select Id, Nombre From Cliente Where Estado = 1 And Ci_O_Nit = @Ci_O_Nit";
     sqlCommand.Parameters.AddWithValue("@Ci_O_Nit", cliente.CI_O_NIT);
     SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
     DataTable dataTable = new DataTable("Cliente");
     sqlDataAdapter.SelectCommand = sqlCommand;
     sqlDataAdapter.Fill(dataTable);
     return dataTable;
 }
 public int add(ClienteEnt cliente)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.StoredProcedure;
     sqlCommand.CommandText = "insertarCliente";
     sqlCommand.Parameters.AddWithValue("@Ci_O_Nit", cliente.CI_O_NIT);
     sqlCommand.Parameters.AddWithValue("@Nombre", cliente.NOMBRE);
     sqlConnection.Open();
     int id = Convert.ToInt32(sqlCommand.ExecuteScalar());
     sqlConnection.Close();
     return id;
 }
 public int authenticateName(ClienteEnt cliente)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Select Count(Id) From Cliente Where Nombre = @Nombre And Estado = @Estado And Id <> @Id";
     sqlCommand.Parameters.AddWithValue("@Nombre", cliente.NOMBRE);
     sqlCommand.Parameters.AddWithValue("@Estado", cliente.ESTADO);
     sqlCommand.Parameters.AddWithValue("@Id", cliente.ID);
     sqlConnection.Open();
     int exists = (int)sqlCommand.ExecuteScalar();
     sqlConnection.Close();
     return exists;
 }
 public void update(ClienteEnt cliente)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Update Cliente Set Ci_O_Nit = @Ci_O_Nit, Nombre = @Nombre Where Id = @Id";
     sqlCommand.Parameters.AddWithValue("@Ci_O_Nit", cliente.CI_O_NIT);
     sqlCommand.Parameters.AddWithValue("@Nombre", cliente.NOMBRE);
     sqlCommand.Parameters.AddWithValue("@Id", cliente.ID);
     sqlConnection.Open();
     sqlCommand.ExecuteNonQuery();
     sqlConnection.Close();
 }
 public DataTable getById(ClienteEnt cliente)
 {
     return objetoCliente.getById(cliente);
 }
 public void update(ClienteEnt cliente)
 {
     objetoCliente.update(cliente);
 }
 public DataTable getByCiONit(ClienteEnt cliente)
 {
     return objetoCliente.getByCiONit(cliente);
 }
 public void delete(ClienteEnt cliente)
 {
     objetoCliente.delete(cliente);
 }
 public int authenticateName(ClienteEnt cliente)
 {
     return objetoCliente.authenticateName(cliente);
 }
 public int authenticateCiONit(ClienteEnt cliente)
 {
     return objetoCliente.authenticateCiONit(cliente);
 }
 public int add(ClienteEnt cliente)
 {
     return objetoCliente.add(cliente);
 }