コード例 #1
0
 public US_GRID_GIAO_KH(decimal i_dbID)
 {
     pm_objDS = new DS_GRID_GIAO_KH();
     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]);
 }
コード例 #2
0
 public US_GRID_GIAO_KH()
 {
     pm_objDS = new DS_GRID_GIAO_KH();
     pm_strTableName = c_TableName;
     pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow();
 }
        private void load_data_to_grid()
        {
            try
            {
                //Kiem tra neu khong phai la don vi nhap thi chi cho xem
                if (m_ddl_don_vi.SelectedValue != Person.get_id_don_vi().ToString())
                {
                    m_grv.Columns[0].Visible = false;
                    m_cmd_insert.Visible = false;
                    m_cmd_update.Visible = false;
                    m_cmd_cancel.Visible = false;
                }
                else
                {
                    m_grv.Columns[0].Visible = true;
                    if (get_form_mode(m_hdf_form_mode) == LOAI_FORM.SUA)
                    {
                        m_cmd_update.Visible = true;
                        m_cmd_cancel.Visible = true;
                    }
                    else if (get_form_mode(m_hdf_form_mode) == LOAI_FORM.THEM)
                    {
                        m_cmd_insert.Visible = true;
                        m_cmd_cancel.Visible = true;
                    }
                }
                //decimal v_id_dc_loai = 1;
                decimal v_id_dc_reported_user;
                // Chú thích: id_dc_loai = 1 - Loại dự án
                //            id_dc_loai = 2 - CLKM
                //Kiểm tra xem thuộc loại nào:
                //if (m_rdb_theo_quoc_lo.Checked == true)
                //{
                //	v_id_dc_loai = 1;
                //}
                //if (m_rdb_theo_chuong_loai_khoan_muc.Checked == true)
                //{
                //	v_id_dc_loai = 2;
                //}
                //Lấy id_reported_user
                v_id_dc_reported_user = Person.get_user_id();
                //1. Get dataset
                DS_GRID_GIAO_KH v_ds = new DS_GRID_GIAO_KH();
                //2. Lay du lieu
                US_GRID_GIAO_KH v_us = new US_GRID_GIAO_KH();
                decimal v_dc_id_quyet_dinh = -1;
                if (m_hdf_id_quyet_dinh.Value.Trim().Equals(""))
                {
                    v_dc_id_quyet_dinh = -1;
                }
                else
                    v_dc_id_quyet_dinh = CIPConvert.ToDecimal(m_hdf_id_quyet_dinh.Value);

                if (v_dc_id_quyet_dinh != -1)
                {
                    US_DM_QUYET_DINH v_us_qd = new US_DM_QUYET_DINH(v_dc_id_quyet_dinh);
                    m_lbl_grid_ngay.Text = CIPConvert.ToStr(v_us_qd.datNGAY_THANG, "dd/MM/yyyy");
                    m_lbl_grid_so_quyet_dinh.Text = v_us_qd.strSO_QUYET_DINH;
                    m_lbl_grid_ve_viec.Text = v_us_qd.strNOI_DUNG;
                }

                //kiem tra xem dang nhap Nguon nao
                string v_str_is_nguon_ns = "N";
                if (Request.QueryString["ip_nguon_ns"] == "Y")
                {
                    v_str_is_nguon_ns = "Y";
                }

                if (v_dc_id_quyet_dinh < 0) return;

                v_us.get_grid_giao_kh_qbt(v_ds
                    , v_dc_id_quyet_dinh
                    , v_str_is_nguon_ns
                    , v_id_dc_reported_user
                    , CIPConvert.ToDecimal(m_ddl_don_vi.SelectedValue));
                m_grv.DataSource = v_ds.Tables[0];
                m_grv.DataBind();
                if (!m_hdf_id_giao_kh.Value.Equals(""))
                {
                    m_grv.SelectedIndex = -1;
                    for (int i = 0; i < m_grv.Rows.Count; i++)
                        if (CIPConvert.ToDecimal(m_grv.DataKeys[i].Value) == CIPConvert.ToDecimal(m_hdf_id_giao_kh.Value)) m_grv.SelectedIndex = i;
                }
                //get tong tien
                decimal v_dc_tong_tien = 0;
                for (int i = 0; i < v_ds.Tables[0].Rows.Count; i++)
                {
                    if (v_ds.Tables[0].Rows[i][GRID_GIAO_KH.ID].ToString() != "-1")
                    {
                        v_dc_tong_tien += get_so_tien(v_ds.Tables[0].Rows[i][GRID_GIAO_KH.NTCT].ToString()) +
                            get_so_tien(v_ds.Tables[0].Rows[i][GRID_GIAO_KH.NS].ToString()) +
                            get_so_tien(v_ds.Tables[0].Rows[i][GRID_GIAO_KH.QUY].ToString());
                    }
                }
                m_lbl_grid_tong_tien.Text = CIPConvert.ToStr(v_dc_tong_tien, "#,###,##");

            }
            catch (Exception v_e)
            {
                m_lbl_mess_grid.Text = v_e.ToString();
            }
        }