Beispiel #1
0
        public void AddRate(UserRating rate)
        {
            CafeRates.Ratings.Add(rate);
            switch (rate.UserRate)
            {
            case Rate.one: CafeRates.CountsOfRates[1]++; break;

            case Rate.two: CafeRates.CountsOfRates[2]++; break;

            case Rate.three: CafeRates.CountsOfRates[3]++; break;

            case Rate.four: CafeRates.CountsOfRates[4]++; break;

            case Rate.five: CafeRates.CountsOfRates[5]++; break;
            }
        }
Beispiel #2
0
 //Rate
 public static void Rate(User currentUser, Cafe selectedBuilding, string rateLine)
 {
     if (selectedBuilding != null)
     {
         if (currentUser == null)
         {
             MessageBox.Show("Please log in");
             return;
         }
         if (rateLine[0] - '0' > 5 || rateLine[0] - '0' < 1)
         {
             MessageBox.Show("Your rate must be from 1 to 5.");
             return;
         }
         UserRating rate = new UserRating(currentUser, (Rate)(rateLine[0] - '0'), rateLine.Trim());
         selectedBuilding.AddRate(rate);
         return;
     }
     MessageBox.Show("There is no selected building.");
 }
Beispiel #3
0
 public virtual void AddRate(UserRating rate)
 {
 }