Example #1
0
        //
        // Get Movie Reviews: from id...
        //
        private void cmdGetMovieReviews_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();

            int id = Convert.ToInt32(txtMovieID.Text);  //converts string to integer

            BusinessTier.Reviews review = businesstier.GetReviews(id);

            foreach (BusinessTier.Review row in review)
            {
                listBox1.Items.Add(row.UserID + ":" + row.Rating);
            }
        }
Example #2
0
        //
        // Each Rating:
        //
        private void cmdEachRating_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            int r5    = 0;
            int r4    = 0;
            int r3    = 0;
            int r2    = 0;
            int r1    = 0;
            int total = 0;

            BusinessTier.Reviews review = businesstier.GetReviews(txtRatingsMovieName.Text);

            foreach (BusinessTier.Review row in review)
            {
                if (row.Rating == 5)
                {
                    r5++;
                }
                if (row.Rating == 4)
                {
                    r4++;
                }
                if (row.Rating == 3)
                {
                    r3++;
                }
                if (row.Rating == 2)
                {
                    r2++;
                }
                if (row.Rating == 1)
                {
                    r1++;
                }
            }
            total = r5 + r4 + r3 + r2 + r1;
            listBox1.Items.Add("5: " + r5);
            listBox1.Items.Add("4: " + r4);
            listBox1.Items.Add("3: " + r3);
            listBox1.Items.Add("2: " + r2);
            listBox1.Items.Add("1: " + r1);
            listBox1.Items.Add("Total:" + total);
        }
Example #3
0
        //
        // Average Rating:
        //
        private void cmdAvgRating_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            double a, b, average;

            a       = 0.0;
            b       = 0.0;
            average = 0.0;

            BusinessTier.Reviews review = businesstier.GetReviews(txtRatingsMovieName.Text);
            //BsuinessTier.Review
            foreach (BusinessTier.Review row in review)
            {
                a++; // length  of db
                b += row.Rating;
            }
            average = b / a;
            listBox1.Items.Add("Average rating: " + average);
        }