Esempio n. 1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            ////try block is use to execute the normal flow of the program execution
            try
            {
                char ch;
                int  choice = 0;
                do
                {
                    Console.WriteLine("Enter 1.To read data from json file");
                    Console.WriteLine("Enter 2.For Regular Expression Program");
                    Console.WriteLine("Enter 3.For stock Program");
                    Console.WriteLine("Enter 4.For InventoryManagement Program");
                    Console.WriteLine("Enter 5.For DeckOfCards Program");
                    Console.WriteLine("Enter 6.For Commercial Data processing Program");
                    Console.WriteLine("Enter 7.For Removing stock Program");
                    Console.WriteLine("Enter 8 For Address Book Program");
                    Console.WriteLine("Enter 9 For Card in sorted queuue Program");
                    Console.WriteLine("Enter 10 for transaction time in queue");
                    Console.WriteLine("Enter 11 for transaction details in stack");
                    try
                    {
                        choice = Convert.ToInt32(Console.ReadLine());
                    }
                    catch (SystemException e)
                    {
                        Console.WriteLine(e.Message);
                    }

                    switch (choice)
                    {
                    case 1:
                        InventoryModel.ReadJsonData();
                        break;

                    case 2:
                        RegularExpression regularExpression = new RegularExpression();
                        regularExpression.ReadData();
                        break;

                    case 3:
                        Stock stock = new Stock();
                        stock.ReadData();
                        break;

                    case 4:
                        InventoryOperations inventory = new InventoryOperations();
                        inventory.Manage();
                        break;

                    case 5:
                        DeckOfCard deckOfCard = new DeckOfCard();
                        deckOfCard.DeckCard();
                        break;

                    case 6:
                        DataProcessingMain dataProcessingMain = new DataProcessingMain();
                        dataProcessingMain.DataProcess();
                        break;

                    case 7:
                        RemovingStock removingStock = new RemovingStock();
                        removingStock.RemoveStock();
                        break;

                    case 8:
                        AddressBook addresBook = new AddressBook();
                        addresBook.AddressBookDetails();
                        break;

                    case 9:
                        CardQueue cardQueue = new CardQueue();
                        cardQueue.CardInQueue();
                        break;

                    case 10:
                        TransactionQueue transactionQueue = new TransactionQueue();
                        transactionQueue.TransactionDetails();
                        break;

                    case 11:
                        TransactionStack transactionStack = new TransactionStack();
                        transactionStack.StackTransaction();
                        break;

                    default:
                        Console.WriteLine("Enter valid data");
                        break;
                    }

                    Console.WriteLine("Do you want to continue(y/n)");
                    ch = Convert.ToChar(Console.ReadLine());
                }while (ch != 'n');
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            string condition     = null;
            int    caseCondition = 0;

            try
            {
                do
                {
                    Console.WriteLine("enter 1 for inventory details");
                    Console.WriteLine("enter 2 for regular expression");
                    Console.WriteLine("enter 3 for stock");
                    Console.WriteLine("enter 4 for inventory management");
                    Console.WriteLine("enter 5 for deck of cards");
                    Console.WriteLine("enter 6 for stock data processing");
                    Console.WriteLine("enter 7 for address book");
                    Console.WriteLine("enter 8 for deck of cards in queue");
                    Console.WriteLine("enter 9 for getting transaction in queue");
                    Console.WriteLine("enter 10 for getting transaction in stack");
                    try
                    {
                        caseCondition = Convert.ToInt32(Console.ReadLine());
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("enter proper condition");
                    }

                    switch (caseCondition)
                    {
                    case 1:
                        ////creating object of inventory class
                        Inventory inventory = new Inventory();
                        inventory.PrintData();
                        break;

                    case 2:
                        ////creating object of RegularExpression class
                        RegularExpression regularExpression = new RegularExpression();
                        regularExpression.ReplacingRegularExpressionWithString();
                        break;

                    case 3:
                        ////creating object of Stock class
                        Stock stock = new Stock();
                        stock.CreateStock();
                        break;

                    case 4:
                        ////creating object of InventoryManagement class
                        InventoryManagement inventoryManagement = new InventoryManagement();
                        inventoryManagement.Manage();
                        break;

                    case 5:
                        ////creating object of DeckOfCards class
                        DeckOfCards deckOfCards = new DeckOfCards();
                        deckOfCards.Distribution();
                        break;

                    case 6:
                        ////creating the object of DataProcessingMainClass class
                        DataProcessingMainClass dataProcessingMainClass = new DataProcessingMainClass();
                        dataProcessingMainClass.DataProcesssing();
                        break;

                    case 7:
                        ////creating the object of AddressBook class
                        AddressBook addressBook = new AddressBook();
                        addressBook.AddressBookDetails();
                        break;

                    case 8:
                        ////creating the object of CardQueue class
                        CardQueue cardQueue = new CardQueue();
                        cardQueue.CardInQueue();
                        break;

                    case 9:
                        ////creating the object of TransactionsInQueue class
                        TransactionsInQueue transaction = new TransactionsInQueue();
                        transaction.TransactionInQueue();
                        break;

                    case 10:
                        ////creating the object of TransactionStack class
                        TransactionStack transactionStack = new TransactionStack();
                        transactionStack.StackTransaction();
                        break;
                    }

                    Console.WriteLine("Enter Y to continue OR any key to stop");

                    condition = Console.ReadLine();
                }while (condition.Equals("y") || condition.Equals("Y"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
        }