protected void btnOfferHistory_Click(object sender, EventArgs e) { int aid; if (int.TryParse(Request.QueryString["aid"], out aid)) { TravelAgencyService service = new TravelAgencyService(); using (service.ToDisposable()) { int?offerId = service.GetOfferHistoryIdByAttractionId(aid); if (offerId.HasValue) { Response.Redirect(String.Format("/Logged/OfferHistoryDetails?oid={0}", offerId.Value)); } } } }