예제 #1
0
        public void Filldataset_by_ID_phap_nhan(DS_V_DM_DON_VI op_ds, decimal ip_dc_id_phap_nhan)
        {
            CStoredProc v_cst = new CStoredProc("pr_V_DM_DON_VI_search_by_id_phap_nhan");

            v_cst.addDecimalInputParam("@id_phap_nhan", ip_dc_id_phap_nhan);
            v_cst.fillDataSetByCommand(this, op_ds);
        }
예제 #2
0
        public void FillDatasetByKeyWord(DS_V_DM_DON_VI op_ds_v_v_dm_don_vi, string ip_str_trang_thai, decimal ip_dc_phap_nhan)
        {
            CStoredProc v_stored_proc = new CStoredProc("pr_V_DM_DON_VI_search_all");

            v_stored_proc.addDecimalInputParam("@ip_dc_phap_nhan", ip_dc_phap_nhan);
            v_stored_proc.addNVarcharInputParam("@ip_str_trang_thai", ip_str_trang_thai);
            v_stored_proc.fillDataSetByCommand(this, op_ds_v_v_dm_don_vi);
        }
예제 #3
0
        public void FillDataset_search_by_ma_dv(DS_V_DM_DON_VI op_ds, string ip_str_ma_dv, decimal ip_dc_phap_nhan)
        {
            CStoredProc v_cst = new CStoredProc("pr_V_DM_DON_VI_search_by_ma_dv");

            v_cst.addDecimalInputParam("@ip_dc_phap_nhan", ip_dc_phap_nhan);
            v_cst.addNVarcharInputParam("@ip_str_ma_dv", ip_str_ma_dv);
            v_cst.fillDataSetByCommand(this, op_ds);
        }
예제 #4
0
        public void FillDatasetByCapDonVi(DS_V_DM_DON_VI op_ds_v_v_dm_don_vi, decimal ip_dc_level, decimal ip_dc_phap_nhan)
        {
            CStoredProc v_stored_proc = new CStoredProc("pr_V_DM_DON_VI_search_cap_don_vi");

            v_stored_proc.addDecimalInputParam("@ip_dc_level", ip_dc_level);
            v_stored_proc.addDecimalInputParam("@ip_dc_phap_nhan", ip_dc_phap_nhan);
            v_stored_proc.fillDataSetByCommand(this, op_ds_v_v_dm_don_vi);
        }
예제 #5
0
        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();
        }
예제 #6
0
        private void load_data_2_cbo_don_vi_cap_tren()
        {
            var v_ds = new DS_V_DM_DON_VI();
            var v_us = new US_V_DM_DON_VI();

            v_us.FillDatasetByCapDonVi(v_ds, 0, CAppContext_201.getCurrentIDPhapnhan());
            m_cbo_ten_don_vi_cap_tren.DisplayMember = DM_DON_VI.MA_DON_VI;
            m_cbo_ten_don_vi_cap_tren.ValueMember   = DM_DON_VI.ID;
            m_cbo_ten_don_vi_cap_tren.DataSource    = v_ds.V_DM_DON_VI;
            var v_row = v_ds.V_DM_DON_VI.NewRow();

            v_row[V_DM_DON_VI.ID]                            = -1;
            v_row[V_DM_DON_VI.ID_CAP_DON_VI]                 = 0;
            v_row[V_DM_DON_VI.ID_DON_VI_CAP_TREN]            = -1;
            v_row[V_DM_DON_VI.ID_LOAI_DON_VI]                = -1;
            v_row[V_DM_DON_VI.MA_DON_VI]                     = "KHONG_CO";
            v_row[V_DM_DON_VI.TEN_DON_VI]                    = "Không có đơn vị cấp trên";
            v_row[V_DM_DON_VI.TEN_TIENG_ANH]                 = "NULL";
            v_row[V_DM_DON_VI.TRANG_THAI]                    = "Y";
            v_row[V_DM_DON_VI.TU_NGAY]                       = "1/1/1800";
            v_row[V_DM_DON_VI.DIA_BAN]                       = "NULL";
            v_row[V_DM_DON_VI.LOAI_DON_VI]                   = "NULL";
            v_row[V_DM_DON_VI.MA_DON_VI_CAP_TREN]            = "NULL";
            v_row[V_DM_DON_VI.TEN_TIENG_ANH_DON_VI_CAP_TREN] = "NULL";
            v_row[V_DM_DON_VI.CAP_DON_VI]                    = "NULL";
            v_ds.V_DM_DON_VI.Rows.InsertAt(v_row, 0);

            switch (m_cbo_cap_don_vi.SelectedIndex)
            {
            case 0:     // Tổ Hợp
                m_cbo_ten_don_vi_cap_tren.SelectedIndex = 0;
                m_cbo_ten_don_vi_cap_tren.Enabled       = false;
                v_us.FillDatasetByCapDonVi(v_ds, 0, CAppContext_201.getCurrentIDPhapnhan());
                break;

            case 1:     // Công ty
                v_us.FillDatasetByCapDonVi(v_ds, 1, CAppContext_201.getCurrentIDPhapnhan());
                m_cbo_ten_don_vi_cap_tren.Enabled = true;
                break;

            case 2:     // Khối
                v_us.FillDatasetByCapDonVi(v_ds, 2, CAppContext_201.getCurrentIDPhapnhan());
                m_cbo_ten_don_vi_cap_tren.Enabled = true;
                break;

            case 3:     // Trung Tâm
                v_us.FillDatasetByCapDonVi(v_ds, 3, CAppContext_201.getCurrentIDPhapnhan());
                m_cbo_ten_don_vi_cap_tren.Enabled = true;
                break;

            default:
                v_us.FillDatasetByCapDonVi(v_ds, 4, CAppContext_201.getCurrentIDPhapnhan());
                m_cbo_ten_don_vi_cap_tren.Enabled = true;
                break;
            }
        }
예제 #7
0
        private void load_data_2_cbo_don_vi_cap_tren()
        {
            var v_ds = new DS_V_DM_DON_VI();
            var v_us = new US_V_DM_DON_VI();

            v_us.Filldataset_by_ID_phap_nhan(v_ds, CAppContext_201.getCurrentIDPhapnhan());
            m_cbo_don_vi.DisplayMember = DM_DON_VI.MA_DON_VI;
            m_cbo_don_vi.ValueMember   = DM_DON_VI.ID;
            m_cbo_don_vi.DataSource    = v_ds.V_DM_DON_VI;
        }
 public US_V_DM_DON_VI(decimal i_dbID)
 {
     pm_objDS = new DS_V_DM_DON_VI();
     pm_strTableName = c_TableName;
     IMakeSelectCmd v_objMkCmd = new CMakeAndSelectCmd(pm_objDS, c_TableName);
     v_objMkCmd.AddCondition("ID", i_dbID, eKieuDuLieu.KieuNumber, eKieuSoSanh.Bang);
     SqlCommand v_cmdSQL;
     v_cmdSQL = v_objMkCmd.getSelectCmd();
     this.FillDatasetByCommand(pm_objDS, v_cmdSQL);
     pm_objDR = getRowClone(pm_objDS.Tables[pm_strTableName].Rows[0]);
 }
        private void us_object_2_grid(US_V_DM_DON_VI i_us_object, DS_V_DM_DON_VI i_ds
                                      , int i_grid_row)
        {
            if (m_fg_donvi.Rows[i_grid_row].UserData == null)
            {
                m_fg_donvi.Rows[i_grid_row].UserData = i_ds.Tables[0].NewRow();
            }
            DataRow v_dr = (DataRow)m_fg_donvi.Rows[i_grid_row].UserData;

            i_us_object.Me2DataRow(v_dr);
            m_obj_trans.DataRow2GridRow(v_dr, i_grid_row);
        }
        private void insert_child_node(US_V_DM_DON_VI i_us_object
                                       , DS_V_DM_DON_VI i_ds
                                       , int i_parent_row
                                       , ref int i_row_result
                                       )
        {
            int v_i_new_grid_row;
            //Lay nut hien tai
            Node v_current_node = m_fg_donvi.Rows[i_parent_row].Node;
            Node v_node_4_index;
            int  v_i_level;

            //Neu them kieu nut la sibling cua nut hien tai
            v_node_4_index = v_current_node;
            v_i_level      = int.Parse(i_us_object.dcID_LEVEL.ToString());
            Node v_last_child = v_node_4_index.GetNode(NodeTypeEnum.LastChild);

            while (v_last_child != null)
            {
                v_node_4_index = v_last_child;
                v_last_child   = v_node_4_index.GetNode(NodeTypeEnum.LastChild);
            }
            v_i_new_grid_row = v_node_4_index.Row.Index + 1;
            m_fg_donvi.Rows.Insert(v_i_new_grid_row);
            //us_object_2_grid(i_us_object, i_ds, v_i_new_grid_row);
            m_fg_donvi.Rows[v_i_new_grid_row][1]         = i_us_object.strMA_DON_VI_CAP_TREN.ToString();
            m_fg_donvi.Rows[v_i_new_grid_row][2]         = i_us_object.strMA_DON_VI.ToString();
            m_fg_donvi.Rows[v_i_new_grid_row].UserData   = i_us_object.dcID;
            m_fg_donvi.Rows[v_i_new_grid_row].IsNode     = true;
            m_fg_donvi.Rows[v_i_new_grid_row].Node.Level = v_i_level;

            switch (v_i_level)
            {
            case 0:
                m_fg_donvi.Rows[v_i_new_grid_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal0];
                break;

            case 1:
                m_fg_donvi.Rows[v_i_new_grid_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal1];
                break;

            case 2:
                m_fg_donvi.Rows[v_i_new_grid_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal2];
                break;

            case 3:
                m_fg_donvi.Rows[v_i_new_grid_row].Style = m_fg_donvi.Styles[CellStyleEnum.Subtotal3];
                break;
            }

            i_row_result = v_i_new_grid_row;
        }
예제 #11
0
        public US_V_DM_DON_VI(decimal i_dbID)
        {
            pm_objDS        = new DS_V_DM_DON_VI();
            pm_strTableName = c_TableName;
            IMakeSelectCmd v_objMkCmd = new CMakeAndSelectCmd(pm_objDS, c_TableName);

            v_objMkCmd.AddCondition("ID", i_dbID, eKieuDuLieu.KieuNumber, eKieuSoSanh.Bang);
            SqlCommand v_cmdSQL;

            v_cmdSQL = v_objMkCmd.getSelectCmd();
            this.FillDatasetByCommand(pm_objDS, v_cmdSQL);
            pm_objDR = getRowClone(pm_objDS.Tables[pm_strTableName].Rows[0]);
        }
예제 #12
0
        private bool trung_ma_don_vi(string ip_str_ma_don_vi)
        {
            var v_ds = new DS_V_DM_DON_VI();
            var v_us = new US_V_DM_DON_VI();

            v_us.FillDatasetByKeyWord(v_ds, ip_str_ma_don_vi, -1, -1, "", CAppContext_201.getCurrentIDPhapnhan());
            decimal v_count = v_ds.V_DM_DON_VI.Count;

            if (v_count > 0)
            {
                return(true);
            }
            return(false);
        }
예제 #13
0
        private void load_data_2_combobox_loai_don_vi()
        {
            DS_V_DM_DON_VI v_ds_v = new DS_V_DM_DON_VI();
            US_V_DM_DON_VI v_us_v = new US_V_DM_DON_VI();

            v_us_v.FillDataset(v_ds_v);
            //m_cbo_loai_don_vi.ValueMember = V_DM_DON_VI.ID_LOAI_DON_VI;
            //m_cbo_loai_don_vi.DisplayMember = V_DM_DON_VI.TEN_LOAI_DON_VI;
            m_cbo_loai_don_vi.DataSource = v_ds_v.V_DM_DON_VI;
            if (v_ds_v.V_DM_DON_VI.Rows.Count > 0)
            {
                m_cbo_loai_don_vi.SelectedIndex = 0;
            }
        }
예제 #14
0
        private void load_data_2_cbo_don_vi_right()
        {
            var v_ds = new DS_V_DM_DON_VI();
            var v_us = new US_V_DM_DON_VI();

            //v_us.FillDatasetByKeyWord(v_ds, "");
            m_cbo_don_vi_right.DataSource    = v_ds.V_DM_DON_VI;
            m_cbo_don_vi_right.DisplayMember = V_DM_DON_VI.TEN_DON_VI;
            m_cbo_don_vi_right.ValueMember   = V_DM_DON_VI.ID;

            m_cbo_ma_don_vi_right.DataSource    = v_ds.V_DM_DON_VI;
            m_cbo_ma_don_vi_right.DisplayMember = V_DM_DON_VI.MA_DON_VI;
            m_cbo_ma_don_vi_right.ValueMember   = V_DM_DON_VI.ID;

            m_load_lbox_right = true;
        }
예제 #15
0
        private void load_custom_source_2_m_txt_don_vi()
        {
            //  int count = m_ds_qua_trinh_lam_viec.Tables["V_GD_QUA_TRINH_LAM_VIEC"].Rows.Count;
            AutoCompleteStringCollection v_acsc_search = new AutoCompleteStringCollection();
            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_by_ID_phap_nhan(v_ds, CAppContext_201.getCurrentIDPhapnhan());
            foreach (DataRow dr in v_ds.V_DM_DON_VI)
            {
                v_acsc_search.Add(dr[V_DM_DON_VI.MA_DON_VI].ToString());
            }

            m_txt_don_vi_moi.AutoCompleteMode         = AutoCompleteMode.Suggest;
            m_txt_don_vi_moi.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            m_txt_don_vi_moi.AutoCompleteCustomSource = v_acsc_search;
        }
        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);
            }
        }
예제 #18
0
        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;
                }
            }
        }
예제 #19
0
 public US_V_DM_DON_VI()
 {
     pm_objDS        = new DS_V_DM_DON_VI();
     pm_strTableName = c_TableName;
     pm_objDR        = pm_objDS.Tables[pm_strTableName].NewRow();
 }
 public US_V_DM_DON_VI()
 {
     pm_objDS = new DS_V_DM_DON_VI();
     pm_strTableName = c_TableName;
     pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow();
 }