125 lines
3.8 KiB
C#
125 lines
3.8 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using CRVM.Utility;
|
|||
|
|
using System.Data;
|
|||
|
|
|
|||
|
|
namespace CRVM
|
|||
|
|
{
|
|||
|
|
public class LogicConnect
|
|||
|
|
{
|
|||
|
|
private IDBAccess projDB = null;
|
|||
|
|
private StringConnectItem connstrItem = null;
|
|||
|
|
public EDBItem dbItem;
|
|||
|
|
private ShowStyle style;
|
|||
|
|
//public string sorcStrs = "";
|
|||
|
|
//private string destStrs = "";
|
|||
|
|
private Dictionary<string, string> tableName;
|
|||
|
|
private DataTable dataTable;
|
|||
|
|
private string connstr = "";
|
|||
|
|
private string tablestr;
|
|||
|
|
private string sql1;
|
|||
|
|
private string str = "";
|
|||
|
|
public LogicConnect(EDBItem dbItem, string tablestr)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
this.dbItem = dbItem;
|
|||
|
|
this.tablestr = tablestr;
|
|||
|
|
//ConnectStrs(dbItem);
|
|||
|
|
}
|
|||
|
|
public LogicConnect(EDBItem dbItem, string sql1, ShowStyle style)
|
|||
|
|
{
|
|||
|
|
this.dbItem = dbItem;
|
|||
|
|
this.sql1 = sql1;
|
|||
|
|
this.style = style;
|
|||
|
|
ConnectStrs(dbItem);
|
|||
|
|
}
|
|||
|
|
public LogicConnect(EDBItem dbItem, string sql1, string tablestr)
|
|||
|
|
{
|
|||
|
|
this.dbItem = dbItem;
|
|||
|
|
this.sql1 = sql1;
|
|||
|
|
this.tablestr = tablestr;
|
|||
|
|
ConnectStrs(dbItem);
|
|||
|
|
}
|
|||
|
|
public void ConnectStrs(EDBItem dbItem)
|
|||
|
|
{
|
|||
|
|
// dbItem = connstrItem.dbItem;
|
|||
|
|
|
|||
|
|
if (dbItem != null)
|
|||
|
|
{
|
|||
|
|
connstrItem = new StringConnectItem();
|
|||
|
|
connstr = StringConnectItem.InitialStrConn(dbItem);
|
|||
|
|
projDB = DBFactory.CreateAccess(dbItem.DataType);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
throw new Exception("请配置数据库数据!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public Dictionary<string, string> GetDataTableName()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
tableName = projDB.GetTableName(connstr, dbItem.Userid);
|
|||
|
|
return tableName;
|
|||
|
|
}
|
|||
|
|
public DataTable GetTableData(string tablename, ShowStyle style)
|
|||
|
|
{
|
|||
|
|
dataTable = projDB.GetTableData(tablename, connstr, style);
|
|||
|
|
return dataTable;
|
|||
|
|
}
|
|||
|
|
public DataTable SelTableData(string tablename, ShowStyle style)
|
|||
|
|
{
|
|||
|
|
dataTable = projDB.SelTableData(tablename, connstr, style);
|
|||
|
|
return dataTable;
|
|||
|
|
}
|
|||
|
|
public DataTable SelTableData(string tablename)
|
|||
|
|
{
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt = projDB.SelTableData(tablename, connstr);
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
public DataTable SelTableData(string tablename,string sql)
|
|||
|
|
{
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt = projDB.SelTableData(tablename,connstr,sql );
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
public DataTable SelStatusTable(string tablename)
|
|||
|
|
{
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt = projDB.SelStatusTable(tablename, connstr);
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
public DataTable TableInfo(string tablename)
|
|||
|
|
{
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt = projDB.GetColumnInfo(tablename, connstr);
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
public DataTable TableData(string tablename)
|
|||
|
|
{
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt = projDB.GetTableData(tablename, connstr);
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
public DataTable DataBase(string sql)
|
|||
|
|
{
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt = projDB.DataBase(connstr, sql);
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取事件信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public DataTable GetEventInfo(ShowStyle style)
|
|||
|
|
{
|
|||
|
|
string sql = "select seq, eventname, field,datavalue,status,tom from T_BPC_TRIGGER order by seq asc";
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt = projDB.GetData(connstr, sql, style);
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|