예제 #1
0
        /// <summary>
        /// 获得数据列表用于图标统计
        /// </summary>
        public List <JMP.MDL.jmp_statistics> GetListTjCount(string stime, string etime, int searchType, string searchname)
        {
            string strSql = string.Format(" select top 10 a.s_brand,sum(a.s_count)as s_count from  jmp_statistics  a left join  " + JMP.DbName.PubDbName.dbbase + ".dbo.jmp_app b on b.a_id=a.s_app_id left join  " + JMP.DbName.PubDbName.dbbase + ".dbo.jmp_user c on c.u_id=b.a_user_id where 1=1   ");

            if (!string.IsNullOrEmpty(stime))
            {
                strSql += "  and convert(varchar(10),a.s_time,120)>='" + stime + "' ";
            }
            if (!string.IsNullOrEmpty(etime))
            {
                strSql += "  and convert(varchar(10),a.s_time,120)<='" + etime + "' ";
            }
            if (searchType > 0 && !string.IsNullOrEmpty(searchname))
            {
                switch (searchType)
                {
                case 1:
                    strSql += " and b.a_name ='" + searchname + "' ";
                    break;

                case 2:
                    strSql += " and c.u_email='" + searchname + "' ";
                    break;
                }
            }
            strSql += " group by a.s_brand  order by s_count desc ";
            DataTable dt = DbHelperSQLTotal.Query(strSql.ToString()).Tables[0];

            return(DbHelperSQLTotal.ToList <JMP.MDL.jmp_statistics>(dt));
        }
예제 #2
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="sqls">SQL语句</param>
        /// <param name="pageIndexs">当前页</param>
        /// <param name="PageSize">每页显示数量</param>
        /// <param name="pageCount">总条数</param>
        /// <returns></returns>
        public List <JMP.MDL.jmp_app_report> SelectList(string sqls, int pageIndexs, int PageSize, out int pageCount)
        {
            string sql = string.Format(sqls);

            SqlParameter[] s = new[] {
                new SqlParameter("@sqlstr", sql.ToString()),
                new SqlParameter("@pageIndex", pageIndexs),
                new SqlParameter("@pageSize", PageSize)
            };
            SqlDataReader reader = DbHelperSQLTotal.RunProcedure("page", s);

            pageCount = 0;
            if (reader.NextResult())
            {
                while (reader.Read())
                {
                    pageCount = Convert.ToInt32(reader[0].ToString());
                }
                if (reader.NextResult())
                {
                    if (reader.HasRows)
                    {
                        dt.Load(reader);
                    }
                }
            }
            reader.Close();
            return(DbHelperSQLTotal.ToList <JMP.MDL.jmp_app_report>(dt));
        }
예제 #3
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="sql">查询语句</param>
        /// <param name="OrderBy">排序</param>
        /// <param name="PageIndex">当前页数</param>
        /// <param name="PageSize">每页显示数量</param>
        /// <param name="Count">总记录数</param>
        /// <returns></returns>
        public List <JMP.MDL.jmp_paychannel> GetLists(string sql, string OrderBy, int PageIndex, int PageSize, out int Count)
        {
            SqlConnection  con = new SqlConnection(DbHelperSQLTotal.connectionString);
            SqlDataAdapter da  = new SqlDataAdapter("SqlPager", con);

            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.Add(new SqlParameter("@Sql", sql));
            da.SelectCommand.Parameters.Add(new SqlParameter("@Order", OrderBy));
            da.SelectCommand.Parameters.Add(new SqlParameter("@PageIndex", PageIndex));
            da.SelectCommand.Parameters.Add(new SqlParameter("@PageSize", PageSize));
            da.SelectCommand.Parameters.Add("@TotalCount", SqlDbType.Int);
            da.SelectCommand.Parameters["@TotalCount"].Direction = ParameterDirection.Output;
            DataTable dt = new DataTable();

            da.Fill(dt);
            Count = Convert.ToInt32(da.SelectCommand.Parameters["@TotalCount"].Value);
            da.Dispose();
            return(DbHelperSQLTotal.ToList <JMP.MDL.jmp_paychannel>(dt));
        }
예제 #4
0
        /// <summary>
        /// 根据sql查询信息
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public List <JMP.MDL.jmp_user_report> DcSelectList(string sql)
        {
            DataTable dt = DbHelperSQLTotal.Query(sql).Tables[0];

            return(DbHelperSQLTotal.ToList <JMP.MDL.jmp_user_report>(dt));
        }