コード例 #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["aid"] != null)
                {
                    CountriesDropDownList.DataSource     = Countries.GetAllCountries();
                    CountriesDropDownList.DataValueField = "CountryID";
                    CountriesDropDownList.DataTextField  = "Country";
                    CountriesDropDownList.DataBind();

                    Actor a1 = Actors.GetActorByID(Request["aid"]);

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

                    ActorPhoto.ImageUrl = "/Pictures/Actors/" + a1.GetActorPhoto();
                }
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request["aid"];

        if (Request["daid"] != null)
        {
            if (Request["daid"] == "1")
            {
                Actors.DeleteActor(id);
                Response.Redirect("/Pages/AllActors.aspx");
            }
        }

        a1 = Actors.GetActorByID(id);

        Page.Title          = a1.GetName();
        NameLabel1.Text     = a1.GetName();
        NameLabel2.Text     = a1.GetName();
        bornYear.Text       = a1.GetBornYear().ToString();
        bornCountry.Text    = Countries.GetCountryByID(a1.GetBornCountry().ToString()).GetCountryName();
        ActorPhoto.ImageUrl = "../Pictures/Actors/" + a1.GetActorPhoto();
        ContryFlag.ImageUrl = "../Pictures/CountryFlag/" + Countries.GetCountryByID(a1.GetBornCountry().ToString()).GetFlag();
        moviesLinks.Text    = Movies.GetMoviesLinkByActorID(id);

        if ((string)Session["allow"] == "1")
        {
            UpdateHyperLink.Visible     = true;
            SlashLabel.Visible          = true;
            DeleteHyperLink.Visible     = true;
            UpdateHyperLink.NavigateUrl = "/Admin/UpdateActor.aspx?aid=" + a1.GetID();
            DeleteHyperLink.NavigateUrl = "/Pages/OneActor.aspx?aid=" + a1.GetID() + "&daid=1";
        }
    }
コード例 #3
0
    public static Actor[] GetActorsByMovieID(string id)
    {
        DataSet ds = DBConn.RunDataSetSQL("select * from MoviesAndActors Where MovieID=" + id);

        Actor[] a1 = new Actor[ds.Tables[0].Rows.Count];

        for (int i = 0; i < a1.Length; i++)
        {
            a1[i] = Actors.GetActorByID(ds.Tables[0].Rows[i]["ActorID"].ToString());
        }
        return(a1);
    }
コード例 #4
0
    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();
                }
            }
        }
    }