public US_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE(decimal i_dbID) { pm_objDS = new DS_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE(); 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 load_data_to_grid_don_hang_de() { //load grid đơn hàng detail: US_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE v_us_don_hang_de = new US_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE(); DS_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE v_ds_don_hang_de = new DS_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE(); v_us_don_hang_de.FillDataset(v_ds_don_hang_de, "Where id_don_dat_hang=" + CIPConvert.ToDecimal(m_hdf_id_don_hang.Value)); m_grv_don_hang_de.DataSource = v_ds_don_hang_de.V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE; m_grv_don_hang_de.DataBind(); string v_str_thong_tin_don_hang_de = " (Có " + v_ds_don_hang_de.V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE.Rows.Count + " mặt hàng)"; m_lbl_thong_tim_grv_don_hang_de.Text = v_str_thong_tin_don_hang_de; if (!m_hdf_ID_GD_DON_DAT_HANG_DE.Value.Equals("")) { m_grv_don_hang_de.SelectedIndex = -1; for (int i = 0; i < m_grv_don_hang_de.Rows.Count; i++) if (CIPConvert.ToDecimal(m_grv_don_hang_de.DataKeys[i].Value) == CIPConvert.ToDecimal(m_hdf_ID_GD_DON_DAT_HANG_DE.Value)) m_grv_don_hang_de.SelectedIndex = i; } m_grv_don_hang_de.Visible = true; }
private void ExportToExcel() { US_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE v_us_don_hang_de = new US_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE(); DS_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE v_ds_don_hang_de = new DS_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE(); v_us_don_hang_de.FillDataset(v_ds_don_hang_de, "Where id_don_dat_hang=" + CIPConvert.ToDecimal(m_hdf_id_don_hang.Value)); //m_grv_don_hang_de.DataSource = v_ds_don_hang_de.V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE; //m_grv_don_hang_de.DataBind(); string filename = "Phiếu đề nghị cấp vật tư" + ".xls"; System.IO.StringWriter tw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); System.Web.UI.WebControls.DataGrid dgGrid = new System.Web.UI.WebControls.DataGrid(); dgGrid.DataSource = v_ds_don_hang_de; dgGrid.DataBind(); //Get the HTML for the control. //header hw.Write(" "); m_lbl_header.RenderControl(hw); hw.WriteLine("<br />"); // tên phòng ban hw.Write(" "); m_lbl_title.RenderControl(hw); hw.WriteLine("<br />"); //m_lbl_title_ma_don_hang.RenderControl(hw); //Mã đơn hàng m_lbl_MP.RenderControl(hw); m_lbl_ma_don_hang_de.RenderControl(hw); hw.Write(" "); m_lbl_pop_lan_tl.RenderControl(hw); hw.Write("   "); m_lbl_pop_lan.RenderControl(hw); hw.Write(" "); m_lbl_pop_ngay_dat_hang_tl.RenderControl(hw); hw.Write("   "); m_lbl_pop_ngay.RenderControl(hw); hw.Write(" "); m_lbl_pop_tong_tien_tl.RenderControl(hw); hw.Write("   "); m_lbl_pop_tong_tien.RenderControl(hw); hw.Write(" "); m_lbl_pop_dinh_muc_tl.RenderControl(hw); hw.Write("   "); m_lbl_pop_dinh_muc.RenderControl(hw); //dgGrid.RenderControl(hw); Response.ClearContent(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-excel"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + ""); this.EnableViewState = false; dgGrid.RenderControl(hw); Response.Write(tw.ToString()); Response.End(); }
public US_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE() { pm_objDS = new DS_V_DON_DAT_HANG_DETAIL_NHAP_DON_HANG_LE(); pm_strTableName = c_TableName; pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow(); }