private void grid2us_object(US_V_DM_DON_VI i_us, int i_grid_row) { DataRow v_dr; v_dr = (DataRow)m_fg.Rows[i_grid_row].UserData; m_obj_trans.GridRow2DataRow(i_grid_row, v_dr); i_us.DataRow2Me(v_dr); }
private void load_data_2_grid() { US_V_DM_DON_VI v_us_dm_don_vi = new US_V_DM_DON_VI(); m_v_ds = new DS_V_DM_DON_VI(); var v_str_search = m_txt_search.Text.Trim(); //var v_str_search = "TEG"; if (m_txt_search.Text.Trim() != m_str_goi_y_tim_kiem) { v_us_dm_don_vi.FillDatasetByKeyWord(m_v_ds, v_str_search, CIPConvert.ToDecimal(m_cbo_loaidv.SelectedValue), CIPConvert.ToDecimal(m_cbo_capdv.SelectedValue), m_cbo_trangthai.SelectedValue.ToString(), CAppContext_201.getCurrentIDPhapnhan()); } else { v_us_dm_don_vi.FillDatasetByKeyWord(m_v_ds, "", CIPConvert.ToDecimal(m_cbo_loaidv.SelectedValue), CIPConvert.ToDecimal(m_cbo_capdv.SelectedValue), m_cbo_trangthai.SelectedValue.ToString(), CAppContext_201.getCurrentIDPhapnhan()); } m_fg.Redraw = false; int minID_LEVEL = int.Parse(m_v_ds.V_DM_DON_VI.Compute("Min(ID_LEVEL)", "").ToString()); DataRow[] v_arr_dr = m_v_ds.V_DM_DON_VI.Select(V_DM_DON_VI.ID_LEVEL + "=" + minID_LEVEL.ToString()); if (v_arr_dr.Length == 0) { return; } CGridUtils.ClearDataInGrid(m_fg); v_us_dm_don_vi.DataRow2Me(v_arr_dr[0]); m_fg.Rows.Count += 1; int v_i_root_row = m_fg.Rows.Count - 1; us_object_2_grid(v_us_dm_don_vi, m_v_ds, v_i_root_row); m_fg.Rows[v_i_root_row].IsNode = true; m_fg.Rows[v_i_root_row].Node.Level = int.Parse(v_us_dm_don_vi.dcID_LEVEL.ToString()); switch (m_fg.Rows[v_i_root_row].Node.Level) { case 0: m_fg.Rows[v_i_root_row].Style = m_fg.Styles[CellStyleEnum.Subtotal0]; break; case 1: m_fg.Rows[v_i_root_row].Style = m_fg.Styles[CellStyleEnum.Subtotal1]; break; case 2: m_fg.Rows[v_i_root_row].Style = m_fg.Styles[CellStyleEnum.Subtotal2]; break; case 3: m_fg.Rows[v_i_root_row].Style = m_fg.Styles[CellStyleEnum.Subtotal3]; break; } insert_all_child_of_node(v_i_root_row, m_v_ds); load_custom_source_2_m_txt_search(); m_fg.Redraw = true; set_search_format_before(); /*Đếm số dòng dữ liệu trên Grid*/ m_lbl_so_luong_ban_ghi.Text = m_v_ds.V_DM_DON_VI.Count.ToString(); }
private void tao_dong_don_vi_grid_don_vi() { DS_V_DM_DON_VI v_ds_v_dm_don_vi = new DS_V_DM_DON_VI(); US_V_DM_DON_VI v_us_v_dm_don_vi = new US_V_DM_DON_VI(); v_us_v_dm_don_vi.FillDatasetByKeyWord(v_ds_v_dm_don_vi, "Y", CAppContext_201.getCurrentIDPhapnhan()); int v_minID_LEVEL = int.Parse(v_ds_v_dm_don_vi.V_DM_DON_VI.Compute("Min(ID_LEVEL)", "").ToString()); DataRow[] v_dr = v_ds_v_dm_don_vi.V_DM_DON_VI.Select(V_DM_DON_VI.ID_LEVEL + "=" + v_minID_LEVEL.ToString()); if (v_dr.Length == 0) { return; } CGridUtils.ClearDataInGrid(m_fg_donvi); v_us_v_dm_don_vi.DataRow2Me(v_dr[0]); m_fg_donvi.Rows.Count += 1; int v_i_root_row = m_fg_donvi.Rows.Count - 1; //m_fg.Rows.Count = m_ds_1.V_DM_DON_VI.Rows.Count + 1; //int v_i_root_row = 1; m_fg_donvi.Rows[v_i_root_row].IsNode = true; m_fg_donvi.Rows[v_i_root_row].Node.Level = int.Parse(v_us_v_dm_don_vi.dcID_LEVEL.ToString()); switch (m_fg_donvi.Rows[v_i_root_row].Node.Level) { case 0: m_fg_donvi.Rows[v_i_root_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal0]; break; case 1: m_fg_donvi.Rows[v_i_root_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal1]; break; case 2: m_fg_donvi.Rows[v_i_root_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal2]; break; case 3: m_fg_donvi.Rows[v_i_root_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal3]; break; } m_fg_donvi.Rows[1][1] = v_us_v_dm_don_vi.strMA_DON_VI_CAP_TREN; m_fg_donvi.Rows[1][2] = v_us_v_dm_don_vi.strMA_DON_VI; m_fg_donvi.Rows[1].UserData = v_us_v_dm_don_vi.dcID; insert_all_child_of_node(v_i_root_row, v_ds_v_dm_don_vi); }
private void insert_all_child_of_node(int i_grid_row, DS_V_DM_DON_VI ip_ds_don_vi) { //US_V_DM_DON_VI v_us_dm_don_vi = new US_V_DM_DON_VI(); //grid2us_object(v_us_dm_don_vi, i_grid_row); DataRow[] v_arr_dr_child = ip_ds_don_vi.V_DM_DON_VI.Select(V_DM_DON_VI.ID_DON_VI_CAP_TREN + "=" + m_fg_donvi.Rows[i_grid_row].UserData.ToString()); foreach (DataRow v_dr in v_arr_dr_child) { US_V_DM_DON_VI v_us_dm_don_vi_child = new US_V_DM_DON_VI(); v_us_dm_don_vi_child.DataRow2Me(v_dr); int v_i_child_row = -1; insert_child_node( v_us_dm_don_vi_child , ip_ds_don_vi , i_grid_row , ref v_i_child_row); insert_all_child_of_node(v_i_child_row, ip_ds_don_vi); } }
private void text_changed() { US_V_DM_DON_VI v_us = new US_V_DM_DON_VI(); DS_V_DM_DON_VI v_ds = new DS_V_DM_DON_VI(); v_us.FillDataset_search_by_ma_dv(v_ds, m_txt_don_vi_moi.Text.Trim(), CAppContext_201.getCurrentIDPhapnhan()); if (v_ds.V_DM_DON_VI.Count == 0) { // BaseMessages.MsgBox_Error("Mã đơn vị không hợp lệ."); } else { if (v_ds.V_DM_DON_VI.Count == 1) { v_us.DataRow2Me((DataRow)v_ds.V_DM_DON_VI.Rows[0]); m_us_dm_don_vi = new US_DM_DON_VI(v_us.dcID); m_txt_ma_don_vi_cap_tren.Text = v_us.strMA_DON_VI_CAP_TREN; } } }