예제 #1
0
 void Application_End(object sender, EventArgs e)
 {
     //  Code that runs on application shutdown
     Application["visibility_flag"] = false;
     masterRef.Service1Client r = new masterRef.Service1Client();
     r.clearcart();
 }
예제 #2
0
        void Session_End(Object sender, EventArgs E)
        {
            Application["visibility_flag"] = false;

            masterRef.Service1Client r = new masterRef.Service1Client();
            r.clearcart();
        }
예제 #3
0
        protected void Button24_Click(object sender, EventArgs e)
        {
            masterRef.Service1Client r = new masterRef.Service1Client();
            r.clearcart();              // clearcart() function in the service is called

            string cart = r.getitems(); // Getting the list of items in the cart from the cart service

            if (cart.Equals("empty"))   // If the cart is empty
            {
                Label3.Text = "0";
                ListBox1.Items.Clear(); // Clear the contents of the cart listbox
            }

            else
            {
                ListBox1.Items.Clear();                                                 // Clear the listbox to update the cart
                string[] stringSeparators  = new string[] { "-----------1----------" }; // to split the cart into items
                string[] stringSeparators1 = new string[] { "\n" };

                string[] items = cart.Split(stringSeparators1, StringSplitOptions.RemoveEmptyEntries);


                // Current total value of cart is calculated here
                for (int i = 0; i < items.Length; i++)
                {
                    ListBox1.Items.Add(items[i]);
                }
                //Label3.Text = sum.ToString();           // total is displayed
            }
            Label22.Text = "0";
            //
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie myCookies = Request.Cookies["data"];

            Label1.Text = myCookies["username"];

            catalog.Visible    = (bool)Application["visibility_flag"];
            cart_block.Visible = (bool)Application["visibility_flag"];
            masterRef.Service1Client r = new masterRef.Service1Client();
            string cart = r.getitems(); // Getting the list of items in the cart from the cart service

            if (cart.Equals("empty"))   // If the cart is empty
            {
                Label22.Text = "0";
                ListBox1.Items.Clear(); // Clear the contents of the cart listbox
            }

            else
            {
                ListBox1.Items.Clear();                                                 // Clear the listbox to update the cart
                string[] stringSeparators  = new string[] { "-----------1----------" }; // to split the cart into items
                string[] stringSeparators1 = new string[] { "\n" };

                string[] items = cart.Split(stringSeparators1, StringSplitOptions.RemoveEmptyEntries);


                // Current total value of cart is calculated here
                for (int i = 0; i < items.Length; i++)
                {
                    ListBox1.Items.Add(items[i]);
                }
                //Label3.Text = sum.ToString();           // total is displayed
            }
        }
예제 #5
0
        void remove(string hotel, string price)
        {
            masterRef.Service1Client r = new masterRef.Service1Client();
            bool deletion = r.deletefromcart(hotel); // Deteting the "Hotel-1" entry from the cart

            string cart = r.getitems();              // Getting the list of items in the cart from the cart service

            if (cart.Equals("empty"))                // If the cart is empty
            {
                Label22.Text = "0";
                ListBox1.Items.Clear(); // Clear the contents of the cart listbox
            }

            else
            {
                ListBox1.Items.Clear();                                                 // Clear the listbox to update the cart
                string[] stringSeparators  = new string[] { "-----------1----------" }; // to split the cart into items
                string[] stringSeparators1 = new string[] { "\n" };

                string[] items = cart.Split(stringSeparators1, StringSplitOptions.RemoveEmptyEntries);


                // Current total value of cart is calculated here
                for (int i = 0; i < items.Length; i++)
                {
                    ListBox1.Items.Add(items[i]);
                }
                //Label3.Text = sum.ToString();           // total is displayed
            }
            if ((Convert.ToInt32(Label22.Text) > 0) && deletion)
            {
                Label22.Text = (Convert.ToInt32(Label22.Text) - Convert.ToInt32(price)).ToString();
            }
        }
예제 #6
0
        void add(string name, string price)
        {
            masterRef.Service1Client r = new masterRef.Service1Client();
            try
            {
                string result = r.addtocart(name, Convert.ToInt32(price));  // The arguments here can be dynamically generated in a real time application
            }
            catch (Exception ex) { Label22.Text = "in tryit" + ex.ToString(); }

            string cart = r.getitems(); // Getting the list of items in the cart from the cart service

            if (cart.Equals("empty"))   // If the cart is empty
            {
                Label22.Text = "0";
                ListBox1.Items.Clear(); // Clear the contents of the cart listbox
            }

            else
            {
                ListBox1.Items.Clear();                                                 // Clear the listbox to update the cart
                string[] stringSeparators  = new string[] { "-----------1----------" }; // to split the cart into items
                string[] stringSeparators1 = new string[] { "\n" };

                string[] items = cart.Split(stringSeparators1, StringSplitOptions.RemoveEmptyEntries);


                // Current total value of cart is calculated here
                for (int i = 0; i < items.Length; i++)
                {
                    ListBox1.Items.Add(items[i]);
                }
                //Label3.Text = sum.ToString();           // total is displayed
            }
            Label22.Text = (Convert.ToInt32(Label22.Text) + Convert.ToInt32(price)).ToString();
        }
예제 #7
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            ccref.ServiceClient cc       = new ccref.ServiceClient();
            ccref.CardVerifier  cvObject = new ccref.CardVerifier();

            cvObject = cc.CreditCardVerification(TextBox1.Text);
            //if (cvObject.Validity == true)
            //{

            Random rnd     = new Random();
            int    orderID = rnd.Next(1, 1000);
            string email   = TextBox4.Text;
            string address = TextArea1.InnerText;


            XmlDocument reg_n     = new XmlDocument();
            String      file_Loc  = AppDomain.CurrentDomain.BaseDirectory + "//";
            String      file_name = "Orders.xml";

            if (!System.IO.File.Exists(file_Loc + file_name))
            {
                using (XmlWriter writer = XmlWriter.Create(@file_Loc + file_name))
                {
                    XmlDeclaration declaration = reg_n.CreateXmlDeclaration("1.0", "UTF-8", "yes");

                    writer.WriteStartDocument();
                    writer.WriteStartElement("orders");

                    writer.WriteStartElement("order");
                    writer.WriteElementString("orderID", orderID.ToString());
                    writer.WriteElementString("email", email);
                    writer.WriteElementString("address", address);
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                    member_home.masterRef.Service1Client r = new masterRef.Service1Client();
                    r.clearcart();
                    Label3.Text = "Order succesfully placed!";
                    Response.Redirect("ordersuccess.html");
                }
            }
            else
            {
                reg_n.Load(file_Loc + file_name);
                // XmlElement root = reg.DocumentElement;
                XmlElement order = reg_n.CreateElement("order");
                XmlElement id    = reg_n.CreateElement("orderID");
                id.InnerText = orderID.ToString();
                XmlElement email_element = reg_n.CreateElement("email");
                email_element.InnerText = email;
                XmlElement address_element = reg_n.CreateElement("address");
                address_element.InnerText = address;
                order.AppendChild(id);
                order.AppendChild(email_element);
                order.AppendChild(address_element);

                XmlNode rootElement = reg_n.SelectSingleNode("/orders");
                rootElement.AppendChild(order);
                reg_n.Save(file_Loc + file_name);
            }
            member_home.masterRef.Service1Client r1 = new masterRef.Service1Client();
            r1.clearcart();

            Label3.Text = "Order succesfully placed!";
            Response.Redirect("ordersuccess.html");



            //}
            //else
            //{

            //    Label3.Text = "Invalid card information. Please try again.";
            //}
        }