protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { DataTable dt = this.GetData("SELECT ISNULL(AVG(Rating), 0) AverageRating, COUNT(Rating) RatingCount FROM Booking where RoomId='" + Request.QueryString["RoomId"] + "'"); Rating1.CurrentRating = Convert.ToInt32(dt.Rows[0]["AverageRating"]); lblRatingStatus.Text = string.Format("{0} Users have rated. Average Rating {1}", dt.Rows[0]["RatingCount"], dt.Rows[0]["AverageRating"]); } hfStatus.Value = "Yes"; DataView dv = (DataView)SqlCounter.Select(new DataSourceSelectArguments()); if (dv.Count == 1) { String n = (String)dv[0][0]; Session.Add("RoomId", dv[0][1]); int m = int.Parse(n); m = m + 1; String c = Convert.ToString(m); hfCounter.Value = c; SqlCounter.Update(); } DataView dv1 = (DataView)SqlDisplayDetails1.Select(new DataSourceSelectArguments()); if (dv1.Count == 1) { String n = (String)dv1[0][0]; if (n.Equals("No")) { lbl.Text = "This Room is already Booked But it is not confirmed by the Landlord. If You want to Book this Room then Click on the 'BookMyRoom' button below and Go to Landlord and Confirm your Booking as early as possible."; } } }
protected void Page_Load(object sender, EventArgs e) { DataView dv3 = (DataView)SqlCheck.Select(new DataSourceSelectArguments()); if (dv3.Count == 1) { Response.Write("<script>alert('This Room is already booked by You')</script>"); Server.Transfer("SearchRoom.aspx"); } hfStatus.Value = "Yes"; DataView dv = (DataView)SqlCounter.Select(new DataSourceSelectArguments()); if (dv.Count == 1) { String n = (String)dv[0][0]; int m = int.Parse(n); m = m + 1; String c = Convert.ToString(m); hfCounter.Value = c; SqlCounter.Update(); } DataView dv1 = (DataView)SqlDisplayDetails1.Select(new DataSourceSelectArguments()); if (dv1.Count == 1) { String n = (String)dv1[0][0]; if (n.Equals("No")) { lbl.Text = "This Room is already Booked But it is not confirmed by the Landlord. If You want to Book this Room then Click on the 'BookMyRoom' button below and Go to Landlord and Confirm your Booking as early as possible."; } } }