示例#1
0
 public void ShowAllList(Perfume perfume)
 {
     Console.WriteLine("\nName of Perfume is " + perfume.name);
     Console.WriteLine("\nSerial_no of Perfume is " + perfume.serial_no);
     Console.WriteLine("\nVolume of Perfume is " + perfume.volume);
     Console.WriteLine("\nType of Perfume is " + perfume.type);
 }
示例#2
0
        public Perfume SearchList(string serial)
        {
            Perfume perfume1 = new Perfume();

            foreach (Perfume perfume in Utility.perfumeList)
            {
                if (perfume.serial_no == serial)
                {
                    perfume1 = perfume;
                }
            }
            return(perfume1);
        }
示例#3
0
        public void InsertInList()
        {
            Perfume perfume = new Perfume();

            Console.WriteLine("Enter name of Perfume");
            perfume.name = Console.ReadLine();

            Console.WriteLine("Enter serial Number");
            perfume.serial_no = Console.ReadLine();

            Console.WriteLine("Enter Volume of Perfume");
            perfume.volume = Console.ReadLine();

            Console.WriteLine("Enter type of Perfume");
            perfume.type = Console.ReadLine();

            Utility.perfumeList.Add(perfume);
        }
示例#4
0
        static void Main(string[] args)
        {
            Manager manager = new Manager();
            int     i;

            do
            {
                Console.WriteLine("Enter 1 to Insert Perfume  into List");
                Console.WriteLine("Enter 2 to ShowAll Perfumes ");
                Console.WriteLine("Enter 3 to Search Perfumes ");
                string c = Console.ReadLine();
                i = Convert.ToInt32(c);

                switch (i)
                {
                case 1:
                    //insertinList
                    manager.InsertInList();

                    break;

                case 2:
                    //showAll
                    foreach (Perfume p in Utility.perfumeList)
                    {
                        manager.ShowAllList(p);
                    }
                    break;

                case 3:
                    //searchinList
                    Console.WriteLine("Enter serial number to search");
                    string  serial   = Console.ReadLine();
                    Perfume perfume1 = manager.SearchList(serial);
                    manager.ShowAllList(perfume1);
                    Console.WriteLine("Press any key to continue");
                    Console.ReadKey();
                    break;
                }
            }while(i != 5);
        }