public bool AddRelGroupDept(int comp_id , string rel_grp_id , string[] est_dept_values , string est_id , int estterm_ref_id , DateTime create_date , int create_user) { int affectedRow = 0; if (est_dept_values.Length == 0) { return(false); } IDbConnection conn = DbAgentHelper.CreateDbConnection(); conn.Open(); IDbTransaction trx = conn.BeginTransaction(); try { affectedRow += _relGroupDept.Delete(conn , trx , comp_id , rel_grp_id , 0 , est_id , estterm_ref_id); foreach (string dept_ref_id in est_dept_values) { affectedRow += _relGroupDept.Insert(conn , trx , comp_id , rel_grp_id , DataTypeUtility.GetToInt32(dept_ref_id) , est_id , estterm_ref_id , create_date , create_user); } trx.Commit(); } catch (Exception ex) { trx.Rollback(); return(false); } finally { conn.Close(); } return((affectedRow > 0) ? true : false); }
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); }