Exemplo n.º 1
0
        //make an array of the items in the manager
        public PhoneInventory[] getItemArray()
        {
            int index = 0;

            PhoneInventory[] itemArr = new PhoneInventory[items.Count];
            foreach (PhoneInventory item in items)
            {
                PhoneInventory i = item;
                itemArr[index++] = i;
            }
            return(itemArr);
        }
Exemplo n.º 2
0
        //constructor
        public InvManager()
        {
            //initialize the attributes
            items = new List <PhoneInventory>( );

            //put some items in the manager for testing
            PhoneInventory item = new PhoneInventory("1", "s10", "65", "AT&T", "2", "300", "Samsung", "consumer");

            items.Add(item);
            item = new PhoneInventory("3", "q10", "32", "AT&T", "12", "200", "Blackberry", "consumer");
            items.Add(item);
            item = new PhoneInventory("2", "s6", "120", "AT&T", "5", "500", "Iphone", "consumer");
            items.Add(item);
        }
Exemplo n.º 3
0
        public PhoneInventory findByID(string id)
        {
            PhoneInventory result = null;

            for (int i = 0; i < items.Count(); i++)
            {
                //does this product have the same id as param id?
                if (items[i].prodId == id)
                {
                    result = items[i];
                }
            }

            return(result);
        }
Exemplo n.º 4
0
        private void addIterm_Click(object sender, EventArgs e)

        {
            try
            {
                string id       = idCounter.ToString();
                string Model    = sModel.Text;
                string capacity = memory.Text;
                string networks = network.Text;
                string Quantity = sQuantity.Text;
                //string dateTimePick = dataTimePicker.Value.Text;
                string Price     = sPrice.Text;
                string suppliers = supplier.Text;
                string buyers    = buyer.Text;


                PhoneInventory item = new PhoneInventory(id, Model, capacity, networks, Quantity, Price, suppliers, buyers);

                listOutPut.Items.Add(item.ToString());



                idCounter++;
            }
            catch
            {
            }

            sModel.Text    = "";
            memory.Text    = "";
            network.Text   = "";
            sQuantity.Text = "";
            sPrice.Text    = "";
            supplier.Text  = "";
            buyer.Text     = "";
        }
Exemplo n.º 5
0
 public void removeItem(PhoneInventory item)
 {
     items.Remove(item);
 }
Exemplo n.º 6
0
 //
 public void addItem(PhoneInventory item)
 {
     items.Add(item);
 }