Exemplo n.º 1
0
        private void showReviewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ReviewEditor re = new ReviewEditor(GetSelectedReviewMedia(), true);

            re.SetContentAndRating(GetSelectedReviewContent(), GetSelectedReviewRating());
            re.Show();
        }
Exemplo n.º 2
0
        private void writeReviewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (GetSelectedMediaName() == null)
            {
                return;
            }
            ReviewEditor re         = new ReviewEditor(GetSelectedMediaName());
            int          reviewType = DBAccessor.CheckReviewValidity(this.CurrentUser, this.GetSelectedMediaFilepath());

            //rating and content are both null, so no special case
            if (reviewType == 0)
            {
                re.ShowDialog();
                if (re.submit)
                {
                    DBAccessor.AddReview(this.CurrentUser, this.GetSelectedMediaFilepath(), re.Rating, re.Content);
                }
            }
            //rating is not null but content is, so this review needs to be updated, not inserted
            else if (reviewType == 1)
            {
                re.RatingBar.Value = DBAccessor.GetCurrentRating(this.CurrentUser, this.GetSelectedMediaFilepath());
                re.ShowDialog();
                if (re.submit)
                {
                    DBAccessor.UpdateReview(this.CurrentUser, this.GetSelectedMediaFilepath(),
                                            this.GetSelectedReviewRating(), re.Content);
                }
            }
            //item has already been reviewed, so it can't be reviewed again
            else if (reviewType == 2)
            {
                MessageBox.Show("You have already reviewed this item!");
            }
        }