Exemplo n.º 1
0
        private async Task LoadIfUserRelated()
        {
            var reviews = await _reviewService.Get <List <Review> >(new ReviewSearchRequest()
            {
                UserId = UserRelatedReviews
            });

            foreach (var item in reviews)
            {
                var query = await _postService.Get <List <Post> >(new PostSearchRequest()
                {
                    ReviewRelatedId = item.ReviewId
                });

                var thisPost             = query.FirstOrDefault();
                ReviewPostHelperVM local = new ReviewPostHelperVM()
                {
                    ReviewId            = item.ReviewId,
                    FavouriteSongs      = item.FavouriteSongs,
                    LeastFavouriteSongs = item.LeastFavouriteSongs,
                    PostDateTime        = thisPost.PostDateTime,
                    PostId     = thisPost.PostId,
                    PostPhoto  = thisPost.PostPhoto,
                    Username   = thisPost.AdminName,
                    Rating     = "Rating: " + item.Rating.ToString() + "/5",
                    ReviewText = item.ReviewText
                };
                ReviewList.Add(local);
            }
        }
Exemplo n.º 2
0
        public void ReviewListJsonTest()
        {
            var ratingList1 = new ReviewList();

            ratingList1.Add(new Review(1, "Name1", "Description1", 2));
            ratingList1.Add(new Review(2, "Name2", "Description2", 3));
            ratingList1.Add(new Review(3, "Name3", "Description3", 4));

            var jsontext = CloneUtility.ToJson(ratingList1);

            Assert.IsFalse(string.IsNullOrEmpty(jsontext));

            var ratingList2 = CloneUtility.FromJson <ReviewList>(jsontext);

            Assert.AreNotSame(ratingList1, ratingList2);
            Assert.AreEqual(ratingList1.List.Count, ratingList2.List.Count);

            for (var index = 0; index < ratingList1.List.Count; index++)
            {
                Assert.AreEqual(ratingList1.List[index].Id, ratingList2.List[index].Id);
                Assert.AreEqual(ratingList1.List[index].Name, ratingList2.List[index].Name);
                Assert.AreEqual(ratingList1.List[index].Description, ratingList2.List[index].Description);
                Assert.AreEqual(ratingList1.List[index].Reviewrating, ratingList2.List[index].Reviewrating);
            }
        }
        // GET: Movies/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            IQueryable <int> movieReviewQuery = from m in _context.Movie
                                                orderby m.ID
                                                select m.ID;

            var movie = await _context.Movie
                        .SingleOrDefaultAsync(m => m.ID == id);

            var reviews = from m in _context.Reviews
                          select m;

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


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

            //return View(movie);

            var movieReviewVM = new ReviewList();

            movieReviewVM.movie   = movie;
            movieReviewVM.mReview = new SelectList(await movieReviewQuery.Distinct().ToListAsync());
            movieReviewVM.review  = await reviews.ToListAsync();

            ViewData["mID"] = movie.ID;

            return(View(movieReviewVM));
        }
Exemplo n.º 4
0
    void Awake()
    {
        //Load Coffin Parts
        var json = Resources.Load <TextAsset>("reviews").text;

        Reviews = JsonUtility.FromJson <ReviewList>(json);
    }
Exemplo n.º 5
0
        public void Update(ReviewList reviewList)
        {
            Guard.IsNotNull(reviewList, nameof(reviewList));
            Guard.IsNotNull(ReviewSummary, nameof(ReviewSummary));

            ReviewSummary.Reviews = new List <SDK.Models.Review>();
            foreach (Microsoft.Marketplace.Storefront.Contracts.V3.Review msReview in reviewList.Reviews)
            {
                SDK.Models.Review review = new()
                {
                    Title                = msReview.Title,
                    ReviewId             = msReview.ReviewId.ToString(),
                    IsRevised            = msReview.IsRevised,
                    Rating               = (int)msReview.Rating,
                    ReviewerName         = msReview.ReviewerName,
                    ReviewText           = msReview.ReviewText,
                    Locale               = msReview.Locale,
                    Market               = msReview.Market,
                    HelpfulNegative      = msReview.HelpfulNegative,
                    HelpfulPositive      = msReview.HelpfulPositive,
                    SubmittedDateTimeUtc = msReview.SubmittedDateTimeUtc,
                    UpdatedSinceResponse = msReview.UpdatedSinceResponse,
                };
                ReviewSummary.Reviews.Add(review);
            }
        }
Exemplo n.º 6
0
        // GET: Movies/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var movie = await _context.Movie
                        .SingleOrDefaultAsync(m => m.ID == id);

            if (movie == null)
            {
                return(NotFound());
            }
            var reviewList = new ReviewList();

            reviewList.movie = movie;
            var reviewContext = _context.Review.Include(r => r.Movie).Where(m => m.MovieID == id);
            var reviewsList   = await reviewContext.ToListAsync();

            reviewList.reviews = reviewsList;

            ViewData["movieID"] = movie.ID;
            return(View(reviewList));
        }
Exemplo n.º 7
0
        public void ReviewListAddandRemoveTest()
        {
            var ratingList = new ReviewList();

            Assert.AreEqual(ratingList.List.Count, 0);

            ratingList.Add(new Review(1, "Name1", "Description1", 2));

            Assert.AreEqual(ratingList.List.Count, 1);

            ratingList.Add(new Review(2, "Name2", "Description2", 3));

            Assert.AreEqual(ratingList.List.Count, 2);

            ratingList.Add(new Review(3, "Name3", "Description3", 4));

            Assert.AreEqual(ratingList.List.Count, 3);

            ratingList.Remove(1);

            Assert.AreEqual(ratingList.List.Count, 2);

            ratingList.Remove(3);

            Assert.AreEqual(ratingList.List.Count, 1);

            ratingList.Remove(2);

            Assert.AreEqual(ratingList.List.Count, 0);
        }
Exemplo n.º 8
0
        public void ReviewListDictionaryTest()
        {
            var ratingList1 = new ReviewList();

            ratingList1.Add(new Review(1, "Name1", "Description1", 2));
            ratingList1.Add(new Review(2, "Name2", "Description2", 3));
            ratingList1.Add(new Review(3, "Name3", "Description3", 4));

            var DictionaryList = ReviewList.ToDictionaryList(ratingList1);

            Assert.IsNotNull(DictionaryList);

            var ratingList2 = ReviewList.FromDictionaryList(DictionaryList);

            Assert.AreNotSame(ratingList1, ratingList2);
            Assert.AreEqual(ratingList1.List.Count, ratingList2.List.Count);

            for (var index = 0; index < ratingList1.List.Count; index++)
            {
                Assert.AreEqual(ratingList1.List[index].Id, ratingList2.List[index].Id);
                Assert.AreEqual(ratingList1.List[index].Name, ratingList2.List[index].Name);
                Assert.AreEqual(ratingList1.List[index].Description, ratingList2.List[index].Description);
                Assert.AreEqual(ratingList1.List[index].Reviewrating, ratingList2.List[index].Reviewrating);
            }
        }
Exemplo n.º 9
0
        public void ReviewListGetByIdTest()
        {
            var ratingList = new ReviewList();

            var guid1 = Guid.NewGuid();
            var guid2 = Guid.NewGuid();
            var guid3 = Guid.NewGuid();

            ratingList.Add(new Review(1, "Name1", "Description1", 2));
            ratingList.Add(new Review(2, "Name2", "Description2", 3));
            ratingList.Add(new Review(3, "Name3", "Description3", 4));

            var rating = ratingList.GetbyId(0);

            Assert.AreEqual(rating, null);

            rating = ratingList.GetbyId(-1);
            Assert.AreEqual(rating, null);

            rating = ratingList.GetbyId(1);
            Assert.AreEqual(rating.Name, "Name1");

            rating = ratingList.GetbyId(2);
            Assert.AreEqual(rating.Name, "Name2");

            rating = ratingList.GetbyId(3);
            Assert.AreEqual(rating.Name, "Name3");
        }
Exemplo n.º 10
0
        public void ReviewListConstructerTest()
        {
            var ratingList = new ReviewList();

            Assert.IsNotNull(ratingList);
            Assert.AreEqual(ratingList.List.Count, 0);
        }
        public Task Handle(CompanyReviewSearchRequest message, IMessageHandlerContext context)
        {
            //TODO: fix the next line
            string     url        = "http://35.192.218.206/Home/GetCompanyReview/";
            HttpClient httpClient = new HttpClient();

            try
            {
                string company = "{\"companyName\":\"" + message.companyName + "\"}";
                httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage wcfresponse = httpClient.GetAsync(url + company).GetAwaiter().GetResult();
                string test = wcfresponse.Content.ReadAsStringAsync().GetAwaiter().GetResult();

                ReviewList reviews = JsonConvert.DeserializeObject <ReviewList>(test);
                if (reviews.count <= 0)
                {
                    return(context.Reply(new CompanyReviewResponse(true, "Reviews for company name : " + message.companyName, reviews.allReviews)));
                }
            }
            catch (HttpRequestException)
            {
                //TODO: Error Message
            }
            catch (Exception) { }
            return(context.Reply(new CompanyReviewResponse(false, "FAILED to acomplish task with messageID: " + context.MessageId, null)));
        }
        private void UpdateReviews(ReviewDetailsDataModel review)
        {
            var index = ReviewList.IndexOf(review);

            ReviewList.Remove(review);
            ReviewList.Insert(index, review);
            //ReviewList = ReviewList;
        }
Exemplo n.º 13
0
        void GetReview()
        {
            ReviewList rvl = new ReviewList();

            rvl.GetByBookID(new Guid(Request.QueryString["BookID"]));
            rptReviews.DataSource = rvl.List;
            rptReviews.DataBind();
        }
Exemplo n.º 14
0
		public ReviewList GetReviews()
		{
			ReviewList val = null;

			string RequestUrl = string.Format(ReviewSearchRequest, SwarmUri, string.Empty);
			JSONParser.JSONDoc jDoc = HttpGet(RequestUrl);
			val = new ReviewList(jDoc);

			return val;
		}
Exemplo n.º 15
0
		public ReviewList GetReviews(Options options)
		{
			ReviewList val = null;

			string RequestUrl = string.Format(ReviewSearchRequest, SwarmUri, options.ToString());
			JSONParser.JSONDoc jDoc = HttpGet(RequestUrl);
			val = new ReviewList(jDoc);

			return val;
		}
        private void LoadData()
        {
            ReviewList = dataProvider.LoadData();

            var sortableList = ReviewList.OrderByDescending(r => r.Mean).ToList();

            ReviewList.Clear();
            for (int i = 0; i < sortableList.Count; i++)
            {
                ReviewList.Add(sortableList.ElementAt(i));
            }
        }
Exemplo n.º 17
0
        public void NotMapFromList()
        {
            var listReview = new ReviewList
            {
                Id          = Guid.NewGuid().ToString(),
                SubjectName = "Lorem of Ipsum",
                Score       = 6d
            };

            Action act = new Action(() => _mapper.Map <Review>(listReview));

            act.Should().Throw <Exception>(because: "no such mapping should be registered");
        }
Exemplo n.º 18
0
        public void ReviewListExistsTest()
        {
            var ratingList = new ReviewList();

            ratingList.Add(new Review(1, "Name1", "Description1", 2));
            ratingList.Add(new Review(2, "Name2", "Description2", 3));
            ratingList.Add(new Review(3, "Name3", "Description3", 4));

            Assert.IsFalse(ratingList.Exists(0));
            Assert.IsFalse(ratingList.Exists(-1));
            Assert.AreEqual(ratingList.Exists(1), true);
            Assert.AreEqual(ratingList.Exists(2), true);
            Assert.AreEqual(ratingList.Exists(3), true);
        }
Exemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = (User)Session["User"];
            ReviewList rl = new ReviewList();

            rl = rl.GetByUserID(user.ID);

            lblRegistered.Text = user.DateCreated.ToString();
            TimeSpan DateDiff   = (d1 - user.DateCreated);
            double   PostPerDay = user.UserBooks.Count / DateDiff.TotalDays;

            lblPostsMade.Text   = rl.Count + " (" + Math.Round(PostPerDay, 2) + " per day)";
            lblBooksPosted.Text = user.UserBooks.Count.ToString();
        }
        private void Filter()
        {
            foreach (var r in ReviewList)
            {
                r.Categories.First(c => c.CategoryName == "Food").Weight         = WeightFood;
                r.Categories.First(c => c.CategoryName == "Localization").Weight = WeightLocalization;
                r.Categories.First(c => c.CategoryName == "Music").Weight        = WeightMusic;
                r.Categories.First(c => c.CategoryName == "Prices").Weight       = WeightPrices;
            }
            var sortableList = ReviewList.OrderByDescending(r => r.Mean).ToList();

            ReviewList.Clear();
            for (int i = 0; i < sortableList.Count; i++)
            {
                ReviewList.Add(sortableList.ElementAt(i));
            }
        }
Exemplo n.º 21
0
 protected void rptReviews_Populate(Guid ID, bool bFilterByChapter)
 {
     //make a new ReviewList called rvwList
     ReviewList rvwList = new ReviewList();
     //if statement that will run if bFilterByChapter is equal to 'true'
     if (bFilterByChapter == true)
     {
         //get the reviewlist by chapter
         rvwList = rvwList.GetByChapterID(ID);
     }
     //else bFilterByChapter is equal to 'false'
     else
     {
         //get the reviewlist by story
         rvwList = rvwList.getByStoryID(ID);
     }
     //bind the list to the repeater
     rptReviews.DataSource = rvwList.List;
     rptReviews.DataBind();
 }
Exemplo n.º 22
0
        private void UpdateReviews(ReviewDetailsDataModel review)
        {
            try
            {
                var index = ReviewList.IndexOf(review);
                ReviewList.Remove(review);
                ReviewList.Insert(index, review);
                if (review.IsVisible)
                {
                    ShowDetailsIcon = _expandIcon;
                }
                else
                {
                    ShowDetailsIcon = _collapseIcon;
                }
            }catch (Exception e) {
            }

            //ReviewList = ReviewList;
        }
Exemplo n.º 23
0
 public async Task <IHttpActionResult> GetStoreReviews(int Store_Id)
 {
     try
     {
         DunkeyContext ctx         = new DunkeyContext();
         ReviewList    returnModel = new ReviewList();
         returnModel.Reviews = ctx.StoreRatings.Include(y => y.User).Where(x => x.Store_Id == Store_Id).ToList();
         CustomResponse <ReviewList> response = new CustomResponse <ReviewList>
         {
             Message    = "Success",
             StatusCode = (int)HttpStatusCode.OK,
             Result     = returnModel
         };
         return(Ok(response));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemplo n.º 24
0
        // GET: Movies
        public async Task <IActionResult> Index(string movieGenre, string searchString)
        {
            // Use LINQ to get list of genres.
            IQueryable <string> genreQuery = from m in _context.Movie
                                             orderby m.Genre
                                             select m.Genre;

            var movies = from m in _context.Movie
                         select m;

            var reviews = from m in _context.Reviews
                          select m;

            if (!String.IsNullOrEmpty(searchString))
            {
                movies = movies.Where(s => s.Title.Contains(searchString));
            }

            if (!String.IsNullOrEmpty(movieGenre))
            {
                movies = movies.Where(x => x.Genre == movieGenre);
            }

            var movieGenreVM = new MovieGenreViewModel();

            movieGenreVM.genres = new SelectList(await genreQuery.Distinct().ToListAsync());
            movieGenreVM.movies = await movies.ToListAsync();

            var movieReviewVM = new ReviewList();

            //movieReviewVM.movie = movie;
            movieReviewVM.mReview = new SelectList(await genreQuery.Distinct().ToListAsync());
            movieReviewVM.review  = await reviews.ToListAsync();

            var movieReviewModelVM = new MovieReview();

            movieReviewModelVM.MGenre  = movieGenreVM;
            movieReviewModelVM.MReview = movieReviewVM;

            return(View(movieReviewModelVM));
        }
Exemplo n.º 25
0
        public void ReviewListXmlCloneTest()
        {
            var ratingList1 = new ReviewList();

            ratingList1.Add(new Review(1, "Name1", "Description1", 2));
            ratingList1.Add(new Review(2, "Name2", "Description2", 3));
            ratingList1.Add(new Review(3, "Name3", "Description3", 4));

            var ratingList2 = CloneUtility.XmlClone(ratingList1, null);

            Assert.AreNotSame(ratingList1, ratingList2);
            Assert.AreEqual(ratingList1.List.Count, ratingList2.List.Count);

            for (var index = 0; index < ratingList1.List.Count; index++)
            {
                Assert.AreEqual(ratingList1.List[index].Id, ratingList2.List[index].Id);
                Assert.AreEqual(ratingList1.List[index].Name, ratingList2.List[index].Name);
                Assert.AreEqual(ratingList1.List[index].Description, ratingList2.List[index].Description);
                Assert.AreEqual(ratingList1.List[index].Reviewrating, ratingList2.List[index].Reviewrating);
            }
        }
Exemplo n.º 26
0
        private async Task LoadIfArtistRelated()
        {
            var albums = await _albumService.Get <List <Album> >(new AlbumSearchRequest()
            {
                ArtistId = ArtistRelatedReviews
            });

            foreach (var item in albums)
            {
                var reviews = await _reviewService.Get <List <Review> >(new ReviewSearchRequest()
                {
                    AlbumId = item.AlbumId
                });

                foreach (var x in reviews)
                {
                    var returnedPost = await _postService.Get <List <Post> >(new PostSearchRequest()
                    {
                        ReviewRelatedId = x.ReviewId
                    });

                    var thisPost             = returnedPost.FirstOrDefault();
                    ReviewPostHelperVM local = new ReviewPostHelperVM()
                    {
                        ReviewId            = x.ReviewId,
                        FavouriteSongs      = x.FavouriteSongs,
                        LeastFavouriteSongs = x.LeastFavouriteSongs,
                        PostDateTime        = thisPost.PostDateTime,
                        PostId     = thisPost.PostId,
                        Username   = thisPost.AdminName,
                        PostPhoto  = thisPost.PostPhoto,
                        Rating     = "Rating: " + x.Rating.ToString() + "/5",
                        ReviewText = x.ReviewText
                    };
                    ReviewList.Add(local);
                }
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// 리뷰 리스트 조회
        /// </summary>
        public void InitReviewList()
        {
            //로그인 예외처리
            //테스트 끝나면 풀것
            if (null == MainViewModel.LoginUser)
            {
                return;
            }

            DataSet dsResult = new DataSet();

            dsResult = callQuery.S_MA_USR_REV_LIST(MainViewModel.LoginUser.USER_NO);
            //dsResult = callQuery.S_MA_USR_REV_LIST("wildowl");

            if (0 == dsResult.Tables.Count)
            {
                return;
            }

            ReviewList.Clear();
            foreach (DataRow item in dsResult.Tables[0].Rows)
            {
                UdtMyListItem myItem = new UdtMyListItem();

                myItem.ContentID   = item["CONS_ID"].ToString();
                myItem.ContentName = item["CONS_NM"].ToString();

                System.Drawing.Image thumbImg = IMRUtils.TypeParser.ByteArrayToImage(Convert.FromBase64String(item["CONS_THUMB_PATH"].ToString()));
                myItem.ContentThumbnail = StaticUtils.ImageToImageSource(thumbImg);

                myItem.ContentType = item["CONS_TP"].ToString();
                myItem.EnterDtm    = item["REV_DTM"].ToString();
                myItem.Deleterable = System.Windows.Visibility.Collapsed;

                ReviewList.Add(myItem);
            }
        }
        // GET: Reviews
        //public async Task<IActionResult> Index()
        //{
        //    return View(await _context.Reviews.ToListAsync());
        //}

        public async Task <IActionResult> Index(string sortOrder)
        {
            ViewData["NameSortParm"]  = sortOrder == "Name" ? "name_desc" : "Name";
            ViewData["MovieSortParm"] = sortOrder == "Movie" ? "movie_desc" : "Movie";
            //ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            //ViewData["MovieSortParm"] = String.IsNullOrEmpty(sortOrder) ? "movie_desc" : "";
            var reviews = from s in _context.Reviews
                          select s;

            var movies = from m in _context.Movie
                         select m;

            foreach (var item in movies)
            {
                foreach (var r in reviews)
                {
                    if (item.ID == r.MovieID)
                    {
                        ViewData["mTitle"] = item.Title;
                        ViewData["mID"]    = r.MovieID;
                    }
                }
            }



            switch (sortOrder)
            {
            case "Name":
                reviews = reviews.OrderBy(s => s.Name);
                break;

            case "name_desc":
                reviews = reviews.OrderByDescending(s => s.Name);
                break;

            case "Movie":
                reviews = reviews.OrderBy(s => s.MovieID);
                break;

            case "movie_desc":
                reviews = reviews.OrderByDescending(s => s.MovieID);
                break;
                //default:
                //    reviews = reviews.OrderBy(s => s.Name);
                //    break;
            }

            var movieGenreVM = new MovieGenreViewModel();

            movieGenreVM.genres = new SelectList(await reviews.AsNoTracking().ToListAsync());
            movieGenreVM.movies = await movies.ToListAsync();

            var movieReviewVM = new ReviewList();

            //movieReviewVM.movie = movie;
            movieReviewVM.mReview = new SelectList(await reviews.AsNoTracking().ToListAsync());
            movieReviewVM.review  = await reviews.ToListAsync();

            var movieReviewModelVM = new MovieReview();

            movieReviewModelVM.MGenre  = movieGenreVM;
            movieReviewModelVM.MReview = movieReviewVM;

            return(View(movieReviewModelVM));

            //return View(await reviews.AsNoTracking().ToListAsync());
        }
Exemplo n.º 29
0
        protected void DeleteChapters(Guid storyID)
        {
            Guid stryID = new Guid(this.ddlStory.SelectedValue);

            ChapterList chapL = new ChapterList();
            chapL = chapL.GetByStoryID(stryID);
            for (int i = 0; i <= chapL.List.Count; i++)
            {
            }

            ReviewList rvwList = new ReviewList();
        }
Exemplo n.º 30
0
 // DELETE: api/Reviews/5
 public void Delete(int id)
 {
     ReviewList.DeleteReview(id);
 }
Exemplo n.º 31
0
 // PUT: api/Reviews/5
 public void Put(int id, Review value)
 {
     ReviewList.Update(id, value);
 }
Exemplo n.º 32
0
 // POST: api/Reviews
 public Review Post(Review value)
 {
     ReviewList.AddReview(value);
     return(ReviewList.GetAReview(value.ID));
 }