I wish to create a chart using microsoft visual studio 2010 but I do not know how to do it. Tried googling for answer but none of them is for 3 tier.
This is my code for the Data Access Layer
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;
}
}
This is my Business Logic Layer
public List<AdvertisementDAL> pieChart()
{
AdvertisementDAL dal = new AdvertisementDAL();
List<AdvertisementDAL> dll = new List<AdvertisementDAL>();
dll = dal.displayChart();
return dll;
}
This is my Presentation Layer(All I know is bind the data together)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
AdvertisementBLL bll = new AdvertisementBLL();
Chart1.DataSource = bll.pieChart();
Chart1.DataBind();
}
}
I guess I'm stuck in Presentation layer any help? The bar will look something like this