protected void btnExport_Click(object sender, EventArgs e) { if (!checkSearchConditionValid()) { return; } else { int limit = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ExportCountLimit"]); ReportQueryBLL bll = new ReportQueryBLL(); string start = ((TextBox)(this.UCDateInputBeginDate.FindControl("txtDate"))).Text.Trim(); int count = bll.QuerySaleReimburseDetailViewCountByRight(start); if (count > limit) { PageUtility.ShowModelDlg(this.Page, "������¼�����ó���" + limit + "��������С��ѯ����"); return; } try { Session.Timeout = 30; string fileID = Guid.NewGuid().ToString(); string outFile = Server.MapPath(@"~/" + saveFilePath) + @"\" + fileID + ".xls"; System.Diagnostics.Debug.WriteLine("outFile := " + outFile); this.ExportDataGrid.DataSource = new GetReportSalesReimburseDetailTableAdapter().GetData(start); this.ExportDataGrid.DataBind(); string fileName = "SaleReimburseDetail" + DateTime.Now.ToString("yyyyMMddHHmmss"); ToExcel(this.ExportDataGrid, fileName); Session.Timeout = 3; } catch (Exception ex) { PageUtility.DealWithException(this, ex); } } }
protected void btnExport_Click(object sender, EventArgs e) { if (!checkSearchConditionValid()) { return; } else { string queryExpession = getSearchCondition(); int stuffID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; int positionID = ((AuthorizationDS.PositionRow)Session["Position"]).PositionId; int limit = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ExportCountLimit"]); ReportQueryBLL bll = new ReportQueryBLL(); int count = bll.QueryPagedFormSalePaymentViewByRightExportViewCountByRight(queryExpession, stuffID, positionID); if (count > limit) { PageUtility.ShowModelDlg(this.Page, "������¼�����ó���" + limit + "��������С��ѯ����"); return; } try { Session.Timeout = 30; string fileID = Guid.NewGuid().ToString(); string outFile = Server.MapPath(@"~/" + saveFilePath) + @"\" + fileID + ".xls"; System.Diagnostics.Debug.WriteLine("outFile := " + outFile); this.ExportDataGrid.DataSource = new GetPagedFormSalePaymentViewByRightExportTableAdapter().GetData(queryExpession, stuffID, positionID); this.ExportDataGrid.DataBind(); string fileName = "FormSalePayment" + DateTime.Now.ToString("yyyyMMddHHmmss"); ToExcel(this.ExportDataGrid, fileName); Session.Timeout = 3; } catch (Exception ex) { PageUtility.DealWithException(this, ex); } } }