Beispiel #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);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Data processing.
        /// </summary>
        /// <exception cref="Exception">system exceptions </exception>
        public void DataProcesssing()
        {
            try
            {
                int caseCondition;
                ////this variable is used for checking the condition of do
                string         doCondition    = null;
                DataProcessing dataProcessing = new DataProcessing();
                do
                {
                    Console.WriteLine("enter 1 for adding customer");
                    Console.WriteLine("enter 2 for adding stock");
                    Console.WriteLine("enter 3 for buying stock");
                    Console.WriteLine("enter 4 for selling stock");
                    Console.WriteLine("enter 5 for view customers");
                    Console.WriteLine("enter 6 for view stock");
                    Console.WriteLine("enter 7 for view transaction");
                    Console.WriteLine("enter 8 for removing the stock ");
                    caseCondition = Convert.ToInt32(Console.ReadLine());
                    switch (caseCondition)
                    {
                    case 1:
                        ////this case is used for adding customer
                        CustomerData customerData = new CustomerData();
                        customerData.AddCustomer();
                        break;

                    case 2:
                        ////this case is used for adding the stock
                        StockData stockData = new StockData();
                        stockData.AddStock();
                        break;

                    case 3:
                        ////this case is used for buying the stock
                        Transaction transaction = new Transaction();
                        transaction.BuyStock();
                        break;

                    case 4:
                        ////this case is used for selling the stock
                        Transaction transaction1 = new Transaction();
                        transaction1.SellStock();
                        break;

                    case 5:
                        ////this case is used for getting the all customer data
                        dataProcessing.CustomerData();

                        break;

                    case 6:
                        ////this case is used for getting all the records
                        dataProcessing.StockData();

                        break;

                    case 7:
                        ////this case is used for getting all the Transactions
                        dataProcessing.TransactionData();

                        break;

                    case 8:
                        ////this case is used for removing the stock
                        RemovingStock removingStock = new RemovingStock();
                        removingStock.RemoveStock();
                        break;
                    }

                    Console.WriteLine("enter y to continue");
                    doCondition = Console.ReadLine();
                }while (doCondition.Equals("y"));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }