Exemplo n.º 1
0
 public Classes.Review GetBusinessFriendReviews(String friendID)
 {
     if (newUser != null)
     {
         List <Classes.Review> reviewList = new List <Classes.Review>();
         query = new Dictionary <string, List <string> >();
         query.Add(sq.SQL_PROJECT, new List <string>()
         {
             sq.SQL_SELECT, c.R_date, c.R_reviewStars,
             c.R_text, c.R_funny, c.R_useful, c.R_cool, c.R_user
         });
         query.Add(sq.SQL_FROM, new List <string>()
         {
             sq.SQL_FROM, c.R_table
         });
         query.Add(sq.SQL_WHERE, new List <string>()
         {
             c.B_id, c.U_id
         });
         query.Add(sq.SQL_COND, new List <string>()
         {
             newBusiness.business_id, friendID
         });
         query.Add(sq.SQL_ORDER, new List <string>()
         {
             sq.SQL_ORDER, sq.SQL_DESC, c.R_date
         });
         List <Object[]> newObject = newQuery.SQLSelectQuery(query);
         foreach (Object[] review in newObject)
         {
             if (review != null)
             {
                 Classes.Review newReview = new Classes.Review()
                 {
                     review_date        = review[0].ToString(),
                     review_stars       = Int32.Parse(review[1].ToString()),
                     review_text        = review[2].ToString(),
                     funny_vote         = Int32.Parse(review[3].ToString()),
                     useful_vote        = Int32.Parse(review[4].ToString()),
                     cool_vote          = Int32.Parse(review[5].ToString()),
                     review_username    = GetUserDetails(review[6].ToString()).username,
                     actual_review_date = review[0].ToString()
                 };
                 return(newReview);
             }
         }
     }
     return(null);
 }
Exemplo n.º 2
0
        public List <Classes.Review> GetBusinessReviews(Classes.Business business)
        {
            List <Classes.Review> reviewList = new List <Classes.Review>();

            query = new Dictionary <string, List <string> >();
            query.Add(sq.SQL_PROJECT, new List <string>()
            {
                sq.SQL_SELECT, c.R_date, c.R_reviewStars,
                c.R_text, c.R_funny, c.R_useful, c.R_cool, c.R_user
            });
            query.Add(sq.SQL_FROM, new List <string>()
            {
                sq.SQL_FROM, c.R_table
            });
            query.Add(sq.SQL_WHERE, new List <string>()
            {
                c.B_id
            });
            query.Add(sq.SQL_COND, new List <string>()
            {
                business.business_id
            });
            query.Add(sq.SQL_ORDER, new List <string>()
            {
                sq.SQL_ORDER, sq.SQL_DESC, c.R_date
            });
            List <Object[]> newObject = newQuery.SQLSelectQuery(query);

            foreach (Object[] review in newObject)
            {
                Classes.Review newReview = new Classes.Review()
                {
                    review_date     = DateTime.Parse(review[0].ToString()).ToString("d"),
                    review_stars    = Int32.Parse(review[1].ToString()),
                    review_text     = review[2].ToString(),
                    funny_vote      = Int32.Parse(review[3].ToString()),
                    useful_vote     = Int32.Parse(review[4].ToString()),
                    cool_vote       = Int32.Parse(review[5].ToString()),
                    review_username = GetUserDetails(review[6].ToString()).username
                };
                reviewList.Add(newReview);
            }
            return(reviewList);
        }