protected void btnImport_Click(object sender, ImageClickEventArgs e) { try { string orderString = hiddExpOrder.Value.Trim(); //排序 string order = "asc"; //排序:降序 string orderBy = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "LinkDate"; //要排序的字段,如果为空,默认为"ID" if (orderString.EndsWith("_d")) { order = "desc";//排序:降序 } string ord = " ORDER BY " + orderBy + " " + order; string CustID = hiddCustID.Value; //客户ID string CustLinkMan = txtCustLinkMan.Value; //被联络人 string LinkDateBegin = txtLinkDateBegin.Value; string LinkDateEnd = txtLinkDateEnd.Value; string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; string CanUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID.ToString(); DataTable dt = ContactHistoryBus.ExportContactInfo(CanUserID, CustID, CustLinkMan, CompanyCD, LinkDateBegin, LinkDateEnd, ord); OutputToExecl.ExportToTableFormat(this, dt, new string[] { "联络单编号", "联络主题", "客户名称", "我方联络人", "联络时间", "客户联络人" }, new string[] { "ContactNo", "Title", "CustNam", "Linker", "LinkDate", "LinkManName" }, "客户联络列表"); } catch { ClientScript.RegisterStartupScript(this.GetType(), "Exp", "<script language=javascript>showPopup('../../../Images/Pic/Close.gif','../../../Images/Pic/note.gif','导出发生异常');</script>"); } }
void LoadDataBind() { string ID = Request.QueryString["id"].ToString();//客户编号 string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; DataTable dt = ContactHistoryBus.PrintContactInfoByID(CompanyCD, ID); if (dt != null) { rd.Load(Server.MapPath(@"~/PrinttingModel/CustManager/CustContactPrint.rpt")); CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.CustContact")); UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //绑定数据 rd.SetDataSource(dt); rd.Refresh(); this.CrystalReportViewer1.ReportSource = rd; rd.SetParameterValue("Today", "制表人:" + userInfo.EmployeeName); } }