예제 #1
0
        // Events
        void OnLoad(object sender, EventArgs e)
        {
            CreateControlsFromTemplate(template, panelReviews, "review", reviews, itemsPerPage);

            BindingManager.AddOrderingBinding(filterSortOrder);
            BindingManager.AddRatingBinding(filterRating);
            BindingManager.AddSortByReviewsBinding(filterSortBy);

            buttonAddMovie.DataBindings.Add("Enabled", Profile.IsAdmin, "Checked");
            buttonWatchlist.DataBindings.Add("Enabled", Profile.IsLoggedIn, "Checked");
            buttonLogin.DataBindings.Add(BindingManager.GetFormattedBindingLoggedIn("Text"));

            for (int i = 0; i < itemsPerPage; i++)
            {
                var review = reviews[i];
                var curi   = i;
                review.Controls["buttonDeleteReview"].DataBindings.Add("Enabled", Profile.IsAdmin, "Checked");
                review.Controls["buttonDeleteReview"].DataBindings.Add("Visible", Profile.IsAdmin, "Checked");
                review.Controls["buttonDeleteReview"].Click += (object s, EventArgs ee) => {
                    ReviewManager.DeleteReview(reviewsData[curi].id);
                };
                review.Controls["buttonMovieInfo"].Click += (object s, EventArgs ee) => {
                    Program.OpenMovieForm(reviewsData[curi].movieId);
                };
            }
            LoadReviews();
        }
예제 #2
0
        private void reviewPublish_Click(object sender, EventArgs e)
        {
            var success = false;

            if (isEditing)
            {
                success = ReviewManager.UpdateReview(reviewData.id, id, reviewRating.Value, reviewText.Text);
            }
            else
            {
                success = ReviewManager.AddReview(id, reviewRating.Value, reviewText.Text) != -1;
            }
            if (success)
            {
                if (isEditing)
                {
                    isEditing = false;
                    Program.ReloadForms();
                }

                reviewText.ResetText();
                reviewRating.Value = 5;
            }
        }
예제 #3
0
 private void buttonPublishRevview_Click(object sender, EventArgs e)
 {
     ReviewManager.DeleteReview(reviewData.id);
 }