public bool RemoveRelGroupInfo(int comp_id, string rel_grp_id) { int affectedRow = 0; IDbConnection conn = DbAgentHelper.CreateDbConnection(); conn.Open(); IDbTransaction trx = conn.BeginTransaction(); try { affectedRow = _relGroupInfo.Delete(conn , trx , comp_id , rel_grp_id); Dac_RelGroupDepts dacDept = new Dac_RelGroupDepts(); dacDept.Delete(conn , trx , comp_id , rel_grp_id , 0 , "" , 0); Dac_RelGroupPositionInfos dacInfos = new Dac_RelGroupPositionInfos(); dacInfos.Delete(conn , trx , comp_id , "" , rel_grp_id); Dac_RelGroupPositionDatas dacDatas = new Dac_RelGroupPositionDatas(); dacDatas.Delete(conn , trx , comp_id , "" , rel_grp_id); trx.Commit(); } catch (Exception ex) { trx.Rollback(); return(false); } finally { conn.Close(); } return((affectedRow > 0) ? true : false); }
public bool RemoveRelGroupPosInfo(DataTable dataTable) { int affectedRow = 0; IDbConnection conn = DbAgentHelper.CreateDbConnection(); conn.Open(); IDbTransaction trx = conn.BeginTransaction(); try { foreach (DataRow dataRow in dataTable.Rows) { affectedRow += _relGroupPosInfo.Delete(conn , trx , DataTypeUtility.GetToInt32(dataRow["COMP_ID"]) , dataRow["REL_GRP_POS_ID"].ToString()); Dac_RelGroupPositionDatas dacDatas = new Dac_RelGroupPositionDatas(); dacDatas.Delete(conn , trx , DataTypeUtility.GetToInt32(dataRow["COMP_ID"]) , dataRow["REL_GRP_POS_ID"].ToString()); } trx.Commit(); } catch (Exception ex) { trx.Rollback(); return(false); } finally { conn.Close(); } return((affectedRow > 0) ? true : false); }