public void close(AperturaDeCajaEnt aperturaDeCaja)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Update Apertura_De_Caja Set Cerrado = 1 Where Cerrado = 1 And Id = @Id";
     sqlCommand.Parameters.AddWithValue("@Id", aperturaDeCaja.ID);
     sqlConnection.Open();
     sqlCommand.ExecuteNonQuery();
     sqlConnection.Close();
 }
 public int exist(AperturaDeCajaEnt aperturaDeCaja)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Select Count(Id) From Apertura_De_Caja Where Cerrado = 0 And Id_Caja = @Id_Caja";
     sqlCommand.Parameters.AddWithValue("@Id_Caja", aperturaDeCaja.ID_CAJA);
     sqlConnection.Open();
     int exist = Convert.ToInt32(sqlCommand.ExecuteScalar());
     sqlConnection.Close();
     return exist;
 }
 public DataTable get(AperturaDeCajaEnt aperturaDeCaja)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Select Id, Monto From Apertura_De_Caja Where Cerrado = 0 And Id_Usuario = @Id_Usuario "
         + "And Id_Caja = @Id_Caja";
     sqlCommand.Parameters.AddWithValue("@Id_Usuario", aperturaDeCaja.ID_USUARIO);
     sqlCommand.Parameters.AddWithValue("@Id_Caja", aperturaDeCaja.ID_CAJA);
     SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
     DataTable dataTable = new DataTable("AperturaDeCaja");
     sqlDataAdapter.SelectCommand = sqlCommand;
     sqlDataAdapter.Fill(dataTable);
     return dataTable;
 }
 public int add(AperturaDeCajaEnt aperturaDeCaja)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.StoredProcedure;
     sqlCommand.CommandText = "insertarAperturaDeCaja";
     sqlCommand.Parameters.AddWithValue("@Id_Usuario", aperturaDeCaja.ID_USUARIO);
     sqlCommand.Parameters.AddWithValue("@Id_Caja", aperturaDeCaja.ID_CAJA);
     sqlCommand.Parameters.AddWithValue("@Hora", aperturaDeCaja.HORA);
     sqlCommand.Parameters.AddWithValue("@Monto", aperturaDeCaja.MONTO);
     sqlConnection.Open();
     int id = Convert.ToInt32(sqlCommand.ExecuteScalar());
     sqlConnection.Close();
     return id;
 }
 public int getId(AperturaDeCajaEnt aperturaDeCaja)
 {
     return objetoAperturaDeCaja.getId(aperturaDeCaja);
 }
 public DataTable get(AperturaDeCajaEnt aperturaDeCaja)
 {
     return objetoAperturaDeCaja.get(aperturaDeCaja);
 }
 public int exists(AperturaDeCajaEnt aperturaDeCaja)
 {
     return objetoAperturaDeCaja.exists(aperturaDeCaja);
 }
 public void close(AperturaDeCajaEnt aperturaDeCaja)
 {
     objetoAperturaDeCaja.close(aperturaDeCaja);
 }
 public int add(AperturaDeCajaEnt aperturaDeCaja)
 {
     return objetoAperturaDeCaja.add(aperturaDeCaja);
 }
 public int getId(AperturaDeCajaEnt aperturaDeCaja)
 {
     SqlConnection sqlConnection = new SqlConnection(ConexionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Select Id From Apertura_De_Caja Where Cerrado = 0 And Id_Usuario = @Id_Usuario "
         + "And Id_Caja = @Id_Caja";
     sqlCommand.Parameters.AddWithValue("@Id_Usuario", aperturaDeCaja.ID_USUARIO);
     sqlCommand.Parameters.AddWithValue("@Id_Caja", aperturaDeCaja.ID_CAJA);
     sqlConnection.Open();
     int id = Convert.ToInt32(sqlCommand.ExecuteScalar());
     sqlConnection.Close();
     return id;
 }