Ejemplo n.º 1
0
        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
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取文章列表右侧广告图
        /// </summary>
        /// <returns></returns>
        public static string Get_Article_List_Ad()
        {
            sbr.Clear();

            ds = recommend_bll.GetList_NewIndex(1, " pageid=" + pid + " 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(), 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 (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());
        }
Ejemplo n.º 3
0
        /// <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());
        }
Ejemplo n.º 4
0
        /// <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());
        }
Ejemplo n.º 5
0
        /// <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>
        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());
        }