本文整理汇总了C#中IDBManager.Open方法的典型用法代码示例。如果您正苦于以下问题:C# IDBManager.Open方法的具体用法?C# IDBManager.Open怎么用?C# IDBManager.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDBManager
的用法示例。
在下文中一共展示了IDBManager.Open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fetch
public object Fetch(object obj)
{
int id;
id = ((FireRoom)obj).rm_id;
// initialize
_fireroom = new FireRoom();
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
_dbmgr = new DBManager(_user.plantDBStr);
_dbmgr.ConnectionString = _user.plantDBStr;
try
{
_dbmgr.Open();
// fetch object information
FetchFireRoom(id, _dbmgr);
FetchComponentList(id, _dbmgr);
FetchCableList(id, _dbmgr);
FetchRouteList(id, _dbmgr);
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
return _fireroom;
}
示例2: Fetch
// fetches object and object items
// user has option of passing object itself OR a string with id and type delimited by '|'
public object Fetch(object obj)
{
int id = ((CableBlock)obj).comp_id;
// create new object and database connection
_cabBlock = new CableBlock();
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
_dbmgr = new DBManager(_user.plantDBStr);
_dbmgr.ConnectionString = _user.plantDBStr;
try
{
_dbmgr.Open();
FetchComponent(id, _dbmgr);
FetchCableBlock(id, _dbmgr);
FetchVertexList(id, _dbmgr);
return _cabBlock;
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
}
示例3: Fetch
public object Fetch(object obj)
{
int id;
string type; //type of object passed
string objtype = obj.GetType().ToString(); //get object type
if (objtype == "System.String")
{
string[] strTemp = ((string)obj).Split(new char[] { '|' }); //if the object type is a string then extract the id and type
id = Convert.ToInt32(strTemp[0]);
type = strTemp[1];
}
else
{
id = ((Drawing)obj).dwg_id;
type = "all"; //object is drawing and get all information
}
_drawing = new Drawing();
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
_dbmgr = new DBManager(_user.plantDBStr);
_dbmgr.ConnectionString = _user.plantDBStr;
try
{
_dbmgr.Open();
switch (type)
{
case "component":
FetchComponentList(id, _dbmgr);
return _drawing.componentlist;
case "cable":
FetchCableList(id, _dbmgr);
return _drawing.cablelist;
case "routeloca":
FetchRoutelocaList(id, _dbmgr);
return _drawing.routelocalist;
default:
FetchDrawing(id, _dbmgr);
FetchComponentList(id, _dbmgr);
FetchCableList(id, _dbmgr);
FetchRoutelocaList(id, _dbmgr);
return _drawing;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
}
示例4: Fetch
// fetches object and object items
// user has option of passing object itself OR a string with id and type delimited by '|'
public object Fetch(object obj)
{
int id;
string type;
string objtype = obj.GetType().ToString();
if (objtype == "System.String")
{
string[] strTemp = ((string)obj).Split(new char[] { '|' });
id = Convert.ToInt32(strTemp[0]);
type = strTemp[1];
}
else
{
id = ((Component)obj).comp_id;
type = "all";
}
// create new object and database connection
_comp = new Component();
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
_dbmgr = new DBManager(_user.plantDBStr);
_dbmgr.ConnectionString = _user.plantDBStr;
try
{
_dbmgr.Open();
// determine type
switch (type)
{
case "ra":
FetchRAList(id, _dbmgr);
return _comp.ralist;
default:
FetchComponent(id, _dbmgr);
FetchFACompDispList(id, _dbmgr);
FetchRAList(id, _dbmgr);
return _comp;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
}
示例5: Fetch
// fetches user information
public object Fetch(object obj)
{
string type;
string objtype = obj.GetType().ToString();
if (objtype == "System.String")
type = "userlist";
else
type = "user";
_user = new User();
_dbmgr = new DBManager(DBHelper.getProvider(Config.getValue("DBStr", "")));
_dbmgr.ConnectionString = Config.getValue("DBStr", "");
try
{
_dbmgr.Open();
switch (type)
{
case "userlist":
FetchAccessList(_dbmgr);
return _accesslist;
default:
FetchUser(obj, _dbmgr);
//if (_user.initial != null)
// FetchPlantInfo(_user, _dbmgr);
return _user;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
}
示例6: FetchDataSet
public DataSet FetchDataSet(string criteria)
{
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
DataSet ds = new DataSet();
string qryString;
switch (_user.plant)
{
case "BLN":
case "TFAC":
qryString = "SELECT * FROM viewROUTELIST_FR ORDER BY NODE";
break;
default:
qryString = "SELECT * FROM viewROUTELIST ORDER BY NODE";
break;
}
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
_dbmgr = new DBManager(_user.plantDBStr);
_dbmgr.ConnectionString = _user.plantDBStr;
try
{
_dbmgr.Open();
ds = (DataSet)_dbmgr.ExecuteDataSet(CommandType.Text, qryString);
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
return ds;
}
示例7: UpdateRA
// updates recovery action
private void UpdateRA(object obj, IDBManager dbmgr)
{
CompRA item = (CompRA)obj;
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(6); // create required paramaters
dbmgr.BeginTransaction();
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@fa_id", item.fa_id);
dbmgr.AddParameters(2, "@ra_disp", item.ra_disp);
dbmgr.AddParameters(3, "@bin", item.bin);
dbmgr.AddParameters(4, "@ra_type", item.ra_type);
dbmgr.AddParameters(5, "@ra_feasible", item.ra_feasible);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FACOMPRA_u"); // execute stored procedure
dbmgr.CommitTransaction();
}
catch (Exception ex)
{
// if there is problem with transaction roll back to original
dbmgr.RollbackTransaction();
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例8: Fetch
public object Fetch(object obj)
{
int fa_id;
int comp_id = 0;
string type; // type of object passed
string objtype = obj.GetType().ToString(); // get object type
if (objtype == "System.String")
{
string[] strTemp = ((string)obj).Split(new char[] { '|' }); // if the object type is a string then extract the id and type
fa_id = Convert.ToInt32(strTemp[0]);
type = strTemp[1];
comp_id = Convert.ToInt32(strTemp[2]);
}
else
{
fa_id = ((FireArea)obj).fa_id;
type = "all"; // object is a cable and get all information
}
_firearea = new FireArea();
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
_dbmgr = new DBManager(_user.plantDBStr);
_dbmgr.ConnectionString = _user.plantDBStr;
try
{
_dbmgr.Open();
switch (type)
{
//case "facompdisp":
// FetchCompDispList(fa_id, _dbmgr);
// return _firearea.compdisplist;
case "facabdisp":
FetchCabDispList(fa_id, comp_id, _dbmgr);
break;
//return _firearea.cabdisplist;
case "facompinfo":
FetchCabDispList(fa_id, comp_id, _dbmgr);
break;
//return _firearea;
case "faB3Table":
FetchFireArea(fa_id, _dbmgr);
FetchVFDRList(fa_id, _dbmgr);
FetchPGList(fa_id, _dbmgr);
FetchGENdocList(fa_id, _dbmgr);
FetchEEdocList(fa_id, _dbmgr);
FetchLICdocList(fa_id, _dbmgr);
FetchIgnitionList(fa_id, _dbmgr);
FetchProtectionList(fa_id, _dbmgr);
break;
//return _firearea;
case "all":
FetchFireArea(fa_id, _dbmgr);
FetchCompDispList(fa_id, _dbmgr);
FetchCascPowerList("SSD", fa_id, _dbmgr);
FetchCascIntlkList("SSD", fa_id, _dbmgr);
break;
//return _firearea;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
return _firearea;
}
示例9: UpdateVFDR
private void UpdateVFDR(object obj, IDBManager dbmgr)
{
FAVFDR item = (FAVFDR)obj;
try
{
dbmgr.Open();
dbmgr.CreateParameters(6);
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@vfdr_id", item.vfdr_id);
dbmgr.AddParameters(2, "@vfdr", item.vfdr);
dbmgr.AddParameters(3, "@vfdr_disp", item.vfdr_disp);
dbmgr.AddParameters(4, "@status", item.status);
dbmgr.AddParameters(5, "@fre_ref", item.fre_ref);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FAVFDR_u");
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例10: DeleteVFDR
private void DeleteVFDR(object obj, IDBManager dbmgr)
{
FAVFDR item = (FAVFDR)obj;
try
{
dbmgr.Open();
dbmgr.CreateParameters(2);
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@vfdr_id", item.vfdr_id);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FAVFDR_d");
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例11: UpdateDocument
private void UpdateDocument(object obj, IDBManager dbmgr)
{
FADoc item = (FADoc)obj;
try
{
dbmgr.Open();
dbmgr.CreateParameters(3);
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@doc_id", item.doc_id);
dbmgr.AddParameters(2, "@comment", item.comment);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FADOC_u");
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例12: FetchComboList
public ArrayList FetchComboList(string initMsg, string param)
{
string qryString = "SELECT DISTINCT CABLE_ID, CABLE FROM viewFADATA_SSD WHERE FA_ID = @fa_id AND COMP_ID = @comp_id ORDER BY CABLE";
ArrayList list = new ArrayList();
string[] strTemp = ((string)param).Split(new char[] { '|' });
int fa_id = Convert.ToInt32(strTemp[0]);
int comp_id = Convert.ToInt32(strTemp[1]);
_user = (User)System.Web.HttpContext.Current.Session[Constant.session.User];
_dbmgr = new DBManager(_user.plantDBStr);
_dbmgr.ConnectionString = _user.plantDBStr;
try
{
// initialize
if (initMsg.Length > 0)
list.Add(new ComboBoxItem(initMsg, "0"));
_dbmgr.Open();
_dbmgr.CreateParameters(2);
_dbmgr.AddParameters(0, "@fa_id", fa_id);
_dbmgr.AddParameters(1, "@comp_id", comp_id);
_dbmgr.ExecuteReader(CommandType.Text, qryString);
while (_dbmgr.DataReader.Read() == true)
{
if (_dbmgr.DataReader.GetInt32(0) != 0)
list.Add(new ComboBoxItem(_dbmgr.DataReader.GetString(1), _dbmgr.DataReader.GetInt32(0).ToString())); ;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
return list;
}
示例13: DeleteCabDisp
private void DeleteCabDisp(object obj, IDBManager dbmgr)
{
FACabDisp item = (FACabDisp)obj; // cast object to proper item type
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(4); // create required paramaters
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@comp_id", item.comp_id);
dbmgr.AddParameters(2, "@cable_id", item.cable_id);
dbmgr.AddParameters(3, "@disp_id", item.disp_id);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FACABDISP_d"); // execute stored procedure
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例14: UpdateKSF
// updates key safety function
private void UpdateKSF(object obj, IDBManager dbmgr)
{
CompKSF item = (CompKSF)obj;
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(4); // create required paramaters
dbmgr.BeginTransaction();
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@ksf_id", item.ksf_id);
dbmgr.AddParameters(2, "@mode_id", item.mode_id);
dbmgr.AddParameters(3, "@note", item.note);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPKSF_u"); // execute stored procedure
dbmgr.CommitTransaction();
}
catch (Exception ex)
{
// if there is problem with transaction roll back to original
dbmgr.RollbackTransaction();
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例15: UpdateDrawing
private void UpdateDrawing(object obj, IDBManager dbmgr)
{
Drawing item = (Drawing)obj;
System.Data.Common.DbParameter param;
try
{
dbmgr.Open();
dbmgr.BeginTransaction();
// check to see if new object
if (item.dwg_id == 0)
{
// if id is null then new object
dbmgr.CreateParameters(3);
dbmgr.AddParameters(0, "@id", 0, true);
dbmgr.AddParameters(1, "@dwg_ref", item.dwg_ref);
dbmgr.AddParameters(2, "@dwg_rev", item.dwg_rev);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.DWGLIST_i");
// get item id
param = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
item.dwg_id = Convert.ToInt32(param.Value);
}
// otherwise update existing object
else
{
dbmgr.CreateParameters(5);
dbmgr.AddParameters(0, "@dwg_id", item.dwg_id);
dbmgr.AddParameters(1, "@dwg_ref", item.dwg_ref);
dbmgr.AddParameters(2, "@dwg_rev", item.dwg_rev);
dbmgr.AddParameters(3, "@dwg_type", item.dwg_type);
dbmgr.AddParameters(4, "@dwg_desc", item.dwg_desc);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.DWGLIST_u");
}
dbmgr.CommitTransaction();
}
catch (Exception ex)
{
dbmgr.RollbackTransaction();
throw ex;
}
finally
{
dbmgr.Dispose();
}
}