Exemplo n.º 1
0
        /// <summary>
        /// 获取更多穿搭推荐
        /// </summary>
        /// <param name="context"></param>
        private void Get_Top20_Zixun(NVelocity.VelocityContext context)
        {
            sbr.Clear();

            StringBuilder listsbr = new StringBuilder();

            int pagesize = 20;

            string where = " isend=0 and pub_state=0 and ishot=1 ";

            if (season_require_id != "")
            {
                #region  根据季节显示文章列表
                string season_where = "";

                if (season_require_id != "" && season_require_id != ",,")
                {
                    season_where = " and (";
                    string[] sarr = season_require_id.Split(',');
                    for (int s = 0; s < sarr.Length; s++)
                    {
                        string nseasonid = sarr[s];
                        if (nseasonid != "")
                        {
                            season_where += "or charindex('," + nseasonid + ",',','+New_Zixun_Season+',')>0 ";
                        }
                    }
                    season_where  = season_where.Replace("(or", "(");
                    season_where += ")";
                }

                if (season_where.IndexOf("charindex") > 0)
                {
                    where += season_where;
                }
                #endregion
            }

            string sql = "select top " + pagesize + " id,title,New_Zixun_intro_short,isimg,img_url,New_Zixun_Price,types,isnull((select product_name from HRENH_PRODUCT_PLATINFO where id=a.product_plat_id),'') as platname,isnull((select Produce_Img from HRENH_PRODUCT_PLATINFO where id=a.product_plat_id),'') as platimg,New_Zixun_Idlist from Hrenh_Article a where " + where + "order by istop desc,edittime desc";



            ds = DbHelperSQL.Query(sql);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                sbr.AppendFormat("<h4 class=\"lineread\">更多穿搭推荐</h4>");
                sbr.AppendFormat("<div class=\"shop\" style=\"margin-left:-20px;\">");

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];

                    #region  文章列表的信息
                    int    article_id    = String_Manage.Return_Int(dr["id"].ToString(), 0);
                    string article_title = String_Manage.Return_Str(dr["title"].ToString(), "");

                    string show_article_title = StringHelper.ReturnNumStr(article_title, 1, 29);
                    int    isimg       = String_Manage.Return_Int(dr["isimg"].ToString(), 0);
                    string article_img = "/template/img/nocontent.png";

                    if (isimg == 1)
                    {
                        article_img = ImgHelper.Get_UploadImgUrl(dr["img_url"].ToString(), 1);
                    }

                    int atype = Convert.ToInt32(dr["types"].ToString());

                    if (atype != 370)
                    {
                        article_title = String_Manage.Return_Str(dr["New_Zixun_intro_short"].ToString(), "");
                    }

                    //string atypename = type_bll.GetModel(type).TypeName;

                    string typeurl = "";

                    //if (type == 370)
                    //{
                    //    typeurl = "/" + ArticleHelper.Get_Type_Rname(type) + "/";
                    //}
                    //else
                    //{
                    //    //通过汉字获取该汉字的首字母
                    //    string type_shouzimu = Get_Hanzi_Shouzimu.GetSpellCode(typename);

                    //    typeurl = "/" + ArticleHelper.Get_Type_Rname(type) + type_shouzimu + "/";
                    //}

                    if (atype == 370)
                    {
                        typeurl = "/" + ArticleHelper.Get_Type_Rname(type) + "/";
                    }
                    else
                    {
                        typename = type_bll.GetModel(atype).TypeName;

                        //通过汉字获取该汉字的首字母
                        string type_shouzimu = Get_Hanzi_Shouzimu.GetSpellCode(typename);

                        typeurl = "/" + ArticleHelper.Get_Type_Rname(atype) + type_shouzimu + "/";
                    }


                    string navurl = typeurl + "show_";

                    string article_url = "href=\"" + navurl + article_id + ".html\" target=\"_blank\" title=\"" + article_title + "\"";

                    string New_Zixun_Price = dr["New_Zixun_Price"].ToString();
                    New_Zixun_Price = Recruit_Job.Return_Money(New_Zixun_Price, 1);

                    string platname = String_Manage.Return_Str(dr["platname"].ToString(), "");
                    string platimg  = String_Manage.Return_Str(dr["platimg"].ToString(), "");
                    if (platimg != "")
                    {
                        platimg = ImgHelper.Get_UploadImgUrl(platimg, 1);
                    }


                    #region  获取当前文章类型下的(特点人群下的第一类和气质风格下的第一类)
                    string typeidlist = dr["New_Zixun_Idlist"].ToString();

                    typeidlist = Set_Season_Ypdp_Typename.Get_Typename_list(typeidlist);

                    #endregion


                    #endregion

                    #region  加载文章列表

                    sbr.AppendFormat("<dl class=\"shopone\">");
                    //sbr.AppendFormat("<a {0}>", article_url);
                    //sbr.AppendFormat("<dt><img src=\"{0}\" alt=\"{1}\"><p>{2}</p></dt>", article_img,article_title, typeidlist);
                    ////sbr.AppendFormat("<dt><img src=\"{0}\" alt=\"{1}\"><img class=\"tb\" src=\"{2}\" alt=\"{3}\"></dt>", article_img, article_title, platimg, platname + "有售");

                    //sbr.AppendFormat("<dd>");
                    //sbr.AppendFormat("<h4>{0}</h4>", show_article_title);
                    ////if (platname != "")
                    ////{
                    ////    sbr.AppendFormat("<b title=\"{1}购买直通车\"><i class=\"sppt\"><img src=\"{2}\" alt=\"{1}\"></i><i>¥</i>{0}</b>", prices, platname, platimg);
                    ////}
                    ////else
                    ////{
                    ////    sbr.AppendFormat("<b><i>¥</i>{0}</b>",prices);
                    ////}
                    //////sbr.AppendFormat("<div class=\"fav\"><em class=\"fav-i\"></em>  <span class=\"fav-n\">1228</span>  </div>");
                    //sbr.AppendFormat("</dd>");
                    //sbr.AppendFormat("</a>");


                    sbr.AppendFormat("<dt>");
                    sbr.AppendFormat("<a {0}>", article_url);
                    sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\">", article_img, article_title);
                    sbr.AppendFormat("</a>");

                    sbr.AppendFormat("<p><a {0}>{1}</a></p>", article_url, typeidlist);

                    sbr.AppendFormat("</dt>");
                    sbr.AppendFormat("<dd>");
                    sbr.AppendFormat("<a {0}>", article_url);
                    sbr.AppendFormat("<h4>{0}</h4>", show_article_title);
                    sbr.AppendFormat("</a>");
                    sbr.AppendFormat("</dd>");

                    sbr.AppendFormat("</dl>");


                    #endregion
                }

                sbr.AppendFormat("</div>");
            }

            context.Put("gdcdtj", sbr.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载文章列表
        /// </summary>
        /// <param name="context"></param>
        private void GetList(NVelocity.VelocityContext context)
        {
            sbr.Clear();

            try
            {
                PageClass pc = new PageClass();

                int record_cnt = 0;
                int page_cnt   = 0;
                int curpage    = 1;
                int pagesize   = 49;

                curpage = String_Manage.Return_Request_Int("page", 1);

                int page = 0;

                if (curpage > 0)
                {
                    page = curpage - 1;
                }

                string where = " and types=" + type + " and isend=0 and a.pub_state=0 and type_parent=" + type_parent + " and New_Zixun_Is_Tbk=0 ";


                if (stype > 0)
                {
                    where = " and charindex('," + stype + ",',','+New_Zixun_Idlist+',')>0 ";
                }


                #region  根据季节显示文章列表
                string season_where = "";

                if (season_require_id_linshi != "" && season_require_id_linshi != ",,")
                {
                    season_where = " and (";
                    string[] sarr = season_require_id_linshi.Split(',');
                    for (int s = 0; s < sarr.Length; s++)
                    {
                        string nseasonid = sarr[s];
                        if (nseasonid != "")
                        {
                            season_where += "or charindex('," + nseasonid + ",',','+New_Zixun_Season+',')>0 ";
                        }
                    }
                    season_where  = season_where.Replace("(or", "(");
                    season_where += ")";
                }

                if (season_where.IndexOf("charindex") > 0)
                {
                    where += season_where;
                }
                #endregion

                //context.Put("redirecturl_error",page+"@@@@@@"+ where);

                ds = pc.TagList_New("*", " edittime desc ", " hrenh_article a ", where, page, pagesize, " id,title,isimg,img_url,edittime,New_Zixun_Price,New_Zixun_intro_short,isnull((select product_name from HRENH_PRODUCT_PLATINFO where id=a.product_plat_id),'') as platname,isnull((select Produce_Img from HRENH_PRODUCT_PLATINFO where id=a.product_plat_id),'') as platimg,New_Zixun_Idlist ");

                if (ds != null && ds.Tables[2].Rows.Count > 0)
                {
                    record_cnt = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
                    page_cnt   = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
                    for (int i = 0; i < ds.Tables[2].Rows.Count; i++)
                    {
                        DataRow dr = ds.Tables[2].Rows[i];

                        #region  文章列表的信息
                        int    article_id    = String_Manage.Return_Int(dr["id"].ToString(), 0);
                        string article_title = String_Manage.Return_Str(dr["title"].ToString(), "");
                        string short_intro   = String_Manage.Return_Str(dr["New_Zixun_intro_short"].ToString(), "");

                        if (type != 370)
                        {
                            if (short_intro != "")
                            {
                                article_title = short_intro;
                            }
                        }

                        string show_article_title = StringHelper.ReturnNumStr(article_title, 0, 29);
                        int    isimg       = String_Manage.Return_Int(dr["isimg"].ToString(), 0);
                        string article_img = "/template/img/nocontent.png";

                        if (isimg == 1)
                        {
                            article_img = ImgHelper.Get_UploadImgUrl(dr["img_url"].ToString(), 1);
                        }

                        string article_addtime = TimeParser.ReturnCurTime(dr["edittime"].ToString(), 1);
                        string prices          = String_Manage.Return_Str(dr["New_Zixun_Price"].ToString(), "0");
                        prices = Recruit_Job.Return_Money(prices, 1);

                        //搭配栏目
                        if (type == 370)
                        {
                            type_shouzimu = "";
                        }

                        string article_url = " href='/" + prname + type_shouzimu + "/show_" + article_id + ".html' target='_blank' title='" + article_title + "' ";

                        string platname = String_Manage.Return_Str(dr["platname"].ToString(), "");
                        string platimg  = String_Manage.Return_Str(dr["platimg"].ToString(), "");
                        if (platimg != "")
                        {
                            platimg = ImgHelper.Get_UploadImgUrl(platimg, 1);
                        }



                        #region  获取当前文章类型下的(特点人群下的第一类和气质风格下的第一类)
                        string typeidlist = dr["New_Zixun_Idlist"].ToString();

                        typeidlist = Set_Season_Ypdp_Typename.Get_Typename_list(typeidlist);

                        #endregion


                        #endregion

                        #region  加载文章列表


                        sbr.AppendFormat("<dl class=\"shopone\">");
                        //sbr.AppendFormat("<a {0}>", article_url);
                        //sbr.AppendFormat("<dt><img src=\"{0}\" alt=\"{1}\"><p>{2}</p></dt>", article_img,article_title, typeidlist);
                        ////sbr.AppendFormat("<dt><img src=\"{0}\" alt=\"{1}\"><img class=\"tb\" src=\"{2}\" alt=\"{3}\"></dt>", article_img, article_title, platimg, platname + "有售");

                        //sbr.AppendFormat("<dd>");
                        //sbr.AppendFormat("<h4>{0}</h4>", show_article_title);
                        ////if (platname != "")
                        ////{
                        ////    sbr.AppendFormat("<b title=\"{1}购买直通车\"><i class=\"sppt\"><img src=\"{2}\" alt=\"{1}\"></i><i>¥</i>{0}</b>", prices, platname, platimg);
                        ////}
                        ////else
                        ////{
                        ////    sbr.AppendFormat("<b><i>¥</i>{0}</b>",prices);
                        ////}
                        //////sbr.AppendFormat("<div class=\"fav\"><em class=\"fav-i\"></em>  <span class=\"fav-n\">1228</span>  </div>");
                        //sbr.AppendFormat("</dd>");
                        //sbr.AppendFormat("</a>");


                        sbr.AppendFormat("<dt>");
                        sbr.AppendFormat("<a {0}>", article_url);
                        sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\">", article_img, article_title);
                        sbr.AppendFormat("</a>");

                        sbr.AppendFormat("<p><a {0}>{1}</a></p>", article_url, typeidlist);

                        sbr.AppendFormat("</dt>");
                        sbr.AppendFormat("<dd>");
                        sbr.AppendFormat("<a {0}>", article_url);
                        sbr.AppendFormat("<h4>{0}</h4>", show_article_title);
                        sbr.AppendFormat("</a>");
                        sbr.AppendFormat("</dd>");



                        sbr.AppendFormat("</dl>");


                        #endregion
                    }
                }
                else
                {
                    sbr.Append("<div class=\"nodata\"></div>");
                }

                if (curpage > page_cnt)
                {
                    curpage = page_cnt;
                }

                if (curpage < page_cnt)
                {
                    sbr.AppendFormat("<dl class=\"shopone\">");
                    sbr.AppendFormat("<a href=\"javascript:;\" title=\"下一页\" class=\"cat-page-next trans200\" onclick='GoPage(" + (curpage + 1) + ")'></a>");
                    sbr.AppendFormat("</dl>");
                }


                context.Put("list", sbr.ToString());
                context.Put("listPage", NewXzc.Common.GenerPage.pageHtml(record_cnt, pagesize, curpage, "GoPage"));
            }
            catch (Exception ex)
            {
                context.Put("redirecturl", "/404");
            }
        }