Ejemplo n.º 1
0
        /// <summary>
        /// 获取栏目页网页
        /// </summary>
        /// <param name="columnId">行业类别</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页条数</param>
        /// <returns></returns>
        public List <htmlPara> GetHtmlList(string columnId, int pageIndex, int pageSize)
        {
            //分页查询
            List <htmlPara> hList = new List <htmlPara>();
            DataTable       dt    = SqlHelperCatalog.ExecuteDataTable(@"select * from 
                (select *, ROW_NUMBER() OVER(order by addTime desc) AS RowId from htmlPara where columnId=@columnId) as b where b.RowId between @startNum and @endNum",
                                                                      new SqlParameter("@columnId", columnId),
                                                                      new SqlParameter("@startNum", (pageIndex - 1) * pageSize + 1),
                                                                      new SqlParameter("@endNum", pageIndex * pageSize));

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                htmlPara hPara = new htmlPara();
                hPara.Id       = (long)row["Id"];
                hPara.userId   = row["userId"].ToString();
                hPara.title    = (string)row["title"];
                hPara.titleImg = (string)row["titleImg"];
                hPara.titleURL = (string)row["titleURL"];
                hPara.columnId = (string)row["columnId"];                                //栏目Id
                string content = (string)row["articlecontent"];
                hPara.articlecontent = ReplaceHtmlTag(content, 60);                      //产品简介
                hPara.city           = (string)row["city"];                              //生产城市
                hPara.smallCount     = (string)row["smallCount"];                        //起订
                hPara.companyName    = (string)SqlHelper.FromDBNull(row["companyName"]); //公司名字
                hPara.ten_qq         = (string)SqlHelper.FromDBNull(row["ten_qq"]);
                hPara.com_web        = (string)SqlHelper.FromDBNull(row["com_web"]);     //网址
                hPara.addTime        = ((DateTime)row["addTime"]).ToString("yyyy-MM-dd");
                hList.Add(hPara);
            }
            return(hList);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="columnId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public List <htmlPara> GetHtmlList(string count, string columnId)
        {
            //分页查询
            List <htmlPara> hList = new List <htmlPara>();
            DataTable       dt    = SqlHelperCatalog.ExecuteDataTable(@"select top (CONVERT(int,@count)) * from htmlPara where columnId !='@columnId' order by addTime desc",
                                                                      new SqlParameter("@columnId", columnId),
                                                                      new SqlParameter("@count", count));

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                htmlPara hPara = new htmlPara();
                hPara.Id       = (long)row["Id"];
                hPara.userId   = row["userId"].ToString();
                hPara.title    = (string)row["title"];
                hPara.titleImg = (string)row["titleImg"];
                hPara.titleURL = (string)row["titleURL"];
                hPara.columnId = (string)row["columnId"];                                //栏目Id
                string content = (string)row["articlecontent"];
                hPara.articlecontent = ReplaceHtmlTag(content, 60);                      //产品简介
                hPara.city           = (string)row["city"];                              //生产城市
                hPara.smallCount     = (string)row["smallCount"];                        //起订
                hPara.companyName    = (string)SqlHelper.FromDBNull(row["companyName"]); //公司名字
                hPara.ten_qq         = (string)SqlHelper.FromDBNull(row["ten_qq"]);
                hPara.com_web        = (string)SqlHelper.FromDBNull(row["com_web"]);     //网址
                hPara.addTime        = ((DateTime)row["addTime"]).ToString("yyyy-MM-dd");
                hList.Add(hPara);
            }
            return(hList);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取栏目信息
        /// </summary>
        /// <param name="sqlstr"></param>
        /// <returns></returns>
        public List <columnInfo> GetColumns(string sqlstr)
        {
            List <columnInfo> cList = new List <columnInfo>();
            DataTable         dt    = SqlHelperCatalog.ExecuteDataTable("select * from columnInfo " + sqlstr);

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                columnInfo cInfo = new columnInfo();
                cInfo.Id         = (int)row["Id"];
                cInfo.columnName = (string)row["columnName"];
                cList.Add(cInfo);
            }
            return(cList);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 右侧浮动栏,前十条新闻
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public List <htmlPara> GetNewsFloat(string userId)
        {
            List <htmlPara> hList = new List <htmlPara>();
            DataTable       dt    = SqlHelperCatalog.ExecuteDataTable(@"select top 10 * from htmlPara where userId=1 and columnId=20 order by addTime desc",
                                                                      new SqlParameter("@userId", userId));

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                htmlPara hPara = new htmlPara();
                hPara.Id       = (long)row["Id"];
                hPara.title    = (string)row["title"];
                hPara.titleURL = row["titleURL"].ToString();
                hList.Add(hPara);
            }
            return(hList);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// XML
        /// </summary>
        /// <returns></returns>
        public List <htmlPara> GetXML()
        {
            List <htmlPara> hParaList = new List <htmlPara>();
            DataTable       dt        = SqlHelperCatalog.ExecuteDataTable("select top 1000 Id, title,titleURL,addTime from htmlPara order by Id desc");

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                htmlPara hPara = new htmlPara();
                hPara.Id       = (long)SqlHelper.FromDBNull(row["Id"]);
                hPara.title    = (string)SqlHelper.FromDBNull(row["title"]);
                hPara.titleURL = (string)SqlHelper.FromDBNull(row["titleURL"]);
                hPara.addTime  = ((DateTime)SqlHelper.FromDBNull(row["addTime"])).ToString("yyyy-MM-dd");
                hParaList.Add(hPara);
            }
            return(hParaList);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 右侧浮动栏,前十条公司产品
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public List <htmlPara> GetProFloat(string userId, string cId)
        {
            List <htmlPara> hList = new List <htmlPara>();
            DataTable       dt    = SqlHelperCatalog.ExecuteDataTable(@"select top 10 Id,title,titleURL from htmlPara where userId=@userId and columnId!=@columnId order by addTime desc",
                                                                      new SqlParameter("@userId", userId),
                                                                      new SqlParameter("@columnId", cId));

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                htmlPara hPara = new htmlPara();
                hPara.Id       = (long)SqlHelper.FromDBNull(row["Id"]);
                hPara.title    = (string)SqlHelper.FromDBNull(row["title"]);
                hPara.titleURL = (string)SqlHelper.FromDBNull(row["titleURL"]);
                hList.Add(hPara);
            }
            return(hList);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取前多少条数据
        /// </summary>
        /// <param name="count">条数</param>
        /// <param name="columnId">栏目Id</param>
        /// <returns></returns>
        public List <htmlPara> GetHtmlList(string count, string columnId)
        {
            List <htmlPara> hList = new List <htmlPara>();
            DataTable       dt    = SqlHelperCatalog.ExecuteDataTable(@"select top (CONVERT(int,@count)) Id,title,titleURL,addTime from htmlPara where columnId !='@columnId' order by addTime desc",
                                                                      new SqlParameter("@columnId", columnId),
                                                                      new SqlParameter("@count", count));

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                htmlPara hPara = new htmlPara();
                hPara.Id       = (long)SqlHelper.FromDBNull(row["Id"]);
                hPara.title    = (string)SqlHelper.FromDBNull(row["title"]);
                hPara.titleURL = (string)SqlHelper.FromDBNull(row["titleURL"]);
                hPara.addTime  = ((DateTime)SqlHelper.FromDBNull(row["addTime"])).ToString("yyyy-MM-dd");
                hList.Add(hPara);
            }
            return(hList);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取单条信息
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="columnId"></param>
        /// <returns></returns>
        public htmlPara GetHtmlPara(string columnId, string Id)
        {
            htmlPara  hPara = new htmlPara();
            DataTable dt    = SqlHelperCatalog.ExecuteDataTable(@"select * from htmlPara h left join columnInfo c on h.columnId=c.Id  where columnId =@columnId and h.Id=@Id",
                                                                new SqlParameter("@columnId", columnId),
                                                                new SqlParameter("@Id", Id));

            if (dt.Rows.Count != 1)
            {
                return(null);
            }
            DataRow row = dt.Rows[0];

            hPara.Id       = (long)SqlHelper.FromDBNull(row["Id"]);
            hPara.userId   = SqlHelper.FromDBNull(row["userId"]).ToString();
            hPara.title    = (string)SqlHelper.FromDBNull(row["title"]);
            hPara.titleImg = (string)SqlHelper.FromDBNull(row["titleImg"]);
            hPara.titleURL = (string)SqlHelper.FromDBNull(row["titleURL"]);
            hPara.columnId = (string)SqlHelper.FromDBNull(row["columnId"]);//栏目Id
            string content = (string)SqlHelper.FromDBNull(row["articlecontent"]);

            //hPara.articlecontent = ReplaceHtmlTag(content, 60);//产品简介
            hPara.articlecontent = content;
            hPara.city           = (string)SqlHelper.FromDBNull(row["city"]);        //生产城市
            hPara.smallCount     = (string)SqlHelper.FromDBNull(row["smallCount"]);  //起订
            hPara.xinghao        = (string)SqlHelper.FromDBNull(row["xinghao"]);     //型号
            hPara.unit           = (string)SqlHelper.FromDBNull(row["unit"]);        //单位
            hPara.sumCount       = (string)SqlHelper.FromDBNull(row["sumCount"]);    //供货总量
            hPara.price          = (string)SqlHelper.FromDBNull(row["price"]);       //单价
            hPara.pinpai         = (string)SqlHelper.FromDBNull(row["pinpai"]);      //品牌
            hPara.companyName    = (string)SqlHelper.FromDBNull(row["companyName"]); //公司名字
            hPara.ten_qq         = (string)SqlHelper.FromDBNull(row["ten_qq"]);
            hPara.com_web        = (string)SqlHelper.FromDBNull(row["com_web"]);     //网址
            hPara.addTime        = ((DateTime)SqlHelper.FromDBNull(row["addTime"])).ToString("yyyy-MM-dd");
            hPara.columnName     = (string)SqlHelper.FromDBNull(row["columnName"]);  //栏目名
            hPara.username       = (string)SqlHelper.FromDBNull(row["username"]);    //用户名
            return(hPara);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 查询上一条下一条
        /// </summary>
        /// <param name="columnId"></param>
        /// <param name="Id"></param>
        /// <returns></returns>
        public List <htmlPara> GetHtmlBAPage(string columnId, string Id)
        {
            List <htmlPara> hList = new List <htmlPara>();
            DataTable       dt    = SqlHelperCatalog.ExecuteDataTable(@"select top 1 -1 as [Sort],Id,title,columnId,titleURL from (select top 1 Id,title,columnId,titleURL from htmlPara where columnId=@columnId and Id<@Id order by Id desc) as tab_up 
                 union select top 1 1 as [Sort],Id,title,columnId,titleURL from (select top 1 Id,title,columnId,titleURL from htmlPara where columnId=@columnId and Id>@Id order by Id) as tab_up",
                                                                      new SqlParameter("@columnId", columnId),
                                                                      new SqlParameter("@Id", Id));

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                htmlPara hPara = new htmlPara();
                hPara.Id       = (long)row["Id"];
                hPara.title    = (string)row["title"];
                hPara.titleURL = row["titleURL"].ToString();
                hPara.columnId = (string)row["columnId"];
                hList.Add(hPara);
            }
            return(hList);
        }