using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.OleDb; namespace Reservation { /// /// Display Application details (location). /// Method modified: Page_Load. ///

Copyright (c) 2002 Alexis Grandemange
/// Mail: alexis.grandemange@pagebox.net

///
This program is free software; you can redistribute it and/or
	/// modify it under the terms of the GNU Lesser General Public
	/// License as published by the Free Software Foundation; version
	/// 2.1 of the License.
	/// This library is distributed in the hope that it will be useful,
	/// but WITHOUT ANY WARRANTY; without even the implied warranty of
	/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	/// GNU Lesser General Public License for more details.
	/// A copy of the GNU Lesser General Public License lesser.txt should be
	/// included in the distribution.
///
public class ApplicationDetails : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox tbAddress; protected System.Web.UI.WebControls.TextBox tbCity; protected System.Web.UI.WebControls.TextBox tbState; protected System.Web.UI.WebControls.TextBox tbZip; protected System.Web.UI.WebControls.TextBox tbCountry; protected System.Web.UI.WebControls.TextBox tbRegion; protected System.Web.UI.WebControls.TextBox tbLatitude; protected System.Web.UI.WebControls.Label lblStatus; protected System.Web.UI.WebControls.HyperLink hlurl; protected System.Web.UI.WebControls.HyperLink hlUrl; protected System.Web.UI.WebControls.TextBox tbLongitude; public ApplicationDetails() { Page.Init += new System.EventHandler(Page_Init); } /// /// Restores details from the applications table. /// private void Page_Load(object sender, System.EventArgs e) { string id = (string)Context.Session["userid"]; if (id == null) { Context.Session.Add("from", "ApplicationDetails.aspx"); Context.Response.Redirect("Login.aspx"); return; } short type = (short)Context.Session["type"]; if (type > 1) { Context.Session.Add("status", "Log-in with a customer or proxy user id"); Context.Session.Add("from", "ApplicationDetails.aspx"); Context.Response.Redirect("Login.aspx"); return; } if (!IsPostBack) { string url = Request.QueryString["url"]; if (url.Length == 0) { lblStatus.Text = "Application URL not set"; return; } OleDbConnection odc = new OleDbConnection(Global.connectionString); odc.Open(); OleDbCommand odcmd = new OleDbCommand("select * from applications where url='" + url + "'", odc); OleDbDataReader odr = odcmd.ExecuteReader(); if (odr.Read()) { hlUrl.NavigateUrl = url.Replace("/Location.asmx", "/Book.aspx"); hlUrl.Text = hlUrl.NavigateUrl; tbAddress.Text = (string)odr["address"]; tbCity.Text = (string)odr["city"]; char[] blank = new char[] { ' ' }; string s = (string)odr["state"]; s = s.TrimEnd(blank); if (s.Length > 0) { if (Global.statePerCode.Contains(s)) tbState.Text = (string)Global.statePerCode[s]; else tbState.Text = (string)Global.provincePerCode[s]; } tbZip.Text = ((string)odr["zip"]).TrimEnd(blank); string c = (string)odr["country"]; tbCountry.Text = (string)Global.countryPerCode[c]; tbRegion.Text = (string)odr["region"]; tbLatitude.Text = ((string)odr["latitude"]).TrimEnd(blank); tbLongitude.Text = ((string)odr["longitude"]).TrimEnd(blank); string reg = tbRegion.Text.ToLower(); } odr.Close(); odc.Close(); } } private void Page_Init(object sender, EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); } #region Web Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }