protected void CommitTransaction() { if (m_oTransaction == null) { throw (new Exception("BeginTransaction must be called before commit or rollback. No open transactions found")); } m_oTransaction.Commit(); m_oTransaction.Dispose(); m_oTransaction = null; }
//--------------------------------------------------------------------------------------------------------------------------------------------------------- public void CommitTransaction() { if (dbTransaction == null) { throw (new Exception("BeginTransaction must be called before commit or rollback. No open transactions found")); } dbTransaction.Commit(); dbTransaction.Dispose(); dbTransaction = null; }
public int Excute() { IDbConnection conn = DataBaseManage.GetdbConnection(); int i_Return = 0; try { conn.Open(); trans = conn.BeginTransaction(); Tran(); trans.Commit(); return(i_Return); } catch (Exception ex) { if (trans != null) { trans.Rollback(); } ex.ToString(); return(i_Return); } finally { if (trans != null) { trans.Dispose(); } if (conn != null) { conn.Close(); conn.Dispose(); } } }
public int Excute() { IDbConnection conn = DataBaseManage.GetdbConnection(); int i_Return = 0; try { conn.Open(); trans = conn.BeginTransaction(); Tran(); trans.Commit(); return i_Return; } catch (Exception ex) { if (trans != null) trans.Rollback(); ex.ToString(); return i_Return; } finally { if (trans != null) trans.Dispose(); if (conn != null) { conn.Close(); conn.Dispose(); } } }
public void SaveAppConfig() { if (!Database.Instance.IsConfigured) { configureDatabase(); } System.Data.IDbTransaction trans = Database.Instance.Connection.BeginTransaction(); try { Database.Instance.ExecuteNonQuery("delete from AppConfig", trans); foreach (string key in AppConfig.Keys) { object exists = Database.Instance.ExecuteScalar("select count(*) from AppConfig where ConfigKey=@p0", trans, key); int count; if (exists != null && int.TryParse(exists.ToString(), out count) && count > 0) { Database.Instance.ExecuteNonQuery("update AppConfig set @p0 = @p1", trans, key, AppConfig[key]); } else { Database.Instance.ExecuteNonQuery("insert into AppConfig(ConfigKey, ConfigValue) Values(@p0, @p1)", trans, key, AppConfig[key]); } } trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw ex; } finally { trans.Dispose(); } }
public override Lfx.Types.OperationResult Imprimir() { // Determino la impresora que le corresponde if (this.Impresora == null) { this.Impresora = this.ObtenerImpresora(); } if (this.Plantilla == null) { this.Plantilla = this.ObtenerPlantilla(); } // Es una plantilla común... se imprime con Lázaro Lfx.Types.OperationResult Res = base.Imprimir(); System.Data.IDbTransaction Trans = null; if (this.Connection.InTransaction == false) { Trans = this.Connection.BeginTransaction(); } if (Res.Success) { Lbl.Sys.Config.ActionLog(this.Connection, Lbl.Sys.Log.Acciones.Print, this.Elemento, null); } else { Lbl.Sys.Config.ActionLog(this.Connection, Lbl.Sys.Log.Acciones.PrintFail, this.Elemento, Res.Message); } if (Trans != null) { Trans.Commit(); Trans.Dispose(); Trans = null; } return(Res); }
public void Dispose() { m_innerTransaction.Dispose(); }