public int AddMenuRole(DataTable dataTable , object old_role_ref_id) { MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common _data = new MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common(); int affectedRow = 0; IDbConnection conn = DbAgentHelper.CreateDbConnection(); conn.Open(); IDbTransaction trx = conn.BeginTransaction(); try { foreach (DataRow dataRow in dataTable.Rows) { _data.Delete_RoleMenu(conn , trx , old_role_ref_id , dataRow["MENU_REF_ID"]); affectedRow += _data.Insert_RoleMenu(conn , trx , old_role_ref_id , dataRow["MENU_REF_ID"]); } trx.Commit(); } catch (Exception ex) { trx.Rollback(); return(0); } finally { conn.Close(); } return(affectedRow); }