or
public
List<AdvertisementDAL> displayChart()
{
List<AdvertisementDAL> dal =
new
List<AdvertisementDAL>();
string
sql =
"Select * From AdvertisementRecord"
;
SqlConnection conn =
new
SqlConnection(_connStr);
SqlCommand cmd =
new
SqlCommand(sql, conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while
(dr.Read())
{
_recordID =
int
.Parse(dr[
"RecordID"
].ToString());
_recordDate = dr[
"RecordDate"
].ToString();
_noOfClick =
int
.Parse(dr[
"NoOfClick"
].ToString());
_noOfView =
int
.Parse(dr[
"NoOfView"
].ToString());
_advertisementID =
int
.Parse(dr[
"FK_AdvertisementID"
].ToString());
dal.Add(
new
AdvertisementDAL(_recordID, _recordDate, _noOfClick, _noOfView, _advertisementID));
}
conn.Close();
dr.Close();
dr.Dispose();
return
dal;
}
public
List<AdvertisementDAL> pieChart()
{
AdvertisementDAL dal =
new
AdvertisementDAL();
List<AdvertisementDAL> dll =
new
List<AdvertisementDAL>();
dll = dal.displayChart();
return
dll;
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
AdvertisementBLL bll =
new
AdvertisementBLL();
RadChart1.DataSource = bll.pieChart();
RadChart1.DataBind();
}
}