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;

namespace CommerceApp
{
	/// <summary>
	/// Summary description for WebForm1.
	/// </summary>
	public class WebForm1 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.TextBox ShopingID;
		protected System.Web.UI.WebControls.TextBox pwd;
		protected System.Web.UI.WebControls.TextBox Username;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Label Date;
		protected System.Web.UI.WebControls.Label Total;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected CommerceWS.InstantOrder InOrder;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{
			this.InOrder=new CommerceApp.CommerceWS.InstantOrder();
			try
			{
				CommerceWS.OrderDetails OD=this.InOrder.CheckStatus(this.Username.Text,this.pwd.Text,int.Parse(this.ShopingID.Text));
			
				this.Date.Text=OD.OrderDate.ToString();
				this.Total.Text =OD.OrderTotal.ToString();
				this.DataGrid1.DataSource=OD.OrderItems;
				this.DataGrid1.DataBind();
			}
			catch
			{
				this.Response.Redirect("http://localhost/CommerceCSVS/InstantOrder.asmx");
			}
		}
	}
}
