Ejemplo n.º 1
0
        /// <summary>
        /// Describes user information, including inventory, funds and active request ID's description.
        /// </summary>
        public static void userRequestAction()
        {
            DAL.MarketClient m = new DAL.MarketClient();
            DAL.DataEntries.IMarketUserData info = new DAL.DataEntries.MarketUserData();
            bool flag = true;

            try
            {
                info = m.SendQueryUserRequest();
            }
            catch (AggregateException ax)
            {
                ServerCrashError();
                flag = false;
            }

            if (flag)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Dictionary <string, int> dic = info.getCommodities();
                Console.WriteLine("You have the following commodities:");

                for (int i = 0; i < dic.Count; i++)
                {
                    Console.WriteLine("* The amount of commodities with the Id of " + dic.Keys.ElementAt(i) + " is " + dic[dic.Keys.ElementAt(i)]);
                }
                Console.WriteLine("You have " + info.getFunds() + " funds.");
                List <int> requests = info.getRequests();
                Console.WriteLine("Your requests Id's are: ");
                for (int i = 0; i < requests.Count; i++)
                {
                    Console.Write(requests.ElementAt(i));
                    if (i < requests.Count - 1)
                    {
                        Console.Write(",");
                    }
                }
                Console.ResetColor();
            }
        }
Ejemplo n.º 2
0
        public static void userRequestAction()
        {
            DAL.MarketClient m = new DAL.MarketClient();
            DAL.DataEntries.IMarketUserData info = new DAL.DataEntries.MarketUserData();
            bool flag = true;

            try
            {
                info = m.SendQueryUserRequest();
            }
            catch (AggregateException ax)
            {
                Console.WriteLine("The server isn't working at the momment, please try again later");
                flag = false;
            }

            if (flag)
            {
                Dictionary <string, int> dic = info.getCommodities();
                Console.WriteLine("You have the following commodities: ");

                for (int i = 0; i < dic.Count; i++)
                {
                    Console.WriteLine("The amount of commodities with the Id " + dic.Keys.ElementAt(i) + " is " + dic[dic.Keys.ElementAt(i)]);
                }
                Console.WriteLine("you have " + info.getFunds() + " funds.");
                List <int> requests = info.getRequests();
                Console.WriteLine("Your requestes's id are: ");
                for (int i = 0; i < requests.Count; i++)
                {
                    Console.Write(requests.ElementAt(i));
                    if (i < requests.Count - 1)
                    {
                        Console.Write(",");
                    }
                }
            }
        }