public void delete(CajaEnt caja) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Update Caja Set Estado = 'INACTIVA' From Caja Where Id = @Id"; sqlCommand.Parameters.AddWithValue("@Id", caja.ID); sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); }
public int exists(CajaEnt caja) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Select Count(Id) From Caja Where Estado = 'ACTIVA' And Nombre_De_Equipo = @Nombre_De_Equipo"; sqlCommand.Parameters.AddWithValue("@Nombre_De_Equipo", caja.NOMBRE_DE_EQUIPO); sqlConnection.Open(); int exists = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlConnection.Close(); return exists; }
public int authenticateNumber(CajaEnt caja) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Select Count(Id) From Caja Where Estado = 'ACTIVA' And Numero = @Numero And Id <> @Id"; sqlCommand.Parameters.AddWithValue("@Numero", caja.NUMERO); sqlCommand.Parameters.AddWithValue("@Id", caja.ID); sqlConnection.Open(); int exists = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlConnection.Close(); return exists; }
public int add(CajaEnt caja) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "insertarCaja"; sqlCommand.Parameters.AddWithValue("@Nombre_De_Equipo", caja.NOMBRE_DE_EQUIPO); sqlCommand.Parameters.AddWithValue("@Numero", caja.NUMERO); sqlConnection.Open(); int id = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlConnection.Close(); return id; }
public void update(CajaEnt caja) { objetoCaja.update(caja); }
public int getNumber(CajaEnt caja) { return objetoCaja.getNumber(caja); }
public int getId(CajaEnt caja) { return objetoCaja.getId(caja); }
public DataTable getById(CajaEnt caja) { return objetoCaja.getById(caja); }
public int exists(CajaEnt caja) { return objetoCaja.exists(caja); }
public void delete(CajaEnt caja) { objetoCaja.delete(caja); }
public int authenticateNumber(CajaEnt caja) { return objetoCaja.authenticateNumber(caja); }
public int add(CajaEnt caja) { return objetoCaja.add(caja); }
public DataTable getById(CajaEnt caja) { SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString); SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "Select Numero From Caja Where Id = @Id"; sqlCommand.Parameters.AddWithValue("@Id", caja.ID); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); DataTable dataTable = new DataTable("Caja"); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(dataTable); return dataTable; }