using System;
using System.Data;
using System.Data.OleDb;
using System.Windows.Forms;
using YariSoft.DBUtil;
namespace YariSoft.DBCommander{
public class IManager
{
#region Loacal variables
protected OleDbConnection connecton = null;
protected SchemaGenerator schema = null;
protected bool _initialized = false;
protected bool needRefresh = false;
private ConnectionState previousConnectionState;
#endregion
#region Properties
public bool Initialized
{
get{ return this._initialized; }
}
public bool NeedRefresh
{
get { return this.needRefresh; }
}
#endregion
#region Constructor/Destructor
public IManager( OleDbConnection Connecton, SchemaGenerator SchemaGenerator )
{
this.connecton = Connecton;
this.schema = SchemaGenerator;
}
public virtual void Dispose(){
}
#endregion
#region Protected functions
protected bool OpenConnection()
{
this.previousConnectionState = this.connecton.State;
bool result = true;
try {
if( previousConnectionState == ConnectionState.Closed ){
this.connecton.Open();
}
} catch(Exception Exp ) {
YariSoft.Utils.YMessages.Show( Exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
result = false;
}
return result;
}
protected bool CloseConnection()
{
bool result = true;
try {
if( previousConnectionState == ConnectionState.Closed ){
this.connecton.Close();
}
} catch(Exception Exp ) {
YariSoft.Utils.YMessages.Show( Exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
result = false;
}
return result;
}
#endregion
#region Public functions
public virtual DataView FillData( object SelectValue )
{
this._initialized = true;
return null;
}
public virtual DataView GetData( object SelectValue )
{
return null;
}
public virtual DataView RefreshData( object SelectValue )
{
return null;
}
public virtual bool FillTableDataByFK ( string FKName )
{
return true;
}
public virtual bool UpdateData( object UpdateObject )
{
return true;
}
#endregion
}
}
|