Esempio n. 1
0
        //public void ToArrayList()
        //{
        //    start:
        //    try
        //    {
        //        ArrayListCollection company = new ArrayListCollection();
        //        Console.WriteLine("*********************Welcome to ArrayList Page*************************");
        //        Console.WriteLine("Enter your choice\n1.Add\n2.View Details\n3.Check\n4.Remove\n5.Exit");
        //        int choice = int.Parse(Console.ReadLine());
        //        do
        //        {
        //            switch (choice)
        //            {
        //                case 1:
        //                    AddEmployees();
        //                    break;
        //                case 2:
        //                    company.DisplayEmployee();
        //                    break;
        //                case 3:
        //                    Console.WriteLine("Enter an Employee ID");
        //                    int employeeID = int.Parse(Console.ReadLine());
        //                    company.GetEmployee(employeeID);
        //                    break;
        //                case 4:
        //                    Console.WriteLine("Enter an Employee ID");
        //                    int employeeNumbers = int.Parse(Console.ReadLine());
        //                    company.toRemove(employeeNumbers);
        //                    break;
        //                case 5:
        //                    ToControl();
        //                    break;
        //            }
        //            Console.WriteLine("*********************Welcome to ArrayList Page*************************");
        //            Console.WriteLine("Enter your choice\n1.Add\n2.View Details\n3.Check\n4.Remove\n5.Exit");
        //            choice = int.Parse(Console.ReadLine());
        //        } while (choice != 6);
        //    }
        //    catch (Exception e)
        //    {
        //        Console.WriteLine(e.Message);
        //        FileLogger.Feed(e.Message);
        //        goto start;
        //    }
        //  }
        public void ToStack()
        {
start:
            try
            {
                StackFile stackCollection = new StackFile();
                Console.WriteLine("*********************Welcome to Stack Page*************************");
                Console.WriteLine("Enter your choice\n1.Add Details\n2.View Details\n3.Remove Last Value \n4.Show Last Value\n5.Exit");
                int option = int.Parse(Console.ReadLine());
                do
                {
                    switch (option)
                    {
                    case 1:
                        stackCollection.AddEmployees();
                        break;

                    case 2:
                        stackCollection.DisplayEmployee();
                        break;

                    case 3:
                        stackCollection.ToRemove();
                        break;

                    case 4:
                        stackCollection.ToPeek();
                        break;

                    case 5:
                        ToControl();
                        break;
                    }
                    Console.WriteLine("*********************Welcome to Stack Page*************************");
                    Console.WriteLine("Enter your choice\n1.Add Details\n2.View Details\n3.Remove Last Value \n4.Show Last Value\n5.Exit");
                    option = int.Parse(Console.ReadLine());
                } while (option != 6);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                FileLogger.Feed(e.Message);
                goto start;
            }
        }
Esempio n. 2
0
        public void ToControl()
        {
start:
            try
            {
                StackFile stackCollection = new StackFile();
                Console.WriteLine("*********************Welcome to Main Page*************************");
                Console.WriteLine("Enter your choice\n1.Stack\n2.Queue\n3.Hastable\n4.Sortedlist\n5.Exit");
                int select = int.Parse(Console.ReadLine());
                do
                {
                    switch (select)
                    {
                    case 1:
                        ToStack();
                        break;

                    case 2:
                        ToQueue();
                        break;

                    case 3:
                        ToHashtable();
                        break;

                    case 4:
                        ToHashtable();
                        break;

                    case 5:
                        ToHashtable();
                        break;
                    }
                    Console.WriteLine("*********************Welcome to Main Page*************************");
                    Console.WriteLine("Enter your choice\n1.Stack\n2.Queue\n3.Hastable\n4.Sortedlist\n5.Exit");
                    select = int.Parse(Console.ReadLine());
                } while (select != 6);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                FileLogger.Feed(e.Message);
                goto start;
            }
        }