void LoadDataBind() { string id = Request.QueryString["id"].ToString();//客户编号 string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; DataTable dt = TalkBus.PrintTalk(CompanyCD, id); if (dt != null) { rd.Load(Server.MapPath(@"~/PrinttingModel/CustManager/TalkPrint.rpt")); CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.CustTalk")); UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //绑定数据 rd.SetDataSource(dt); rd.Refresh(); this.CrystalReportViewer1.ReportSource = rd; rd.SetParameterValue("Today", "制表人:" + userInfo.EmployeeName); } }
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) : "CreatedDate"; //要排序的字段,如果为空,默认为"ID" if (orderString.EndsWith("_d")) { order = "desc";//排序:降序 } string ord = " ORDER BY " + orderBy + " " + order; CustTalkModel CustTalkM = new CustTalkModel(); string CustID = hiddCustID.Value; CustTalkM.TalkType = Convert.ToInt32(ddlTalkType.Value); //类型 CustTalkM.Priority = selePriority.Value; //优先级 string TalkBegin = txtTalkBegin.Value; //== "" ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(context.Request.Form["TalkBegin"].ToString());//开始时间 string TalkEnd = txtTalkEnd.Value; //== "" ? Convert.ToDateTime("9999-12-31") : Convert.ToDateTime(context.Request.Form["TalkEnd"].ToString() + " 23:59:59.000");//结束时间 CustTalkM.Title = txtTitle.Value; //主题 CustTalkM.Status = seleStatus.Value; //状态 CustTalkM.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; string CanUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID.ToString(); DataTable dt = TalkBus.ExportTalkInfo(CanUserID, CustID, CustTalkM, TalkBegin, TalkEnd, ord); OutputToExecl.ExportToTableFormat(this, dt, new string[] { "洽谈编号", "洽谈主题", "客户名称", "客户联系人", "优先级", "洽谈方式", "完成期限", "执行人", "状态", "创建人", "创建日期" }, new string[] { "TalkNo", "title", "custnam", "linkmanname", "PriorityName", "typename", "CompleteDate", "LinkerName", "StatusName", "EmployeeName", "CreatedDate" }, "客户洽谈列表信息"); } catch { ClientScript.RegisterStartupScript(this.GetType(), "Exp", "<script language=javascript>showPopup('../../../Images/Pic/Close.gif','../../../Images/Pic/note.gif','导出发生异常');</script>"); } }