예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if ((string)Session["allow"] != "1")
            {
                Response.Redirect("/Pages/Forbidden.aspx");
            }
            else
            {
                if (Request["did"] != null)
                {
                    CountriesDropDownList.DataSource     = Countries.GetAllCountries();
                    CountriesDropDownList.DataValueField = "CountryID";
                    CountriesDropDownList.DataTextField  = "Country";
                    CountriesDropDownList.DataBind();

                    Director d1 = Directors.GetDirectorByID(Request["did"]);

                    FirstNameTextBox.Text = d1.GetFirstName();
                    LastNameTextBox.Text  = d1.GetLastName();
                    BornYearTextBox.Text  = d1.GetBornYear().ToString();
                    CountriesDropDownList.SelectedValue = d1.GetBornCountry().ToString();

                    DirectorPhoto.ImageUrl = "/Pictures/Directors/" + d1.GetDirectorPhoto();
                }
            }
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request["did"];

        if (Request["ddid"] != null)
        {
            if (Request["ddid"] == "1")
            {
                Directors.DeleteDirector(id);
                Response.Redirect("/Pages/AllDirectors.aspx");
            }
        }

        d1 = Directors.GetDirectorByID(id);

        Page.Title             = d1.GetName();
        NameLabel1.Text        = d1.GetName();
        NameLabel2.Text        = d1.GetName();
        bornYear.Text          = d1.GetBornYear().ToString();
        bornCountry.Text       = Countries.GetCountryByID(d1.GetBornCountry().ToString()).GetCountryName();
        DirectorPhoto.ImageUrl = "../Pictures/Directors/" + d1.GetDirectorPhoto();
        ContryFlag.ImageUrl    = "../Pictures/CountryFlag/" + Countries.GetCountryByID(d1.GetBornCountry().ToString()).GetFlag();
        moviesLinks.Text       = Movies.GetMoviesLinkByDirectorID(id);

        if ((string)Session["allow"] == "1")
        {
            UpdateHyperLink.Visible     = true;
            SlashLabel.Visible          = true;
            DeleteHyperLink.Visible     = true;
            UpdateHyperLink.NavigateUrl = "/Admin/UpdateDirector.aspx?did=" + d1.GetID();
            DeleteHyperLink.NavigateUrl = "/Pages/OneDirector.aspx?did=" + d1.GetID() + "&ddid=1";
        }
    }
예제 #3
0
    public static Director[] GetDirectorsByMovieID(string id)
    {
        DataSet ds = DBConn.RunDataSetSQL("select * from MoviesAndDirectors Where MovieID=" + id);

        Director[] d1 = new Director[ds.Tables[0].Rows.Count];

        for (int i = 0; i < d1.Length; i++)
        {
            d1[i] = Directors.GetDirectorByID(ds.Tables[0].Rows[i]["DirectorID"].ToString());
        }
        return(d1);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if ((string)Session["allow"] != "1")
            {
                Response.Redirect("/Pages/Forbidden.aspx");
            }
            else
            {
                if (Request["mid"] != null || Session["update_movie"] != null)
                {
                    if (Session["update_movie"] != null)
                    {
                        m1 = (Movie)Session["update_movie"];
                    }
                    else //FIRST VISIT
                    {
                        m1 = Movies.GetMovieByID(Request["mid"]);
                        Session["update_movie"] = m1;
                    }
                    Session["update_currentpage"] = "UpdateMovie.aspx";

                    // delete section
                    if (Request["deleteAward"] != null)
                    {
                        string[] str = Request["deleteAward"].Split(',');
                        Awards.DeleteMovieAward(m1.GetID().ToString(), str[0], int.Parse(str[1]));
                    }

                    if (Request["deleteActor"] != null)
                    {
                        Actors.DeleteMovieActor(m1.GetID().ToString(), Request["deleteActor"].ToString());
                    }

                    if (Request["deleteDirector"] != null)
                    {
                        Directors.DeleteMovieDirector(m1.GetID().ToString(), Request["deleteDirector"].ToString());
                    }

                    if (Request["deleteWriter"] != null)
                    {
                        Writers.DeleteMovieWriter(m1.GetID().ToString(), Request["deleteWriter"].ToString());
                    }

                    // add section
                    if (Request["addActor"] != null)
                    {
                        Movies.AddMovieActor(m1, Actors.GetActorByID(Request["addActor"]));
                    }

                    if (Request["addDirector"] != null)
                    {
                        Movies.AddMovieDirector(m1, Directors.GetDirectorByID(Request["addDirector"]));
                    }

                    if (Request["addWriter"] != null)
                    {
                        Movies.AddMovieWriter(m1, Writers.GetWriterByID(Request["addWriter"]));
                    }

                    GenresListBox.DataSource     = Genres.GetAllGenres();
                    GenresListBox.DataTextField  = "Genre";
                    GenresListBox.DataValueField = "GenreID";
                    GenresListBox.DataBind();

                    SeriesDropDownList.DataSource     = Series.GetAllSeries();
                    SeriesDropDownList.DataTextField  = "Series";
                    SeriesDropDownList.DataValueField = "SeriesID";
                    SeriesDropDownList.DataBind();

                    AwardsDropDownList.DataSource     = Awards.GetAllAwards();
                    AwardsDropDownList.DataTextField  = "Award";
                    AwardsDropDownList.DataValueField = "AwardID";
                    AwardsDropDownList.DataBind();

                    GlobalIDTextBox.Text = m1.GetGlobalID().ToString();

                    MovieNameTextBox.Text = m1.GetName();
                    int sr = m1.GetSeries();

                    for (int i = 0; i < SeriesDropDownList.Items.Count; i++)
                    {
                        if (int.Parse(SeriesDropDownList.Items[i].Value) == sr)
                        {
                            SeriesDropDownList.Items[i].Selected = true;
                        }
                    }

                    ReleaseYearTextBox.Text = m1.GetReleaseYear().ToString();

                    D3AvailableCheckBox.Checked = m1.Get3DAvailable();

                    RatingTextBox.Text = m1.GetRating().ToString();

                    TotalTimeTextBox.Text = m1.GetTotalTime().ToString();

                    Genre[] g1 = Genres.GetGenresByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < GenresListBox.Items.Count; i++)
                    {
                        for (int j = 0; j < g1.Length; j++)
                        {
                            if (int.Parse(GenresListBox.Items[i].Value) == g1[j].GetID())
                            {
                                GenresListBox.Items[i].Selected = true;
                            }
                        }
                    }

                    Award[] a1 = Awards.GetAwardsByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < a1.Length; i++)
                    {
                        AwardsLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteAward=" + "" + a1[i].GetID() + "," + a1[i].GetYear() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        AwardsLabel.Text += a1[i].GetAward() + " - " + a1[i].GetYear();
                        AwardsLabel.Text += "<br />";
                    }

                    Actor[] ac1 = Actors.GetActorsByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < ac1.Length; i++)
                    {
                        ActorsLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteActor=" + "" + ac1[i].GetID() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        ActorsLabel.Text += ac1[i].GetName();
                        ActorsLabel.Text += "<br />";
                    }

                    Director[] d1 = Directors.GetDirectorsByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < d1.Length; i++)
                    {
                        DirectorsLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteDirector=" + "" + d1[i].GetID() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        DirectorsLabel.Text += d1[i].GetName();
                        DirectorsLabel.Text += "<br />";
                    }

                    Writer[] w1 = Writers.GetWritersByMovieID(m1.GetID().ToString());

                    for (int i = 0; i < w1.Length; i++)
                    {
                        WritersLabel.Text += "<a href=\"UpdateMovie.aspx?mid=" + m1.GetID() + "&deleteWriter=" + "" + w1[i].GetID() + "\" style=\"color: #FF0000; font-weight: bold\">X</a>" + "&nbsp&nbsp";
                        WritersLabel.Text += w1[i].GetName();
                        WritersLabel.Text += "<br />";
                    }

                    MoviePhoto.ImageUrl = "../Pictures/Movies/" + m1.GetMoviePhoto();

                    TrailerTextBox.Text = m1.GetTrailer();
                }
            }
        }
    }