protected void Page_Load(object sender, EventArgs e) { error = ""; user = new NetflixBL.User((string)Session["username"]); s = new NetflixBL.Series((int)Session["sid"]); user.GetSeries(); drop.Visible = false; GridView1.Visible = false; for (int i = 0; i < user.SeriesList1.Count; i++) { bool a = user.SeriesList1[i].seriesID == s.seriesID; if (a == true) { add.Visible = false; drop.Visible = true; GridView1.Visible = true; break; } } name.Text = s.seriesName; desc.Text = s.Description; Stats.Text = "watched by " + s.GetWatchers().ToString() + " users"; DataSet ds = episodeDAL.GetAll(); List <int> seasons = new List <int>(); for (int i = 0; i < ds.Tables["episodeTBL"].Rows.Count; i++) { if (!seasons.Contains((int)ds.Tables["episodeTBL"].Rows[i]["SeasonNum"]) && (int)ds.Tables["episodeTBL"].Rows[i]["EpiSeries"] == s.seriesID) { seasons.Add((int)ds.Tables["episodeTBL"].Rows[i]["SeasonNum"]); } } if (!Page.IsPostBack) { for (int i = 0; i < seasons.Count; i++) { drop.Items.Add(seasons[i].ToString()); } SeriesPoster.ImageUrl = s.Posterurl; DataSet ds1 = episodeDAL.GetAll(); List <NetflixBL.Episode> episodes = new List <NetflixBL.Episode>(); if (seasons.Count > 0) { for (int i = 0; i < ds1.Tables["episodeTBL"].Rows.Count; i++) { if ((int)ds1.Tables["episodeTBL"].Rows[i]["SeasonNum"] == seasons[0] && (int)ds.Tables["episodeTBL"].Rows[i]["EpiSeries"] == s.seriesID) { NetflixBL.Episode episode = new NetflixBL.Episode((int)ds1.Tables["episodeTBL"].Rows[i]["EpisdeID"]); episodes.Add(episode); } GridView1.DataSource = episodes; GridView1.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Login"] == null) { Response.Redirect("Main.aspx"); } user = new NetflixBL.User((string)Session["Username"]); user.GetSeries(); DataList1.DataSource = user.SeriesList1; if (!IsPostBack) { DataList1.DataBind(); } }