Пример #1
0
        /// <summary>
        /// 获取所有大图
        /// </summary>
        private void getImgBanner()
        {
            IList <BannerInfo> allImgBanners = new List <BannerInfo>();

            allImgBanners = VshopBrowser.GetAllImgBanners();
            int activityCount = allImgBanners.Count;//获取所有的活动数量

            for (int i = 0; i < allImgBanners.Count; i++)
            {
                TplCfgInfo info2 = new NavigateInfo
                {
                    LocationType = allImgBanners[i].LocationType,
                    Url          = allImgBanners[i].Url
                };
                string loctionUrl = "javascript:";
                if (!string.IsNullOrEmpty(allImgBanners[i].Url))
                {
                    loctionUrl = info2.LoctionUrl;
                }
                if (litActivity != null)
                {
                    //排版处理
                    string text       = this.litActivity.Text;
                    int    cellCounts = 0;//排版的数量基数
                    switch (SettingsManager.GetMasterSettings(true).VTheme.ToLower())
                    {
                    case "e0402":
                    case "e0403":
                        cellCounts = 2;

                        if (activityCount % cellCounts != 0 && i == activityCount - 1)    //如果是单数,并且到了循环的最后一条图片时,
                        {
                            this.litActivity.Text = text + "<li style='list-style:none;width:100%'><a  id=\"ahref\" href='" + loctionUrl + "'><img src=\"" + allImgBanners[i].ImageUrl + "\" title=\"" + allImgBanners[i].ShortDesc + "\" alt=\"" + allImgBanners[i].ShortDesc + "\" /></a></li>";
                        }
                        else
                        {
                            this.litActivity.Text = text + "<li style='list-style:none'><a  id=\"ahref\" href='" + loctionUrl + "'><img src=\"" + allImgBanners[i].ImageUrl + "\" title=\"" + allImgBanners[i].ShortDesc + "\" alt=\"" + allImgBanners[i].ShortDesc + "\" /></a></li>";
                        }
                        break;

                    default:    //默认样式:直接堆叠.
                        this.litActivity.Text = text + "<li style='list-style:none'><a  id=\"ahref\" href='" + loctionUrl + "'><img src=\"" + allImgBanners[i].ImageUrl + "\" title=\"" + allImgBanners[i].ShortDesc + "\" alt=\"" + allImgBanners[i].ShortDesc + "\" /></a></li>";
                        break;
                    }
                }
            }


            if (allImgBanners.Count == 0)
            {
                this.div_activity = (HtmlControl)this.FindControl("div_activity");
                if (div_activity != null)
                {
                    div_activity.Visible = false;
                }

                //this.litActivity.Text = "<a id=\"ahref\"  href='javascript:'><img src=\"/Utility/pics/default.jpg\" title=\"\"  /></a>";
            }
        }