Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
 public DataTable getById(ClienteEnt cliente)
 {
     return objetoCliente.getById(cliente);
 }
Ejemplo n.º 7
0
 public void update(ClienteEnt cliente)
 {
     objetoCliente.update(cliente);
 }
Ejemplo n.º 8
0
 public DataTable getByCiONit(ClienteEnt cliente)
 {
     return objetoCliente.getByCiONit(cliente);
 }
Ejemplo n.º 9
0
 public void delete(ClienteEnt cliente)
 {
     objetoCliente.delete(cliente);
 }
Ejemplo n.º 10
0
 public int authenticateName(ClienteEnt cliente)
 {
     return objetoCliente.authenticateName(cliente);
 }
Ejemplo n.º 11
0
 public int authenticateCiONit(ClienteEnt cliente)
 {
     return objetoCliente.authenticateCiONit(cliente);
 }
Ejemplo n.º 12
0
 public int add(ClienteEnt cliente)
 {
     return objetoCliente.add(cliente);
 }