private void load_data_2_grid() { US_HT_PHAN_QUYEN_HE_THONG v_us_phan_quyen = new US_HT_PHAN_QUYEN_HE_THONG(); DS_HT_PHAN_QUYEN_HE_THONG v_ds_phan_quyen = new DS_HT_PHAN_QUYEN_HE_THONG(); v_us_phan_quyen.FillDataset(v_ds_phan_quyen); CGridUtils.Dataset2C1Grid(v_ds_phan_quyen, m_fg, m_obj_trans); US_HT_PHAN_QUYEN_CHO_NHOM v_us_phan_quyen_cho_nhom = new US_HT_PHAN_QUYEN_CHO_NHOM(); DS_HT_PHAN_QUYEN_CHO_NHOM v_ds_phan_quyen_cho_nhom = new DS_HT_PHAN_QUYEN_CHO_NHOM(); v_us_phan_quyen_cho_nhom.FillDatasetByGroupUserID(m_us_group.dcID, v_ds_phan_quyen_cho_nhom); //set not null quyen user for (int v_i_cur = m_fg.Rows.Fixed; v_i_cur < m_fg.Rows.Count; v_i_cur++) { m_fg[v_i_cur, (int)e_col_number.LA_QUYEN_USER] = false; } //set quyen foreach (DataRow v_dr in v_ds_phan_quyen_cho_nhom.HT_PHAN_QUYEN_CHO_NHOM.Rows) { for (int v_i_cur = m_fg.Rows.Fixed; v_i_cur < m_fg.Rows.Count; v_i_cur++) { if ((decimal)m_fg[v_i_cur, (int)e_col_number.ID_QUYEN] == (decimal)v_dr[HT_PHAN_QUYEN_CHO_NHOM.ID_PHAN_QUYEN_HE_THONG]) { m_fg[v_i_cur, (int)e_col_number.LA_QUYEN_USER] = true; } } } }
private void save_data() { if (!check_validate()) { return; } form_2_us_object(); switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: m_us_group.Insert(); break; case DataEntryFormMode.UpdateDataState: m_us_group.Update(); break; } US_HT_PHAN_QUYEN_CHO_NHOM v_us_quyen_user = new US_HT_PHAN_QUYEN_CHO_NHOM(); v_us_quyen_user.dcID_NHOM_NGUOI_SU_DUNG = m_us_group.dcID; v_us_quyen_user.DeleteAllQuyenOfGroupUser(m_us_group.dcID); for (int v_i_cur = m_fg.Rows.Fixed; v_i_cur < m_fg.Rows.Count; v_i_cur++) { if ((bool)m_fg[v_i_cur, (int)e_col_number.LA_QUYEN_USER] == true) { v_us_quyen_user.dcID_PHAN_QUYEN_HE_THONG = CIPConvert.ToDecimal(m_fg[v_i_cur, (int)e_col_number.ID_QUYEN]); v_us_quyen_user.Insert(); } } BaseMessages.MsgBox_Infor("Đã cập nhật thành công!"); this.Close(); }
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 save_data() { if (!check_validate()) return; form_2_us_object(); switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: m_us_group.Insert(); break; case DataEntryFormMode.UpdateDataState: m_us_group.Update(); break; } US_HT_PHAN_QUYEN_CHO_NHOM v_us_quyen_user = new US_HT_PHAN_QUYEN_CHO_NHOM(); v_us_quyen_user.dcID_NHOM_NGUOI_SU_DUNG = m_us_group.dcID; v_us_quyen_user.DeleteAllQuyenOfGroupUser(m_us_group.dcID); for (int v_i_cur = m_fg.Rows.Fixed; v_i_cur < m_fg.Rows.Count; v_i_cur++) { if ((bool)m_fg[v_i_cur, (int)e_col_number.LA_QUYEN_USER] == true) { v_us_quyen_user.dcID_PHAN_QUYEN_HE_THONG = CIPConvert.ToDecimal(m_fg[v_i_cur, (int)e_col_number.ID_QUYEN]); v_us_quyen_user.Insert(); } } BaseMessages.MsgBox_Infor("Đã cập nhật thành công!"); this.Close(); }
private void load_data_2_grid() { US_HT_PHAN_QUYEN_HE_THONG v_us_phan_quyen = new US_HT_PHAN_QUYEN_HE_THONG(); DS_HT_PHAN_QUYEN_HE_THONG v_ds_phan_quyen = new DS_HT_PHAN_QUYEN_HE_THONG(); v_us_phan_quyen.FillDataset(v_ds_phan_quyen); CGridUtils.Dataset2C1Grid(v_ds_phan_quyen, m_fg, m_obj_trans); US_HT_PHAN_QUYEN_CHO_NHOM v_us_phan_quyen_cho_nhom = new US_HT_PHAN_QUYEN_CHO_NHOM(); DS_HT_PHAN_QUYEN_CHO_NHOM v_ds_phan_quyen_cho_nhom = new DS_HT_PHAN_QUYEN_CHO_NHOM(); v_us_phan_quyen_cho_nhom.FillDatasetByGroupUserID(m_us_group.dcID, v_ds_phan_quyen_cho_nhom); //set not null quyen user for (int v_i_cur = m_fg.Rows.Fixed; v_i_cur < m_fg.Rows.Count; v_i_cur++) { m_fg[v_i_cur, (int)e_col_number.LA_QUYEN_USER] = false; } //set quyen foreach (DataRow v_dr in v_ds_phan_quyen_cho_nhom.HT_PHAN_QUYEN_CHO_NHOM.Rows) { for (int v_i_cur = m_fg.Rows.Fixed; v_i_cur < m_fg.Rows.Count; v_i_cur++) { if ((decimal)m_fg[v_i_cur, (int)e_col_number.ID_QUYEN] == (decimal)v_dr[HT_PHAN_QUYEN_CHO_NHOM.ID_PHAN_QUYEN_HE_THONG]) { m_fg[v_i_cur, (int)e_col_number.LA_QUYEN_USER] = true; } } } }