protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");

            int ID = (int)e.Keys["Id"];

            RestaurantServiceReference.Review review = new RestaurantServiceReference.Review();
            string feedback = (string)e.NewValues["feedback"];
            string rating   = (string)e.NewValues["rating"];
            string name     = (string)e.NewValues["name"];
            string id       = (string)e.NewValues["userId"];

            review.Id       = ID;
            review.Feedback = feedback;
            review.Rating   = int.Parse(rating);
            review.Name     = name;
            review.UserId   = int.Parse(id);


            bool status = client.UpdateReview(review);

            lblStatus.Text      = "Review Updated Successfully...";
            lblStatus.ForeColor = System.Drawing.Color.Green;

            GridView1.EditIndex = -1;
            BindData();
        }
Esempio n. 2
0
        protected void Btn_Add_Review_Click(object sender, EventArgs e)
        {
            try
            {
                RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService");
                RestaurantServiceReference.Review review = new RestaurantServiceReference.Review();

                int id = client.GetUserId(Session["username"].ToString());
                review.UserId   = id;
                review.Name     = DropDownList1.SelectedValue;
                review.Feedback = txtFeedback.Text;
                review.Rating   = int.Parse(txtRating.Text);

                client.AddReview(review);
                lblStauts.Text      = "Review Added Successfully";
                lblStauts.ForeColor = System.Drawing.Color.Green;
            }
            catch (Exception ex)
            {
                lblStauts.Text      = ex.Message.ToString();
                lblStauts.ForeColor = System.Drawing.Color.Red;
            }
        }