Exemplo n.º 1
0
        public static long GetPersonID(string personFullName, string personIMDbLink)
        {
            try
            {
                DataTable dtPersons = new DataTable();

                if (personIMDbLink.Length > 0)
                {
                    dtPersons = Person_SP.GetByIMDBLink(personIMDbLink);

                    if (dtPersons.Rows.Count > 0)
                    {
                        return(Convert.ToInt64(dtPersons.Rows[0]["PersonID"]));
                    }
                    else
                    {
                        dtPersons = new DataTable();

                        dtPersons = Person_SP.GetByNameExact(personFullName);
                        Person[] ps = Person.FetchAllPerson(dtPersons);

                        foreach (Person p in ps)
                        {
                            if (p.IMDBLink.Length == 0)
                            {
                                return(p.PersonID);
                            }
                        }
                    }
                }
                else
                {
                    dtPersons = new DataTable();

                    dtPersons = Person_SP.GetByNameExact(personFullName);
                    Person[] ps = Person.FetchAllPerson(dtPersons);

                    foreach (Person p in ps)
                    {
                        if (p.IMDBLink.Length == 0)
                        {
                            return(p.PersonID);
                        }
                    }
                }

                return(0);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        private void InitializeActor()
        {
            try
            {
                this.dtActor = Person_SP.GetList(true, false);

                dgvActor.DataGridViewColumns["dgvActorName"].DataPropertyName = "FullName";
                dgvActor.DataGridViewColumns["dgvActorName"].Visible          = true;

                dgvActor.DataGridViewColumns["dgvPhotoLink"].DataPropertyName = "PhotoLink";
                dgvActor.DataGridViewColumns["dgvPhotoLink"].Visible          = false;

                dgvActor.DataSource = this.dtActor;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void btnActorList_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dtAllPerson = new DataTable();
                dtAllPerson = Person_SP.GetList(true, false);

                if (FormManager.IsFormOpen(enForms.frmPersonList, "Actor") == false)
                {
                    frmPersonList personTemp = new frmPersonList(dtAllPerson, "Actor");

                    personTemp.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 4
0
        private void Initialize()
        {
            try
            {
                DataTable dtPerson         = new DataTable();
                DataTable dtMoviesActed    = new DataTable();
                DataTable dtMoviesDirected = new DataTable();
                DataTable dtPersonType     = new DataTable();

                dtPerson = Person_SP.GetByID(this.personID);
                Person_SP.GetTypeByID(this.personID, out this.isActor, out this.isDirector);

                if (this.isDirector == true)
                {
                    dtMoviesDirected = Movie_SP.GetByDirectorID(this.personID);
                }

                if (this.isActor == true)
                {
                    dtMoviesActed = Movie_SP.GetByActorID(this.personID);
                }

                this.person.FetchSinglePerson(dtPerson);
                this.moviesDirected = Movie.FetchAllMovie(dtMoviesDirected);
                this.moviesActed    = Movie.FetchAllMovie(dtMoviesActed);

                // Form Title

                this.Text = this.person.FullName;

                // Summary

                lblActorName.Text = this.person.FullName;

                if (File.Exists(PathUtils.GetApplicationPersonPath() + this.person.PhotoLink) == true)
                {
                    try
                    {
                        picPhoto.Image = Image.FromFile(PathUtils.GetApplicationPersonPath() + this.person.PhotoLink);
                    }
                    catch
                    {
                        // Do nothing for image that is corrupted
                    }
                }

                if (this.isActor == true && this.isDirector == true)
                {
                    lblUp.Visible        = true;
                    lblUpValue.Visible   = true;
                    lblDown.Visible      = true;
                    lblDownValue.Visible = true;

                    lblUp.Text   = "Number of Movies Directed:";
                    lblDown.Text = "Number of Movies Acted:";

                    lblUpValue.Text   = this.moviesDirected.Length.ToString();
                    lblDownValue.Text = this.moviesActed.Length.ToString();
                }
                else if (this.isActor == true && this.isDirector == false)
                {
                    lblUp.Visible        = false;
                    lblUpValue.Visible   = false;
                    lblDown.Visible      = true;
                    lblDownValue.Visible = true;

                    lblUp.Text   = "";
                    lblDown.Text = "Number of Movies Acted:";

                    lblUpValue.Text   = "";
                    lblDownValue.Text = this.moviesActed.Length.ToString();

                    DataOperation.HideTabPage(tab, tabDirected);
                }
                else if (this.isActor == false && this.isDirector == true)
                {
                    lblUp.Visible        = false;
                    lblUpValue.Visible   = false;
                    lblDown.Visible      = true;
                    lblDownValue.Visible = true;

                    lblUp.Text   = "";
                    lblDown.Text = "Number of Movies Directed:";

                    lblUpValue.Text   = "";
                    lblDownValue.Text = this.moviesDirected.Length.ToString();

                    DataOperation.HideTabPage(tab, tabActed);
                }
                else
                {
                    lblUp.Visible        = false;
                    lblUpValue.Visible   = false;
                    lblDown.Visible      = false;
                    lblDownValue.Visible = false;

                    lblUp.Text   = "";
                    lblDown.Text = "";

                    lblUpValue.Text   = "";
                    lblDownValue.Text = "";

                    DataOperation.HideTabPage(tab, tabDirected);
                    DataOperation.HideTabPage(tab, tabActed);
                }

                // Movies Directed

                repDirected.EnableRightClickMenu = iMovieBase.IsLogin;
                repDirected.DataSource           = moviesDirected;

                // Movies Acted

                repActed.EnableRightClickMenu = iMovieBase.IsLogin;
                repActed.DataSource           = moviesActed;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }