private static void SetUpReportDatabase()
        {
            PiecePart display    = new PiecePart("DS-1428", "LCD Display", 14.37);
            PiecePart speaker    = new PiecePart("SP-92", "Speaker", 3.50);
            PiecePart microphone = new PiecePart("MC-28", "Microphone", 5.30);
            PiecePart cellRadio  = new PiecePart("CR-56", "Cell Radio", 30);
            PiecePart frontCover = new PiecePart("FC-77", "Front Cover", 1.4);
            PiecePart backCover  = new PiecePart("RC-77", "RearCover", 1.2);

            Assembly  keypad        = new Assembly("KP-62", "Keypad");
            Assembly  button        = new Assembly("B52", "Button");
            PiecePart buttonCover   = new PiecePart("CV-15", "Cover", .5);
            PiecePart buttonContact = new PiecePart("CN-2", "Contact", 1.2);

            button.Add(buttonCover);
            button.Add(buttonContact);
            for (int i = 0; i < 15; i++)
            {
                keypad.Add(button);
            }

            cellphone = new Assembly("CP-7734", "Cell Phone");
            cellphone.Add(display);
            cellphone.Add(speaker);
            cellphone.Add(microphone);
            cellphone.Add(cellRadio);
            cellphone.Add(frontCover);
            cellphone.Add(backCover);
            cellphone.Add(keypad);
        }
Exemple #2
0
        public void Visit(PiecePart p)
        {
            pieceCount++;
            string partNumber = p.PartNumber;

            int partNumberCount = 0;

            if (pieceMap.ContainsKey(partNumber))
            {
                partNumberCount = (int)pieceMap[partNumber];
            }

            partNumberCount++;
            pieceMap[partNumber] = partNumberCount;
        }
        public static void Assembly()
        {
            Console.WriteLine("Assembly");
            SetUp();
            a.Add(p1);
            a.Add(p2);
            Console.WriteLine(2.Equals(a.Parts.Count).ToString());

            PiecePart p = a.Parts[0] as PiecePart;

            Console.WriteLine(p.Equals(p1).ToString());

            p = a.Parts[1] as PiecePart;
            Console.WriteLine(p.Equals(p2).ToString());
            Console.WriteLine("");
        }
 public void Visit(PiecePart p)
 {
     visitedParts.Add(p);
 }
 public static void SetUp()
 {
     p1 = new PiecePart("997624", "MyPart", 3.20);
     p2 = new PiecePart("7734", "Hell", 666);
     a  = new Assembly("5879", "MyAssembly");
 }
 public void Visit(PiecePart p)
 {
     cost += p.Cost;
 }