private List<US_V_DM_OTO> get_top_dm_oto_by_name(string ip_str_oto_name, decimal ip_dc_id_dv_su_dung)
 {
     DS_V_DM_OTO v_ds_oto = new DS_V_DM_OTO();
     US_V_DM_OTO v_us = new US_V_DM_OTO();
     v_ds_oto.EnforceConstraints = false;
     v_us.load_oto_by_ten(v_ds_oto, ip_str_oto_name, ip_dc_id_dv_su_dung);
     if (v_ds_oto.V_DM_OTO.Rows.Count == 0) return null;
     List<US_V_DM_OTO> v_teachers = new List<US_V_DM_OTO>();
     if (v_ds_oto.V_DM_OTO.Rows.Count > 0)
         for (int i = 0; i < v_ds_oto.V_DM_OTO.Rows.Count; i++)
         {
             US_V_DM_OTO v_oto = new US_V_DM_OTO();
             v_oto.dcID = int.Parse(v_ds_oto.V_DM_OTO.Rows[i]["ID"].ToString());
             v_oto.strTEN_TAI_SAN = v_ds_oto.V_DM_OTO.Rows[i][V_DM_OTO.TEN_TAI_SAN].ToString().TrimEnd();
             v_teachers.Add(v_oto);
         }
     return v_teachers;
 }
    private void load_data_to_grid()
    {
        try
        {
            m_lbl_ket_qua_loc_du_lieu.Text = "DANH SÁCH Ô TÔ";
            // Đổ dữ liệu từ US vào DS

            US_V_DM_OTO v_us_v_dm_oto = new US_V_DM_OTO();
            DS_V_DM_OTO v_ds_v_dm_oto = new DS_V_DM_OTO();

            v_us_v_dm_oto.FillDatasetLoadDataToGridOto_by_tu_khoa(
                m_txt_tim_kiem.Text.Trim()
                , CONST_QLDB.ID_TAT_CA
                , CONST_QLDB.ID_TAT_CA
                , CONST_QLDB.ID_TAT_CA
                , CONST_QLDB.ID_TAT_CA
                , CONST_QLDB.ID_TAT_CA
                , CONST_QLDB.MA_TAT_CA
                , Person.get_user_name()
                , v_ds_v_dm_oto);

            // Treo dữ liệu lên lưới
            string v_str_thong_tin = " (Có " + v_ds_v_dm_oto.V_DM_OTO.Rows.Count + " bản ghi)";
            m_lbl_ket_qua_loc_du_lieu.Text += v_str_thong_tin;
            m_grv_dm_oto.DataSource = v_ds_v_dm_oto.V_DM_OTO;
            m_grv_dm_oto.DataBind();

        }
        catch (Exception v_e)
        {
            //nhớ using Ip.Common
            CSystemLog_301.ExceptionHandle(this, v_e);

        }
    }
    protected void m_grv_bao_cao_oto_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        try
        {
            m_grv_bao_cao_oto.PageIndex = e.NewPageIndex;
            System.Threading.Thread.Sleep(1000);
            string v_str_user_name = Person.get_user_name();
            if (v_str_user_name.Equals(null)) return;
            US_V_DM_OTO v_us_v_dm_oto = new US_V_DM_OTO();
            DS_V_DM_OTO v_ds_v_dm_oto = new DS_V_DM_OTO();
            v_us_v_dm_oto.FillDatasetLoadDataToGridOto_by_tu_khoa(
                   m_txt_tu_khoa.Text.Trim()
                   , CIPConvert.ToDecimal(m_cbo_bo_tinh.SelectedValue)
                   , CIPConvert.ToDecimal(m_cbo_don_vi_quan_ly.SelectedValue)
                   , CIPConvert.ToDecimal(m_cbo_don_vi_su_dung.SelectedValue)
                   , CIPConvert.ToDecimal(m_cbo_trang_thai.SelectedValue)
                   , CIPConvert.ToDecimal(m_cbo_loai_xe.SelectedValue)
                   , m_cbo_loai_hinh_don_vi.SelectedValue
                   , v_str_user_name
                   , v_ds_v_dm_oto
                );
            m_grv_bao_cao_oto.DataSource = v_ds_v_dm_oto.V_DM_OTO;
            m_grv_bao_cao_oto.DataBind();

        }
        catch (System.Exception ex)
        {
            CSystemLog_301.ExceptionHandle(this, ex);
        }
    }
    private void load_data_to_grid_oto()
    {
        reset_thong_bao();
        m_lbl_thong_tin_oto.Text = "DANH SÁCH Ô TÔ";
        if (!check_validate_data_is_ok()) return;

        string v_str_user_name = Person.get_user_name();
        if (v_str_user_name.Equals(null)) return;
        US_V_DM_OTO v_us_v_dm_oto = new US_V_DM_OTO();
        DS_V_DM_OTO v_ds_v_dm_oto = new DS_V_DM_OTO();
        v_us_v_dm_oto.FillDatasetLoadDataToGridOto_by_tu_khoa(
               m_txt_tu_khoa.Text.Trim()
               , CIPConvert.ToDecimal(m_cbo_bo_tinh.SelectedValue)
               , CIPConvert.ToDecimal(m_cbo_don_vi_quan_ly.SelectedValue)
               , CIPConvert.ToDecimal(m_cbo_don_vi_su_dung.SelectedValue)
               , CIPConvert.ToDecimal(m_cbo_trang_thai.SelectedValue)
               , CIPConvert.ToDecimal(m_cbo_loai_xe.SelectedValue)
               , m_cbo_loai_hinh_don_vi.SelectedValue
               , v_str_user_name
               , v_ds_v_dm_oto
            );
        m_grv_bao_cao_oto.DataSource = v_ds_v_dm_oto.V_DM_OTO;
        if (v_ds_v_dm_oto.V_DM_OTO.Count == 0) thong_bao("Không có kết quả tìm kiếm phù hợp!");
        System.Threading.Thread.Sleep(1000);
        string v_str_thong_tin = " (Có " + v_ds_v_dm_oto.V_DM_OTO.Rows.Count + " bản ghi)";
        m_lbl_thong_tin_oto.Text += v_str_thong_tin;
        m_grv_bao_cao_oto.DataBind();
        m_grv_bao_cao_oto.Visible = true;
    }
 private void load_data_to_ten_tai_san()
 {
     DS_V_DM_OTO v_ds_v_dm_oto = new DS_V_DM_OTO();
     US_V_DM_OTO v_us_v_dm_oto = new US_V_DM_OTO();
     v_us_v_dm_oto.FillDatasetLoadDataToGridOto_by_tu_khoa(
         String.Empty
         , CIPConvert.ToDecimal(m_cbo_bo_tinh_up.SelectedValue)
         , CIPConvert.ToDecimal(m_cbo_don_vi_chu_quan_up.SelectedValue)
         , CIPConvert.ToDecimal(m_cbo_don_vi_su_dung_tai_san_up.SelectedValue)
         , ID_TRANG_THAI_OTO.DANG_SU_DUNG
         , CIPConvert.ToDecimal(m_cbo_loai_o_to_up.SelectedValue)
         , CONST_QLDB.MA_TAT_CA
         , Person.get_user_name()
         , v_ds_v_dm_oto);
     m_cbo_ten_tai_san.DataSource = v_ds_v_dm_oto.V_DM_OTO;
     m_cbo_ten_tai_san.DataTextField = V_DM_OTO.TEN_TAI_SAN;
     m_cbo_ten_tai_san.DataValueField = V_DM_OTO.ID;
     m_cbo_ten_tai_san.DataBind();
 }
 private void grid2us_object(
     US_V_DM_OTO 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 delete_v_dm_oto()
 {
     if (!CGridUtils.IsThere_Any_NonFixed_Row(m_fg)) return;
     if (!CGridUtils.isValid_NonFixed_RowIndex(m_fg, m_fg.Row)) return;
     if (BaseMessages.askUser_DataCouldBeDeleted(8) != BaseMessages.IsDataCouldBeDeleted.CouldBeDeleted) return;
     US_V_DM_OTO v_us = new US_V_DM_OTO();
     grid2us_object(v_us, m_fg.Row);
     try
     {
         v_us.BeginTransaction();
         v_us.Delete();
         v_us.CommitTransaction();
         m_fg.Rows.Remove(m_fg.Row);
     }
     catch (Exception v_e)
     {
         v_us.Rollback();
         CDBExceptionHandler v_objErrHandler = new CDBExceptionHandler(v_e,
             new CDBClientDBExceptionInterpret());
         v_objErrHandler.showErrorMessage();
     }
 }
 private void us_object2grid(
     US_V_DM_OTO i_us
     , int i_grid_row)
 {
     DataRow v_dr = (DataRow)m_fg.Rows[i_grid_row].UserData;
     i_us.Me2DataRow(v_dr);
     m_obj_trans.DataRow2GridRow(v_dr, i_grid_row);
 }
    private void load_data_to_grid()
    {
        m_lbl_ket_qua_loc_du_lieu.Text = "Kết quả lọc dữ liệu";

        US_V_DM_OTO v_us_v_dm_oto = new US_V_DM_OTO();
        DS_V_DM_OTO v_ds_v_dm_oto = new DS_V_DM_OTO();

        v_us_v_dm_oto.FillDatasetLoadDataToGridOto_by_tu_khoa(
            m_txt_tim_kiem.Text.Trim()
            , CIPConvert.ToDecimal(m_ddl_bo_tinh.SelectedValue)
            , CIPConvert.ToDecimal(m_ddl_dv_chu_quan.SelectedValue)
            , CIPConvert.ToDecimal(m_ddl_dv_sd_ts.SelectedValue)
            , CIPConvert.ToDecimal(m_ddl_trang_thai_oto.SelectedValue)
            , CONST_QLDB.ID_TAT_CA
            , CONST_QLDB.MA_TAT_CA
            , Person.get_user_name()
            , v_ds_v_dm_oto);
        string v_str_thong_tin = " (Có " + v_ds_v_dm_oto.V_DM_OTO.Rows.Count + " bản ghi)";
        m_lbl_ket_qua_loc_du_lieu.Text += v_str_thong_tin;

        m_grv_dm_oto.DataSource = v_ds_v_dm_oto.V_DM_OTO;
        m_grv_dm_oto.DataBind();
    }