本文整理汇总了C#中IDBManager.ExecuteNonQuery方法的典型用法代码示例。如果您正苦于以下问题:C# IDBManager.ExecuteNonQuery方法的具体用法?C# IDBManager.ExecuteNonQuery怎么用?C# IDBManager.ExecuteNonQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDBManager
的用法示例。
在下文中一共展示了IDBManager.ExecuteNonQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateRoutechg
private void UpdateRoutechg(object obj, IDBManager dbmgr)
{
CabRoute item = (CabRoute)obj; // cast object to proper item type
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(8); // create required paramaters
dbmgr.AddParameters(0, "@cable_id", item.cable_id);
dbmgr.AddParameters(1, "@seq", item.seq);
dbmgr.AddParameters(2, "@node_id", item.node_id);
dbmgr.AddParameters(3, "@fz_id", item.fz_id);
dbmgr.AddParameters(4, "@add_del", item.add_del);
dbmgr.AddParameters(5, "@dwg_id", item.dwg_id);
dbmgr.AddParameters(6, "@dwg_rev", item.dwg_rev);
dbmgr.AddParameters(7, "@col_ref", item.col_ref);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.CABROUTE_CHGS_u"); // execute stored procedure
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例2: 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();
}
}
示例3: UpdateStatus
private void UpdateStatus(IDBManager dbmgr, FireArea item, int statustype_id, string user_id, DateTime status_date)
{
if ((user_id == "N/A") || (user_id == ""))
{
// delete status
dbmgr.CreateParameters(2);
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@statustype_id", statustype_id);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FASTATUS_d");
}
else
{
// update status
dbmgr.CreateParameters(4);
dbmgr.AddParameters(0, "@fa_id", item.fa_id);
dbmgr.AddParameters(1, "@statustype_id", statustype_id);
dbmgr.AddParameters(2, "@user_id", user_id);
if (status_date == Convert.ToDateTime(null))
// set date to null
dbmgr.AddParameters(3, "@status_date", null);
else
// update date
dbmgr.AddParameters(3, "@status_date", status_date);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.FASTATUS_u");
}
}
示例4: 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();
}
}
示例5: 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();
}
}
示例6: UpdateRoute
private void UpdateRoute(object obj, IDBManager dbmgr)
{
Route item = (Route)obj;
System.Data.Common.DbParameter param;
try
{
dbmgr.Open();
dbmgr.BeginTransaction();
// check to see if new object
if (item.node_id == 0)
{
// if id is null then new object
dbmgr.CreateParameters(2);
dbmgr.AddParameters(0, "@id", 0, true);
dbmgr.AddParameters(1, "@node", item.node);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.ROUTELIST_i");
// get item id
param = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
item.node_id = Convert.ToInt32(param.Value);
}
// otherwise update existing object
else
{
// update ROUTELIST table
dbmgr.CreateParameters(2);
dbmgr.AddParameters(0, "@node_id", item.node_id);
dbmgr.AddParameters(1, "@node", item.node);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.ROUTELIST_u");
}
dbmgr.CommitTransaction();
}
catch (Exception ex)
{
// if there is problem with transaction roll back to original
dbmgr.RollbackTransaction();
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例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: UpdateComponent
// updates component
private void UpdateComponent(object obj, IDBManager dbmgr)
{
Component item = (Component)obj;
System.Data.Common.DbParameter new_comp_id;
try
{
dbmgr.Open();
dbmgr.BeginTransaction();
// check to see if new object
if (item.comp_id == 0)
{
// if id is null then create new object
dbmgr.CreateParameters(11);
dbmgr.AddParameters(0, "@id", 0, true);
dbmgr.AddParameters(1, "@comp", item.comp);
dbmgr.AddParameters(2, "@pri_sub", item.pri_sub);
dbmgr.AddParameters(3, "@unit_id", item.unit_id);
dbmgr.AddParameters(4, "@sys_id", item.sys_id);
dbmgr.AddParameters(5, "@comp_type_id", item.comp_type_id);
dbmgr.AddParameters(6, "@comp_desc", item.comp_desc);
dbmgr.AddParameters(7, "@ssd_req", item.ssd_req);
dbmgr.AddParameters(8, "@pra_req", item.pra_req);
dbmgr.AddParameters(9, "@npo_req", item.npo_req);
dbmgr.AddParameters(10, "@cfp_req", item.cfp_req);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPLIST_i");
// get item id
new_comp_id = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
item.comp_id = Convert.ToInt32(new_comp_id.Value);
// set old object to null to prevent it from taking value from existing page
SaveHistory(item, null, item.argUser.name, "COMPLIST", item.comp, item.comp, dbmgr, null);
}
// otherwise updating existing object
else
{
// update COMPLIST table
dbmgr.CreateParameters(28);
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@pri_sub", item.pri_sub);
dbmgr.AddParameters(2, "@unit_id", item.unit_id);
dbmgr.AddParameters(3, "@sys_id", item.sys_id);
dbmgr.AddParameters(4, "@train_id", item.train_id);
dbmgr.AddParameters(5, "@comp_type_id", item.comp_type_id);
dbmgr.AddParameters(6, "@comp", item.comp);
dbmgr.AddParameters(7, "@comp_desc", item.comp_desc);
dbmgr.AddParameters(8, "@np_id", item.np_id);
dbmgr.AddParameters(9, "@hsbp_id", item.hsbp_id);
dbmgr.AddParameters(10, "@hsp_id", item.hsp_id);
dbmgr.AddParameters(11, "@csp_id", item.csp_id);
dbmgr.AddParameters(12, "@prap_id", item.prap_id);
dbmgr.AddParameters(13, "@cfpp_id", item.cfpp_id);
dbmgr.AddParameters(14, "@npop_id", item.npop_id);
dbmgr.AddParameters(15, "@npo_np_id", item.npo_np_id);
dbmgr.AddParameters(16, "@fail_elect_id", item.fail_elect_id);
dbmgr.AddParameters(17, "@fail_air_id", item.fail_air_id);
dbmgr.AddParameters(18, "@hi_lo", item.hi_lo);
dbmgr.AddParameters(19, "@ssd_req", item.ssd_req);
dbmgr.AddParameters(20, "@pra_req", item.pra_req);
dbmgr.AddParameters(21, "@npo_req", item.npo_req);
dbmgr.AddParameters(22, "@cfp_req", item.cfp_req);
dbmgr.AddParameters(23, "@nsca_req", item.nsca_req);
dbmgr.AddParameters(24, "@method_id", item.method_id);
dbmgr.AddParameters(25, "@box_id", item.box_id);
dbmgr.AddParameters(26, "@comment", item.comment);
dbmgr.AddParameters(27, "@error_num", 0, true);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPLIST_u");
// update master drawings
UpdateMasterDrawing(dbmgr, item, item.ee_id, item.ee_ref, item.ee_rev, item.ee_cp, 1); // elementary
UpdateMasterDrawing(dbmgr, item, item.pid_id, item.pid_ref, item.pid_rev, item.pid_cp, 2); // p&id
UpdateMasterDrawing(dbmgr, item, item.ol_id, item.ol_ref, item.ol_rev, item.ol_cp, 3); // one-line
// update status
UpdateStatus(dbmgr, item, 1, item.prep_by, item.prep_date);
UpdateStatus(dbmgr, item, 5, item.chkd_by, item.chkd_date);
// save to history
SaveHistory(item, _oldobj, item.argUser.name, "COMPLIST", item.comp, 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();
}
}
示例9: UpdateDrawing
// updates drawing
private void UpdateDrawing(object obj, IDBManager dbmgr)
{
CompDwg item = (CompDwg)obj;
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(5); // create required paramaters
dbmgr.BeginTransaction();
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@dwg_id", item.dwg_id);
dbmgr.AddParameters(2, "@dwgtype_id", 4); // other drawing
dbmgr.AddParameters(3, "@dwg_rev", item.dwg_rev);
dbmgr.AddParameters(4, "@dwg_cp", item.dwg_cp);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPDWGS_u"); // execute stored procedure
// save history
SaveHistory(item, _oldobj, item.argUser.name, "COMPDWGS", item.dwg_ref, 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();
}
}
示例10: DeleteSubcomp
private void DeleteSubcomp(object obj, IDBManager dbmgr)
{
Subcomp item = (Subcomp)obj; // cast object to proper item type
try
{
dbmgr.Open(); // open database
dbmgr.BeginTransaction();
dbmgr.CreateParameters(2); // create required paramaters
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@subcomp", item.subcomp);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.SUBCOMPS_d"); // execute stored procedure
// save history, set current item to null
SaveHistory(null, _oldobj, item.argUser.name, "SUBCOMPS", item.subcomp, 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();
}
}
示例11: UpdateCable
// updates cable
private void UpdateCable(object obj, IDBManager dbmgr)
{
CompCab item = (CompCab)obj;
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(11); // create required paramaters
dbmgr.BeginTransaction();
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@cable_id", item.cable_id);
dbmgr.AddParameters(2, "@note", item.note);
dbmgr.AddParameters(3, "@fault", item.fault);
dbmgr.AddParameters(4, "@fault_type", item.fault_type);
dbmgr.AddParameters(5, "@fr_dwg_rev", item.fr_dwg_rev);
dbmgr.AddParameters(6, "@to_dwg_rev", item.to_dwg_rev);
dbmgr.AddParameters(7, "@ssd_req", item.ssd_req);
dbmgr.AddParameters(8, "@pra_req", item.pra_req);
dbmgr.AddParameters(9, "@npo_req", item.npo_req);
dbmgr.AddParameters(10, "@cfp_req", item.cfp_req);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPCAB_u"); //execute stored procedure
// save history
SaveHistory(item, _oldobj, item.argUser.name, "COMPCAB", item.cable, 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();
}
}
示例12: DeleteComponent
// deletes component
private void DeleteComponent(object obj, IDBManager dbmgr)
{
Component item = (Component)obj;
try
{
dbmgr.Open();
dbmgr.CreateParameters(2);
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@error_num", 0, true);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPLIST_d");
// save to history, make current object null
SaveHistory(null, _oldobj, item.argUser.name, "COMPLIST", item.comp, item.comp, dbmgr, _fieldlist);
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}
示例13: UpdateStatus
private void UpdateStatus(IDBManager dbmgr, Component item, int statustype_id, string user_id, DateTime status_date)
{
if ((user_id == "N/A") || (user_id == ""))
{
// delete status
dbmgr.CreateParameters(2);
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@statustype_id", statustype_id);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPSTATUS_d");
}
else
{
if (status_date == Convert.ToDateTime(null))
{
// update status
dbmgr.CreateParameters(3);
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@statustype_id", statustype_id);
dbmgr.AddParameters(2, "@user_id", user_id);
}
else
{
// update status
dbmgr.CreateParameters(4);
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@statustype_id", statustype_id);
dbmgr.AddParameters(2, "@user_id", user_id);
dbmgr.AddParameters(3, "@status_date", status_date);
}
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPSTATUS_u");
}
}
示例14: UpdateMasterDrawing
private void UpdateMasterDrawing(IDBManager dbmgr, Component item, int dwg_id, string dwg_ref, string dwg_rev, string dwg_cp, int dwg_type)
{
// if drawing ref is empty or N/A then delete
if (dwg_ref == "")
{
dbmgr.CreateParameters(3);
dbmgr.BeginTransaction();
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@dwg_id", dwg_id);
dbmgr.AddParameters(2, "@dwgtype_id", dwg_type);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPDWGS_d");
}
// otherwise update
else
{
// add updated/new
dbmgr.CreateParameters(5);
dbmgr.AddParameters(0, "@comp_id", item.comp_id);
dbmgr.AddParameters(1, "@dwg_id", dwg_id);
dbmgr.AddParameters(2, "@dwgtype_id", dwg_type);
dbmgr.AddParameters(3, "@dwg_rev", dwg_rev);
dbmgr.AddParameters(4, "@dwg_cp", dwg_cp);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.COMPDWGS_MASTER_u");
}
}
示例15: UpdateBDEndpoint
private void UpdateBDEndpoint(object obj, IDBManager dbmgr)
{
RouteBDEndpoint item = (RouteBDEndpoint)obj; // cast object to proper item type
try
{
dbmgr.Open(); // open database
dbmgr.CreateParameters(2); // create required paramaters
dbmgr.AddParameters(0, "@endpt", item.endpt);
dbmgr.AddParameters(1, "@bdendpt", item.bd_endpt);
dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.BDENDPOINTS_u"); // execute stored procedure
}
catch (Exception ex)
{
throw ex;
}
finally
{
dbmgr.Dispose();
}
}