/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetSMSHistroyStatistics(QuerySMSSendHistory query, string order, int currentPage, int pageSize, out int totalCount) { string where = string.Empty; #region 数据权限判断 if (query.LoginID != Constant.INT_INVALID_VALUE) { string whereDataRight = ""; whereDataRight = Dal.UserGroupDataRigth.Instance.GetSqlRightstr("a", "BGID", "CreateUserID", (Int32)query.LoginID); where += whereDataRight; } #endregion if (query.CreateTimeBegin != Constant.DATE_INVALID_VALUE && query.CreateTimeEnd != Constant.DATE_INVALID_VALUE) { where += " and (a.CreateTime>='" + query.CreateTimeBegin + "' and a.CreateTime<='" + query.CreateTimeEnd + "')"; } if (query.CreateUserID != Constant.INT_INVALID_VALUE) { where += " and a.CreateUserID=" + query.CreateUserID; } if (query.BGID != Constant.INT_INVALID_VALUE) { where += " and a.BGID=" + query.BGID; } if (query.AgentNum != Constant.STRING_INVALID_VALUE) { where += " and c.agentnum='" + StringHelper.SqlFilter(query.AgentNum) + "'"; } DataSet ds; SqlParameter[] parameters = { new SqlParameter("@where", SqlDbType.NVarChar,4000), //edit by wangtonghai 2016/5/3 将@where参数大小从40000 变更成4000 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_SMSHISTROYSTATISTICS_SELECT, parameters); totalCount = (int)(parameters[4].Value); return(ds.Tables[0]); }
/// <summary> /// 得到一个对象实体 /// </summary> public Entities.SMSSendHistory GetSMSSendHistory() { QuerySMSSendHistory query = new QuerySMSSendHistory(); DataTable dt = new DataTable(); int count = 0; dt = GetSMSSendHistory(query, string.Empty, 1, 1, out count); if (count > 0) { return(LoadSingleSMSSendHistory(dt.Rows[0])); } else { return(null); } }
/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetSMSSendHistory(QuerySMSSendHistory query, string order, int currentPage, int pageSize, out int totalCount) { string where = string.Empty; #region 数据权限判断 if (query.LoginID.HasValue && query.LoginID.Value > 0) { string whereDataRight = ""; whereDataRight = Dal.UserGroupDataRigth.Instance.GetSqlRightstr("a", "BGID", "CreateUserID", (Int32)query.LoginID); where += whereDataRight; } #endregion if (query.RecID != Constant.INT_INVALID_VALUE) { where += " and a.RecID=" + query.RecID; } if (query.CreateTimeBegin != Constant.DATE_INVALID_VALUE && query.CreateTimeEnd != Constant.DATE_INVALID_VALUE) { where += " and (a.CreateTime>='" + query.CreateTimeBegin + "' and a.CreateTime<='" + query.CreateTimeEnd + "')"; } if (query.Phone != Constant.STRING_INVALID_VALUE) { where += " and a.phone='" + StringHelper.SqlFilter(query.Phone) + "'"; } if (!string.IsNullOrEmpty(query.PhoneList)) { string[] array = query.PhoneList.Split(','); string p = "'" + string.Join("','", array) + "'"; where += " and a.phone in (" + p + ")"; } if (query.Reservicer != Constant.STRING_INVALID_VALUE) { where += " and b.custname like '%" + StringHelper.SqlFilter(query.Reservicer) + "%'"; } if (query.Content != Constant.STRING_INVALID_VALUE) { where += " and a.Content like '%" + StringHelper.SqlFilter(query.Content) + "%'"; } if (query.CreateUserID != Constant.INT_INVALID_VALUE) { where += " and a.CreateUserID=" + query.CreateUserID; } if (query.BGID != Constant.INT_INVALID_VALUE) { where += " and a.BGID=" + query.BGID; } if (query.Status != Constant.INT_INVALID_VALUE) { where += " and a.Status=" + query.Status; } //根据客户查询短信有问题 强斐 2016-8-10 if (!string.IsNullOrEmpty(query.CBID)) { where += " and a.CustID='" + SqlFilter(query.CBID) + "'"; } if (!string.IsNullOrEmpty(query.CRMCustID)) { where += " and a.CRMCustID='" + SqlFilter(query.CRMCustID) + "'"; } DataSet ds; SqlParameter[] parameters = { new SqlParameter("@where", SqlDbType.NVarChar,4000), //edit by wangtonghai 2016/5/3 将@where参数大小从40000 变更成4000 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_SMSSENDHISTORY_SELECT, parameters); totalCount = (int)(parameters[4].Value); return(ds.Tables[0]); }
/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetSMSSendHistoryForExport(QuerySMSSendHistory query, string order, int currentPage, int pageSize, out int totalCount) { return(Dal.SMSSendHistory.Instance.GetSMSSendHistoryForExport(query, order, currentPage, pageSize, out totalCount)); }