Exemplo n.º 1
0
        public void loadSearchText()
        {
            dbConnect baglan = new dbConnect();

            baglan.openConnect();
            string sqlString = "SELECT name, m_no FROM Movies";

            baglan.Command(sqlString);
            while (baglan.dr.Read())
            {
                movieList.Add(baglan.dr[0].ToString());
            }
            baglan.closeConnect();
            searchTextBox.AutoCompleteCustomSource = movieList;
        }
Exemplo n.º 2
0
        public void loadSearchText()
        {
            dbConnect baglan = new dbConnect();

            baglan.openConnect();
            string sqlString = "SELECT name,l_name FROM Human";

            baglan.Command(sqlString);
            while (baglan.dr.Read())
            {
                humanList.Add(baglan.dr[0].ToString() + " " + baglan.dr[1].ToString());
            }
            baglan.closeConnect();

            searchTextBox.AutoCompleteCustomSource = humanList;
        }
Exemplo n.º 3
0
        public void loadComingSoon()
        {
            dbConnect baglan = new dbConnect();

            baglan.openConnect();
            string sqlString = "SELECT * FROM Movies WHERE release_date > '" + today + "'";

            baglan.Command(sqlString);
            for (int i = 0; i < comingSoonCount; i++)  //  Coming soon kısmında gösterilecek 10 filmi nesnelere çeker.
            {
                baglan.dr.Read();
                comingSoonMovie[i] = new Movies();
                comingSoonMovie[i].setValues(baglan.dr[0].ToString(),
                                             baglan.dr[1].ToString(),
                                             baglan.dr[2].ToString(),
                                             DateTime.Parse(baglan.dr[3].ToString()),
                                             baglan.dr[4].ToString(),
                                             baglan.dr[5].ToString(),
                                             baglan.dr[6].ToString(),
                                             baglan.dr[7].ToString(),
                                             baglan.dr[8].ToString());
            }
            baglan.closeConnect();
            for (int i = 0; i < comingSoonCount; i++)
            {
                baglan.openConnect();
                sqlString = "SELECT t.name FROM Movies m, Types t, TypeOfMovie tm WHERE m.m_no='" + comingSoonMovie[i].getM_no().ToString() + "' AND (m.m_no=tm.m_no) AND (tm.t_no = t.t_no)";
                baglan.Command(sqlString);
                while (baglan.dr.Read())
                {
                    comingSoonMovie[i].setMovieTypes(baglan.dr[0].ToString());
                }

                baglan.closeConnect();
            }

            coverPictureBox.ImageLocation = comingSoonMovie[0].getCover().ToString();
            trailerPlayer.Movie           = comingSoonMovie[0].getTrailer().ToString();
            movieNameLabel.Text           = comingSoonMovie[0].getName().ToString();
            movieAboutLabel.Text          = comingSoonMovie[0].getAbout().ToString();
            releaseDateLabel.Text         = "Release Date: " + comingSoonMovie[0].getRelease_date().ToString("dd MMMM yyyy");
            typeOfMovieLabel.Text         = comingSoonMovie[0].getMovieType().ToString();
        }
Exemplo n.º 4
0
        public void loadTopTenCeleb()
        {
            dbConnect baglan = new dbConnect();

            baglan.openConnect();
            string sqlString = "SELECT h.h_no,h.name,h.l_name,h.photo,AVG(ch.point) as AvgPoint FROM Human h, CommentsOfHuman ch " +
                               "WHERE (h.h_no=ch.h_no) AND (h.actorFlag='TRUE') GROUP BY h.h_no,h.name,h.l_name, h.photo ORDER BY AvgPoint DESC";

            baglan.Command(sqlString);

            for (int i = 0; i < topCelebCount; i++)  //  Coming soon kısmında gösterilecek 10 filmi nesnelere çeker.
            {
                baglan.dr.Read();
                topTenCelebHuman[i] = new Human();
                topTenCelebHuman[i].setTopCelebInfo(baglan.dr[0].ToString(),
                                                    baglan.dr[1].ToString(),
                                                    baglan.dr[2].ToString(),
                                                    baglan.dr[3].ToString());
            }
            baglan.closeConnect();
            topTenCelebPictureBox1.ImageLocation  = topTenCelebHuman[0].getPhoto();
            topTenCelebPictureBox2.ImageLocation  = topTenCelebHuman[1].getPhoto();
            topTenCelebPictureBox3.ImageLocation  = topTenCelebHuman[2].getPhoto();
            topTenCelebPictureBox4.ImageLocation  = topTenCelebHuman[3].getPhoto();
            topTenCelebPictureBox5.ImageLocation  = topTenCelebHuman[4].getPhoto();
            topTenCelebPictureBox6.ImageLocation  = topTenCelebHuman[5].getPhoto();
            topTenCelebPictureBox7.ImageLocation  = topTenCelebHuman[6].getPhoto();
            topTenCelebPictureBox8.ImageLocation  = topTenCelebHuman[7].getPhoto();
            topTenCelebPictureBox9.ImageLocation  = topTenCelebHuman[8].getPhoto();
            topTenCelebPictureBox10.ImageLocation = topTenCelebHuman[9].getPhoto();

            topTenCelebLabel1.Text  = topTenCelebHuman[0].getName() + " " + topTenCelebHuman[0].getL_name();
            topTenCelebLabel2.Text  = topTenCelebHuman[1].getName() + " " + topTenCelebHuman[1].getL_name();
            topTenCelebLabel3.Text  = topTenCelebHuman[2].getName() + " " + topTenCelebHuman[2].getL_name();
            topTenCelebLabel4.Text  = topTenCelebHuman[3].getName() + " " + topTenCelebHuman[3].getL_name();
            topTenCelebLabel5.Text  = topTenCelebHuman[4].getName() + " " + topTenCelebHuman[4].getL_name();
            topTenCelebLabel6.Text  = topTenCelebHuman[5].getName() + " " + topTenCelebHuman[5].getL_name();
            topTenCelebLabel7.Text  = topTenCelebHuman[6].getName() + " " + topTenCelebHuman[6].getL_name();
            topTenCelebLabel8.Text  = topTenCelebHuman[7].getName() + " " + topTenCelebHuman[7].getL_name();
            topTenCelebLabel9.Text  = topTenCelebHuman[8].getName() + " " + topTenCelebHuman[8].getL_name();
            topTenCelebLabel10.Text = topTenCelebHuman[9].getName() + " " + topTenCelebHuman[9].getL_name();
        }
Exemplo n.º 5
0
        private void signInbutton_Click(object sender, EventArgs e)
        {
            dbConnect baglan = new dbConnect();

            baglan.openConnect();
            string sqlString = "SELECT * FROM Users WHERE email='" + emailTextBox.Text.ToString() + "' AND pass='******'";

            baglan.Command(sqlString);
            baglan.dr.Read();
            if (baglan.dr.HasRows)
            {
                user.setValue(baglan.dr[0].ToString(),
                              baglan.dr[1].ToString(),
                              baglan.dr[2].ToString(),
                              baglan.dr[3].ToString(),
                              Convert.ToBoolean(baglan.dr[4].ToString()));
                loginPanel.Visible   = false;
                loginInPanel.Visible = true;
                userNameLabel.Text   = user.getName();
                userNo = user.getU_No();
                signUpToolStripMenuItem.Enabled        = false;
                signOutToolStripMenuItem.Visible       = true;
                myWatchlistToolStripMenuItem.Visible   = true;
                myWatchedListToolStripMenuItem.Visible = true;
                loadRecommendedMovies();
                if (user.getIsAdmin())
                {
                    adminPanelToolStripMenuItem.Visible = true;
                    adminPanelButton.Visible            = true;
                }
                else
                {
                    adminPanelButton.Visible = false;
                }
            }
            else
            {
                MessageBox.Show("Hatalı Giriş.", "Error");
            }
            baglan.closeConnect();
        }
Exemplo n.º 6
0
        public void loadSearchText()
        {
            dbConnect baglan = new dbConnect();

            baglan.openConnect();
            string sqlString = "SELECT name,l_name FROM Human";

            baglan.Command(sqlString);
            while (baglan.dr.Read())
            {
                humanList.Add(baglan.dr[0].ToString() + " " + baglan.dr[1].ToString());
            }
            baglan.closeConnect();
            baglan.openConnect();
            sqlString = "SELECT name, m_no FROM Movies";
            baglan.Command(sqlString);
            while (baglan.dr.Read())
            {
                movieList.Add(baglan.dr[0].ToString());
            }
            baglan.closeConnect();
        }
Exemplo n.º 7
0
        public void loadRecommendedMovies()
        {
            recomendedMoviesPanel.Controls.Clear();
            dbConnect baglan = new dbConnect();

            baglan.openConnect();
            string sqlString = "";

            if (user.getU_No() != null)
            {
                sqlString = "SELECT TOP 5 m.* FROM Movies m, TypeOfMovie tm WHERE (tm.m_no=m.m_no) AND tm.t_no=(" +
                            "SELECT TOP 1 t_no From WatchList wl, TypeOfMovie tm WHERE wl.m_no = tm.m_no AND wl.u_no='" + user.getU_No() + "'" +
                            "ORDER BY NEWID())";
            }
            else
            {
                sqlString = "SELECT TOP 5 m.* FROM Movies m ORDER BY NEWID()";
            }
            Label[]      name = new Label[RECOMMENDEDCOUNT + 1];
            PictureBox[] recommendedMovieCover = new PictureBox[RECOMMENDEDCOUNT + 1];

            int recommendedCounter = 0;

            name[recommendedCounter]          = new Label();
            name[recommendedCounter].Location = new Point(-150, 250);
            name[recommendedCounter].Size     = new Size(0, 0);
            name[recommendedCounter].AutoSize = false;

            name[recommendedCounter].Name = "RecommendedMovieNameStartPosition";
            recomendedMoviesPanel.Controls.Add(name[recommendedCounter]);

            recommendedMovieCover[recommendedCounter]          = new PictureBox();
            recommendedMovieCover[recommendedCounter].Location = new Point(-150, 3);
            recommendedMovieCover[recommendedCounter].Size     = new Size(0, 0);
            recommendedMovieCover[recommendedCounter].Name     = "RecommendedMovieCoverStartPosition";
            recomendedMoviesPanel.Controls.Add(recommendedMovieCover[recommendedCounter]);

            baglan.openConnect();
            baglan.Command(sqlString);

            while (baglan.dr.Read())
            {
                recommendedCounter++;


                recommendedMovieCover[recommendedCounter]               = new PictureBox();
                recommendedMovieCover[recommendedCounter].ForeColor     = Color.Black;
                recommendedMovieCover[recommendedCounter].ImageLocation = baglan.dr[7].ToString();
                recommendedMovieCover[recommendedCounter].SizeMode      = PictureBoxSizeMode.StretchImage;
                recommendedMovieCover[recommendedCounter].Location      = new Point(recommendedMovieCover[recommendedCounter - 1].Location.X + 156, 3);
                recommendedMovieCover[recommendedCounter].Size          = new Size(150, 245);
                recommendedMovieCover[recommendedCounter].Click        += new EventHandler(movieCover_Click);
                recommendedMovieCover[recommendedCounter].MaximumSize   = new Size(150, 245);
                recommendedMovieCover[recommendedCounter].Name          = baglan.dr[0].ToString() + "@RecommendedMovieCoverPictureBox";
                recomendedMoviesPanel.Controls.Add(recommendedMovieCover[recommendedCounter]);


                name[recommendedCounter]             = new Label();
                name[recommendedCounter].Font        = new Font("Times New Roman", 11, FontStyle.Bold);
                name[recommendedCounter].ForeColor   = Color.Black;
                name[recommendedCounter].Name        = baglan.dr[0].ToString() + "@NameLabel";
                name[recommendedCounter].Click      += new EventHandler(nameLabel_Click);
                name[recommendedCounter].Text        = baglan.dr[1].ToString();
                name[recommendedCounter].Location    = new Point(name[recommendedCounter - 1].Location.X + 156, 250);
                name[recommendedCounter].AutoSize    = false;
                name[recommendedCounter].Size        = new Size(150, 35);
                name[recommendedCounter].MaximumSize = new Size(150, 35);
                recomendedMoviesPanel.Controls.Add(name[recommendedCounter]);
            }
            baglan.closeConnect();
        }
Exemplo n.º 8
0
        public void loadList(string sqlString, string sqlCount)
        {
            dbConnect connect        = new dbConnect();
            dbConnect connectForType = new dbConnect();
            int       movieCount     = 0;

            connect.openConnect();
            connect.Command(sqlCount);
            connect.dr.Read();
            movieCount = Convert.ToInt32(connect.dr[0].ToString());
            connect.closeConnect();
            if (movieCount < 1)
            {
                MessageBox.Show("There is no record to show.", "Error");
                this.Close();
            }
            Label[]      name       = new Label[movieCount + 1];
            Label[]      type       = new Label[movieCount + 1];
            Label[]      about      = new Label[movieCount + 1];
            PictureBox[] movieCover = new PictureBox[movieCount + 1];

            int movieCounter = 0;

            name[movieCounter]          = new Label();
            name[movieCounter].Location = new Point(0, -153);
            name[movieCounter].Size     = new Size(0, 0);
            name[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(name[movieCounter]);


            type[movieCounter]          = new Label();
            type[movieCounter].Location = new Point(0, -123);
            type[movieCounter].Size     = new Size(0, 0);
            type[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(type[movieCounter]);


            about[movieCounter]          = new Label();
            about[movieCounter].Location = new Point(0, -97);
            about[movieCounter].Size     = new Size(0, 0);
            about[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(about[movieCounter]);

            movieCover[movieCounter]          = new PictureBox();
            movieCover[movieCounter].Location = new Point(0, -153);
            movieCover[movieCounter].Size     = new Size(0, 0);
            movieCover[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(movieCover[movieCounter]);


            movieCounter++;

            string movieType = "";

            connect.openConnect();
            connect.Command(sqlString);

            while (connect.dr.Read())
            {
                name[movieCounter]             = new Label();
                name[movieCounter].Font        = new Font("Microsoft Sans Serif", 14, FontStyle.Bold);
                name[movieCounter].ForeColor   = Color.Black;
                name[movieCounter].Click      += new EventHandler(nameLabel_Click);
                name[movieCounter].Text        = connect.dr[1].ToString();
                name[movieCounter].Location    = new Point(122, name[movieCounter - 1].Location.Y + 156);
                name[movieCounter].AutoSize    = true;
                name[movieCounter].MaximumSize = new Size(550, 25);
                name[movieCounter].Name        = connect.dr[0].ToString() + "@NameLabel";
                mainPanel.Controls.Add(name[movieCounter]);  // kişilerin İsimleri bu labele hizalanacak


                connectForType.openConnect();
                connectForType.Command("SELECT t.name FROM Movies m, Types t, TypeOfMovie tm WHERE m.m_no = '" + connect.dr[0].ToString() + "' AND(m.m_no = tm.m_no) AND (tm.t_no = t.t_no)");
                while (connectForType.dr.Read())
                {
                    movieType += connectForType.dr[0].ToString() + " ";
                }
                connectForType.closeConnect();

                type[movieCounter]             = new Label();
                type[movieCounter].Font        = new Font("Microsoft Sans Serif", 12);
                type[movieCounter].ForeColor   = Color.Black;
                type[movieCounter].Text        = movieType;
                type[movieCounter].Location    = new Point(122, type[movieCounter - 1].Location.Y + 156);
                type[movieCounter].AutoSize    = true;
                type[movieCounter].MaximumSize = new Size(550, 20);
                type[movieCounter].Name        = connect.dr[0].ToString() + "@MovieTypeLabel";
                mainPanel.Controls.Add(type[movieCounter]);

                movieType                       = "";
                about[movieCounter]             = new Label();
                about[movieCounter].Font        = new Font("Microsoft Sans Serif", 10);
                about[movieCounter].ForeColor   = Color.Black;
                about[movieCounter].Text        = connect.dr[2].ToString();
                about[movieCounter].Location    = new Point(122, about[movieCounter - 1].Location.Y + 156);
                about[movieCounter].AutoSize    = true;
                about[movieCounter].MaximumSize = new Size(550, 85);
                about[movieCounter].Name        = connect.dr[0].ToString() + "@aboutLabel";
                mainPanel.Controls.Add(about[movieCounter]);


                movieCover[movieCounter]               = new PictureBox(); // kişilerin resimleri bu Pictureboxa hizalanacak
                movieCover[movieCounter].Location      = new Point(12, movieCover[movieCounter - 1].Location.Y + 156);
                movieCover[movieCounter].Size          = new Size(100, 150);
                movieCover[movieCounter].ImageLocation = connect.dr[7].ToString();
                movieCover[movieCounter].SizeMode      = PictureBoxSizeMode.StretchImage;
                movieCover[movieCounter].Click        += new EventHandler(movieCover_Click);
                movieCover[movieCounter].Name          = connect.dr[0].ToString() + "@humanPictureBox";
                mainPanel.Controls.Add(movieCover[movieCounter]);

                movieCounter++;
            }
        }
Exemplo n.º 9
0
        public void loadList(string sqlString, string sqlCount)
        {
            dbConnect connect    = new dbConnect(); //// Buradan
            int       humanCount = 0;

            connect.openConnect();
            connect.Command(sqlCount);
            connect.dr.Read();
            humanCount = Convert.ToInt32(connect.dr[0].ToString());
            connect.closeConnect();                 //// Buraya kadar Veri tabanındaki kişi sayısını bulduk.
            if (humanCount < 1)
            {
                MessageBox.Show("There is no record to show.", "Error");
                this.Close();
            }
            Label[]      name         = new Label[humanCount + 1];      // Kişilerin isimlerinin yazılacağı labellar
            Label[]      job          = new Label[humanCount + 1];      //Kişilerin mesleklerinin yazılacağı labellar
            Label[]      biography    = new Label[humanCount + 1];      //Kişilerin biographylerinin yazılacağı labellar
            PictureBox[] humanPicture = new PictureBox[humanCount + 1]; //Kişilerin resimlerinin ekleneceği pictureboxlar

            int humanCounter = 0;

            name[humanCounter]          = new Label();
            name[humanCounter].Location = new Point(0, -153);
            name[humanCounter].Size     = new Size(0, 0);
            name[humanCounter].Name     = "HumanListStartPositionLabel";
            mainPanel.Controls.Add(name[humanCounter]); // kişilerin İsimleri bu labele hizalanacak

            job[humanCounter]          = new Label();   // kişilerin meslekleri bu labele hizalanacak
            job[humanCounter].Location = new Point(0, -123);
            job[humanCounter].Size     = new Size(0, 0);
            job[humanCounter].Name     = "HumanListStartPositionLabel";
            mainPanel.Controls.Add(job[humanCounter]);

            biography[humanCounter]          = new Label();   // kişilerin biograpyleri bu labele hizalanacak
            biography[humanCounter].Location = new Point(0, -97);
            biography[humanCounter].Size     = new Size(0, 0);
            biography[humanCounter].Name     = "HumanListStartPositionLabel";
            mainPanel.Controls.Add(biography[humanCounter]);

            humanPicture[humanCounter]          = new PictureBox();   // kişilerin resimleri bu Pictureboxa hizalanacak
            humanPicture[humanCounter].Location = new Point(0, -153);
            humanPicture[humanCounter].Size     = new Size(0, 0);
            humanPicture[humanCounter].Name     = "HumanListStartPositionLabel";
            mainPanel.Controls.Add(humanPicture[humanCounter]);


            humanCounter++;

            string humanJob = "";

            connect.openConnect();
            connect.Command(sqlString);

            while (connect.dr.Read())
            {
                name[humanCounter]             = new Label();
                name[humanCounter].Font        = new Font("Microsoft Sans Serif", 14, FontStyle.Bold);
                name[humanCounter].ForeColor   = Color.Black;
                name[humanCounter].Click      += new EventHandler(nameLabel_Click);
                name[humanCounter].Text        = connect.dr[1].ToString() + " " + connect.dr[2].ToString();
                name[humanCounter].Location    = new Point(122, name[humanCounter - 1].Location.Y + 156);
                name[humanCounter].AutoSize    = true;
                name[humanCounter].MaximumSize = new Size(550, 25);
                name[humanCounter].Name        = connect.dr[0].ToString() + "@NameLabel";
                mainPanel.Controls.Add(name[humanCounter]);  // kişilerin İsimleri bu labele hizalanacak

                if (connect.dr[10].ToString() == "True")
                {
                    if (connect.dr[9].ToString() == "M")
                    {
                        humanJob += "Actor";
                    }
                    else
                    {
                        humanJob += "Actress";
                    }
                }

                if (connect.dr[11].ToString() == "True")
                {
                    humanJob += " Author";
                }

                if (connect.dr[12].ToString() == "True")
                {
                    humanJob += " Director";
                }


                job[humanCounter]             = new Label(); // kişilerin meslekleri bu labele hizalanacak
                job[humanCounter].Font        = new Font("Microsoft Sans Serif", 12);
                job[humanCounter].ForeColor   = Color.Black;
                job[humanCounter].Text        = humanJob;
                job[humanCounter].Location    = new Point(122, job[humanCounter - 1].Location.Y + 156);
                job[humanCounter].AutoSize    = true;
                job[humanCounter].MaximumSize = new Size(550, 20);
                job[humanCounter].Name        = connect.dr[0].ToString() + "@HumanJobLabel";
                mainPanel.Controls.Add(job[humanCounter]);

                humanJob = "";

                biography[humanCounter]             = new Label(); // kişilerin biograpyleri bu labele hizalanacak
                biography[humanCounter].Font        = new Font("Microsoft Sans Serif", 10);
                biography[humanCounter].ForeColor   = Color.Black;
                biography[humanCounter].Text        = connect.dr[6].ToString();
                biography[humanCounter].Location    = new Point(122, biography[humanCounter - 1].Location.Y + 156);
                biography[humanCounter].AutoSize    = true;
                biography[humanCounter].MaximumSize = new Size(550, 85);
                biography[humanCounter].Name        = connect.dr[0].ToString() + "@BiographyLabel";
                mainPanel.Controls.Add(biography[humanCounter]);


                humanPicture[humanCounter]               = new PictureBox(); // kişilerin resimleri bu Pictureboxa hizalanacak
                humanPicture[humanCounter].Location      = new Point(12, humanPicture[humanCounter - 1].Location.Y + 156);
                humanPicture[humanCounter].Size          = new Size(100, 150);
                humanPicture[humanCounter].ImageLocation = connect.dr[8].ToString();
                humanPicture[humanCounter].SizeMode      = PictureBoxSizeMode.StretchImage;
                humanPicture[humanCounter].Click        += new EventHandler(humanPicture_Click);
                humanPicture[humanCounter].Name          = connect.dr[0].ToString() + "@humanPictureBox";
                mainPanel.Controls.Add(humanPicture[humanCounter]);



                humanCounter++;
            }
        }
Exemplo n.º 10
0
        public void loadDetailsHuman(string gelenH_No)
        {
            Human     gelenHuman = new Human();
            dbConnect connect    = new dbConnect();

            connect.openConnect();
            string sqlString = "SELECT h.*,AVG(ch.point) FROM Human h, CommentsOfHuman ch WHERE h.h_no ='" + gelenH_No + "' AND (h.h_no = ch.h_no)  GROUP BY h.h_no,h.name,h.l_name,h.b_date,h.city,h.country,h.biography,h.height,h.photo,h.sex,h.actorFlag,h.authorFlag,h.directorFlag";

            connect.Command(sqlString);
            connect.dr.Read();
            gelenHuman.setValues(connect.dr[0].ToString(),
                                 connect.dr[1].ToString(),
                                 connect.dr[2].ToString(),
                                 DateTime.Parse(connect.dr[3].ToString()),
                                 connect.dr[4].ToString(),
                                 connect.dr[5].ToString(),
                                 connect.dr[6].ToString(),
                                 connect.dr[7].ToString(),
                                 connect.dr[8].ToString(),
                                 Convert.ToChar(connect.dr[9].ToString()),
                                 Convert.ToBoolean(connect.dr[10].ToString()),
                                 Convert.ToBoolean(connect.dr[11].ToString()),
                                 Convert.ToBoolean(connect.dr[12].ToString()));


            humanPointLabel.Text = connect.dr[13].ToString() + " /10";
            connect.closeConnect();
            humanPictureBox.ImageLocation = gelenHuman.getPhoto();
            humanNameLabel.Text           = gelenHuman.getName() + " " + gelenHuman.getL_name();
            this.Text               += " [" + gelenHuman.getName() + " " + gelenHuman.getL_name() + "]";
            humanBODLabel.Text       = gelenHuman.getB_date().ToString("dd MMMM yyyy");
            humanCityLabel.Text      = gelenHuman.getCity() + ", " + gelenHuman.getCountry();
            humanBiographyLabel.Text = gelenHuman.getBiography();
            humanHeightLabel.Text   += gelenHuman.getHeight() + " cm";
            humanSexLabel.Text       = gelenHuman.getSex();
            humanJobLabel.Text       = gelenHuman.getJobs();


            connect.openConnect();
            sqlString = "SELECT COUNT(*) FROM Human h, Movies m, ActorsOfMovie aom WHERE (h.h_no='" + gelenH_No + "') AND (h.h_no = aom.h_no) AND(m.m_no = aom.m_no) UNION " +
                        "SELECT COUNT(*) FROM Human h, Movies m, AuthorsOfMovie auom WHERE(h.h_no = '" + gelenH_No + "') AND(h.h_no = auom.h_no) AND(m.m_no = auom.m_no) UNION " +
                        "SELECT COUNT(*) FROM Human h, Movies m, DirectorsOfMovie dom WHERE(h.h_no = '" + gelenH_No + "') AND(h.h_no = Dom.h_no) AND(m.m_no = dom.m_no)";
            connect.Command(sqlString);
            while (connect.dr.Read())
            {
                knownForCount += Convert.ToInt32(connect.dr[0].ToString());
            }
            connect.closeConnect();

            if (knownForCount > 4)
            {
                knownForCount = 4;
            }
            connect.openConnect();
            sqlString = "SELECT h.h_no,m.m_no,m.name,m.cover FROM Human h, Movies m, ActorsOfMovie aom WHERE (h.h_no='" + gelenH_No + "') AND (h.h_no = aom.h_no) AND (m.m_no = aom.m_no) GROUP BY h.h_no,m.m_no,m.name,m.cover UNION " +
                        "SELECT h.h_no,m.m_no,m.name,m.cover FROM Human h, Movies m, AuthorsOfMovie auom WHERE(h.h_no = '" + gelenH_No + "') AND(h.h_no = auom.h_no) AND(m.m_no = auom.m_no) GROUP BY h.h_no,m.m_no,m.name,m.cover UNION " +
                        "SELECT h.h_no,m.m_no,m.name,m.cover FROM Human h, Movies m, DirectorsOfMovie dom WHERE(h.h_no = '" + gelenH_No + "') AND(h.h_no = dom.h_no) AND(m.m_no = dom.m_no) GROUP BY h.h_no,m.m_no,m.name,m.cover";
            connect.Command(sqlString);

            for (int i = 0; i < knownForCount; i++)
            {
                connect.dr.Read();

                knownForInformation[i, 0] = connect.dr[2].ToString();
                knownForInformation[i, 1] = connect.dr[3].ToString();
                knownForInformation[i, 2] = connect.dr[1].ToString();
            }
            connect.closeConnect();
            knownForPictureBox1.ImageLocation = knownForInformation[0, 1];
            knownForPictureBox2.ImageLocation = knownForInformation[1, 1];
            knownForPictureBox3.ImageLocation = knownForInformation[2, 1];
            knownForPictureBox4.ImageLocation = knownForInformation[3, 1];
            knownForLabel1.Text = knownForInformation[0, 0];
            knownForLabel2.Text = knownForInformation[1, 0];
            knownForLabel3.Text = knownForInformation[2, 0];
            knownForLabel4.Text = knownForInformation[3, 0];
        }
Exemplo n.º 11
0
        public void loadComment()
        {
            dbConnect connect         = new dbConnect();
            dbConnect forReplyConnect = new dbConnect();
            string    sqlString       = "";
            string    replySqlString  = "";
            int       commentCount    = 0;

            connect.openConnect();
            sqlString = "SELECT Count(*) FROM CommentsOfHuman ch WHERE (ch.h_no='" + gelenH_No + "')";
            connect.Command(sqlString);
            connect.dr.Read();
            commentCount += Convert.ToInt32(connect.dr[0].ToString());
            connect.closeConnect();

            connect.openConnect();
            sqlString = "SELECT Count(*) FROM ReplyOfHuman rh WHERE (rh.h_no='" + gelenH_No + "')";
            connect.Command(sqlString);
            connect.dr.Read();
            commentCount += Convert.ToInt32(connect.dr[0].ToString());
            connect.closeConnect();

            Label[] comment          = new Label[commentCount + 1];
            int     labelCounter     = 0;
            int     labelHeight      = 0;
            int     commentBoxHeight = 0;

            connect.openConnect();
            comment[labelCounter]          = new Label();
            comment[labelCounter].Location = new Point(1, 1);     // label'imizin x ve y kordinatını yani konumunu belirledik.
            comment[labelCounter].Size     = new Size(1, 1);
            comment[labelCounter].Name     = "commentStartLabel"; // label'imizin adını  belirledik.
            commentsPanel.Controls.Add(comment[labelCounter]);    // label'imizin nereye ekleneceğini belirledik.

            labelCounter++;
            sqlString = "SELECT ch.u_no,u.name,ch.point,ch.comment,ch.date FROM CommentsOfHuman ch , Users u WHERE (ch.u_no = u.u_no) AND " +
                        "(ch.h_no='" + gelenH_No + "') ORDER BY ch.date";
            connect.Command(sqlString);
            while (connect.dr.Read())
            {
                if (connect.dr[3].ToString() == "")
                {
                }
                else
                {
                    comment[labelCounter]           = new Label();                         // bu kısımda deneme kod adlı label dizisinin ilk elemanının form ekranına eklenicek yeni bir label olduğunu belirttik.
                    comment[labelCounter].Font      = new Font("Microsoft Sans Serif", 9); // bu kısımda ise label'imize bir font belirledik.
                    comment[labelCounter].ForeColor = Color.Black;                         // label'imizin yazı rengini belirledik.
                    comment[labelCounter].Text      = connect.dr[1].ToString() + ":\n" + connect.dr[3].ToString();
                    if (comment[labelCounter].Text.Length < 50)
                    {
                        labelHeight = 40;
                    }
                    else if (comment[labelCounter].Text.Length < 100)
                    {
                        labelHeight = 60;
                    }
                    else if (comment[labelCounter].Text.Length < 150)
                    {
                        labelHeight = 80;
                    }
                    else if (comment[labelCounter].Text.Length < 350)
                    {
                        labelHeight = 100;
                    }

                    comment[labelCounter].Size     = new Size(550, labelHeight);                                                                // label'imizin boyutunu belirledik.
                    comment[labelCounter].Location = new Point(10, comment[labelCounter - 1].Location.Y + comment[labelCounter - 1].Height);    // label'imizin x ve y kordinatını yani konumunu belirledik.
                    comment[labelCounter].Name     = connect.dr[0].ToString() + "@" + connect.dr[1].ToString() + "@" + labelCounter.ToString(); // label'imizin adını  belirledik.
                    commentsPanel.Controls.Add(comment[labelCounter]);                                                                          // label'imizin nereye ekleneceğini belirledik.
                    comment[labelCounter].Click += new EventHandler(comment_Click);                                                             // label'imize clilck eventi ekledik.
                    commentBoxHeight            += labelHeight;
                    labelCounter++;
                    forReplyConnect.openConnect();
                    replySqlString = "SELECT ur.name,rh.comment,rh.date FROM ReplyOfHuman rh, Users ur WHERE (rh.u_no2=ur.u_no) AND " +
                                     "rh.u_no='" + connect.dr[0].ToString() + "' " +
                                     "AND rh.h_no='" + gelenH_No + "'" +
                                     "ORDER BY rh.date";

                    forReplyConnect.Command(replySqlString);
                    while (forReplyConnect.dr.Read())
                    {
                        comment[labelCounter]           = new Label();                                                                  // bu kısımda deneme kod adlı label dizisinin ilk elemanının form ekranına eklenicek yeni bir label olduğunu belirttik.
                        comment[labelCounter].Font      = new Font("Microsoft Sans Serif", 9, FontStyle.Bold);                          // bu kısımda ise label'imize bir font belirledik.
                        comment[labelCounter].ForeColor = Color.DimGray;                                                                // label'imizin yazı rengini belirledik.
                        comment[labelCounter].Text      = forReplyConnect.dr[0].ToString() + ": \n" + forReplyConnect.dr[1].ToString(); // label'imizin yazı rengini belirledik.
                        if (comment[labelCounter].Text.Length < 50)
                        {
                            labelHeight = 40;
                        }
                        else if (comment[labelCounter].Text.Length < 100)
                        {
                            labelHeight = 60;
                        }
                        else if (comment[labelCounter].Text.Length < 150)
                        {
                            labelHeight = 80;
                        }
                        else if (comment[labelCounter].Text.Length < 350)
                        {
                            labelHeight = 100;
                        }

                        comment[labelCounter].Size     = new Size(550, labelHeight);
                        comment[labelCounter].Location = new Point(50, comment[labelCounter - 1].Location.Y + comment[labelCounter - 1].Height); // label'imizin x ve y kordinatını yani konumunu belirledik.
                        comment[labelCounter].Name     = labelCounter.ToString();                                                                // label'imizin adını  belirledik. Ben burada direkt sayı olarak verdim isimlerini fakat form ekranında aynı isimde eleman olur ise sorun çıkabilir.
                        commentsPanel.Controls.Add(comment[labelCounter]);                                                                       // label'imizin nereye ekleneceğini belirledik. Direkt form ekranına ekleyecek iseniz This.Controls.Add() komutunu kullanabilirsiniz.
                                                                                                                                                 //comment[labelCounter].Click += new EventHandler(comment_Click);// label'imize clilck eventi ekledik.
                        commentBoxHeight += labelHeight;
                        labelCounter++;
                    }
                    forReplyConnect.closeConnect();
                }
            }
            connect.closeConnect();
            pointComboBox.SelectedIndex = 0;
            if (gelenU_No == null)
            {
                newCommentGroupBox.Enabled = false;

                pointComboBox.Text = "";
            }
            commentsGroupBox.Size = new Size(697, commentBoxHeight + 30);
        }
Exemplo n.º 12
0
        public void loadDetailsMovies(string gelenM_No)
        {
            Movies    gelenMovie = new Movies();
            dbConnect connect    = new dbConnect();

            connect.openConnect();
            string sqlString = "SELECT m.m_no,m.name,m.about,m.release_date,m.budget,m.mtime,m.trailer,m.cover,m.m_language,AVG(cm.point) AS point " +
                               "FROM Movies m,CommentsOfMovie cm WHERE m.m_no='" + gelenM_No + "' AND (m.m_no=cm.m_no) GROUP BY m.m_no,m.name,m.about,m.release_date,m.budget,m.mtime,m.trailer,m.cover,m.m_language";

            connect.Command(sqlString);
            connect.dr.Read();
            gelenMovie.setValues(connect.dr[0].ToString(),
                                 connect.dr[1].ToString(),
                                 connect.dr[2].ToString(),
                                 DateTime.Parse(connect.dr[3].ToString()),
                                 connect.dr[4].ToString(),
                                 connect.dr[5].ToString(),
                                 connect.dr[6].ToString(),
                                 connect.dr[7].ToString(),
                                 connect.dr[8].ToString());
            double temp = Convert.ToDouble(connect.dr[9].ToString());

            moviePointLabel.Text = temp.ToString("N1") + " /10";
            connect.closeConnect();
            moviePictureBox.ImageLocation = gelenMovie.getCover();
            trailerPlayer.Movie           = gelenMovie.getTrailer();
            movieNameLabel.Text           = gelenMovie.getName();
            movieTimeLabel.Text           = gelenMovie.getMtime();
            movieReleaseDateLabel.Text    = gelenMovie.getRelease_date().ToString("dd MMMM yyyy");
            movieAboutLabel.Text          = gelenMovie.getAbout();
            this.Text += " [" + gelenMovie.getName() + "]";

            connect.openConnect();                                                                //For Movie Types
            sqlString = "SELECT t.name FROM Movies m, Types t, TypeOfMovie tm " +
                        "WHERE m.m_no='" + gelenMovie.getM_no() + "' AND (m.m_no=tm.m_no) AND (tm.t_no = t.t_no)";
            connect.Command(sqlString);
            while (connect.dr.Read())
            {
                gelenMovie.setMovieTypes(connect.dr[0].ToString());
            }
            connect.closeConnect();

            movieTypeLabel.Text = gelenMovie.getMovieType();

            connect.openConnect();                                                              //For Movie Directors
            sqlString = "SELECT h.name,h.l_name FROM Movies m, Human h, DirectorsOfMovie dm " +
                        "WHERE m.m_no='" + gelenMovie.getM_no() + "' AND (m.m_no=dm.m_no) AND (dm.h_no = h.h_no)";
            connect.Command(sqlString);
            while (connect.dr.Read())
            {
                gelenMovie.setDirectors(connect.dr[0].ToString() + " " + connect.dr[1].ToString());
            }
            connect.closeConnect();
            movieDirectorLabel.Text += gelenMovie.getDirectors();

            connect.openConnect();                                                              //For Movie Directors
            sqlString = "SELECT h.name,h.l_name FROM Movies m, Human h, AuthorsOfMovie aom " +
                        "WHERE m.m_no='" + gelenMovie.getM_no() + "' AND (m.m_no=aom.m_no) AND (aom.h_no = h.h_no)";
            connect.Command(sqlString);
            while (connect.dr.Read())
            {
                gelenMovie.setAuthors(connect.dr[0].ToString() + " " + connect.dr[1].ToString());
            }

            connect.closeConnect();
            movieAuthorLabel.Text += gelenMovie.getAuthors();

            connect.openConnect();                                                              //For Movie Leading Role Stars
            sqlString = "SELECT h.name,h.l_name FROM Movies m, Human h, ActorsOfMovie aom " +
                        "WHERE m.m_no='" + gelenMovie.getM_no() + "' AND aom.leading_role='T' AND (m.m_no=aom.m_no) AND (aom.h_no = h.h_no)";
            connect.Command(sqlString);
            while (connect.dr.Read())
            {
                gelenMovie.setLeadingRoles(connect.dr[0].ToString() + " " + connect.dr[1].ToString());
            }

            connect.closeConnect();
            movieLeadingRoleLabel.Text += gelenMovie.getLeadingRoles();



            connect.openConnect();                                                              //For Movie Actors
            sqlString = "SELECT m.m_no,h.h_no,h.name,h.l_name,h.photo,AVG(ch.point) AS moviePoint " +
                        "FROM Human h, Movies m, ActorsOfMovie aom,CommentsOfHuman ch " +
                        "WHERE (m.m_no='" + gelenMovie.getM_no() + "') AND (h.h_no = aom.h_no) AND(m.m_no =aom.m_no) AND (ch.h_no=h.h_no) " +
                        "GROUP BY m.m_no,h.h_no,h.name,h.l_name,h.photo ORDER BY moviePoint DESC";
            connect.Command(sqlString);
            for (int i = 0; i < bestStarsCount; i++)
            {
                connect.dr.Read();
                bestStarsInformation[i, 0] = connect.dr[1].ToString();
                bestStarsInformation[i, 1] = connect.dr[2].ToString() + " " + connect.dr[3].ToString();
                bestStarsInformation[i, 2] = connect.dr[4].ToString();
            }
            connect.closeConnect();

            bestStarPictureBox1.ImageLocation = bestStarsInformation[0, 2];
            bestStarPictureBox2.ImageLocation = bestStarsInformation[1, 2];
            bestStarPictureBox3.ImageLocation = bestStarsInformation[2, 2];
            bestStarPictureBox4.ImageLocation = bestStarsInformation[3, 2];

            bestStarLabel1.Text = bestStarsInformation[0, 1];
            bestStarLabel2.Text = bestStarsInformation[1, 1];
            bestStarLabel3.Text = bestStarsInformation[2, 1];
            bestStarLabel4.Text = bestStarsInformation[3, 1];
        }
Exemplo n.º 13
0
        public void loadList()
        {
            string sqlString = "SELECT * FROM Movies WHERE m_no IN (SELECT m_no FROM WatchList WHERE isWatched='false' AND u_no='" + gelenU_No.ToString() + "')";
            string sqlCount  = "SELECT COUNT(*) FROM Movies WHERE m_no IN (SELECT m_no FROM WatchList WHERE isWatched='false' AND u_no='" + gelenU_No.ToString() + "')";

            dbConnect connect        = new dbConnect();
            dbConnect connectForType = new dbConnect();
            int       movieCount     = 0;

            connect.openConnect();
            connect.Command(sqlCount);
            connect.dr.Read();
            movieCount = Convert.ToInt32(connect.dr[0].ToString());
            connect.closeConnect();
            if (movieCount < 1)
            {
                MessageBox.Show("There is no record to show.", "Error");
                this.Close();
            }
            Label[]      name            = new Label[movieCount + 1];
            Label[]      type            = new Label[movieCount + 1];
            PictureBox[] removeWatchList = new PictureBox[movieCount + 1];
            PictureBox[] movieCover      = new PictureBox[movieCount + 1];
            PictureBox[] watchedMovie    = new PictureBox[movieCount + 1];


            int movieCounter = 0;

            name[movieCounter]          = new Label();
            name[movieCounter].Location = new Point(0, -153);
            name[movieCounter].Size     = new Size(0, 0);
            name[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(name[movieCounter]);

            type[movieCounter]          = new Label();
            type[movieCounter].Location = new Point(0, -123);
            type[movieCounter].Size     = new Size(0, 0);
            type[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(type[movieCounter]);



            removeWatchList[movieCounter]          = new PictureBox();
            removeWatchList[movieCounter].Location = new Point(0, -97);
            removeWatchList[movieCounter].Size     = new Size(0, 0);
            removeWatchList[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(removeWatchList[movieCounter]);

            movieCover[movieCounter]          = new PictureBox();
            movieCover[movieCounter].Location = new Point(0, -153);
            movieCover[movieCounter].Size     = new Size(0, 0);
            movieCover[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(movieCover[movieCounter]);

            watchedMovie[movieCounter]          = new PictureBox();
            watchedMovie[movieCounter].Location = new Point(0, -55);
            watchedMovie[movieCounter].Size     = new Size(0, 0);
            watchedMovie[movieCounter].Name     = "MovieListStartPositionLabel";
            mainPanel.Controls.Add(watchedMovie[movieCounter]);

            movieCounter++;

            string movieType = "";

            connect.openConnect();
            connect.Command(sqlString);

            while (connect.dr.Read())
            {
                name[movieCounter]             = new Label();
                name[movieCounter].Font        = new Font("Microsoft Sans Serif", 14, FontStyle.Bold);
                name[movieCounter].ForeColor   = Color.Black;
                name[movieCounter].Click      += new EventHandler(nameLabel_Click);
                name[movieCounter].Text        = connect.dr[1].ToString();
                name[movieCounter].Location    = new Point(122, name[movieCounter - 1].Location.Y + 156);
                name[movieCounter].AutoSize    = true;
                name[movieCounter].MaximumSize = new Size(550, 25);
                name[movieCounter].Name        = connect.dr[0].ToString() + "@NameLabel";
                mainPanel.Controls.Add(name[movieCounter]);  // kişilerin İsimleri bu labele hizalanacak


                connectForType.openConnect();
                connectForType.Command("SELECT t.name FROM Movies m, Types t, TypeOfMovie tm WHERE m.m_no = '" + connect.dr[0].ToString() + "' AND(m.m_no = tm.m_no) AND (tm.t_no = t.t_no)");
                while (connectForType.dr.Read())
                {
                    movieType += connectForType.dr[0].ToString() + " ";
                }
                connectForType.closeConnect();

                type[movieCounter]             = new Label();
                type[movieCounter].Font        = new Font("Microsoft Sans Serif", 12);
                type[movieCounter].ForeColor   = Color.Black;
                type[movieCounter].Text        = movieType;
                type[movieCounter].Location    = new Point(122, type[movieCounter - 1].Location.Y + 156);
                type[movieCounter].AutoSize    = true;
                type[movieCounter].MaximumSize = new Size(550, 20);
                type[movieCounter].Name        = connect.dr[0].ToString() + "@MovieTypeLabel";
                mainPanel.Controls.Add(type[movieCounter]);

                movieType = "";

                removeWatchList[movieCounter]             = new PictureBox();
                removeWatchList[movieCounter].Font        = new Font("Microsoft Sans Serif", 10);
                removeWatchList[movieCounter].ForeColor   = Color.Black;
                removeWatchList[movieCounter].Image       = Properties.Resources.file_delete;
                removeWatchList[movieCounter].SizeMode    = PictureBoxSizeMode.StretchImage;
                removeWatchList[movieCounter].Location    = new Point(122, removeWatchList[movieCounter - 1].Location.Y + 156);
                removeWatchList[movieCounter].Size        = new Size(32, 32);
                removeWatchList[movieCounter].Click      += new EventHandler(removeMovie_Click);
                removeWatchList[movieCounter].MaximumSize = new Size(550, 85);
                removeWatchList[movieCounter].Name        = connect.dr[0].ToString() + "@removeWatchListPictureBox";
                mainPanel.Controls.Add(removeWatchList[movieCounter]);


                movieCover[movieCounter]               = new PictureBox(); // kişilerin resimleri bu Pictureboxa hizalanacak
                movieCover[movieCounter].Location      = new Point(12, movieCover[movieCounter - 1].Location.Y + 156);
                movieCover[movieCounter].Size          = new Size(100, 150);
                movieCover[movieCounter].ImageLocation = connect.dr[7].ToString();
                movieCover[movieCounter].SizeMode      = PictureBoxSizeMode.StretchImage;
                movieCover[movieCounter].Click        += new EventHandler(movieCover_Click);
                movieCover[movieCounter].Name          = connect.dr[0].ToString() + "@humanPictureBox";
                mainPanel.Controls.Add(movieCover[movieCounter]);

                watchedMovie[movieCounter]           = new PictureBox();
                watchedMovie[movieCounter].Font      = new Font("Microsoft Sans Serif", 10);
                watchedMovie[movieCounter].ForeColor = Color.Black;
                watchedMovie[movieCounter].Image     = Properties.Resources.watched;
                watchedMovie[movieCounter].SizeMode  = PictureBoxSizeMode.StretchImage;
                watchedMovie[movieCounter].Location  = new Point(122, watchedMovie[movieCounter - 1].Location.Y + 156);
                watchedMovie[movieCounter].Size      = new Size(40, 50);
                watchedMovie[movieCounter].Click    += new EventHandler(watchedMovie_Click);
                //watchedMovie[movieCounter].MaximumSize = new Size(550, 85);
                watchedMovie[movieCounter].Name = connect.dr[0].ToString() + "@removeWatchListPictureBox";
                mainPanel.Controls.Add(watchedMovie[movieCounter]);

                movieCounter++;
            }
        }