public OrmBenchmarkDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public bool Connect() { // Check for valid connection string if(m_sConnectionString == null || m_sConnectionString.Length == 0) throw( new Exception("Invalid database connection string")); // Disconnect if already connected Disconnect(); // Get ADONET connection object m_oConnection = GetConnection(); m_oConnection.ConnectionString = this.ConnectionString; // Implement connection retries for(int i=0; i <= m_nRetryConnect; i++) { try { m_oConnection.Open(); if(m_oConnection.State == ConnectionState.Open) { m_bConnected = true; break; } } catch { if(i == m_nRetryConnect) throw; // Wait for 1 second and try again Thread.Sleep(1000); } } // Get command object m_oCommand = m_oConnection.CreateCommand(); m_oCommand.CommandTimeout = m_nCommandTimeout; return m_bConnected; }
public SchedulingDataClassesDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); }
public ClaimDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); }
public OrdiniProduzioneAdapter(System.Data.IDbConnection connection, IDbTransaction transaction) : base(connection, transaction) { }
public DataClasses_PortalDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); }
public Classwork___May_23DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public void Open() { EnableRecover = false; if (DbConnection != null && DbConnection.State != System.Data.ConnectionState.Closed && DbConnection.State != System.Data.ConnectionState.Broken) return; Lfx.Workspace.Master.DebugLog(this.Handle, "Abriendo " + this.Name); System.Text.StringBuilder ConnectionString = new System.Text.StringBuilder(); switch (Lfx.Data.DataBaseCache.DefaultCache.AccessMode) { case AccessModes.Odbc: if (Lfx.Data.DataBaseCache.DefaultCache.Provider == null) Lfx.Data.DataBaseCache.DefaultCache.Provider = new qGen.Providers.Odbc(); ConnectionString.Append("DSN=" + Lfx.Data.DataBaseCache.DefaultCache.ServerName + ";"); Lfx.Data.DataBaseCache.DefaultCache.ServerName = "(ODBC)"; break; case AccessModes.MySql: if (Lfx.Data.DataBaseCache.DefaultCache.Provider == null) Lfx.Data.DataBaseCache.DefaultCache.Provider = new qGen.Providers.MySql(); ConnectionString.Append("Convert Zero Datetime=true;"); ConnectionString.Append("Connection Timeout=30;"); ConnectionString.Append("Default Command Timeout=9000;"); ConnectionString.Append("Allow User Variables=True;"); ConnectionString.Append("Allow Batch=True;"); // ConnectionString.Append("KeepAlive=20;"); // No sirve, uso KeepAlive propio ConnectionString.Append("Pooling=true;"); ConnectionString.Append("Cache Server Properties=false;"); switch (System.Text.Encoding.Default.BodyName) { case "utf-8": ConnectionString.Append("charset=utf8;"); break; case "iso-8859-1": ConnectionString.Append("charset=latin1;"); break; } if (Lfx.Data.DataBaseCache.DefaultCache.SlowLink) { ConnectionString.Append("Compress=true;"); ConnectionString.Append("Use Compression=true;"); } Lfx.Data.DataBaseCache.DefaultCache.OdbcDriver = null; Lfx.Data.DataBaseCache.DefaultCache.Mars = false; Lfx.Data.DataBaseCache.DefaultCache.SqlMode = qGen.SqlModes.MySql; break; case AccessModes.Npgsql: if (Lfx.Data.DataBaseCache.DefaultCache.Provider == null) Lfx.Data.DataBaseCache.DefaultCache.Provider = new qGen.Providers.Npgsql(); ConnectionString.Append("CommandTimeout=900;"); Lfx.Data.DataBaseCache.DefaultCache.SqlMode = qGen.SqlModes.PostgreSql; break; case AccessModes.MSSql: if (Lfx.Data.DataBaseCache.DefaultCache.Provider == null) Lfx.Data.DataBaseCache.DefaultCache.Provider = new qGen.Providers.Odbc(); Lfx.Data.DataBaseCache.DefaultCache.OdbcDriver = "SQL Server"; Lfx.Data.DataBaseCache.DefaultCache.SqlMode = qGen.SqlModes.TransactSql; break; } if (Lfx.Data.DataBaseCache.DefaultCache.OdbcDriver != null) ConnectionString.Append("DRIVER={" + Lfx.Data.DataBaseCache.DefaultCache.OdbcDriver + "};"); string Server, Port; if (Lfx.Data.DataBaseCache.DefaultCache.ServerName.IndexOf(':') >= 0) { string[] Temp = Lfx.Data.DataBaseCache.DefaultCache.ServerName.Split(new char[] { ':' }, 2, StringSplitOptions.RemoveEmptyEntries); Server = Temp[0]; Port = Temp[1]; } else { Server = Lfx.Data.DataBaseCache.DefaultCache.ServerName; Port = null; } ConnectionString.Append("SERVER=" + Server + ";"); if(string.IsNullOrEmpty(Port) == false) ConnectionString.Append("PORT=" + Port + ";"); if (Lfx.Data.DataBaseCache.DefaultCache.DataBaseName.Length > 0) ConnectionString.Append("DATABASE=" + Lfx.Data.DataBaseCache.DefaultCache.DataBaseName + ";"); ConnectionString.Append("UID=" + Lfx.Data.DataBaseCache.DefaultCache.UserName + ";"); ConnectionString.Append("PWD=" + Lfx.Data.DataBaseCache.DefaultCache.Password + ";"); DbConnection = Lfx.Data.DataBaseCache.DefaultCache.Provider.GetConnection(); DbConnection.ConnectionString = ConnectionString.ToString(); try { DbConnection.Open(); } catch (Exception ex) { throw ex; } this.SetupConnection(this.DbConnection); EnableRecover = true; if (KeepAlive > 0 && KeepAliveTimer == null) { KeepAliveTimer = new System.Timers.Timer(this.KeepAlive * 1000); KeepAliveTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.KeepAliveTimer_Elapsed); KeepAliveTimer.Start(); } if (DbConnection is System.Data.Odbc.OdbcConnection) { System.Data.Odbc.OdbcConnection OdbcConnection = DbConnection as System.Data.Odbc.OdbcConnection; try { OdbcConnection.StateChange -= new System.Data.StateChangeEventHandler(this.Connection_StateChange); } catch { // Nada } OdbcConnection.StateChange += new System.Data.StateChangeEventHandler(this.Connection_StateChange); } if (Lfx.Workspace.Master.ServerVersion == null) Lfx.Workspace.Master.ServerVersion = this.ServerVersion; }
public BookLibrary(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public JustBuyEntityDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public linqChiTieuDanSuatDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public DB_ViaticosDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); }
public MailSenderDBDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
/// <summary> /// Realiza una conexión con la Base de Datos /// </summary> /// <returns></returns> public bool Connect() { try { // Validar si el 'ConnectionString' es válido if (m_sConnectionString == null || m_sConnectionString.Length == 0) { if (m_oLog != null) { m_oLog.TraceError("La cadena de conexión para la Base de Datos no es válida.", m_idConexion); } throw (new DataAccessException("La cadena de conexión para la Base de Datos no es válida.", -50)); } // Desconectarse si esta actualmente conectado Disconnect(); // Obtener el objeto ADO.NET Conection m_oConnection = GetConnection(); m_oConnection.ConnectionString = m_sConnectionString; // Intentar conectar for (int i = 0; i <= m_nRetryConnect; i++) { if (m_oLog != null) { if (i > 0) m_oLog.TraceLog("Intento de conexion nro: " + i.ToString(), m_idConexion); } try { m_oConnection.Open(); if (m_oConnection.State == ConnectionState.Open) { m_bConnected = true; break; } } catch { if (i == m_nRetryConnect) throw; // Reintentos cada 1 segundo Thread.Sleep(1000); } } // Obtiene el objeto COMMAND m_oCommand = m_oConnection.CreateCommand(); m_oCommand.CommandTimeout = (m_nCommandTimeout > 0) ? m_nCommandTimeout : m_oConnection.ConnectionTimeout; return m_bConnected; } catch (DataAccessException ex) { throw ex; } catch (Exception ex) { throw new DataAccessException("Error no esperado al realizar la conexión.", ex); } }
public ChatBotDataModelDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public void Connect(String connectionString, String baseDataDir) { if (connectionString == null) connectionString = defaultConnectionString; try { dbConnection = new MySqlConnection (connectionString); dbConnection.Open (); // todo: initialize DB structure } catch (Exception) { throw new Exception("Error connecting to database."); } if (baseDataDir != null) this.baseDataDir = Common.EndDirWithSlash(baseDataDir); if (!Directory.Exists(this.baseDataDir)) { Directory.CreateDirectory(this.baseDataDir); // TODO: make this recursive to create parents } }
public PhantomReporterDBDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public PianificazioneAdapter(System.Data.IDbConnection connection, IDbTransaction transaction) : base(connection, transaction) { }
private void pmUpdateRecord() { string strErrorMsg = ""; bool bllIsNewRow = false; bool bllIsCommit = false; WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); DataRow dtrSaveInfo = this.dtsDataEnv.Tables[this.mstrRefTable].NewRow(); if (this.mFormEditMode == UIHelper.AppFormState.Insert || (objSQLHelper.SetPara(new object[] { this.mstrEditRowID }) && !objSQLHelper.SQLExec(ref this.dtsDataEnv, "QChkRow", this.mstrRefTable, "select cRowID from " + this.mstrRefTable + " where cRowID = ?", ref strErrorMsg))) { bllIsNewRow = true; if (this.mstrEditRowID == string.Empty) { WS.Data.Agents.cConn objConn = WS.Data.Agents.cConn.GetInStance(); this.mstrEditRowID = objConn.RunRowID(this.mstrRefTable); } dtrSaveInfo[MapTable.ShareField.CreateBy] = App.FMAppUserID; dtrSaveInfo[MapTable.ShareField.CreateDate] = objSQLHelper.GetDBServerDateTime(); } // Control Field ที่ทุก Form ต้องมี dtrSaveInfo[MapTable.ShareField.RowID] = this.mstrEditRowID; dtrSaveInfo[MapTable.ShareField.LastUpdateBy] = App.FMAppUserID; dtrSaveInfo[MapTable.ShareField.LastUpdate] = objSQLHelper.GetDBServerDateTime(); // Control Field ที่ทุก Form ต้องมี dtrSaveInfo[QEMPlantInfo.Field.CorpID] = App.ActiveCorp.RowID; dtrSaveInfo[QEMPlantInfo.Field.Code] = this.txtCode.Text.TrimEnd(); dtrSaveInfo[QEMPlantInfo.Field.Name] = this.txtName.Text.TrimEnd(); dtrSaveInfo[QEMPlantInfo.Field.Name2] = this.txtName2.Text.TrimEnd(); dtrSaveInfo["CWORKHOUR"] = this.txtQcStdWorkHr.Tag.ToString(); dtrSaveInfo["CHOLIDAY"] = this.txtQcHoliday.Tag.ToString(); dtrSaveInfo["CWORKCAL"] = ""; dtrSaveInfo["CACTIVE"] = ""; dtrSaveInfo["NCAPACITY"] = 0; dtrSaveInfo["CJOB"] = ""; dtrSaveInfo["CPROJ"] = ""; this.mSaveDBAgent = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); this.mSaveDBAgent.AppID = App.AppID; this.mdbConn = this.mSaveDBAgent.GetDBConnection(); try { this.mdbConn.Open(); this.mdbTran = this.mdbConn.BeginTransaction(IsolationLevel.ReadUncommitted); string strSQLUpdateStr = ""; object[] pAPara = null; cDBMSAgent.GenUpdateSQLString(dtrSaveInfo, "CROWID", bllIsNewRow, ref strSQLUpdateStr, ref pAPara); this.mSaveDBAgent.BatchSQLExec(strSQLUpdateStr, pAPara, ref strErrorMsg, this.mdbConn, this.mdbTran); this.mdbTran.Commit(); bllIsCommit = true; if (this.mFormEditMode == UIHelper.AppFormState.Insert) { KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Insert, TASKNAME, this.txtCode.Text, this.txtName.Text, App.FMAppUserID, App.AppUserName); } else if (this.mFormEditMode == UIHelper.AppFormState.Edit) { if (this.mstrOldCode == this.txtCode.Text && this.mstrOldName == this.txtName.Text) { KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Update, TASKNAME, this.txtCode.Text, this.txtName.Text, App.FMAppUserID, App.AppUserName); } else { KeepLogAgent.KeepLogChgValue(objSQLHelper, KeepLogType.Update, TASKNAME, this.txtCode.Text, this.txtName.Text, App.FMAppUserID, App.AppUserName, this.mstrOldCode, this.mstrOldName); } } } catch (Exception ex) { if (!bllIsCommit) { this.mdbTran.Rollback(); } App.WriteEventsLog(ex); #if xd_RUNMODE_DEBUG MessageBox.Show("Message : " + ex.Message + "\n" + ex.Source + "\n" + ex.StackTrace); #endif } finally { this.mdbConn.Close(); } }
public linqBuuTaGiuLaiDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public ScheduleDataDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public SQLRepositoryDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public FamilyManagementDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public WarehouseLINQDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public FbvAdapter(System.Data.IDbConnection connection, IDbTransaction transaction) : base(connection, transaction) { }
public DataClasses1DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public linqPhatHanhPayPostDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }
public void Disconnect() { // Disconnect can be called from Dispose and should guarantee no errors if(!m_bConnected) return; if(m_oTransaction != null) RollbackTransaction(false); if(m_oCommand != null) { m_oCommand.Dispose(); m_oCommand = null; } if(m_oConnection != null) { try { m_oConnection.Close(); } catch { } m_oConnection.Dispose(); m_oConnection = null; } m_bConnected = false; }
public override void Drop(System.Data.IDbConnection connection) { throw new InvalidOperationException("For your protection, master keys must be dropped manually."); }
private void Inicializa() { m_oConnection = null; m_oCommand = null; m_oTransaction = null; m_sConnectionString = null; m_nroTransaction = 0; m_nCommandTimeout = 0; m_nRetryConnect = 3; m_bDisposed = false; m_bConnected = false; m_sProviderAssembly = null; m_sProviderConnectionClass = null; m_sProviderCommandBuilderClass = null; m_eProvider = PROVIDER_TYPE.PROVIDER_NONE; m_idConexion = 0; m_oDataReader = null; }
private bool pmDeleteRow(string inRowID, string inCode, string inName, ref string ioErrorMsg) { bool bllIsCommit = false; bool bllResult = false; this.mSaveDBAgent = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); this.mSaveDBAgent.AppID = App.AppID; this.mdbConn = this.mSaveDBAgent.GetDBConnection(); this.mSaveDBAgent2 = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside); this.mSaveDBAgent2.AppID = App.AppID; this.mdbConn2 = this.mSaveDBAgent2.GetDBConnection(); try { this.mdbConn.Open(); this.mdbTran = this.mdbConn.BeginTransaction(IsolationLevel.ReadUncommitted); this.mdbConn2.Open(); this.mdbTran2 = this.mdbConn2.BeginTransaction(IsolationLevel.ReadUncommitted); string strErrorMsg = ""; //Delete Child Table Business.Entity.QMasterAcChart QRefChild = new QMasterAcChart(App.ConnectionString, App.DatabaseReside); QRefChild.SetSaveDBAgent(this.mSaveDBAgent, this.mdbConn, this.mdbTran); QRefChild.SetSaveDBAgent2(this.mSaveDBAgent2, this.mdbConn2, this.mdbTran2); QRefChild.DeleteChildTable(inCode); object[] pAPara = new object[1] { inRowID }; this.mSaveDBAgent.BatchSQLExec("delete from " + this.mstrRefTable + " where cRowID = ?", pAPara, ref strErrorMsg, this.mdbConn, this.mdbTran); this.mdbTran.Commit(); this.mdbTran2.Commit(); bllIsCommit = true; WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Delete, TASKNAME, inCode, inName, App.FMAppUserID, App.AppUserName); bllResult = true; } catch (Exception ex) { ioErrorMsg = ex.Message; bllResult = false; if (!bllIsCommit) { this.mdbTran.Rollback(); this.mdbTran2.Rollback(); } App.WriteEventsLog(ex); } finally { this.mdbConn.Close(); this.mdbConn2.Close(); } return(bllResult); }
/// <summary> /// Realiza la desconexión de la Base de Datos /// </summary> public void Disconnect() { try { ValidateDataReader(); bool OpenTransaction = false; // Disconnect puede llamarse desde 'Dispose' y debe garantizar que no hay errores if (!m_bConnected) { return; } // Si quedaron transacciones abiertas, realiza el Rollback if (m_oTransaction != null) { if (m_oLog != null) { m_oLog.TraceLog("Al desconectar se detectaron transacciones abiertas...", m_idConexion); } RollbackTransaction(true); OpenTransaction = true; } // Elimina el objeto Command if (m_oCommand != null) { m_oCommand.Dispose(); m_oCommand = null; } // Elimina el objeto Connection if (m_oConnection != null) { // Intenta cerrar la conexión try { m_oConnection.Close(); } catch { } m_oConnection.Dispose(); m_oConnection = null; } m_bConnected = false; if (OpenTransaction) { throw new DataAccessException("Se han detectado una o mas Transacciones abiertas al momento de desconectarse de la Base de Datos. No se ha podido completar la operación.", -30); } } catch (DataAccessException ex) { throw ex; } catch (Exception ex) { throw new DataAccessException("Error inesperado al desconectase de la Base de Datos.", ex); } }
private void pmUpdateRecord() { string strErrorMsg = ""; bool bllIsNewRow = false; bool bllIsCommit = false; WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); DataRow dtrSaveInfo = this.dtsDataEnv.Tables[this.mstrRefTable].NewRow(); if (this.mFormEditMode == UIHelper.AppFormState.Insert || (objSQLHelper.SetPara(new object[] { this.mstrEditRowID }) && !objSQLHelper.SQLExec(ref this.dtsDataEnv, "QChkRow", this.mstrRefTable, "select cRowID from " + this.mstrRefTable + " where cRowID = ?", ref strErrorMsg))) { bllIsNewRow = true; if (this.mstrEditRowID == string.Empty) { WS.Data.Agents.cConn objConn = WS.Data.Agents.cConn.GetInStance(); this.mstrEditRowID = objConn.RunRowID(this.mstrRefTable); } dtrSaveInfo["cCreateBy"] = App.FMAppUserID; } string strGroup = ""; switch (this.cmbType.SelectedIndex) { case 0: strGroup = "1"; break; case 1: strGroup = "2"; break; case 2: strGroup = "3"; break; case 3: strGroup = "4"; break; case 4: strGroup = "5"; break; case 5: strGroup = "6"; break; } string strCateg = ""; switch (this.cmbCateg.SelectedIndex) { case 0: strCateg = "G"; break; case 1: strCateg = "D"; break; } dtrSaveInfo["cRowID"] = this.mstrEditRowID; dtrSaveInfo["cCode"] = this.txtCode.Text.TrimEnd(); dtrSaveInfo["cName"] = this.txtName.Text.TrimEnd(); dtrSaveInfo["cFChr"] = AppUtil.StringHelper.GetFChr(this.txtName.Text.TrimEnd()); dtrSaveInfo["cName2"] = this.txtName2.Text.TrimEnd(); dtrSaveInfo["cGroup"] = strGroup; dtrSaveInfo["cCateg"] = strCateg; dtrSaveInfo["nLevel"] = this.txtCode.Text.TrimEnd().Length; dtrSaveInfo["cLastUpdBy"] = App.FMAppUserID; dtrSaveInfo["dLastUpd"] = objSQLHelper.GetDBServerDateTime();; this.mSaveDBAgent = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); this.mSaveDBAgent.AppID = App.AppID; this.mdbConn = this.mSaveDBAgent.GetDBConnection(); this.mSaveDBAgent2 = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside); this.mSaveDBAgent2.AppID = App.AppID; this.mdbConn2 = this.mSaveDBAgent2.GetDBConnection(); try { this.mdbConn.Open(); this.mdbTran = this.mdbConn.BeginTransaction(IsolationLevel.ReadUncommitted); this.mdbConn2.Open(); this.mdbTran2 = this.mdbConn2.BeginTransaction(IsolationLevel.ReadUncommitted); string strSQLUpdateStr = ""; object[] pAPara = null; cDBMSAgent.GenUpdateSQLString(dtrSaveInfo, "CROWID", bllIsNewRow, ref strSQLUpdateStr, ref pAPara); this.mSaveDBAgent.BatchSQLExec(strSQLUpdateStr, pAPara, ref strErrorMsg, this.mdbConn, this.mdbTran); Business.Entity.QMasterAcChart QRefChild = new QMasterAcChart(App.ConnectionString, App.DatabaseReside); QRefChild.SetSaveDBAgent(this.mSaveDBAgent, this.mdbConn, this.mdbTran); QRefChild.SetSaveDBAgent2(this.mSaveDBAgent2, this.mdbConn2, this.mdbTran2); QRefChild.SaveChildTable(dtrSaveInfo, this.mstrOldCode); this.mdbTran.Commit(); this.mdbTran2.Commit(); bllIsCommit = true; if (this.mFormEditMode == UIHelper.AppFormState.Insert) { KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Insert, TASKNAME, this.txtCode.Text, this.txtName.Text, App.FMAppUserID, App.AppUserName); } else if (this.mFormEditMode == UIHelper.AppFormState.Edit) { if (this.mstrOldCode == this.txtCode.Text && this.mstrOldName == this.txtName.Text) { KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Update, TASKNAME, this.txtCode.Text, this.txtName.Text, App.FMAppUserID, App.AppUserName); } else { KeepLogAgent.KeepLogChgValue(objSQLHelper, KeepLogType.Update, TASKNAME, this.txtCode.Text, this.txtName.Text, App.FMAppUserID, App.AppUserName, this.mstrOldCode, this.mstrOldName); } } } catch (Exception ex) { if (!bllIsCommit) { this.mdbTran.Rollback(); this.mdbTran2.Rollback(); } App.WriteEventsLog(ex); #if xd_RUNMODE_DEBUG MessageBox.Show("Message : " + ex.Message + "\n" + ex.Source + "\n" + ex.StackTrace); #endif } finally { this.mdbConn.Close(); this.mdbConn2.Close(); } }
public void Close() { if (this.DbConnection != null) { m_Closing = true; try { KeepAliveTimer.Stop(); if (DbConnection.State == System.Data.ConnectionState.Open) DbConnection.Close(); DbConnection.Dispose(); DbConnection = null; } catch (Exception ex) { if (Lfx.Workspace.Master.DebugMode) throw ex; } m_Closing = false; } }
public NorthwindClassesDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); }
public void Dispose() { if (this.Handle == 0 && Lfx.Workspace.Master.Disposing == false) { throw new InvalidOperationException("No se puede deshechar el espacio de trabajo maestro"); } else { Lfx.Workspace.Master.ActiveConnections.Remove(this); Lfx.Workspace.Master.DebugLog(this.Handle, "Deshechando " + this.Name); this.Close(); if (KeepAliveTimer != null) { KeepAliveTimer.Dispose(); KeepAliveTimer = null; } if (DbConnection != null) { DbConnection.Dispose(); DbConnection = null; } //GC.SuppressFinalize(this); } }
public SuperligTakımDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); }