// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_RESOURCES_HOTELS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_RESOURCES_HOTELS_EDIT"])) && Convert.ToBoolean(Session["sgLFS_RESOURCES_HOTELS_DELETE"])) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if ((string)Request.QueryString["source_page"] == null) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in hotels_navigator.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); // Prepare initial data Session.Remove("hotelsSetupTableDummy"); tdNoResults.Visible = false; // If coming from // ... Left Menu or select_project if (Request.QueryString["source_page"] == "out") { // Load hotelsSetupTDS = new HotelsSetupTDS(); HotelsSetupHotelsSetup model = new HotelsSetupHotelsSetup(hotelsSetupTDS); int companyId = Int32.Parse(hdfCompanyId.Value); model.LoadAll(companyId); // Check if there is data HotelsSetupHotelsSetup modelForMessage = new HotelsSetupHotelsSetup(hotelsSetupTDS); modelForMessage.Load(companyId); if (modelForMessage.Table.Rows.Count > 0) { tdNoResults.Visible = false; } else { tdNoResults.Visible = true; } // Store tables Session["hotelsSetupTDS"] = hotelsSetupTDS; Session["hotelsSetupTable"] = hotelsSetupTDS.HotelsSetup; } } else { // Restore datasets hotelsSetupTDS = (HotelsSetupTDS)Session["hotelsSetupTDS"]; Session["hotelsSetupTable"] = hotelsSetupTDS.HotelsSetup; } }