using System;
using System.Data;
using System.Configuration;
using System.Collections;
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.Data.SqlClient;

public partial class WebMain_news_Advertisement_dlAdvertisement_default : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand cmd = new SqlCommand("select * from Advertisement where Type='1' and Condition='y'", conn);
        SqlDataReader sdr = cmd.ExecuteReader();
        sdr.Read();
        if (sdr.HasRows)
        {

            Image1.ImageUrl = "~/WebMain/news/Advertisement/dlAdvertisement/ad/left.jpg";
            Image1.Width = sdr.GetInt32(4);
            Image1.Height = sdr.GetInt32(5);
            Image1.BorderWidth = 0;
            Image1.Attributes.Add("onclick", "window.open('" + sdr.GetString(13) + "')");
            Image2.ImageUrl = "~/WebMain/news/Advertisement/dlAdvertisement/ad/right.jpg";
            Image2.Width = sdr.GetInt32(4);
            Image2.Height = sdr.GetInt32(5);
            Image2.BorderWidth = 0;
            Image2.Attributes.Add("onclick", "window.open('" + sdr.GetString(14) + "')");
        }
        else
        {
            this.Panel1.Visible = false;
            Image1.Visible = false;
            Image2.Visible = false;
        }
        sdr.Close();
        conn.Close();
    }
}
