Ejemplo n.º 1
0
        public Guitar getGuitar(string serialNumber)
        {
            for (int i = 0; i < this.guitars.Count; i++)
            {
                Guitar guitar = this.guitars[i];

                if (guitar.getSerialNumber().Equals(serialNumber))
                {
                    return(guitar);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        private void btnFindGuitar_Click(object sender, EventArgs e) {
            Inventory inventory = new Inventory();

            initialInventory(inventory);

            Guitar myGuitarLikes = new Guitar(null, 0.0, "gibson", null, null, null, null);

            Guitar guitar = inventory.search(myGuitarLikes);

            if (guitar != null) {
                displayGuitarInfo(guitar);
            } else {
                displaySorryMessage(myGuitarLikes);
            }
        }
Ejemplo n.º 3
0
        public Guitar search(Guitar searchGuitar) {
            for (int i = 0; i < this.guitars.Count; i++) {
                Guitar guitar = this.guitars[i];

                string builder = searchGuitar.getBuilder();
                if ((builder != null) && (!builder.Equals("")) && (!builder.Equals(guitar.getBuilder()))) {
                    continue;
                }

                // TODO : compare each property of the guitar

                return guitar;
            }

            return null;
        }
Ejemplo n.º 4
0
        public Guitar search(Guitar searchGuitar)
        {
            for (int i = 0; i < this.guitars.Count; i++)
            {
                Guitar guitar = this.guitars[i];

                string builder = searchGuitar.getBuilder();
                if ((builder != null) && (!builder.Equals("")) && (!builder.Equals(guitar.getBuilder())))
                {
                    continue;
                }

                // TODO : compare each property of the guitar

                return(guitar);
            }

            return(null);
        }
Ejemplo n.º 5
0
        private void btnFindGuitar_Click(object sender, EventArgs e)
        {
            Inventory inventory = new Inventory();

            initialInventory(inventory);

            Guitar myGuitarLikes = new Guitar(null, 0.0, "gibson", null, null, null, null);

            Guitar guitar = inventory.search(myGuitarLikes);

            if (guitar != null)
            {
                displayGuitarInfo(guitar);
            }
            else
            {
                displaySorryMessage(myGuitarLikes);
            }
        }
Ejemplo n.º 6
0
        public void addGuitar(string serialNumber, double price, string builder, string model, string type, string backWood, string topWood)
        {
            Guitar guitar = new Guitar(serialNumber, price, builder, model, type, backWood, topWood);

            this.guitars.Add(guitar);
        }
Ejemplo n.º 7
0
 private void displaySorryMessage(Guitar guitar) {
     string sorryMsg = String.Format("Not found guitar build from {0}.", guitar.getBuilder());
     MessageBox.Show(sorryMsg);
 }
Ejemplo n.º 8
0
 private void displayGuitarInfo(Guitar guitar) {
     string infoMsg = String.Format("Found guitar.\n\nSerialNo. {0}\nPrice {1}", guitar.getSerialNumber(), guitar.getPrice());
     MessageBox.Show(infoMsg);
 }
Ejemplo n.º 9
0
        private void displaySorryMessage(Guitar guitar)
        {
            string sorryMsg = String.Format("Not found guitar build from {0}.", guitar.getBuilder());

            MessageBox.Show(sorryMsg);
        }
Ejemplo n.º 10
0
        private void displayGuitarInfo(Guitar guitar)
        {
            string infoMsg = String.Format("Found guitar.\n\nSerialNo. {0}\nPrice {1}", guitar.getSerialNumber(), guitar.getPrice());

            MessageBox.Show(infoMsg);
        }
Ejemplo n.º 11
0
 public void addGuitar(string serialNumber, double price, string builder, string model, string type, string backWood, string topWood) {
     Guitar guitar = new Guitar(serialNumber, price, builder, model, type, backWood, topWood);
     this.guitars.Add(guitar);
 }