Esempio n. 1
0
 public ReviewData Add(ReviewData review)
 {
     review.createdDate = DateTime.UtcNow;
     review.lastModified = DateTime.UtcNow;
     //review = CopyFromReviewableToNew(review);
     //ReviewData newR = CopyFromModelToData(review);
     Guid newId = Guid.NewGuid();
     review.id = newId;
     _reviewRepository.Collection.Insert(review);
     _rr.UpdateStatistics(review.parentReviewableId);
     return Get(newId);
 }
Esempio n. 2
0
        private Review PopulateData(ReviewData reviewData)
        {
            //retreive the matching parent reviewableData
            ReviewableData reviewableData = _reviewableRepository.Get(reviewData.parentReviewableId, Guid.Empty);

            //populate parent reviewable data
            //Review review = AutoMapper.Mapper.Map<ReviewableData, Review>(reviewableData);
            //populate review data
            //review = AutoMapper.Mapper.Map<ReviewData, Review>(reviewData);

            Review review = AutoMapper.Mapper.Map<ReviewData, Review>(reviewData);
            AutoMapper.Mapper.Map(reviewableData, review, typeof(ReviewableData), typeof(Review));
            //populate images from parent reviewable
            //review = CopyImagesFromDomainToUI(reviewableData, review);

            return review;
        }
Esempio n. 3
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            SqlConnection conn = null;
            SqlDataReader dr = null;

            try
            {
                ReviewRepository pr = new ReviewRepository();
                ReviewableRepository rr = new ReviewableRepository();
                UserRepository ur = new UserRepository();

                conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DataServices"].ConnectionString);
                conn.Open();

                SqlCommand cmd = new SqlCommand("SELECT * from vCurrentProductReviews", conn);

                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    ReviewData prod = new ReviewData();
                    //prod.name = dr.GetString(4);
                    //if (dr.GetValue(5) != DBNull.Value)
                    //    prod.description = dr.GetString(5);
                    if (dr.GetValue(6) != DBNull.Value)
                        prod.createdDate = dr.GetDateTime(6);
                    if (dr.GetValue(7) != DBNull.Value)
                        prod.lastModified = dr.GetDateTime(7);
                    if (dr.GetValue(8) != DBNull.Value)
                        prod.text = dr.GetString(8);
                    if (dr.GetValue(9) != DBNull.Value)
                        prod.rating = dr.GetDouble(9);
                    if (dr.GetValue(10) != DBNull.Value)
                    {
                        prod.userName = dr.GetString(10);
                        prod.user = ur.GetByName(prod.userName).id;
                    }
                    if (dr.GetValue(14) != DBNull.Value)
                        prod.fBFeedPostId = dr.GetString(14);
                    if (dr.GetValue(15) != DBNull.Value)
                        prod.fBTimelinePostId = dr.GetString(15);

                    if (dr.GetValue(4) != DBNull.Value)
                    {
                        ReviewableData x = rr.GetByName(dr.GetString(4), Guid.Empty).First();
                        prod.parentReviewableId = x.id;
                        prod.parentName = x.name;

                        //prod.outsideCode = x.outsideCode;
                        //prod.outsideCodeType = x.outsideCodeType;
                        //prod.issuerCountryCode = x.issuerCountryCode;
                        //prod.issuerCountry = x.issuerCountry;
                        //prod.providedByBizId = x.parentReviewableId;
                        //prod.providedByBizName = x.parentName;

                    }
                    prod.reviewableType = "product";

                    pr.Add(prod);

                }
                dr.Close();
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
Esempio n. 4
0
        public ReviewData Update(ReviewData review)
        {
            //Guid newId = Guid.GenerateNewId();
            //review.lastModified = DateTime.UtcNow;
            //ReviewData newR = this.CopyFromModelToData(review);

            _reviewRepository.Collection.Save(review);
            _rr.UpdateStatistics(review.parentReviewableId);
            _rsr.Recalculate();

            return Get(review.id);
        }