public int anular_comprobante(clsComprobante comprobante) { int filas_afectadas = -1; try { con.conectarBD(); tra = con.conector.BeginTransaction(); cmd = new MySqlCommand("anular_comprobante", con.conector); cmd.CommandType = CommandType.StoredProcedure; cmd.Transaction = tra; cmd.Parameters.Add(new MySqlParameter("@_idcomprobante", MySqlDbType.Int32)); cmd.Parameters[0].Value = comprobante.Idcomprobante; dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { filas_afectadas = Convert.ToInt32(dr["_filas_afectadas"]); } dr.Close(); } tra.Commit(); return(filas_afectadas); } catch (MySqlException ex) { filas_afectadas = -1; tra.Rollback(); return(filas_afectadas); throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }
public int anular_comprobante(clsComprobante comprobante) { return(icompro.anular_comprobante(comprobante)); }