Пример #1
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            // 'rest' is the rest to update.
            Restaurant rest = UpdateRest;

            // Check witch filed was changed.
            if (!restName.Text.Equals(""))
            {
                rest.Name = restName.Text;
            }
            if (!city.Equals(""))
            {
                rest.City = city;
            }
            if (!urltAdd.Text.Equals(""))
            {
                rest.URL = urltAdd.Text;
            }
            if (!price.Equals(""))
            {
                rest.PriceRange = price;
            }

            // Update in the DB the details that was changed.
            UpdateRest = rest;

            // Show the Restaurant Details view. (with the changes)
            IsEdit = false;
            RestaurantDetails rd = new RestaurantDetails(idRest);

            rd.Show();
            this.Close();
        }
Пример #2
0
        private void Go_Back_Click(object sender, RoutedEventArgs e)
        {
            // Go Back - show the Restaurant Details view. (without add the new review)
            RestaurantDetails restdetails = new RestaurantDetails(restID);

            restdetails.Show();
            this.Close();
        }
Пример #3
0
        private void Details_Click(object sender, RoutedEventArgs e)
        {
            //Restaurant showThisRestDetailes = c.getDetailsByID(restID);
            RestaurantDetails restD = new RestaurantDetails(restID);

            restD.Show();
            search.Close();
        }
Пример #4
0
        private void Go_Back_Click(object sender, RoutedEventArgs e)
        {
            // Go back - show the Restaurant Details view. (without changes)
            IsEdit = false;
            RestaurantDetails rd = new RestaurantDetails(idRest);

            rd.Show();
            this.Close();
        }
Пример #5
0
        private void Details_Click(object sender, RoutedEventArgs e)
        {
            // Show this 'restID' Rest Detailes view -
            // without add review & raiting, and with edit options.
            RestaurantDetails restD = new RestaurantDetails(restID);

            restD.Show();
            restow.Close();
        }
Пример #6
0
        private void Insert_Click(object sender, RoutedEventArgs e)
        {
            // Fill current date.
            string date = DateTime.Now.ToString("MM/dd/yyy");

            // Update visbility.
            if (!reviewText.Equals(""))
            {
                errorReview.Visibility = Visibility.Collapsed;
            }

            // Checks if all mandatory details have been entered.
            if (reviewText.Text.Equals("") || rating == 0)
            {
                string errorMessage = " You must enter ";
                if (reviewText.Text.Equals(""))
                {
                    errorReview.Visibility = Visibility.Visible;
                    errorMessage          += "review, ";
                }
                if (rating == 0)
                {
                    errorRate.Visibility = Visibility.Visible;
                    errorMessage        += "rating, ";
                }
                errorText.Visibility = Visibility.Visible;
                errorText.Text       = errorMessage;
            }
            else
            {
                // Insert to the DB the new review.
                MyNewReview = new UserReview(restID, reviewText.Text, date, rating);

                // Show the Restaurant Details view (with the new review).
                RestaurantDetails restdetails = new RestaurantDetails(restID);
                restdetails.Show();
                this.Close();
            }
        }