using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using BookShopOnline.Bll;
using BookShopOnline.Model;

public partial class AdPic : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            ShowAdPic();
    }
    private void ShowAdPic()
    {
        IList<AdsImg> adsImgList = new AdsImgBll().SelectAllAdsImg();
        if (adsImgList == null||adsImgList.Count==0)
            return;

        StringBuilder str = new StringBuilder();
        str.Append("<script>");
        foreach (AdsImg adsImg in adsImgList)
        {
            str.Append(string.Format("PImgPlayer.addItem('{0}', '{1}', '{2}');",adsImg.AdsTitle,adsImg.PageUrl,adsImg.ImgPath));
        }
        str.Append("PImgPlayer.init( 'imgADPlayer', 440, 145 );");
        str.Append("</script>");
        Literal1.Text = str.ToString();
    }
}
