예제 #1
0
        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);
            }
        }
예제 #2
0
        public int countNotInAInB(collection ip_coll)
        {
            int v_count = 0;

            for (int i = 0; i < index; i++)
            {
                for (int j = 0; j < ip_coll.index; j++)
                {
                    if (s[i] == ip_coll.s[j])
                    {
                        v_count++;
                        break;
                    }
                }
            }
            return(ip_coll.index - v_count);
        }
예제 #3
0
        public collection NotInAInB(collection ip_coll)
        {
            collection v_result = new collection(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);
        }