using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using xabaraCOM;

public partial class ad_widthAD : System.Web.UI.UserControl
{
    private string adID;
    public string adW = "1000";
    public string adH = "90";

    protected void Page_Load(object sender, EventArgs e)
    {
        sqlServer sql = new sqlServer();

        if (!string.IsNullOrEmpty(adID as string))
        {
            string[] ids = adID.Split(new char[] { '|' });  //分类，宽度，高度
            if (ids.GetUpperBound(0) ==2)
            {
                adW = xabara.isNum(ids[1]).ToString();
                adH = xabara.isNum(ids[2]).ToString();

                string strSql = "select * from ads where starDate<getdate() and stopDate>getdate() and classID=" + xabara.isNum(ids[0]) + " order by starDate DESC,aID DESC";
                //Response.Write(strSql);
                //Response.End();
                DataTable dt = sql.getDataTable(strSql);
                int c = dt.Rows.Count;

                if (c > 0)
                {
                    for (int i = 0; i < c; i++)
                    {
                        divImg.Text += "<li>" + dt.Rows[i]["adCode"].ToString().Replace("\"", "\'") + "</li>";
                        divCount.Text += "<li>" + (i + 1).ToString() + "</li>";
                    }
                }

                dt.Dispose();
            }
        }
    }

    public string ClassID   //得到参数
    {
        get { return adID; }
        set { adID = value; }
    }
}
