Esempio n. 1
0
 public CCollection NotInAInB(CCollection ip_coll)
 {
     CCollection v_result = new CCollection(countNotInAInB(ip_coll));
     for (int i = 0; i < ip_coll.index; i++)
     {
         int j;
         for (j = 0; j < index; j++)
         {
             if (s[j] == ip_coll.s[i])
             {
                 break;
             }
         }
         if (j == index)
         {
             v_result.insert(ip_coll.s[i]);
         }
     }
     return v_result;
 }
        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();

                CCollection v_coll_new = new CCollection(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);
                CCollection v_coll_old = new CCollection(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());
                }

                CCollection v_coll_quyen_insert = new CCollection(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 = 1;
                    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();
                }

                CCollection v_coll_quyen_delete = new CCollection(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);
            }
        }