//string updated = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie myCookies = Request.Cookies["details"];

            if (myCookies == null)
            {
                Response.Redirect("http://webstrar13.fulton.asu.edu/page0/Home.aspx");
            }
            else
            {
                Label1.Text = "Hello, " + myCookies["username"];
                ServiceReference1.CatalogService1Client client = new ServiceReference1.CatalogService1Client();
                city  = Request.QueryString["city"];
                carid = city + "car";

                result = client.GetHotelDeals(city);

                for (int i = 0; i < result.Count(); i++)
                {
                    string[] delim = result[i].Split(';');
                    string   res   = "<b> Package " + (i + 1).ToString() + "</b> <br> <br>" + "<b> Night Duration: </b>" + delim[0] + "<br>" +
                                     "<b> Start Date: </b>" + delim[1] + "<br>" +
                                     "<b> End Date: </b>" + delim[2] + "<br>" +
                                     "<b> Description: </b>" + delim[3] + "<br>" +
                                     "<b> Price per night: </b>" + delim[4] + "<br>" +
                                     "<b> City: </b>" + delim[5];

                    TableRow trow = new TableRow();
                    trow.BorderStyle = BorderStyle.Solid;
                    Table1.Rows.Add(trow);

                    TableCell tcell1 = new TableCell();
                    tcell1.BorderStyle = BorderStyle.Solid;
                    tcell1.Text        = res;
                    trow.Cells.Add(tcell1);

                    Button b = new Button();
                    b.Text   = "Add To Cart";
                    b.ID     = "Button" + i.ToString();
                    b.Click += new EventHandler(Button_Click);
                    TableCell tcell2 = new TableCell();
                    tcell2.BorderStyle = BorderStyle.Solid;
                    tcell2.Controls.Add(b);
                    tcell2.HorizontalAlign = HorizontalAlign.Center;
                    tcell2.VerticalAlign   = VerticalAlign.Middle;
                    trow.Cells.Add(tcell2);
                }

                int j     = 1;
                int count = 0;
                if (Session.Count != 0)
                {
                    while (j <= 10 && count <= Session.Count)
                    {
                        if (Session[city + j.ToString()] != null)
                        {
                            order = (orderItem)Session[city + j.ToString()];
                            viewcart1.updatecart(order._Name, order._ProductId, order._Price);
                            count++;
                        }
                        j++;
                    }

                    j = 1;

                    while (j <= 10 && count <= Session.Count)
                    {
                        if (Session[carid + j.ToString()] != null)
                        {
                            order = (orderItem)Session[carid + j.ToString()];
                            viewcart1.updatecart(order._Name, order._ProductId, order._Price);
                            count++;
                        }
                        j++;
                    }
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie myCookies = Request.Cookies["details"];

            if (myCookies == null)
            {
                Response.Redirect("http://webstrar13.fulton.asu.edu/page0/Home.aspx");
            }
            else
            {
                Label1.Text = "Hello, " + myCookies["username"];
                city        = Request.QueryString["city"];
                carid       = city + "car";
                String start = Request.QueryString["start"];
                String end   = Request.QueryString["end"];
                String pick  = Request.QueryString["pick"];
                String drop  = Request.QueryString["drop"];

                ServiceReference1.CatalogService1Client client = new ServiceReference1.CatalogService1Client();

                result = client.GetCarDeals(city, start, end, pick, drop);

                for (int i = 0; (i < 11) || (i < result.Count()); i++)
                {
                    string[] delim = result[i].Split(';');
                    string   res   = "<b> Deal " + (i + 1).ToString() + "</b> <br> <br>" + "<b> Car Type Code: </b>" + delim[0] + "<br>" +
                                     "<b> Daily Rate: </b>" + delim[1] + "<br>" +
                                     "<b> Pick Up Code: </b>" + delim[2] + "<br>" +
                                     "<b> Rental Days: </b>" + delim[3] + "<br>" +
                                     "<b> Sub Total: </b>" + delim[5] + "<br>" +
                                     "<b> Taxes and Fares: </b>" + delim[6] + "<br>" +
                                     "<b> Total Price: </b>" + delim[7];

                    TableRow trow = new TableRow();
                    trow.BorderStyle = BorderStyle.Solid;
                    Table1.Rows.Add(trow);

                    TableCell tcell1 = new TableCell();
                    tcell1.BorderStyle = BorderStyle.Solid;
                    tcell1.Text        = res;
                    trow.Cells.Add(tcell1);

                    Button b = new Button();
                    b.Text   = "Add To Cart";
                    b.ID     = "But" + i.ToString();
                    b.Click += new EventHandler(Button_Click);
                    TableCell tcell2 = new TableCell();
                    tcell2.BorderStyle = BorderStyle.Solid;
                    tcell2.Controls.Add(b);
                    tcell2.HorizontalAlign = HorizontalAlign.Center;
                    tcell2.VerticalAlign   = VerticalAlign.Middle;
                    trow.Cells.Add(tcell2);
                }

                int j     = 1;
                int count = 0;
                if (Session.Count != 0)
                {
                    while (j <= 10 && count <= Session.Count)
                    {
                        if (Session[city + j.ToString()] != null)
                        {
                            order = (orderItem)Session[city + j.ToString()];
                            viewcart1.updatecart(order._Name, order._ProductId, order._Price);
                            count++;
                        }
                        j++;
                    }

                    j = 1;

                    while (j <= 10 && count <= Session.Count)
                    {
                        if (Session[carid + j.ToString()] != null)
                        {
                            order = (orderItem)Session[carid + j.ToString()];
                            viewcart1.updatecart(order._Name, order._ProductId, order._Price);
                            count++;
                        }
                        j++;
                    }
                }
            }
        }