private void m_cmd_save_Click(object sender, EventArgs e) { try { US_HT_PHAN_QUYEN_CHO_NHOM v_us_ht_phan_quyen_cho_nhom; DS_HT_PHAN_QUYEN_CHO_NHOM v_ds_ht_phan_quyen_cho_nhom = new DS_HT_PHAN_QUYEN_CHO_NHOM(); collection v_coll_new = new collection(m_lbox_quyen_da_cap.Items.Count); for (int i = 0; i < m_lbox_quyen_da_cap.Items.Count; i++) { v_coll_new.insert(m_lbox_quyen_da_cap.Items[i].ToString()); } US_HT_PHAN_QUYEN_HE_THONG v_us_pqht = new US_HT_PHAN_QUYEN_HE_THONG(); DS_HT_PHAN_QUYEN_HE_THONG v_ds_pqht = new DS_HT_PHAN_QUYEN_HE_THONG(); v_us_pqht.FillDatasetQuyenDaCapByIdUserGroup(v_ds_pqht, m_dc_id_user_group); collection v_coll_old = new collection(v_ds_pqht.Tables[0].Rows.Count); for (int i = 0; i < v_ds_pqht.Tables[0].Rows.Count; i++) { DataRow v_dr = v_ds_pqht.Tables[0].Rows[i]; v_coll_old.insert(v_dr[HT_PHAN_QUYEN_HE_THONG.MA_PHAN_QUYEN].ToString()); } collection v_coll_quyen_insert = new collection(v_coll_new.countInANotInB(v_coll_old)); v_coll_quyen_insert = v_coll_new.InANotInB(v_coll_old); for (int i = 0; i < v_coll_quyen_insert.getIndex(); i++) { v_us_ht_phan_quyen_cho_nhom = new US_HT_PHAN_QUYEN_CHO_NHOM(); v_us_ht_phan_quyen_cho_nhom.dcID_USER_GROUP = m_dc_id_user_group; v_ds_pqht.Clear(); v_us_pqht.FillDatasetByMaPhanQuyen(v_ds_pqht, v_coll_quyen_insert.s[i]); v_us_ht_phan_quyen_cho_nhom.dcID_PHAN_QUYEN_HE_THONG = CIPConvert.ToDecimal(v_ds_pqht.Tables[0].Rows[0][HT_PHAN_QUYEN_HE_THONG.ID]); v_us_ht_phan_quyen_cho_nhom.Insert(); } collection v_coll_quyen_delete = new collection(v_coll_new.countNotInAInB(v_coll_old)); v_coll_quyen_delete = v_coll_new.NotInAInB(v_coll_old); for (int i = 0; i < v_coll_quyen_delete.getIndex(); i++) { v_ds_ht_phan_quyen_cho_nhom.Clear(); v_us_ht_phan_quyen_cho_nhom = new US_HT_PHAN_QUYEN_CHO_NHOM(); v_us_ht_phan_quyen_cho_nhom.FillDatasetByIdUserGroupAndMaPhanQuyen(v_ds_ht_phan_quyen_cho_nhom, m_dc_id_user_group, v_coll_quyen_delete.s[i]); v_us_ht_phan_quyen_cho_nhom.dcID = CIPConvert.ToDecimal(v_ds_ht_phan_quyen_cho_nhom.Tables[0].Rows[0][HT_PHAN_QUYEN_CHO_NHOM.ID]); v_us_ht_phan_quyen_cho_nhom.Delete(); } BaseMessages.MsgBox_Infor("Dữ liệu đã được cập nhật"); this.Close(); } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } }
private void load_data_2_rtxt_quyen_da_cap(decimal ip_dc_id) { US_HT_PHAN_QUYEN_HE_THONG v_us = new US_HT_PHAN_QUYEN_HE_THONG(); DS_HT_PHAN_QUYEN_HE_THONG v_ds = new DS_HT_PHAN_QUYEN_HE_THONG(); v_us.FillDatasetQuyenDaCapByIdUserGroup(v_ds, ip_dc_id); int v_row_count = v_ds.Tables[0].Rows.Count; m_lbox_quyen_da_cap.Items.Clear(); for (int i = 0; i < v_row_count; i++) { DataRow v_dr = v_ds.Tables[0].Rows[i]; m_lbox_quyen_da_cap.Items.Add(v_dr[HT_PHAN_QUYEN_HE_THONG.MA_PHAN_QUYEN]); } }