Ejemplo n.º 1
0
        /*            
         * Comments:
         * 
         * For run this code without errors, you should to create an Azure Redis Cache Service in Microsoft Azure, and get your
         * own ConnectionString and passwords for the server .
         * Once you have your Azure Redis Cache service, now you need to set the property "SSL Port " no enabled if you don't do
         * this action, you can't run the code correctly.
         * Don't forget to add the reference StackExchange.Redis from Nuget Package also.
         * More references: 
         * 
         * API:
         * https://github.com/StackExchange/StackExchange.Redis/blob/master/StackExchange.Redis/StackExchange/Redis/IDatabase.cs
         * 
         * One tool that you can use for monitoring your redis data base is: Redis Desktop Manager from:
         * http://redisdesktop.com/
         */

        static void Main(string[] args)
        {
            try
            {
                string Value = "", Key = "", Field="";
                int Operation = 0;

                RedisCache ServerAzureRedisCache = new RedisCache();

                do
                {
                    Console.Clear();

                    Console.WriteLine("* * * [ Azure Redis Cache Operations ] * * *");
                    Console.WriteLine();

                    Console.WriteLine(" 1) Save set.");
                    Console.WriteLine(" 2) See value of sets.");
                    Console.WriteLine(" 3) See all sets");
                    Console.WriteLine(" 4) Make an intersection");
                    Console.WriteLine(" 5) Make an union.");
                    Console.WriteLine(" 6) Make a difference.");
                    Console.WriteLine(" 0) Exit.");

                    Console.WriteLine();

                    Console.Write("Choose operation: ");
                    Operation = int.Parse(Console.ReadLine().Trim());
                    Console.WriteLine();

                    switch (Operation)
                    {
                        case 1:

                            /*
                             Code for save a hash
                             */

                            Console.Write("Write the key to the set: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write number of fields: ");
                            int Number_of_Fields = int.Parse(Console.ReadLine().Trim());

                            List<RedisObject> RedisObjectList = new List<RedisObject>();                           

                            for (int i = 0; i < Number_of_Fields; i++)
                            {
                                RedisObject RedisObjectItem = new RedisObject();

                                Console.Write("Value: ");
                                RedisObjectItem.Value = Console.ReadLine();

                                RedisObjectList.Add(RedisObjectItem);
                            }

                            long Result=ServerAzureRedisCache.SaveHash(Key, RedisObjectList);

                            if (Result>0)
                            {
                                Console.WriteLine("");
                                Console.WriteLine("The set was created" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("The set was not created" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;

                        case 2:

                            Console.Write("Write the key to the set: ");
                            Key = Console.ReadLine().Trim();

                            RedisObjectList = ServerAzureRedisCache.SeeValuesOfSet(Key);

                            if (RedisObjectList.Count()>0)
                            {
                                Console.WriteLine(Key);
                                Console.WriteLine("");

                                foreach (RedisObject RedisObjectFound in RedisObjectList)
                                    Console.WriteLine(RedisObjectFound.Value);

                                Console.WriteLine("");
                                Console.WriteLine("All values were shown" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("The set not exist" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;

                        case 3:

                            List<SetObject>SetObjectList = ServerAzureRedisCache.SeeAllSets();

                            foreach (SetObject SetObjectFound in SetObjectList)
                            {
                                Console.WriteLine(SetObjectFound.SetName);
                                Console.WriteLine("");

                                foreach (RedisObject RedisObjectFound in SetObjectFound.RedisObjectList)
                                    Console.WriteLine(RedisObjectFound.Value);

                                Console.WriteLine("");
                            }

                            Console.WriteLine("");
                            Console.WriteLine("All the sets were shown" + " [ Now press Enter ]");
                            Console.ReadLine();

                            break;

                        case 4:

                            Console.Write("Write the number of sets: ");
                            int Number_of_Sets = int.Parse(Console.ReadLine().Trim());

                            RedisKey[] RedisKeyArray = new RedisKey[Number_of_Sets];

                            for (int i = 0; i < Number_of_Sets; i++)
                            {
                                RedisKeyArray[i] = new RedisKey();

                                Console.Write("Write the key: ");
                                RedisKeyArray[i]=Console.ReadLine();
                            }

                            RedisObjectList = ServerAzureRedisCache.MakeIntersection(RedisKeyArray);

                            if (RedisObjectList.Count() > 0)
                            {
                                Console.WriteLine("");

                                foreach (RedisObject RedisObjectFound in RedisObjectList)
                                    Console.WriteLine(RedisObjectFound.Value);

                                Console.WriteLine("");
                                Console.WriteLine("The intersections were found" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Not exist intersections between keys" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;

                        case 5:

                            Console.Write("Write the number of sets: ");
                            Number_of_Sets = int.Parse(Console.ReadLine().Trim());

                            RedisKeyArray = new RedisKey[Number_of_Sets];

                            for (int i = 0; i < Number_of_Sets; i++)
                            {
                                RedisKeyArray[i] = new RedisKey();

                                Console.Write("Write the key: ");
                                RedisKeyArray[i]=Console.ReadLine();
                            }

                            RedisObjectList = ServerAzureRedisCache.MakeUnion(RedisKeyArray);

                            if (RedisObjectList.Count() > 0)
                            {
                                Console.WriteLine("");

                                foreach (RedisObject RedisObjectFound in RedisObjectList)
                                    Console.WriteLine(RedisObjectFound.Value);

                                Console.WriteLine("");
                                Console.WriteLine("That's the result of union. Name of set: " + RedisObjectList[0].Key + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Not exist intersections between keys" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;

                        case 6:

                            Console.Write("Write the number of sets: ");
                            Number_of_Sets = int.Parse(Console.ReadLine().Trim());

                            RedisKeyArray = new RedisKey[Number_of_Sets];

                            for (int i = 0; i < Number_of_Sets; i++)
                            {
                                RedisKeyArray[i] = new RedisKey();

                                Console.Write("Write the key: ");
                                RedisKeyArray[i]=Console.ReadLine();
                            }

                            RedisObjectList = ServerAzureRedisCache.MakeDifference(RedisKeyArray);

                            if (RedisObjectList.Count() > 0)
                            {
                                Console.WriteLine("");

                                foreach (RedisObject RedisObjectFound in RedisObjectList)
                                    Console.WriteLine(RedisObjectFound.Value);

                                Console.WriteLine("");
                                Console.WriteLine("The differences were found" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Not exist differences between keys" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }


                            break;

                    }
            
                } while (Operation!=0);
            }
            catch (Exception ex)
            {
                Console.Clear();
                Console.WriteLine("An error occurred. Detail: " + ex.Message + " [ Now press Enter ]");

                Console.Read();
            }
        }
Ejemplo n.º 2
0
        /*
         * Comments:
         *
         * For run this code without errors, you should to create an Azure Redis Cache Service in Microsoft Azure, and get your
         * own ConnectionString and passwords for the server .
         * Once you have your Azure Redis Cache service, now you need to set the property "SSL Port " no enabled if you don't do
         * this action, you can't run the code correctly.
         * Don't forget to add the reference StackExchange.Redis from Nuget Package also.
         * More references:
         *
         * API:
         * https://github.com/StackExchange/StackExchange.Redis/blob/master/StackExchange.Redis/StackExchange/Redis/IDatabase.cs
         *
         * One tool that you can use for monitoring your redis data base is: Redis Desktop Manager from:
         * http://redisdesktop.com/
         */
        static void Main(string[] args)
        {
            try
            {
                string Value = "", Key = "", Field="";
                int Operation = 0;

                RedisCache ServerAzureRedisCache = new RedisCache();

                do
                {
                    Console.Clear();

                    Console.WriteLine("* * * [ Azure Redis Cache Operations ] * * *");
                    Console.WriteLine();

                    Console.WriteLine(" 1) Set one bit.");
                    Console.WriteLine(" 2) Get status of one bit.");
                    Console.WriteLine(" 0) Exit.");

                    Console.WriteLine();

                    Console.Write("Choose operation: ");
                    Operation = int.Parse(Console.ReadLine().Trim());
                    Console.WriteLine();

                    switch (Operation)
                    {
                        case 1:

                            Console.Write("Write the key to the bit map: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write the value (1/0): ");
                            Value = Console.ReadLine().Trim();

                            if (ServerAzureRedisCache.SetBit(Key, Value) == true)
                            {
                                Console.WriteLine();
                                Console.WriteLine("The bit was marked. " + "[ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine();
                                Console.WriteLine("The bit was not marked. " + "[ Now press Enter ]");
                                Console.ReadLine();
                            }
                        break;

                        case 2:

                            Console.Write("Write the key to the bit map: ");
                            Key = Console.ReadLine().Trim();

                            if(ServerAzureRedisCache.GetBit(Key)==true)
                            {
                                Console.WriteLine();
                                Console.WriteLine("The bit has 1. " + "[ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine();
                                Console.WriteLine("The bit has 0 or not exist. " + "[ Now press Enter ]");
                                Console.ReadLine();
                            }

                        break;
                    }

                } while (Operation!=0);
            }
            catch (Exception ex)
            {
                Console.Clear();
                Console.WriteLine("An error occurred. Detail: " + ex.Message + " [ Now press Enter ]");

                Console.Read();
            }
        }
Ejemplo n.º 3
0
        /*            
         * Comments:
         * 
         * For run this code without errors, you should to create an Azure Redis Cache Service in Microsoft Azure, and get your
         * own ConnectionString and passwords for the server .
         * Once you have your Azure Redis Cache service, now you need to set the property "SSL Port " no enabled if you don't do
         * this action, you can't run the code correctly.
         * Don't forget to add the reference StackExchange.Redis from Nuget Package also.
         * More references: 
         * 
         * API:
         * https://github.com/StackExchange/StackExchange.Redis/blob/master/StackExchange.Redis/StackExchange/Redis/IDatabase.cs
         * 
         * One tool that you can use for monitoring your redis data base is: Redis Desktop Manager from:
         * http://redisdesktop.com/
         */

        static void Main(string[] args)
        {
            try
            {
                string Value = "", Key = "", Field="";
                int Operation = 0;

                RedisCache ServerAzureRedisCache = new RedisCache();

                do
                {
                    Console.Clear();

                    Console.WriteLine("* * * [ Azure Redis Cache Operations ] * * *");
                    Console.WriteLine();

                    Console.WriteLine(" 1) Save order set.");
                    Console.WriteLine(" 2) See order set.");
                    Console.WriteLine(" 3) See value of position in order set");
                    Console.WriteLine(" 0) Exit.");

                    Console.WriteLine();

                    Console.Write("Choose operation: ");
                    Operation = int.Parse(Console.ReadLine().Trim());
                    Console.WriteLine();

                    switch (Operation)
                    {
                        case 1:

                            /*
                             Code for save a hash
                             */

                            Console.Write("Write the key to the order set: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write the value: ");
                            Value = Console.ReadLine().Trim();

                            ServerAzureRedisCache.SaveOrderSet(Key, Value);

                            Console.WriteLine("");
                            Console.WriteLine("The order set was created" + " [ Now press Enter ]");
                            Console.ReadLine();

                            break;

                        case 2:

                            Console.Write("Write the key to see the order set: ");
                            Key = Console.ReadLine().Trim();

                            List<RedisObject> RedisObjectList = ServerAzureRedisCache.SeeOrderSets(Key);

                            if (RedisObjectList.Count() > 0)
                            {
                                Console.WriteLine("");

                                foreach (RedisObject RedisObjectFound in RedisObjectList)
                                    Console.WriteLine(RedisObjectFound.Value);

                                Console.WriteLine("");
                                Console.WriteLine("The order set list was shown" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Not exist the order set list" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;

                        case 3:

                            Console.Write("Write the key to the order set: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write the value: ");
                            Value = Console.ReadLine().Trim();

                            long Result = ServerAzureRedisCache.SeeValuePosition(Key, Value);

                            if (Result >= 0)
                            {
                                Console.WriteLine("");
                                Console.WriteLine("The position of value is: " + Result + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Not exist the value in the order set  "+ " [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;
                    }
            
                } while (Operation!=0);
            }
            catch (Exception ex)
            {
                Console.Clear();
                Console.WriteLine("An error occurred. Detail: " + ex.Message + " [ Now press Enter ]");

                Console.Read();
            }
        }
Ejemplo n.º 4
0
        /*            
         * Comments:
         * 
         * For run this code without errors, you should to create an Azure Redis Cache Service in Microsoft Azure, and get your
         * own ConnectionString and passwords for the server .
         * Once you have your Azure Redis Cache service, now you need to set the property "SSL Port " no enabled if you don't do
         * this action, you can't run the code correctly.
         * Don't forget to add the reference StackExchange.Redis from Nuget Package also.
         * More references: 
         * 
         * API:
         * https://github.com/StackExchange/StackExchange.Redis/blob/master/StackExchange.Redis/StackExchange/Redis/IDatabase.cs
         * 
         * One tool that you can use for monitoring your redis data base is: Redis Desktop Manager from:
         * http://redisdesktop.com/
         */

        static void Main(string[] args)
        {
            try
            {
                string Value = "", Key = "";
                int Operation = 0;

                RedisCache ServerAzureRedisCache = new RedisCache();

                do
                {
                    Console.Clear();

                    Console.WriteLine("* * * [ Azure Redis Cache Operations ] * * *");
                    Console.WriteLine();

                    Console.WriteLine(" 1) Insert data in a list (on the right).");
                    Console.WriteLine(" 2) Insert data in a list (on the left).");
                    Console.WriteLine(" 3) Remove data in a list (on the right).");
                    Console.WriteLine(" 4) Remove data in a list (on the left).");
                    Console.WriteLine(" 5) Know the size of list.");
                    Console.WriteLine(" 6) Show data in a list.");
                    Console.WriteLine(" 7) Cut list.");
                    Console.WriteLine(" 0) Exit.");

                    Console.WriteLine();

                    Console.Write("Choose operation: ");
                    Operation = int.Parse(Console.ReadLine().Trim());
                    Console.WriteLine();

                    switch (Operation)
                    {

                        case 1:

                            /*
                             Code for insert data in a list in the Azure Redis Cache
                             */

                            Console.Write("Write the Key to the list: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write one value to save: ");
                            Value = Console.ReadLine().Trim();

                            long RightResult = ServerAzureRedisCache.InsertDataInListOnTheRight(Key, Value);
                            Console.WriteLine("");

                            if (RightResult > 0)
                                Console.Write("The data was inserted successfully!" + " [ Now press Enter ]");

                            else
                                Console.Write("Data is not in the list" + " [ Now press Enter ]");

                            Console.ReadLine();

                            break;

                        case 2:

                            /*
                           Code for insert data in a list in the Azure Redis Cache
                           */

                            Console.Write("Write the Key to the list: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write one value to save: ");
                            Value = Console.ReadLine().Trim();

                            long LeftResult = ServerAzureRedisCache.InsertDataInListOnTheLeft(Key, Value);
                            Console.WriteLine("");

                            if (LeftResult > 0)
                                Console.Write("The data was inserted successfully!" + " [ Now press Enter ]");

                            else
                                Console.Write("Data is not in the list" + " [ Now press Enter ]");

                            Console.ReadLine();

                            break;

                        case 3:

                            /*
                             Code for remove data in a list
                             */

                            Console.Write("Write the Key to the list: ");
                            Key = Console.ReadLine().Trim();

                            ServerAzureRedisCache.RemoveDataInListOnTheRight(Key);

                            Console.WriteLine("");
                            Console.WriteLine("Data removed on the right" + " [ Now press Enter ]");
                            Console.ReadLine();

                            break;

                        case 4:

                            /*
                             Code for remove data in a list
                             */

                            Console.Write("Write the Key to the list: ");
                            Key = Console.ReadLine().Trim();

                            ServerAzureRedisCache.RemoveDataInListOnTheLeft(Key);

                            Console.WriteLine("");
                            Console.WriteLine("Data removed on the left" + " [ Now press Enter ]");
                            Console.ReadLine();

                            break;

                        case 5:

                            /*
                             Code for knows the size of list
                             */

                            Console.Write("Write the key to the list: ");
                            Key = Console.ReadLine().Trim();

                            long SizeList = ServerAzureRedisCache.SizeOfList(Key);

                            Console.WriteLine("");
                            Console.WriteLine("Size of list: " + SizeList + " [ Now press Enter ]");
                            Console.ReadLine();

                            break;

                        case 6:

                            /*
                             Code for see all data in a list
                             */

                            Console.Write("Write the key to the list: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write a range: Start with: ");
                            int StartRange = int.Parse(Console.ReadLine().Trim());

                            Console.Write("Write a range: End with: ");
                            int EndRange = int.Parse(Console.ReadLine().Trim());

                            Console.WriteLine("");
                            List<RedisObject>RedisList = ServerAzureRedisCache.SeeDataInList(Key, StartRange, EndRange);

                            foreach (RedisObject RedisHash in RedisList)
                            {
                                Console.Write(RedisHash.Key + " : ");
                                Console.Write(RedisHash.Value);
                                Console.WriteLine();
                            }

                            Console.WriteLine("");
                            Console.WriteLine("All hashes showed" + " [ Now press Enter ]");
                            Console.ReadLine();

                            break;

                        case 7:

                            /*
                             Code for cut a list
                             */

                            Console.Write("Write the key to the list: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write a range: Cut from: ");
                            int StartCut = int.Parse(Console.ReadLine().Trim());

                            Console.Write("Write a range: Cut to: ");
                            int EndCut = int.Parse(Console.ReadLine().Trim());

                            ServerAzureRedisCache.CutList(Key, StartCut, EndCut);

                            Console.WriteLine("");
                            Console.WriteLine("The list was cut" + " [ Now press Enter ]");
                            Console.ReadLine();

                            break;
                    }
            
                } while (Operation!=0);
            }
            catch (Exception ex)
            {
                Console.Clear();
                Console.WriteLine("An error occurred. Detail: " + ex.Message + " [ Now press Enter ]");

                Console.Read();
            }
        }
Ejemplo n.º 5
0
        /*            
         * Comments:
         * 
         * For run this code without errors, you should to create an Azure Redis Cache Service in Microsoft Azure, and get your
         * own ConnectionString and passwords for the server .
         * Once you have your Azure Redis Cache service, now you need to set the property "SSL Port " no enabled if you don't do
         * this action, you can't run the code correctly.
         * Don't forget to add the reference StackExchange.Redis from Nuget Package also.
         * More references: 
         * 
         * API:
         * https://github.com/StackExchange/StackExchange.Redis/blob/master/StackExchange.Redis/StackExchange/Redis/IDatabase.cs
         * 
         * One tool that you can use for monitoring your redis data base is: Redis Desktop Manager from:
         * http://redisdesktop.com/
         */

        static void Main(string[] args)
        {
            try
            {
                string Value = "", Key = "";
                int Operation = 0;              

                RedisCache ServerAzureRedisCache = new RedisCache();

                do
                {
                    Console.Clear();

                    Console.WriteLine("* * * [ Azure Redis Cache Operations ] * * *");
                    Console.WriteLine();

                    Console.WriteLine(" 1) Save data.");
                    Console.WriteLine(" 2) Search data.");
                    Console.WriteLine(" 3) Update data.");
                    Console.WriteLine(" 4) Delete data.");
                    Console.WriteLine(" 5) List all data");
                    Console.WriteLine(" 0) Exit.");

                    Console.WriteLine();

                    Console.Write("Choose operation: ");
                    Operation = int.Parse(Console.ReadLine().Trim());
                    Console.WriteLine();

                    switch (Operation)
                    {
                        case 1:

                            /*
                             Code for save data in the Azure Redis Cache DataBase
                            */

                            Console.Write("Write one key to the data: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write one value to save: ");
                            Value = Console.ReadLine().Trim();

                            if(ServerAzureRedisCache.SaveData(Key, Value)==true)
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Data saved successfully! [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Unsaved data [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;

                        case 2:

                            /*
                              Code for search data in the Azure Redis Cache DataBase
                            */

                            Console.Write("Write the Key to search: ");
                            Key = Console.ReadLine().Trim();

                            string  ValueFound = ServerAzureRedisCache.SearchData(Key);

                            if (ValueFound!=null)
                                Console.WriteLine("The data is: " + ValueFound + " [ Now press Enter ]");
                    
                            else
                                Console.WriteLine("Data not found" + " [ Now press Enter ]");

                            Console.ReadLine();
                            
                            break;

                        case 3:

                            /*
                             Code for update data in the Azure Redis Cache DataBase
                             */

                            Console.Write("Write the Key to search: ");
                            Key = Console.ReadLine().Trim();

                            Console.Write("Write the new value: ");
                            Value = Console.ReadLine().Trim();

                            if (ServerAzureRedisCache.UpdateData(Key, Value) == true)
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Data updated successfully! [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("Data was not updated [ Now press Enter ]");
                                Console.ReadLine();
                            }

                            break;

                        case 4:

                            /*
                             Code for delete data in the Azure Redis Cache DataBase
                           */

                            Console.Write("Write the Key to delete: ");
                            Key = Console.ReadLine().Trim();

                            bool ResultDelete = ServerAzureRedisCache.DeleteData(Key);

                            if (ResultDelete == true)
                                Console.WriteLine("The data was deleted successfully!" + " [ Now press Enter ]");

                            else
                                Console.WriteLine("Data not found" + " [ Now press Enter ]");

                            Console.ReadLine();

                            break;

                        case 5:

                            /*
                             Code for list all data in the Azure Redis Cache DataBase
                           */

                            List<RedisObject> RedisObjects = ServerAzureRedisCache.ListKeys();

                            if (RedisObjects.Count()>0)
                            {
                                foreach (RedisObject RedisHash in RedisObjects)
                                {
                                    Console.Write(RedisHash.Key + " : ");
                                    Console.Write(RedisHash.Value);
                                    Console.WriteLine();
                                }

                                Console.WriteLine("");
                                Console.WriteLine("All hashes shown" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                            else
                            {
                                Console.WriteLine("");
                                Console.WriteLine("No information at this time" + " [ Now press Enter ]");
                                Console.ReadLine();
                            }
                           

                            break;

                                           }
            
                } while (Operation!=0);
            }
            catch (Exception ex)
            {
                Console.Clear();
                Console.WriteLine("An error occurred. Detail: " + ex.Message + " [ Now press Enter ]");

                Console.Read();
            }
        }