コード例 #1
0
        /// <summary>
        /// Create the reviews using the fixed list of images.
        /// </summary>
        /// <param name="client">The Content Moderator client.</param>
        private static void CreateReviews(ContentModeratorClient client)
        {
            WriteLine(null, true);
            WriteLine("Creating reviews for the following images:", true);

            // Create the structure to hold the request body information.
            List <CreateReviewBodyItem> requestInfo =
                new List <CreateReviewBodyItem>();

            // Create some standard metadata to add to each item.
            List <CreateReviewBodyItemMetadataItem> metadata =
                new List <CreateReviewBodyItemMetadataItem>(
                    new CreateReviewBodyItemMetadataItem[] {
                new CreateReviewBodyItemMetadataItem(
                    MetadataKey, MetadataValue)
            });

            // Populate the request body information and the initial cached review information.
            for (int i = 0; i < ImageUrls.Length; i++)
            {
                // Cache the local information with which to create the review.
                var itemInfo = new ReviewItem()
                {
                    Type      = MediaType,
                    ContentId = i.ToString(),
                    Url       = ImageUrls[i],
                    ReviewId  = null
                };

                WriteLine($" - {itemInfo.Url}; with id = {itemInfo.ContentId}.", true);

                // Add the item informaton to the request information.
                requestInfo.Add(new CreateReviewBodyItem(
                                    itemInfo.Type, itemInfo.Url, itemInfo.ContentId,
                                    CallbackEndpoint, metadata));

                // Cache the review creation information.
                reviewItems.Add(itemInfo);
            }

            var reviewResponse = client.Reviews.CreateReviewsWithHttpMessagesAsync(
                "application/json", TeamName, requestInfo);

            // Update the local cache to associate the created review IDs with
            // the associated content.
            var reviewIds = reviewResponse.Result.Body;

            for (int i = 0; i < reviewIds.Count; i++)
            {
                Program.reviewItems[i].ReviewId = reviewIds[i];
            }

            WriteLine(JsonConvert.SerializeObject(
                          reviewIds, Formatting.Indented));

            Thread.Sleep(throttleRate);
        }
コード例 #2
0
        public async void ShowReviewInfor(ReviewItem reviewItem)
        {
            var replyPopup = new ReplyPopupView();

            reviewItem.SetStar();
            replyPopup.BindingContext = reviewItem;
            replyPopup.InitStars();
            await PopupNavigation.Instance.PushAsync(replyPopup);
        }
コード例 #3
0
        public void InitStars()
        {
            ReviewItem review = this.BindingContext as ReviewItem;

            star1.Source = review.star1;
            star2.Source = review.star2;
            star3.Source = review.star3;
            star4.Source = review.star4;
            star5.Source = review.star5;
        }
コード例 #4
0
        public async Task <IActionResult> PostReviewItem([FromBody] ReviewItem reviewItem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.ReviewItem.Add(reviewItem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetReviewItem", new { id = reviewItem.Id }, reviewItem));
        }
コード例 #5
0
        public async void ShowDetailOrder(ReviewItem reviewItem)
        {
            var           DetalPage     = new OrderDetailPopupView();
            OrderBillItem orderBillItem = new OrderBillItem
            {
                Order         = dataProvider.GetOrderBillByIDOrderBill(reviewItem.IDOrderBill),
                AddedProducts = dataProvider.GetProductsInBillByIDBill(reviewItem.IDOrderBill)
            };

            DetalPage.BindingContext = orderBillItem;
            await PopupNavigation.Instance.PushAsync(DetalPage);
        }
コード例 #6
0
        public async Task <ActionResult <ReviewItem> > PutReviewItem(long id, ReviewItem review)
        {
            if (id != review.ReviewId)
            {
                return(BadRequest());
            }

            _context.Entry(review).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(await _context.ReviewItems.FindAsync(id));;
        }
コード例 #7
0
        public void when_is_the_next_review_due()
        {
            var item = new ReviewItem
            {
                DifficultyRating    = 12,
                ReviewDate          = new DateTime(2013, 09, 18),
                CorrectReviewStreak = 8,
            };
            var strategy = new SuperMemo2ReviewStrategy();

            Debug.WriteLine(strategy.NextReview(item));
        }
コード例 #8
0
 public ReviewItem CreateStar(ReviewItem item)
 {
     if (item.Rating == 0)
     {
         item.star1 = "emptystar";
         item.star2 = "emptystar";
         item.star3 = "emptystar";
         item.star4 = "emptystar";
         item.star5 = "emptystar";
     }
     if (item.Rating == 1)
     {
         item.star1 = "fullstar";
         item.star2 = "emptystar";
         item.star3 = "emptystar";
         item.star4 = "emptystar";
         item.star5 = "emptystar";
     }
     if (item.Rating == 2)
     {
         item.star1 = "fullstar";
         item.star2 = "fullstar";
         item.star3 = "emptystar";
         item.star4 = "emptystar";
         item.star5 = "emptystar";
     }
     if (item.Rating == 3)
     {
         item.star1 = "fullstar";
         item.star2 = "fullstar";
         item.star3 = "fullstar";
         item.star4 = "emptystar";
         item.star5 = "emptystar";
     }
     if (item.Rating == 4)
     {
         item.star1 = "fullstar";
         item.star2 = "fullstar";
         item.star3 = "fullstar";
         item.star4 = "fullstar";
         item.star5 = "emptystar";
     }
     if (item.Rating == 5)
     {
         item.star1 = "fullstar";
         item.star2 = "fullstar";
         item.star3 = "fullstar";
         item.star4 = "fullstar";
         item.star5 = "fullstar";
     }
     return(item);
 }
コード例 #9
0
        public async Task <int> Add(ReviewItem reviewItem)
        {
            var rating = await _ratingService.GetRating(reviewItem.RatingId);

            if (rating == null)
            {
                return(0);
            }

            _context.ReviewItem.Add(reviewItem);
            await _context.SaveChangesAsync();

            return(1);
        }
コード例 #10
0
        /// <summary>
        /// Open edit review page if these review is on page
        /// </summary>
        /// <param name="productReview">Review data in IProductReview format</param>
        /// <returns>EditReviewPageLogic page if review exist and null if not</returns>
        public EditReviewPageLogic EditReviewThatEqualsTo(IProductReview productReview)
        {
            ReviewItem tmp = ReviewsPage.GetReviewsListIfAnyExists().FirstOrDefault(x => x.Equals(productReview));

            if (tmp != null)
            {
                tmp.ClickOnEditLink();
                return(new EditReviewPageLogic());
            }
            else
            {
                return(null);
            }
        }
コード例 #11
0
    protected void FillPage()
    {
        int TitleId = Int32.Parse(Request.QueryString["TitleId"]);

        imgCover.ImageUrl = "../../Storage/Images/" + TitleId.ToString() + ".png";
        Title ttl = ebs.Titles.SingleOrDefault(t => t.TitleId == TitleId);

        lblTitleBig.Text   = ttl.TitleName;
        lblDesc.Text       = ttl.TitleDescription;
        lblEdition.Text    = ttl.Edition;
        lblFormat.Text     = ttl.FileFormat;
        lblISBN.Text       = ttl.ISBN.ToString();
        lblPages.Text      = ttl.Pages.ToString();
        lblPrice.Text      = ttl.Price.ToString();
        lblPubDate.Text    = ttl.PubDate.ToShortDateString();
        lbRating.Text      = System.Math.Round(ttl.Rating, 2).ToString();
        lbRatingCount.Text = ttl.RatingCount.ToString();
        lblDownloads.Text  = ttl.DownloadCount.ToString();
        //get list of authors as string
        var queryAuthList = from au in ebs.Authors
                            from t in au.Titles
                            where t.TitleId == TitleId
                            select string.Concat(au.FirstName, " ", au.LastName);

        lblAuthList.Text = String.Join(", ", queryAuthList);

        //get list of categories as string
        var queryCatList = from cat in ebs.Categories
                           from t in cat.Titles
                           where t.TitleId == TitleId
                           select cat.CategoryName;

        lblCatList.Text = String.Join(", ", queryCatList);

        //get reviews
        var queryReviews = from rev in ebs.Reviews
                           where rev.Title.TitleId == TitleId
                           select rev;
        List <ReviewItem> lst_rev = new List <ReviewItem>();
        ReviewItem        revitm;

        foreach (Review item in queryReviews)
        {
            revitm = new ReviewItem(item);
            lst_rev.Add(revitm);
        }
        gvReviews.DataSource = lst_rev;
        gvReviews.DataBind();
    }
コード例 #12
0
        //-------------------------------------------------------------------------

        public ReviewContentDlg(string filePath,
                                int revision)
        {
            InitializeComponent();

            // Add file path to the dlg title.
            Text += ": " + filePath + '#' + revision;

            // Add the html renderer component.
            _uiContent.Dock = DockStyle.Fill;
            _uiContent.Text = ReviewItem.GetHtmlDiffContent(filePath, revision);
            Controls.Add(_uiContent);

            uiClose.SendToBack();
        }
コード例 #13
0
        public ActionResult UnpassReview(ReviewItem reviewItem)
        {
            ReturnObject ro = null;

            try
            {
                ReviewUtils.UnpassReview(this.dbContext, reviewItem);
                ro = new ReturnObject();
            }
            catch (Exception ex)
            {
                ro = new ReturnObject(ex.Message);
            }
            return(Json(ro));
        }
コード例 #14
0
ファイル: ReviewController.cs プロジェクト: Dajjal/Test
        public async Task <IHttpActionResult> Post(ReviewItem item)
        {
            using (TestDBEntities db = new TestDBEntities())
            {
                Reviews rec = new Reviews()
                {
                    ClientName = item.ClientName,
                    Review     = item.Review
                };
                db.Reviews.Add(rec);
                await db.SaveChangesAsync();

                item.ID = rec.ID;
                return(Ok(item));
            }
        }
コード例 #15
0
        public async Task <IActionResult> UploadReview([FromForm] string review, [FromForm] int refID, [FromForm] string name, [FromForm] string uID, [FromForm] int rating)
        {
            ReviewItem reviewItem = new ReviewItem();

            reviewItem.RevRefID = refID;
            reviewItem.Name     = name;
            reviewItem.Review   = review;
            reviewItem.Uploaded = DateTime.Now.ToString();
            reviewItem.Rating   = rating;
            reviewItem.UID      = uID;

            _context.ReviewItem.Add(reviewItem);
            await _context.SaveChangesAsync();

            return(Ok($"review uploaded"));
        }
コード例 #16
0
        public void LoadData()
        {
            CreateChartData();
            _numberOfOrder   = dataProvider.GetOrderBillByIDStore(Infor.IDStore).Count;
            _numberOfProduct = dataProvider.GetProductByIDStore(Infor.IDStore).Count;

            //===========
            List <OrderBill> orders = dataProvider.GetOrderBillByIDStore(Infor.IDStore);
            double           total  = 0;

            foreach (OrderBill order in orders)
            {
                if (order.State == OrderState.Received)
                {
                    List <Product> orderedProducts = dataProvider.GetProductsInBillByIDBill(order.IDOrderBill);
                    total += order.GetTotal();
                }
            }
            _renenue = total.ToString();
            //===========
            List <ReviewItem> result       = new List <ReviewItem>();
            List <OrderBill>  reviewOrders = dataProvider.GetMyReviewedOrder();

            reviewOrders = SortByDate(reviewOrders);

            for (int i = 0; i < reviewOrders.Count; i++)
            {
                if (i == 5)
                {
                    break;
                }
                User       user = dataProvider.GetUserByIDUser(reviewOrders[i].IDUser);
                ReviewItem item = new ReviewItem
                {
                    CustomerImage = user.ImageURL,
                    CustomerName  = user.UserName,
                    Content       = reviewOrders[i].Review,
                    Date          = reviewOrders[i].Date,
                    Rating        = reviewOrders[i].Rating
                };
                item = CreateStar(item);
                result.Add(item);
            }
            _reviews = new ObservableCollection <ReviewItem>(result);

            LoadCategories();
        }
コード例 #17
0
        //-----------------------------------------------------------------------------------------------------------------------

        //***********************************************************************************************************************
        #region         // Section des Procédures Privées
        //-----------------------------------------------------------------------------------------------------------------------

        //***********************************************************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="Choice"></param>
        //-----------------------------------------------------------------------------------------------------------------------
        private static void RegisterReview(bool Choice)
        {
            //-------------------------------------------------------------------------------------------------------------------
            ReviewItem Review = new ReviewItem()
            {
                //---------------------------------------------------------------------------------------------------------------
                StartUp         = 0,
                UserChoice      = Choice,
                RequestCount    = 0,
                LastCheckDate   = DateTime.Today,
                LastRequestDate = DateTime.Today,
                //---------------------------------------------------------------------------------------------------------------
            };

            //-------------------------------------------------------------------------------------------------------------------

            //-------------------------------------------------------------------------------------------------------------------
            try
            {
                //---------------------------------------------------------------------------------------------------------------
                if (IsolatedStorageSettings.ApplicationSettings.Contains("review"))
                {
                    //-----------------------------------------------------------------------------------------------------------
                    Review = (ReviewItem)IsolatedStorageSettings.ApplicationSettings ["review"];

                    Review.RequestCount++;
                    Review.UserChoice      = Choice;
                    Review.LastRequestDate = DateTime.Now;
                    //-----------------------------------------------------------------------------------------------------------
                }
                //---------------------------------------------------------------------------------------------------------------

                //---------------------------------------------------------------------------------------------------------------
                IsolatedStorageSettings.ApplicationSettings ["review"] = Review;

                IsolatedStorageSettings.ApplicationSettings.Save();
                //---------------------------------------------------------------------------------------------------------------
            }
            //-------------------------------------------------------------------------------------------------------------------
            catch {}
            //-------------------------------------------------------------------------------------------------------------------
        }
コード例 #18
0
ファイル: ReviewDlg.cs プロジェクト: melzatkinson/Critr
        //-------------------------------------------------------------------------

        public ReviewDlg(ReviewItem reviewItem)
        {
            InitializeComponent();

            // There must be a logged on user.
            if (Program.LoggedOnUser == null)
            {
                throw new Exception("No user logged-on.");
            }

            // Null review item given? We're creating a new item.
            Review = reviewItem;

            if (reviewItem == null)
            {
                Review               = new ReviewItem();
                Review.Active        = true;
                Review.CreatedByUser = Program.LoggedOnUser;
            }
        }
コード例 #19
0
        public async Task <ActionResult <ReviewItem> > PostReviewItem(ReviewItem review)
        {
            if (review == null)
            {
                throw new System.ArgumentNullException(nameof(review));
            }

            var bookItem = await _context.BookItems.FindAsync(review.BookItem.BookId);

            if (bookItem == null)
            {
                return(NotFound());
            }

            review.BookItem = bookItem;

            _context.ReviewItems.Add(review);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetReviewItem), new { id = review.ReviewId }, review));
        }
コード例 #20
0
        public async Task <ActionResult <ReviewItem> > PostReviewItem(ReviewItem reviewItem)
        {
            if (_reviewService.ReviewItemExists(reviewItem.Id))
            {
                ModelState.AddModelError("", "Item already exists");
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var saved = await _reviewService.Add(reviewItem);

            if (saved == 0)
            {
                ModelState.AddModelError("", "Please select a valid rating");
                return(BadRequest(ModelState));
            }

            return(CreatedAtAction("GetReviewItem", new { id = reviewItem.Id }, reviewItem));
        }
コード例 #21
0
ファイル: ReviewFrame.cs プロジェクト: gopa810/Rambha
        private void StartDocumentReview(MNDocument doc, string filePath)
        {
            Document    = doc;
            doc.Reviews = p_Book;
            ClearUI();

            labelBookTitle.Text     = Document.Book.BookTitle;
            tabControl1.SelectedTab = tabBook;

            string folder = Properties.Settings.Default.ReviewsDirectory;

            if (Directory.Exists(folder))
            {
                string path = Path.Combine(folder, Path.GetFileNameWithoutExtension(Document.Book.FilePath) + ".smr");
                LoadData(path);
            }

            p_PageOrig = null;
            p_ItemOrig = null;
            p_Page     = new ReviewPage();
            p_Item     = new ReviewItem();
        }
コード例 #22
0
ファイル: ReviewFrame.cs プロジェクト: gopa810/Rambha
        private void SetItem(SMControl sControl)
        {
            if (p_Page.Items.ContainsKey(sControl.Id))
            {
                p_Item = p_Page.Items[sControl.Id];
            }
            else
            {
                p_Item = new ReviewItem();
                p_Page.Items[sControl.Id] = p_Item;
                p_Item.ItemText           = sControl.TextRaw;
                p_Item.ItemNotes          = "";
            }

            tabControl1.SelectedTab = tabItem;

            labelControlId.Text = sControl.Id.ToString();
            textItemText.Text   = p_Item.ItemText;
            textItemNotes.Text  = p_Item.ItemNotes;

            p_ItemOrig = sControl;
            UpdateItemTextColor();
        }
コード例 #23
0
        // Create the reviews using the fixed list of images.
        private static void CreateReviews(ContentModeratorClient client, string[] ImageUrls, string teamName, string endpoint)
        {
            Console.WriteLine("--------------------------------------------------------------");
            Console.WriteLine();
            Console.WriteLine("CREATE HUMAN IMAGE REVIEWS");

            // The minimum amount of time, in milliseconds, to wait between calls to the Image List API.
            const int throttleRate = 2000;
            // The number of seconds to delay after a review has finished before getting the review results from the server.
            const int latencyDelay = 45;

            // The name of the log file to create. Relative paths are relative to the execution directory.
            const string OutputFile = "OutputLog.txt";

            // The optional name of the subteam to assign the review to. Not used for this example.
            const string Subteam = null;

            // The media type for the item to review. Valid values are "image", "text", and "video".
            const string MediaType = "image";

            // The metadata key to initially add to each review item. This is short for 'score'.
            // It will enable the keys to be 'a' (adult) and 'r' (racy) in the response,
            // with a value of true or false if the human reviewer marked them as adult and/or racy.
            const string MetadataKey = "sc";
            // The metadata value to initially add to each review item.
            const string MetadataValue = "true";

            // A static reference to the text writer to use for logging.
            TextWriter writer;

            // The cached review information, associating a local content ID to the created review ID for each item.
            List <ReviewItem> reviewItems = new List <ReviewItem>();

            using (TextWriter outputWriter = new StreamWriter(OutputFile, false))
            {
                writer = outputWriter;
                WriteLine(writer, null, true);
                WriteLine(writer, "Creating reviews for the following images:", true);

                // Create the structure to hold the request body information.
                List <CreateReviewBodyItem> requestInfo = new List <CreateReviewBodyItem>();

                // Create some standard metadata to add to each item.
                List <CreateReviewBodyItemMetadataItem> metadata =
                    new List <CreateReviewBodyItemMetadataItem>(new CreateReviewBodyItemMetadataItem[]
                                                                { new CreateReviewBodyItemMetadataItem(MetadataKey, MetadataValue) });

                // Populate the request body information and the initial cached review information.
                for (int i = 0; i < ImageUrls.Length; i++)
                {
                    // Cache the local information with which to create the review.
                    var itemInfo = new ReviewItem()
                    {
                        Type      = MediaType,
                        ContentId = i.ToString(),
                        Url       = ImageUrls[i],
                        ReviewId  = null
                    };

                    WriteLine(writer, $" {Path.GetFileName(itemInfo.Url)} with id = {itemInfo.ContentId}.", true);

                    // Add the item informaton to the request information.
                    requestInfo.Add(new CreateReviewBodyItem(itemInfo.Type, itemInfo.Url, itemInfo.ContentId, endpoint, metadata));

                    // Cache the review creation information.
                    reviewItems.Add(itemInfo);
                }

                var reviewResponse = client.Reviews.CreateReviewsWithHttpMessagesAsync("application/json", teamName, requestInfo);

                // Update the local cache to associate the created review IDs with the associated content.
                var reviewIds = reviewResponse.Result.Body;
                for (int i = 0; i < reviewIds.Count; i++)
                {
                    reviewItems[i].ReviewId = reviewIds[i];
                }

                WriteLine(outputWriter, JsonConvert.SerializeObject(reviewIds, Formatting.Indented));
                Thread.Sleep(throttleRate);

                // Get details of the reviews created that were sent to the Content Moderator website.
                WriteLine(outputWriter, null, true);
                WriteLine(outputWriter, "Getting review details:", true);
                foreach (var item in reviewItems)
                {
                    var reviewDetail = client.Reviews.GetReviewWithHttpMessagesAsync(teamName, item.ReviewId);
                    WriteLine(outputWriter, $"Review {item.ReviewId} for item ID {item.ContentId} is " +
                              $"{reviewDetail.Result.Body.Status}.", true);
                    WriteLine(outputWriter, JsonConvert.SerializeObject(reviewDetail.Result.Body, Formatting.Indented));
                    Thread.Sleep(throttleRate);
                }

                Console.WriteLine();
                Console.WriteLine("Perform manual reviews on the Content Moderator site.");
                Console.WriteLine("Then, press any key to continue.");
                Console.ReadKey();

                // After the human reviews, the results are confirmed.
                Console.WriteLine();
                Console.WriteLine($"Waiting {latencyDelay} seconds for results to propagate.");
                Thread.Sleep(latencyDelay * 1000);

                // Get details from the human review.
                WriteLine(writer, null, true);
                WriteLine(writer, "Getting review details:", true);
                foreach (var item in reviewItems)
                {
                    var reviewDetail = client.Reviews.GetReviewWithHttpMessagesAsync(teamName, item.ReviewId);
                    WriteLine(writer, $"Review {item.ReviewId} for item ID {item.ContentId} is " + $"{reviewDetail.Result.Body.Status}.", true);
                    WriteLine(outputWriter, JsonConvert.SerializeObject(reviewDetail.Result.Body, Formatting.Indented));

                    Thread.Sleep(throttleRate);
                }

                Console.WriteLine();
                Console.WriteLine("Check the OutputLog.txt file for results of the review.");

                writer = null;
                outputWriter.Flush();
                outputWriter.Close();
            }
            Console.WriteLine("--------------------------------------------------------------");
        }
コード例 #24
0
 public void when_is_the_next_review_due()
 {
     var item = new ReviewItem
     {
         DifficultyRating = 12,
         ReviewDate = new DateTime(2013, 09, 18),
         CorrectReviewStreak = 8,
     };
     var strategy = new SuperMemo2ReviewStrategy();
     
     Debug.WriteLine(strategy.NextReview(item));
 }