/// <summary> /// Disconnect objects from database /// </summary> /// <returns>True if success, otherwise false</returns> public bool Disconnect() { // Trace begin function message if (m_TraceSwitch.TraceInfo) { TraceLog.Write("OleDataSet", "Disconnect", "End function", "", TraceLog.TraceMsgLevel.Message, m_TraceSwitch); } // Disconnect TCase table if (m_TCase.Disconnect() == false) { // Trace warning message if (m_TraceSwitch.TraceWarning) { TraceLog.Write("OleDataSet", "Disconnect", "Cannot disconnect TCase table. Function exit before end with false parameter", "", TraceLog.TraceMsgLevel.Warning, m_TraceSwitch); } return(false); } // Disconnect TOS table if (m_TOS.Disconnect() == false) { // Trace warning message if (m_TraceSwitch.TraceWarning) { TraceLog.Write("OleDataSet", "Disconnect", "Cannot disconnect TOperatingSystems table. Function exit before end with false parameter", "", TraceLog.TraceMsgLevel.Warning, m_TraceSwitch); } return(false); } // Disconnect TPriority table if (m_TPriority.Disconnect() == false) { // Trace warning message if (m_TraceSwitch.TraceWarning) { TraceLog.Write("OleDataSet", "Disconnect", "Cannot disconnect TPriority table. Function exit before end with false parameter", "", TraceLog.TraceMsgLevel.Warning, m_TraceSwitch); } return(false); } // Disconnect TState table if (m_TState.Disconnect() == false) { // Trace warning message if (m_TraceSwitch.TraceWarning) { TraceLog.Write("OleDataSet", "Disconnect", "Cannot disconnect TState table. Function exit before end with false parameter", "", TraceLog.TraceMsgLevel.Warning, m_TraceSwitch); } return(false); } // Disconnect TType table if (m_TType.Disconnect() == false) { // Trace warning message if (m_TraceSwitch.TraceWarning) { TraceLog.Write("OleDataSet", "Disconnect", "Cannot disconnect TType table. Function exit before end with false parameter", "", TraceLog.TraceMsgLevel.Warning, m_TraceSwitch); } return(false); } // Disconnect TUsers table if (m_TUsers.Disconnect() == false) { // Trace warning message if (m_TraceSwitch.TraceWarning) { TraceLog.Write("OleDataSet", "Disconnect", "Cannot disconnect TUsers table. Function exit before end with false parameter", "", TraceLog.TraceMsgLevel.Warning, m_TraceSwitch); } return(false); } try { // Dispose DataSet m_DataSet.Dispose(); m_DataSet = null; } catch (Exception ex) { // Trace error message if (m_TraceSwitch.TraceError) { TraceLog.Write("OleDataSet", "Disconnect", "Error while dispose m_DataSet. Cause : " + ex.Message, ex.Source, TraceLog.TraceMsgLevel.Error, m_TraceSwitch); } return(false); } // Trace end function message if (m_TraceSwitch.TraceInfo) { TraceLog.Write("OleDataSet", "Disconnect", "End function", "", TraceLog.TraceMsgLevel.Message, m_TraceSwitch); } return(true); }