コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            username = (string)Session["Username"];
            EpiID    = (int)Session["EpiID"];


            if (NetflixBL.Rate.IsExistUser(username, EpiID))
            {
                rate = new NetflixBL.Rate(username, EpiID);
                DropDownList1.Visible = false;
                Rate.Visible          = false;
                MyRate.Visible        = true;
                MyRate.Text           = rate.starts.ToString() + "/5";
            }
            else
            {
                DropDownList1.Visible = true;
                Rate.Visible          = true;
                MyRate.Visible        = false;
            }

            epi          = new NetflixBL.Episode(EpiID);
            EpiName.Text = epi.episodeName;
            Time.Text    = epi.episodeLength.ToString() + " minutes";
            AvgRate.Text = epi.avgrate.ToString() + "/5";
        }
コード例 #2
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();
                    }
                }
            }
        }
コード例 #3
0
        protected void drop_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataSet ds = episodeDAL.GetAll();
            List <NetflixBL.Episode> episodes = new List <NetflixBL.Episode>();

            for (int i = 0; i < ds.Tables["episodeTBL"].Rows.Count; i++)
            {
                if ((int)ds.Tables["episodeTBL"].Rows[i]["SeasonNum"] == int.Parse(drop.SelectedItem.Text) && (int)ds.Tables["episodeTBL"].Rows[i]["EpiSeries"] == s.seriesID)
                {
                    NetflixBL.Episode episode = new NetflixBL.Episode((int)ds.Tables["episodeTBL"].Rows[i]["EpisdeID"]);
                    episodes.Add(episode);
                }
                GridView1.DataSource = episodes;
                GridView1.DataBind();
            }
        }