Exemplo n.º 1
0
        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();
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            int i = e.Item.ItemIndex;

            NetflixBL.Series s = slist[i];
            ((Button)e.Item.FindControl("sname")).Text      = s.seriesName;
            ((Label)e.Item.FindControl("sid")).Text         = s.seriesID.ToString();
            ((Image)e.Item.FindControl("sposter")).ImageUrl = s.Posterurl;
            ((Label)e.Item.FindControl("sdesc")).Text       = s.Description;
        }