private void BindData() { //查询数据 QueryCustomerVoiceMsg query = new QueryCustomerVoiceMsg(); query.ANI = ANI; query.BeginTime = DateTimeToString(BeginTime, "00:00:00"); query.EndTime = DateTimeToString(EndTime, "23:59:59"); query.selBusinessType = selBusinessType; query.Agent = Agent; query.PRBeginTime = DateTimeToString(PRBeginTime, "00:00:00"); query.PREndTime = DateTimeToString(PREndTime, "23:59:59"); query.prStatus = prStatus; query.HasSkill = HasSkill; query.Hasaudio = Hasaudio; query.IsExclusive = IsExclusive; DataTable dt = BLL.CustomerVoiceMsg.Instance.GetCustomerVoiceMsgData(query, "a.StartTime desc ", BLL.PageCommon.Instance.PageIndex, PageSize, out RecordCount); if (dt != null) { repeaterTableList.DataSource = dt; repeaterTableList.DataBind(); } litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, PageSize, BLL.PageCommon.Instance.PageIndex, 1); }
private void ExportData() { //查询数据 QueryCustomerVoiceMsg query = new QueryCustomerVoiceMsg(); query.ANI = ANI; query.BeginTime = DateTimeToString(BeginTime, "00:00:00"); query.EndTime = DateTimeToString(EndTime, "23:59:59"); query.selBusinessType = selBusinessType; query.Agent = Agent; query.PRBeginTime = DateTimeToString(PRBeginTime, "00:00:00"); query.PREndTime = DateTimeToString(PREndTime, "23:59:59"); query.prStatus = prStatus; query.HasSkill = HasSkill; query.Hasaudio = Hasaudio; int RecordCount = 0; DataTable dt = BLL.CustomerVoiceMsg.Instance.GetCustomerVoiceMsgData(query, "a.StartTime desc ", 1, -1, out RecordCount); ExportData(dt); }
/// 分页查询数据 /// <summary> /// 分页查询数据 /// </summary> /// <param name="query"></param> /// <param name="order"></param> /// <param name="currentPage"></param> /// <param name="pageSize"></param> /// <param name="totalCount"></param> /// <returns></returns> public DataTable GetCustomerVoiceMsgData(QueryCustomerVoiceMsg query, string order, int currentPage, int pageSize, out int totalCount) { string where = GetWhere(query); DataSet ds; SqlParameter[] parameters = { new SqlParameter("@where", SqlDbType.NVarChar, 40000), new SqlParameter("@order", SqlDbType.NVarChar, 200), new SqlParameter("@pagesize", SqlDbType.Int, 4), new SqlParameter("@indexpage", SqlDbType.Int, 4), new SqlParameter("@totalRecorder", SqlDbType.Int, 4) }; parameters[0].Value = where; parameters[1].Value = order; parameters[2].Value = pageSize; parameters[3].Value = currentPage; parameters[4].Direction = ParameterDirection.Output; ds = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_CUSTOMERVOICEMSG_SELECT, parameters); totalCount = (int)(parameters[4].Value); return(ds.Tables[0]); }
/// 构造查询条件 /// <summary> /// 构造查询条件 /// </summary> /// <param name="query"></param> /// <returns></returns> private string GetWhere(QueryCustomerVoiceMsg query) { string where = ""; if (!string.IsNullOrEmpty(query.ANI)) { where += " and a.CallNO ='" + SqlFilter(query.ANI) + "'"; } if (!string.IsNullOrEmpty(query.BeginTime)) { where += " and a.StartTime>='" + SqlFilter(query.BeginTime) + "'"; } if (!string.IsNullOrEmpty(query.EndTime)) { where += " and a.StartTime<='" + SqlFilter(query.EndTime) + "'"; } if (!string.IsNullOrEmpty(query.selBusinessType) && query.selBusinessType != "-1") { where += " and b.TelMainNum='" + SqlFilter(query.selBusinessType.Substring(3)) + "'"; } if (!string.IsNullOrEmpty(query.Agent)) { where += " and d.TrueName like '%" + SqlFilter(query.Agent) + "%'"; } if (!string.IsNullOrEmpty(query.PRBeginTime)) { where += " and a.ProcessTime>='" + SqlFilter(query.PRBeginTime) + "'"; } if (!string.IsNullOrEmpty(query.PREndTime)) { where += " and a.ProcessTime<='" + SqlFilter(query.PREndTime) + "'"; } if (!string.IsNullOrEmpty(query.prStatus)) { where += " and a.Status IN (" + Dal.Util.SqlFilterByInCondition(query.prStatus) + ")"; } if (!string.IsNullOrEmpty(query.IsExclusive)) { if (query.IsExclusive == "0") { where += " and g.UserID is null"; } else { where += " and g.UserID is not null"; } } if (!string.IsNullOrEmpty(query.HasSkill)) { if (query.HasSkill == "1") { //有 where += " and ISNULL(a.SGID,0)>0"; } if (query.HasSkill == "0") { //无 where += " and ISNULL(a.SGID,0)=0"; } } if (!string.IsNullOrEmpty(query.Hasaudio)) { if (query.Hasaudio == "1") { //有 where += " and a.SourceType=1"; } if (query.Hasaudio == "0") { //无 where += " and a.SourceType=2"; } } return(where); }
/// 分页查询数据 /// <summary> /// 分页查询数据 /// </summary> /// <param name="query"></param> /// <param name="order"></param> /// <param name="currentPage"></param> /// <param name="pageSize"></param> /// <param name="totalCount"></param> /// <returns></returns> public DataTable GetCustomerVoiceMsgData(QueryCustomerVoiceMsg query, string order, int currentPage, int pageSize, out int totalCount) { return(Dal.CustomerVoiceMsg.Instance.GetCustomerVoiceMsgData(query, order, currentPage, pageSize, out totalCount)); }