protected void btnAddReview_Click(object sender, EventArgs e) { UserFunctions uf = new UserFunctions(); if (txtReview.Text == "") { lblErrorMessage.Text = "Please say something about the restaurant."; } else { UserObject user = (UserObject)Session["User"]; string username = user.username; string RestaurantName = lblRestaurantName.Text; int RestID = uf.GetRestaurantID(rname, raddress); int qualityrating = int.Parse(ddlQualityRating.Text); int pricerating = 5; if (uf.AddNewReviewDB(username, RestID, txtReview.Text, pricerating, qualityrating) > 0) { uf.CalculateAverages(RestID); Response.Redirect("UserHome.aspx"); } else { lblErrorMessage.Text = "Error. Please try again."; } } }