private async void btnSubmit_Click(object sender, RoutedEventArgs e) { //if (this.rating.Value == 0) //{ // await new MessageDialog(String.Format("please rate this {0}", ReviewTarget.ToString())).ShowAsync(); // return; //} this.SpinAndWait(true); this.UserReview.Reviewer = String.IsNullOrWhiteSpace(this.tbName.Text) ? "anonymous" : this.tbName.Text; this.UserReview.Review = this.tbReview.Text.Trim(); //this.UserReview.Rating = Convert.ToInt16(this.rating.Value); this.UserReview.ReviewTS = DateTime.Now; this.UserReview.UserId = ExtendedPropertyHelper.GetUserIdentifier(); Config.UserName = this.UserReview.Reviewer; if (ReviewTarget == ReviewTargetDef.Film) { FilmReview fr = (FilmReview)this.UserReview; fr.Movie = SelectedFilm.EDI; if (this.UserReview.Id != 0) { await App.MobileService.GetTable <FilmReview>().UpdateAsync(fr); } else { await App.MobileService.GetTable <FilmReview>().InsertAsync(fr); } } else { CinemaReview cr = (CinemaReview)this.UserReview; cr.Cinema = SelectedCinema.ID; if (this.UserReview.Id != 0) { await App.MobileService.GetTable <CinemaReview>().UpdateAsync(cr); } else { await App.MobileService.GetTable <CinemaReview>().InsertAsync(cr); } } this.SpinAndWait(false); (this.Parent as Flyout).Hide(); }
private async void LogMOLAd_Tap(object sender, System.Windows.Input.GestureEventArgs e) { try { BookingHistory bh = new BookingHistory(); bh.UserId = ExtendedPropertyHelper.GetUserIdentifier(); await App.MobileService.GetTable <BookingHistory>().InsertAsync(bh); Config.MolAdTapped = true; } catch { } }
private async void Page_Loaded(object sender, RoutedEventArgs e) { if (ReviewTarget == ReviewTargetDef.Film) { this.tbReviewing.Text = SelectedFilm.Title; List <FilmReview> filmreviews = await App.MobileService.GetTable <FilmReview>().Where(r => r.Movie == SelectedFilm.EDI && r.UserId == ExtendedPropertyHelper.GetUserIdentifier()).ToListAsync(); if (filmreviews != null && filmreviews.Count > 0) { this.UserReview = filmreviews[0]; } else { this.UserReview = new FilmReview() { Reviewer = Config.UserName } }; } else { this.tbReviewing.Text = String.Format("Cineworld - {0}", SelectedCinema.Name); List <CinemaReview> cinemareviews = await App.MobileService.GetTable <CinemaReview>().Where(r => r.Cinema == SelectedCinema.ID && r.UserId == ExtendedPropertyHelper.GetUserIdentifier()).ToListAsync(); if (cinemareviews != null && cinemareviews.Count > 0) { this.UserReview = cinemareviews[0]; } else { this.UserReview = new CinemaReview() { Reviewer = Config.UserName } }; } this.PopulateExistingReview(); } }