当前位置: 首页>>代码示例>>C#>>正文


C# IDBManager.CommitTransaction方法代码示例

本文整理汇总了C#中IDBManager.CommitTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# IDBManager.CommitTransaction方法的具体用法?C# IDBManager.CommitTransaction怎么用?C# IDBManager.CommitTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDBManager的用法示例。


在下文中一共展示了IDBManager.CommitTransaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:49,代码来源:DrawingManager.cs

示例2: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:47,代码来源:RouteManager.cs

示例3: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:24,代码来源:FireRoomManager.cs

示例4: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:58,代码来源:FireRoomManager.cs

示例5: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:37,代码来源:ComponentManager.cs

示例6: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:28,代码来源:NPOManager.cs

示例7: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:98,代码来源:ComponentManager.cs

示例8: UpdateDisposition

        private void UpdateDisposition(object obj, IDBManager dbmgr)
        {
            Disposition item = (Disposition)obj;
            System.Data.Common.DbParameter new_disp_id;
            try
            {
                dbmgr.Open();
                dbmgr.BeginTransaction();
                if (item.disp_id == 0)
                {
                    // if is id null then create new object
                    dbmgr.CreateParameters(3);
                    dbmgr.AddParameters(0, "@id", 0, true);
                    dbmgr.AddParameters(1, "@disp", item.disp);
                    dbmgr.AddParameters(2, "@disp_desc", item.disp_desc);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.DISPLIST_i");

                    // get item id
                    new_disp_id = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
                    item.disp_id = Convert.ToInt32(new_disp_id.Value);
                }
                else
                {
                    // update table
                    dbmgr.CreateParameters(3);
                    dbmgr.AddParameters(0, "@disp_id", item.disp_id);
                    dbmgr.AddParameters(1, "@disp", item.disp);
                    dbmgr.AddParameters(2, "@disp_desc", item.disp_desc);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.DISPLIST_u");
                }
                dbmgr.CommitTransaction();
            }
            catch (Exception ex)
            {
                dbmgr.RollbackTransaction();
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:42,代码来源:DispositionManager.cs

示例9: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:29,代码来源:ComponentManager.cs

示例10: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:39,代码来源:ComponentManager.cs

示例11: UpdateCable

        // updates cable
        private void UpdateCable(object obj, IDBManager dbmgr)
        {
            Cable item = (Cable)obj;
            System.Data.Common.DbParameter new_cable_id;

            try
            {
                dbmgr.Open();
                dbmgr.BeginTransaction();

                // check to see if new object
                if (item.cable_id == 0)
                {
                    // if id is null then create new object
                    dbmgr.CreateParameters(4);
                    dbmgr.AddParameters(0, "@id", 0, true);
                    dbmgr.AddParameters(1, "@cable", item.cable);
                    dbmgr.AddParameters(2, "@fr_equip_id", item.fr_equip_id);
                    dbmgr.AddParameters(3, "@to_equip_id", item.to_equip_id);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.CABLIST_i");

                    // get item id
                    new_cable_id = (System.Data.Common.DbParameter)dbmgr.Parameters.GetValue(0);
                    item.cable_id = Convert.ToInt32(new_cable_id.Value);
                }
                else
                {
                    // update CABLIST table
                    dbmgr.CreateParameters(12);
                    dbmgr.AddParameters(0, "@cable_id", item.cable_id);
                    dbmgr.AddParameters(1, "@cable", item.cable);
                    dbmgr.AddParameters(2, "@fr_equip_id", item.fr_equip_id);
                    dbmgr.AddParameters(3, "@to_equip_id", item.to_equip_id);
                    dbmgr.AddParameters(4, "@fr_dwg_id", item.fr_dwg_id);
                    dbmgr.AddParameters(5, "@to_dwg_id", item.to_dwg_id);
                    dbmgr.AddParameters(6, "@fr_equip_bd", item.fr_equip_bd);
                    dbmgr.AddParameters(7, "@to_equip_bd", item.to_equip_bd);
                    dbmgr.AddParameters(8, "@cable_len", item.cable_len);
                    dbmgr.AddParameters(9, "@cable_size", item.cable_size);
                    dbmgr.AddParameters(10, "@cable_code", item.cable_code);
                    dbmgr.AddParameters(11, "@comment", item.comment);
                    dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.CABLIST_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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:61,代码来源:CableManager.cs

示例12: UpdateUser

        private void UpdateUser(object obj, IDBManager dbmgr)
        {
            User item = (User)obj;

            try
            {
                dbmgr.Open();
                dbmgr.CreateParameters(7);
                dbmgr.BeginTransaction();
                dbmgr.AddParameters(0, "@name", item.name);
                dbmgr.AddParameters(1, "@lname", item.lname);
                dbmgr.AddParameters(2, "@fname", item.fname);
                dbmgr.AddParameters(3, "@initial", item.initial);
                dbmgr.AddParameters(4, "@level", item.level);
                dbmgr.AddParameters(5, "@password", item.password);
                dbmgr.AddParameters(6, "@plant", item.plant);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.USERLIST_u");

                dbmgr.CommitTransaction();
            }
            catch (Exception ex)
            {
                dbmgr.RollbackTransaction();
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:30,代码来源:UserManager.cs

示例13: DeleteUser

        private void DeleteUser(object obj, IDBManager dbmgr)
        {
            User item = (User)obj;

            try
            {
                dbmgr.Open();
                dbmgr.BeginTransaction();

                dbmgr.CreateParameters(1);
                dbmgr.AddParameters(0, "NAME", item.name);
                dbmgr.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.USERLIST_d");

                dbmgr.CommitTransaction();
            }
            catch (Exception ex)
            {
                dbmgr.RollbackTransaction();
                throw ex;
            }
            finally
            {
                dbmgr.Dispose();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:25,代码来源:UserManager.cs

示例14: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:30,代码来源:NSCAManager.cs

示例15: 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();
            }
        }
开发者ID:DanielSpalding,项目名称:Projects,代码行数:33,代码来源:ComponentManager.cs


注:本文中的IDBManager.CommitTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。