本文整理汇总了C#中IDBManager.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IDBManager.Dispose方法的具体用法?C# IDBManager.Dispose怎么用?C# IDBManager.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDBManager
的用法示例。
在下文中一共展示了IDBManager.Dispose方法的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: UpdateInterlock
// porcedure update incominginterlock
private void UpdateInterlock(object obj, IDBManager dbmgr)
{
CompIntlk item = (CompIntlk)obj;
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(9); // create required paramaters
dbmgr.BeginTransaction();
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@intlk_id", item.intlk_id);
dbmgr.AddParameters(2, "@device", item.device);
dbmgr.AddParameters(3, "@contacts", item.contacts);
dbmgr.AddParameters(4, "@note", item.note);
dbmgr.AddParameters(5, "@ssd_req", item.ssd_req);
dbmgr.AddParameters(6, "@pra_req", item.pra_req);
dbmgr.AddParameters(7, "@npo_req", item.npo_req);
dbmgr.AddParameters(8, "@cfp_req", item.cfp_req);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPINTLKS_u"); // execute stored procedure
// save hisotry
SaveHistory(item, _oldobj, item.argUser.name, "COMPINTLKS", item.intlk, item.comp, dbmgr, _fieldlist);
dbmgr.CommitTransaction();
}
catch (Exception ex)
{
// if there is problem with transaction roll back to original
dbmgr.RollbackTransaction();
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例4: UpdatePG
private void UpdatePG(object obj, IDBManager dbmgr)
{
FAPG item = (FAPG)obj;
try
{
dbmgr.Open();
dbmgr.CreateParameters(4);
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@pg", item.pg);
dbmgr.AddParameters(2, "@method", item.method);
dbmgr.AddParameters(3, "@comment", item.comment);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FAPG_u");
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例5: UpdateFireArea
private void UpdateFireArea(object obj, IDBManager dbmgr)
{
FireArea item = (FireArea)obj;
System.Data.Common.DbParameter param;
try
{
dbmgr.Open();
dbmgr.BeginTransaction();
// check to see if new object
if (item.fa_id == 0)
{
dbmgr.CreateParameters(3);
dbmgr.AddParameters(0, "@id", 0, true);
dbmgr.AddParameters(1, "@fa", item.fa);
dbmgr.AddParameters(2, "@fa_desc", item.fa_desc);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FALIST_i");
// get item id
param = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
item.fa_id = (int)param.Value;
}
// otherwise update existing object
else
{
dbmgr.CreateParameters(14);
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@fa", item.fa);
dbmgr.AddParameters(2, "@fa_desc", item.fa_desc);
dbmgr.AddParameters(3, "@bldg", item.bldg);
dbmgr.AddParameters(4, "@elev", item.elev);
dbmgr.AddParameters(5, "@ssd_path", item.ssd_path);
dbmgr.AddParameters(6, "@req", item.req);
dbmgr.AddParameters(7, "@supp", item.supp);
dbmgr.AddParameters(8, "@det", item.det);
dbmgr.AddParameters(9, "@comment", item.comment);
dbmgr.AddParameters(10, "@dwg_id", item.dwg_id);
dbmgr.AddParameters(11, "@dwg_rev", item.dwg_rev);
dbmgr.AddParameters(12, "@risk_summary", item.risk_summary);
dbmgr.AddParameters(13, "@reg_basis", item.reg_basis);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FALIST_u"); // execute the stored procedure
//update status
UpdateStatus(dbmgr, item, 1, item.prep_by, item.prep_date);
UpdateStatus(dbmgr, item, 5, item.chkd_by, item.chkd_date);
}
dbmgr.CommitTransaction();
}
catch (Exception ex)
{
dbmgr.RollbackTransaction();
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例6: UpdateCompDisp
private void UpdateCompDisp(object obj, IDBManager dbmgr)
{
FACompDisp item = (FACompDisp)obj; // cast object to proper item type
try
{
dbmgr.Open();
dbmgr.CreateParameters(5); // create required paramaters
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@comp_id", item.comp_id);
dbmgr.AddParameters(2, "@old_disp_id", item.old_disp_id);
dbmgr.AddParameters(3, "@disp_id", item.disp_id);
dbmgr.AddParameters(4, "@status", item.status);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FACOMPDISP_u"); // execute stored procedure
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例7: DeleteFireArea
private void DeleteFireArea(object obj, IDBManager dbmgr)
{
FireArea item = (FireArea)obj; //cast object to proper item type
try
{
dbmgr.Open(); //open database
dbmgr.CreateParameters(1); //create required paramaters
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FALIST_d"); //execute stored procedure
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例8: FetchDataSet
public DataSet FetchDataSet(string criteria)
{
DataSet ds = new DataSet();
string qryString = "SELECT * FROM viewFALIST ORDER BY FA";
_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;
}
示例9: 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();
}
}
示例10: 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();
}
}
示例11: DeleteDrawing
private void DeleteDrawing(object obj, IDBManager dbmgr)
{
Drawing item = (Drawing)obj;
try
{
dbmgr.Open();
dbmgr.CreateParameters(2);
dbmgr.AddParameters(0, "@dwg_id", item.dwg_id);
dbmgr.AddParameters(1, "@error_num", 0, true);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.DWGLIST_d");
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例12: 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 = ((Document)obj).doc_id;
type = "all"; //object is document and get all information
}
_document = new Document();
_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 "firearea":
FetchFAList(id, _dbmgr);
return _document.falist;
default:
FetchDocument(id, _dbmgr);
FetchFAList(id, _dbmgr);
return _document;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
_dbmgr.Dispose();
}
}
示例13: UpdateFireRoom
private void UpdateFireRoom(object obj, IDBManager dbmgr)
{
FireRoom item = (FireRoom)obj;
System.Data.Common.DbParameter param;
try
{
dbmgr.Open();
dbmgr.BeginTransaction();
// check to see if new object
if (item.rm_id == 0)
{
// if id is null then new object
dbmgr.CreateParameters(4);
dbmgr.AddParameters(0, "@rm", item.rm);
dbmgr.AddParameters(1, "@id", 0, true);
dbmgr.AddParameters(2, "@fz_id", item.fz_id);
dbmgr.AddParameters(3, "@rm_desc", item.rm_desc);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FRLIST_i");
// get item id
param = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(1);
item.rm_id = Convert.ToInt32(param.Value);
}
// otherwise update existing object
else
{
// update FRLIST table
dbmgr.CreateParameters(11);
dbmgr.AddParameters(0, "@rm_id", item.rm_id);
dbmgr.AddParameters(1, "@rm", item.rm);
dbmgr.AddParameters(2, "@rm_desc", item.rm_desc);
dbmgr.AddParameters(3, "@bldg", item.bldg);
dbmgr.AddParameters(4, "@elev", item.elev);
dbmgr.AddParameters(5, "@fz_id", item.fz_id);
dbmgr.AddParameters(6, "@req", item.req);
dbmgr.AddParameters(7, "@supp", item.supp);
dbmgr.AddParameters(8, "@det", item.det);
dbmgr.AddParameters(9, "@dwg_id", item.dwg_id);
dbmgr.AddParameters(10, "@dwg_rev", item.dwg_rev);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FRLIST_u");
}
dbmgr.CommitTransaction();
}
catch (Exception ex)
{
// if there is problem with transaction roll back to original
dbmgr.RollbackTransaction();
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例14: DeleteFireRoom
private void DeleteFireRoom(object obj, IDBManager dbmgr)
{
FireRoom item = (FireRoom)obj;
try
{
dbmgr.Open(); // open database
dbmgr.BeginTransaction();
dbmgr.CreateParameters(1); // create required paramaters
dbmgr.AddParameters(0, "@rm_id", item.rm_id);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FRLIST_d"); // 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: 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();
}
}