Beispiel #1
0
        private void deletePrice_Edit_Click(object sender, EventArgs e)
        {
            if (list_Ticket.SelectedItem.ToString().Equals("Tablet"))
            {
                int select = 0;
                select = list_Ticket.SelectedIndex + 1;
                Tablet aux = (Tablet)order[select];
                aux.setLessPrice(20);
                order[list_Ticket.SelectedIndex] = aux;
                list_Ticket.Items.Insert(select + 1, aux.getAllTablet());
                list_Ticket.Items.RemoveAt(select);;
            }
            if (list_Ticket.SelectedItem.ToString().Equals("Ordenador"))
            {
                int select = 0;
                select = list_Ticket.SelectedIndex + 1;
                Computer aux = (Computer)order[select];
                aux.setLessPrice(20);
                order[list_Ticket.SelectedIndex] = aux;
                list_Ticket.Items.Insert(select + 1, aux.getAllComputer());
                list_Ticket.Items.RemoveAt(select);
            }

            if (list_Ticket.SelectedItem.ToString().Equals("Movil"))
            {
                int select = 0;
                select = list_Ticket.SelectedIndex + 1;
                Movile aux = (Movile)order[select];
                aux.setLessPrice(20);
                order[list_Ticket.SelectedIndex] = aux;
                list_Ticket.Items.Insert(select + 1, aux.getAllMovile());
                list_Ticket.Items.RemoveAt(select);
            }
        }
Beispiel #2
0
        //Add Button
        private void add_BtnOrder_Click(object sender, EventArgs e)
        {
            order.Add(" ");

            if (combo_Order.SelectedIndex == 0)
            {
                string   brand    = brand_Order.Text.ToString();
                string   name     = name_Order.Text.ToString();
                int      ram      = Int32.Parse(ram_Order.Text.ToString());
                int      price    = Int32.Parse(price_Order.Text.ToString());
                int      speed    = Int32.Parse(speed_Order.Text.ToString());
                int      port     = Int32.Parse(ports_Order.Text.ToString());
                Computer computer = new Computer("computer", brand, name, ram, price, speed, port);
                order.Add(computer);
                list_Ticket.Items.Add("Ordenador");
                list_Ticket.Items.Add(computer.getAllComputer());
            }
            if (combo_Order.SelectedIndex == 1)
            {
                string brand    = brand_Order.Text.ToString();
                string name     = name_Order.Text.ToString();
                int    ram      = Int32.Parse(ram_Order.Text.ToString());
                int    price    = Int32.Parse(price_Order.Text.ToString());
                int    resource = Int32.Parse(resolution_Order.Text.ToString());
                int    batery   = Int32.Parse(batery_Order.Text.ToString());
                Tablet tablet   = new Tablet("tablet", brand, name, ram, price, resource, batery);
                order.Add(tablet);
                list_Ticket.Items.Add("Tablet");
                list_Ticket.Items.Add(tablet.getAllTablet());
            }
            if (combo_Order.SelectedIndex == 2)
            {
                string brand  = brand_Order.Text.ToString();
                string name   = name_Order.Text.ToString();
                int    ram    = Int32.Parse(ram_Order.Text.ToString());
                int    price  = Int32.Parse(price_Order.Text.ToString());
                string os     = operativeSistem_Order.Text.ToString();
                int    batery = Int32.Parse(batery_Order.Text.ToString());
                int    memory = Int32.Parse(memory_Order.Text.ToString());
                Movile movile = new Movile("movile", brand, name, ram, price, os, batery, memory);
                order.Add(movile);
                list_Ticket.Items.Add("Movil");
                list_Ticket.Items.Add(movile.getAllMovile());
            }
        }