/// <summary> /// 获取产品推荐的内容 /// </summary> /// <param name="title"></param> /// <param name="show_title"></param> /// <param name="openstyle"></param> /// <param name="httpurl"></param> /// <param name="imgurl"></param> /// <param name="width_height"></param> /// <returns></returns> private string GetProductContent(string title, string show_title, int openstyle, string httpurl, string imgurl, string width_height) { sbr.Clear(); sbr.AppendFormat("<div class=\"item-productReco-box\">"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">", title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); sbr.AppendFormat("<span>"); sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{1}\">{0}</a>", show_title, title); sbr.AppendFormat("</span>"); } else { sbr.AppendFormat("<a {1} title=\"{0}\">", title, Return_HttpURL.Return_Url(httpurl, openstyle)); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); sbr.AppendFormat("<span>"); sbr.AppendFormat("<a {1} title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); sbr.AppendFormat("</span>"); } sbr.AppendFormat("</div>"); return(sbr.ToString()); }
/// <summary> /// 获取红人资讯、红人作品、红人专访、红人专题,这四项右侧的推荐图 /// </summary> /// <param name="cid">对应位置编号</param> private string GetItemImg(int cid) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(1, " pageid=1000 and cid=" + cid + " "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 14); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"138\" width=\"236\""; sbr.AppendFormat("<div class=\"item-content-img\">"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">", title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); sbr.AppendFormat("<span>"); sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{1}\">{0}</a>", show_title, title); sbr.AppendFormat("</span>"); } else { sbr.AppendFormat("<a {0} title=\"{1}\">", Return_HttpURL.Return_Url(httpurl, openstyle), title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); sbr.AppendFormat("<span>"); sbr.AppendFormat("<a {2} title=\"{1}\">{0}</a>", show_title, title, Return_HttpURL.Return_Url(httpurl, openstyle)); sbr.AppendFormat("</span>"); } sbr.AppendFormat("</div>"); } } return(sbr.ToString()); }
/// <summary> /// 获取文章详情右侧广告图 /// </summary> /// <returns></returns> public static string Get_Article_Detail_Ad(int cid) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(1, " pageid=" + pid + " and cid= " + cid); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 22); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"250\" width=\"300\""; if (cid == 1011) { width_height = "height=\"60\" width=\"640\""; } if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">", title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); } else { sbr.AppendFormat("<a {1} title=\"{0}\">", title, Return_HttpURL.Return_Url(httpurl, openstyle)); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); } } } return(sbr.ToString()); }
/// <summary> /// 新闻热点、红人专访 /// </summary> /// <param name="cid"></param> /// <returns></returns> private string Get_News_Hren(int cid) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(8, " pageid=1000 and cid=" + cid + " "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = ArticleHelper.GetArticleTitle(dr["v2"].ToString()); title = StringHelper.ReturnNumStr(title, 2, 0); string show_title = StringHelper.ReturnNumStr(title, 2, 18); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"130\" width=\"300\""; sbr.AppendFormat("<li>"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">{1}", title, show_title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); } else { sbr.AppendFormat("<a {1} title=\"{0}\">{2}", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); } sbr.AppendFormat("</li>"); } } return(sbr.ToString()); }
public override void Page_Load(ref NVelocity.VelocityContext context) { base.Page_Load(ref context); #region 加载首页友情链接 StringBuilder sbr_foot = new StringBuilder(); DataSet ds_foot = null; BLL.RED_RECOMMEND recommend_bll_foot = new BLL.RED_RECOMMEND(); ds_foot = recommend_bll_foot.GetList_NewIndex(0, " pageid=2000 and cid=1001 "); if (ds_foot != null && ds_foot.Tables[0].Rows.Count > 0) { sbr_foot.AppendFormat("<div class=\"friendLink\">"); sbr_foot.AppendFormat("<div class=\"box\">"); sbr_foot.AppendFormat("<div>"); sbr_foot.AppendFormat("<h2>友情链接</h2>"); for (int i = 0; i < ds_foot.Tables[0].Rows.Count; i++) { DataRow dr = ds_foot.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 3, 0); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); sbr_foot.AppendFormat("<a {1} title=\"{0}\">{0}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle)); if (i < ds_foot.Tables[0].Rows.Count - 1) { sbr_foot.AppendFormat("<i>|</i>"); } } sbr_foot.AppendFormat("</div>"); sbr_foot.AppendFormat("</div>"); sbr_foot.AppendFormat("</div>"); } context.Put("foot_link", sbr_foot.ToString()); #endregion }
/// <summary> /// 获取列表页热点文章 /// </summary> /// <returns></returns> public static string Get_Hot_Articel() { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(0, " pageid=2100 and cid=1001 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 1, 0); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string show_title = StringHelper.ReturnNumStr(title, 3, 20); sbr.AppendFormat("<li>"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">{1}</a>", title, show_title); } else { if (httpurl.ToLower().Contains("http://")) { sbr.AppendFormat("<a {1} target='_blank' title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); } else { sbr.AppendFormat("<a href='{1}' target='_blank' title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); } } sbr.AppendFormat("</li>"); } } return(sbr.ToString()); }
/// <summary> /// 获取文章相关热门文章 /// </summary> /// <param name="article_id">当前被访问的文章的ID,可为0(代表列表页)</param> /// <returns></returns> public static string Get_New_Article(int article_id) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(10, " pageid=" + pid + " and cid=1008 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string title = ""; try { title = DbHelperSQL.GetSingle("select top 1 isnull(title,0) as title from hrenh_article where id=" + desc + " and pub_state=0").ToString(); } catch (Exception ex) { } title = StringHelper.ReturnNumStr(title, 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 18); sbr.AppendFormat("<li>"); sbr.AppendFormat("<i>{0}</i>", (i + 1)); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">{1}</a>", title, show_title); } else { sbr.AppendFormat("<a {1} title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); } //int cnt = 0; //try //{ // cnt=Convert.ToInt32(DbHelperSQL.GetSingle("select top 1 isnull(read_cnt,0) as cnt from hrenh_article where id="+desc+"").ToString()); //} //catch (Exception ex) //{ //} //if (desc == article_id.ToString()) //{ // cnt = cnt + 1; //} //sbr.AppendFormat("<span><b>{0}</b> 阅读</span>",cnt); sbr.AppendFormat("</li>"); } } return(sbr.ToString()); }
/// <summary> /// 获取指定数目的图片,可为0 /// </summary> /// <param name="top">具体的数目,可为0</param> /// <param name="pageid">页面ID</param> /// <param name="cid">栏目ID</param> /// <returns></returns> public static string Get_Tj_Img(int top, int pageid, int cid) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(top, " pageid=" + pageid + " and cid=" + cid + " "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 18); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"300\" width=\"640\""; if (cid == 1002 || cid == 1003) { sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\">"); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<a title=\"{0}\" class=\"white\" {1}><img width=\"320\" height=\"250\" border=\"0\" alt=\"{0}\" src=\"{2}\"><em class=\"fcut\"><span>{3}</span></em></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("</div>"); sbr.AppendFormat("</div>"); } else if (pageid == 2300 && cid == 1001) { sbr.AppendFormat("<div>"); httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); sbr.AppendFormat("<a title=\"{0}\" {1}><img alt=\"{0}\" src=\"{2}\"></a>", title, httpurl, imgurl); sbr.AppendFormat("</div>"); } else if (cid == 1004) { string curhref = " href='javascript:;' "; if (httpurl != "") { curhref = " href='" + httpurl + "' target='_blank' "; } string red_title = title; if (title == "羽绒服" || title == "呢子大衣" || title == "卫衣") { red_title = "<font style='font-weight:bold;'>" + title + "</font>"; } sbr.AppendFormat("<a {1} title=\"{0}\">{2}</a><span style=\"margin-left:10px;margin-right:10px;\">/</span>", title, curhref, red_title); } else if (cid == 1008) { if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<a {0} title=\"{1}\"><img src=\"{2}\" alt=\"{1}\"></a>", httpurl, title, imgurl); } else if (cid == 1009) { sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\">"); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } //sbr.AppendFormat("<a title=\"{0}\" class=\"white\" href=\"{1}\"><img width=\"280\" height=\"429\" border=\"0\" alt=\"{0}\" src=\"{2}\"><em class=\"fcut\"><span>{3}</span></em></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("<a title=\"{0}\" class=\"white\" {1}><img width=\"280\" height=\"429\" border=\"0\" alt=\"{0}\" src=\"{2}\"></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("</div>"); sbr.AppendFormat("</div>"); } else if (cid == 1005)//详情页热门推荐轮播图 { show_title = StringHelper.ReturnNumStr(title, 1, 15); sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\">"); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<a {1} title=\"{0}\" class=\"white\"><img border=\"0\" alt=\"{0}\" src=\"{2}\"><em class=\"fcut\"><span>{3}</span></em></a>", title, httpurl, imgurl, show_title); sbr.AppendFormat("</div>"); sbr.AppendFormat("</div>"); } else if (cid == 1006) { show_title = StringHelper.ReturnNumStr(title, 1, 22); string cname_class = ""; if (i == 0) { cname_class = "mar10"; } sbr.AppendFormat("<dl class=\"ltjh-list {0}\">", cname_class); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<dt><a {0} title=\"{1}\"><img src=\"{2}\" alt=\"{1}\"></a></dt>", httpurl, title, imgurl); sbr.AppendFormat("<dd><a {0} title=\"{1}\">{2}</a></dd>", httpurl, title, show_title); sbr.AppendFormat("</dl>"); } else if (cid == 1007) { show_title = StringHelper.ReturnNumStr(title, 1, 13); desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 1, 13); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\"><a {0} title=\"{1}\"><img width=\"300\" height=\"390\" border=\"0\" alt=\"{1}\" src=\"{2}\"></a></div>", httpurl, title, imgurl); sbr.AppendFormat("<p>"); sbr.AppendFormat("<a {0} title=\"{1}\">{2}</a>", httpurl, title, show_title); sbr.AppendFormat("<span>{0}</span>", desc); sbr.AppendFormat("</p>"); sbr.AppendFormat("<p class=\"everyday-pickC\">"); sbr.AppendFormat("</p>"); sbr.AppendFormat("<span style=\"position:absolute;left:15px;top:343px;color:#fff;font-size:20px;\"><i style=\"color:#c0292a\"></i>/<b style=\"color:#ffffff\"></b></span>"); sbr.AppendFormat("</div>"); } else if (cid == 1010) { show_title = StringHelper.ReturnNumStr(title, 1, 23); desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 1, 13); if (openstyle != 1 && openstyle != 2) { httpurl = " href='javascript:;' "; } else { httpurl = Return_HttpURL.Return_Url(httpurl, openstyle); } sbr.AppendFormat("<div class=\"item\"><div class=\"g-pic\"><a {0} title=\"{1}\"><img width=\"300\" height=\"390\" border=\"0\" alt=\"{1}\" src=\"{2}\"></a></div>", httpurl, title, imgurl); sbr.AppendFormat("<p>"); sbr.AppendFormat("<a {0} title=\"{1}\">{2}</a>", httpurl, title, show_title); //sbr.AppendFormat("<span>{0}</span>", desc); sbr.AppendFormat("</p>"); sbr.AppendFormat("<p class=\"everyday-pickC\">"); sbr.AppendFormat("</p>"); sbr.AppendFormat("<span style=\"position:absolute;left:15px;top:343px;color:#fff;font-size:20px;\"><i style=\"color:#c0292a\"></i>/<b style=\"color:#ffffff\"></b></span>"); sbr.AppendFormat("</div>"); } } } return(sbr.ToString()); }
/// <summary> /// 今日热点 /// </summary> /// <param name="context"></param> private string Get_Jrrd(NVelocity.VelocityContext context) { StringBuilder sbr = new StringBuilder(); DataSet ds = null; int pid = 2100; sbr.Clear(); ds = recommend_bll.GetList_NewIndex(24, " pageid=" + pid + " and cid=1012 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { int total = ds.Tables[0].Rows.Count; int cols = 6; int rows = 0; if (total % cols == 0) { rows = total / cols; } else { rows = total / cols + 1; } for (int i = 0; i < rows; i++) { sbr.AppendFormat("<div class=\"today_div\">"); for (int j = i * cols; j < (i + 1) * cols; j++) { if (j < total) { DataRow dr = ds.Tables[0].Rows[j]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 1, 17); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); sbr.AppendFormat("<div class=\"fcut\">"); sbr.AppendFormat("<div class=\"mask\">"); sbr.AppendFormat("<a {0} title=\"{1}\">", Return_HttpURL.Return_Url(httpurl, openstyle), title); sbr.AppendFormat("{0}</a>", show_title); sbr.AppendFormat("</div>"); sbr.AppendFormat("</div>"); } else { break; } } sbr.AppendFormat("</div>"); } } return(sbr.ToString()); }
/// <summary> /// 获取列表页中头部的轮播图 /// </summary> private string GetLB() { sbr.Clear(); int cid = 0; switch (type) { case 1: cid = 1001; break; case 2: cid = 1002; break; case 3: cid = 1003; break; case 4: cid = 1004; break; case 5: cid = 1005; break; case 35: cid = 1012; break; case 40: cid = 1012; break; case 41: cid = 1012; break; case 42: cid = 1012; break; } ds = recommend_bll.GetList_NewIndex(6, " pageid=1100 and cid=" + cid + " "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 18); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"300\" width=\"640\""; sbr.AppendFormat("<div>"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("<span class=\"slides-descride\">"); sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{1}\">{0}</a>", show_title, title); sbr.AppendFormat("</span>"); } else { sbr.AppendFormat("<a {2} title=\"{1}\"><img src=\"{0}\" alt=\"{1}\" {3}></a>", imgurl, title, Return_HttpURL.Return_Url(httpurl, openstyle), width_height); sbr.AppendFormat("<span class=\"slides-descride\">"); sbr.AppendFormat("<a {2} title=\"{1}\">{0}</a>", show_title, title, Return_HttpURL.Return_Url(httpurl, openstyle)); sbr.AppendFormat("</span>"); } sbr.AppendFormat("</div>"); } } return(sbr.ToString()); }
/// <summary> /// 获取二级和三级 /// </summary> private void Get_Second_Third(NVelocity.VelocityContext context) { sbr.Clear(); int pageid = 2200; int cid = 1001; string navurl_list = ""; switch (type) { case 49: cid = 1001; break; case 50: cid = 1002; break; case 51: cid = 1003; break; case 52: cid = 1004; break; case 53: cid = 1005; break; case 54: cid = 1006; break; case 55: cid = 1007; break; case 370: cid = 1008; break; } try { DataSet adds = DbHelperSQL.Query("select v3,v4,url from red_recommend where pageid=" + pageid + " and cid=" + cid + " order by sort asc,id desc"); if (adds != null && adds.Tables[0].Rows.Count > 0) { StringBuilder adsbr = new StringBuilder(); foreach (DataRow addr in adds.Tables[0].Rows) { string imgurl = ImgHelper.GetCofigShowUrl() + addr["v3"].ToString(); string httpurl = String_Manage.Return_Str(addr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(addr["v4"].ToString(), 0); adsbr.AppendFormat("<a class=\"right_img\" {0} title=\"女装搭配\">", Return_HttpURL.Return_Url(httpurl, openstyle)); adsbr.AppendFormat("<img src=\"{0}\" alt=\"女装搭配\">", imgurl); adsbr.AppendFormat("</a>"); } context.Put("adimgs", adsbr.ToString()); } } catch (Exception ex) { } //不是搭配栏目 if (type < 370) { //当前大类型下的第一类型的ID int first_type_id = 0; try { first_type_id = Convert.ToInt32(DbHelperSQL.GetSingle("select top 1 id from HRENH_ARTICLE_TYPE where pid=" + type + " order by id asc").ToString()); } catch (Exception ex) { } try { string son_sql = "select a.id,a.typename,a.lvl,(select top 1 TypeImg from HRENH_ARTICLE_TYPE where id=a.id) as typeimg from return_article_all_son_typelist(" + type + "," + type_parent + ") a where a.lvl=1"; ds = DbHelperSQL.Query(son_sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int f = 0; f < ds.Tables[0].Rows.Count; f++) { DataRow dr = ds.Tables[0].Rows[f]; string id = dr["id"].ToString(); string typename = dr["typename"].ToString(); string lvl = dr["lvl"].ToString(); string typeimg = dr["typeimg"].ToString(); if (typeimg != "") { typeimg = ImgHelper.Get_UploadImgUrl(typeimg, 1); } string article_url = " href='javascript:void(0)' title='" + typename + "' "; //sbr.AppendFormat("<div class=\"resumeWrap\">"); //sbr.AppendFormat("<div class=\"catalogInfo\">"); //sbr.AppendFormat("<a {0}>", article_url); //sbr.AppendFormat("<p class=\"title\">{0}</p>", typename); //sbr.AppendFormat("</a>"); //sbr.AppendFormat("<a class=\"imgWrap\" {0}>", article_url); //sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\">", typeimg, typename); //sbr.AppendFormat("</a>"); //sbr.AppendFormat("</div>"); sbr.AppendFormat("<dl class=\"type_section first\">"); sbr.AppendFormat("<dt><a {0}>{1}</a></dt>", article_url, typename); sbr.AppendFormat("<dd>"); sbr.AppendFormat("<a class=\"cat_img\" {0}>", article_url); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\">", typeimg, typename); sbr.AppendFormat("</a>"); sbr.AppendFormat("<ul>"); #region 加载三级 string third_sql = "select a.id,a.typename,(select TypeRename from hrenh_article_type where id=a.id) as rname from return_article_all_son_typelist(" + id + "," + type_parent + ") a where a.lvl=1"; //不是包包、美妆下的类型 if (type != baobao_id && type != meizhuang_id) { if (first_type_id.ToString() == id) { if (season_require_id != "") { ////当前显示类型是配饰 //if (type == peishi_id) //{ // //当前被设置显示的季节是四季 // if (season_require_id_linshi.IndexOf(season_siji_id_linshi) >= 0) // { // third_sql += " and charindex('" + season_require_id_linshi+ "',','+(select season_id from hrenh_article_type where id=a.id)+',')>0 "; // } // else//当前被设置显示的季节不是四季 // { // third_sql += " and charindex('" + season_require_id_linshi + season_siji_id_linshi + "',','+(select season_id from hrenh_article_type where id=a.id)+',')>0 "; // } //} //else //{ third_sql += " and (select season_id from hrenh_article_type where id=a.id) in(" + season_require_id + ")"; //} } } } DataSet sonds = DbHelperSQL.Query(third_sql); if (sonds != null && sonds.Tables[0].Rows.Count > 0) { int total_cnt = sonds.Tables[0].Rows.Count; int column = 4; int rows = 0; if (total_cnt % column == 0) { rows = total_cnt / column; } else { rows = total_cnt / column + 1; } for (int i = 0; i < rows; i++) { //sbr.AppendFormat("<div class=\"catalogChoice\">"); //sbr.AppendFormat("<ul>"); for (int j = i * column; j < (i + 1) * column; j++) { if (j < total_cnt) { DataRow sdr = sonds.Tables[0].Rows[j]; id = sdr["id"].ToString(); typename = sdr["typename"].ToString(); string rname = sdr["rname"].ToString(); //是否是被热推的类型 string cur_type_hot = ""; if (f == 0) { //cur_type_hot = "hot"; typeurl = "/" + rname + type_shouzimu + "/"; } else { //typeurl = "/" + prname + "/" + rname + "/"; typeurl = "/" + prname + "/" + rname + ".html"; } article_url = " href='" + typeurl + "' title='" + typename + "' "; navurl_list += "http://www.ypindapei.com" + typeurl + "|" + typename; //sbr.AppendFormat("<li><a {0}>{1}</a></li>", article_url, typename); sbr.AppendFormat("<li>"); sbr.AppendFormat("<a {0} class=\"pagani_log_link {2}\" >{1}</a>", article_url, typename, cur_type_hot); sbr.AppendFormat("</li>"); } else { break; } } //sbr.AppendFormat("</ul>"); //sbr.AppendFormat("</div>"); } } #endregion //sbr.AppendFormat("</div>"); sbr.AppendFormat("</ul>"); sbr.AppendFormat("</dd>"); sbr.AppendFormat("</dl>"); } } context.Put("Second_Third", sbr.ToString()); context.Put("redirecturl_error", navurl_list); } catch (Exception ex) { //context.Put("redirecturl","/404"); context.Put("redirecturl_error", ex.ToString()); } } }
/// <summary> /// 红人写真 /// </summary> /// <param name="context"></param> private void GetXZImg(NVelocity.VelocityContext context) { sbr.Clear(); ds = recommend_bll.GetList_NewIndex(5, " pageid=1000 and cid=1006 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 2, 0); string show_title = StringHelper.ReturnNumStr(title, 2, 22); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"405\" width=\"450\""; switch (i) { case 0: width_height = "height=\"405\" width=\"450\""; break; case 1: width_height = "height=\"200\" width=\"340\""; break; case 2: width_height = "height=\"200\" width=\"200\""; show_title = StringHelper.ReturnNumStr(title, 2, 12); break; case 3: width_height = "height=\"200\" width=\"200\""; show_title = StringHelper.ReturnNumStr(title, 2, 12); break; case 4: width_height = "height=\"200\" width=\"340\""; break; } sbr.AppendFormat("<div class=\"item-photo-box\">"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">", title); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); sbr.AppendFormat("<span>"); sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{1}\">{0}</a>", show_title, title); sbr.AppendFormat("</span>"); } else { sbr.AppendFormat("<a {1} title=\"{0}\">", title, Return_HttpURL.Return_Url(httpurl, openstyle)); sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); sbr.AppendFormat("</a>"); sbr.AppendFormat("<span>"); sbr.AppendFormat("<a {1} title=\"{0}\">{2}</a>", title, Return_HttpURL.Return_Url(httpurl, openstyle), show_title); sbr.AppendFormat("</span>"); } sbr.AppendFormat("</div>"); } } context.Put("xz", sbr.ToString()); }
/// <summary> /// 首页轮播图 /// </summary> /// <param name="context"></param> private void GetTopImg(NVelocity.VelocityContext context) { sbr.Clear(); StringBuilder html = new StringBuilder(); int cnt = 0; ds = recommend_bll.GetList_NewIndex(0, " pageid=1000 and cid=1001 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { cnt = ds.Tables[0].Rows.Count; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 0, 22); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"350\" width=\"680\""; //sbr.AppendFormat("<div>"); //if (openstyle != 1 && openstyle != 2) //{ // sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); // sbr.AppendFormat("<span class=\"slides-descride\">"); // sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{1}\">{0}</a>",show_title,title); // sbr.AppendFormat("</span>"); //} //else //{ // sbr.AppendFormat("<a {2} title=\"{1}\"><img src=\"{0}\" alt=\"{1}\" {3}></a>", imgurl, title, Return_HttpURL.Return_Url(httpurl, openstyle), width_height); // sbr.AppendFormat("<span class=\"slides-descride\">"); // sbr.AppendFormat("<a {2} title=\"{1}\">{0}</a>", show_title, title, Return_HttpURL.Return_Url(httpurl, openstyle)); // sbr.AppendFormat("</span>"); //} //sbr.AppendFormat("</div>"); sbr.AppendFormat("<div class=\"item imgwrap\">"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\">", imgurl, title); //sbr.AppendFormat("<span class=\"slides-descride\">"); //sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{1}\">{0}</a>", show_title, title); //sbr.AppendFormat("</span>"); } else { sbr.AppendFormat("<a {2} title=\"{1}\"><img src=\"{0}\" alt=\"{1}\"></a>", imgurl, title, Return_HttpURL.Return_Url(httpurl, openstyle)); //sbr.AppendFormat("<span class=\"slides-descride\">"); //sbr.AppendFormat("<a {2} title=\"{1}\">{0}</a>", show_title, title, Return_HttpURL.Return_Url(httpurl, openstyle)); //sbr.AppendFormat("</span>"); } sbr.AppendFormat("</div>"); if (i == 0) { html.AppendFormat("<span class=\"dot_list current\" onmouseover=\"slide_00.slideToNearBy({0})\"></span>", i); } else { html.AppendFormat("<span class=\"dot_list\" onmouseover=\"slide_00.slideToNearBy({0})\"></span>", i); } } } context.Put("lunbo", sbr.ToString()); context.Put("lunbo_2", html.ToString()); context.Put("cnt", cnt); }
/// <summary> /// 相关阅读 /// </summary> /// <param name="context"></param> public void Init_Xgyd(NVelocity.VelocityContext context) { StringBuilder sbr = new StringBuilder(); DataSet ds = null; int pid = 1300; try { ds = recommend_bll.GetList_NewIndex(4, " pageid=" + pid + " and cid=1010 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string title = ""; int isimg = 0; string imgurl = "/template/img/nocontent.png"; string addtime = ""; string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); try { DataSet ads = DbHelperSQL.Query("select top 1 title,isimg,img_url,addtime from hrenh_article where id=" + desc + " and pub_state=0"); if (ads != null && ads.Tables[0].Rows.Count > 0) { for (int j = 0; j < ads.Tables[0].Rows.Count; j++) { DataRow adr = ads.Tables[0].Rows[j]; title = adr["title"].ToString(); isimg = String_Manage.Return_Int(adr["isimg"].ToString(), 0); if (isimg == 1) { imgurl = ImgHelper.Get_UploadImgUrl(adr["img_url"].ToString(), 1); } addtime = TimeParser.ReturnCurTime(adr["addtime"].ToString(), 4); } } } catch (Exception ex) { } title = StringHelper.ReturnNumStr(title, 0, 0); string show_title = StringHelper.ReturnNumStr(title, 1, 38); string width_height = "height=\"60\" width=\"90\""; sbr.AppendFormat("<li>"); sbr.AppendFormat("<em></em>"); sbr.AppendFormat("<a {1} title=\"{0}\">", title, Return_HttpURL.Return_Url(httpurl, openstyle)); sbr.AppendFormat("{0}", show_title); sbr.AppendFormat("</a>"); sbr.AppendFormat("<span>{0}</span>", addtime); sbr.AppendFormat("</li>"); } } else { sbr.Append("<div class=\"nodata\">没有找到相关数据</div>"); } } catch (Exception ex) { sbr.AppendFormat(ex.ToString()); } context.Put("xgyd", sbr.ToString()); }
/// <summary> /// 相关搜索上方广告 /// </summary> /// <param name="context"></param> private void Init_Search_Ad(NVelocity.VelocityContext context) { StringBuilder sbr = new StringBuilder(); DataSet ds = null; int pid = 1300; sbr.Clear(); ds = recommend_bll.GetList_NewIndex(0, " pageid=" + pid + " and cid=1009 "); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; string title = StringHelper.ReturnNumStr(dr["v1"].ToString(), 0, 0); string show_title = StringHelper.ReturnNumStr(title, 1, 10); string desc = StringHelper.ReturnNumStr(dr["v2"].ToString(), 0, 80); string imgurl = ImgHelper.GetCofigShowUrl() + dr["v3"].ToString(); string httpurl = String_Manage.Return_Str(dr["url"].ToString(), ""); //链接打开方式,1:在本页面打,2:在新页面打开 int openstyle = String_Manage.Return_Int(dr["v4"].ToString(), 0); string width_height = "height=\"90\" width=\"640\""; //if (openstyle != 1 && openstyle != 2) //{ // sbr.AppendFormat("<a href=\"javascript:void(0)\" title=\"{0}\">", title); // sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); // sbr.AppendFormat("</a>"); //} //else //{ // sbr.AppendFormat("<a {1} title=\"{0}\">", title, Return_HttpURL.Return_Url(httpurl, openstyle)); // sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, title, width_height); // sbr.AppendFormat("</a>"); //} string hittpurl = " href=\"javascript:;\" "; show_title = StringHelper.ReturnNumStr(title, 1, 0); width_height = "height=\"128\" width=\"128\""; //<div class="nn" style="position: relative;"><a href="javascript:;"><img src="$img/01.jpg"><p class="tuceng4"><span class="mone">¥54.00</span></p></a></div> sbr.AppendFormat("<div class=\"nn\" style=\"position: relative;\">"); if (openstyle != 1 && openstyle != 2) { sbr.AppendFormat("<a {0} title=\"{1}\">", hittpurl, title); } else { sbr.AppendFormat("<a {0} title=\"{1}\">", Return_HttpURL.Return_Url(httpurl, openstyle), title); } sbr.AppendFormat("<img src=\"{0}\" alt=\"{1}\" {2}>", imgurl, show_title, width_height); sbr.AppendFormat("<p class=\"tuceng4\"><span class=\"mone\">¥{0}</span></p>", Recruit_Job.Return_Money(desc, 2)); sbr.AppendFormat("</a>"); sbr.AppendFormat("</div>"); } } context.Put("Search_Ad", sbr.ToString()); }