static void Main(string[] args)
        {
            String ip        = "localhost";
            int    port      = 51773;
            String Namespace = "USER";
            String username  = "******";
            String password  = "******";

            try
            {
                // Using IRISADOConnection to connect
                IRISADOConnection connect = new IRISADOConnection();

                // Create connection string
                connect.ConnectionString = "Server = " + ip + "; Port = " + port + "; Namespace =  " + Namespace + "; Password = "******"; User ID = " + username;
                connect.Open();
                Console.WriteLine("Hello World! You have successfully connected to InterSystems IRIS. Press any key to continue.");
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine("Connection failed:\n" + e);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            String ip        = "localhost";
            int    port      = 51773;
            String username  = "******";
            String password  = "******";
            String Namespace = "USER";

            try {
                IRISADOConnection connect = new IRISADOConnection();
                connect.ConnectionString = "Server = " + ip + "; Port = " + port + "; Namespace =  " + Namespace + "; Password = "******"; User ID = " + username;
                connect.Open();
                Console.WriteLine("Connected to InterSystems IRIS.");

                bool always = true;
                while (always)
                {
                    Console.WriteLine("1. View top 10");
                    Console.WriteLine("2. Create Portfolio table");
                    Console.WriteLine("3. Add to Portfolio");
                    Console.WriteLine("4. Update Portfolio");
                    Console.WriteLine("5. Delete from Portfolio");
                    Console.WriteLine("6. View Portfolio");
                    Console.WriteLine("7. Quit");
                    Console.WriteLine("What would you like to do? ");

                    String option = Console.ReadLine();
                    switch (option)
                    {
                    // Task 2
                    case "1":
                        // Uncomment below line to run Task 2
                        // Task2(connect);
                        break;

                    // Task 3
                    case "2":
                        // Uncomment below line to run Task 3
                        // Task3(connect);
                        break;

                    // Task 4
                    case "3":
                        // Uncomment below line to run Task 4
                        // Task4(connect);
                        break;

                    // Task 5
                    case "4":
                        // Uncomment below line to run Task 5
                        // Task5(connect);
                        break;

                    // Task 6
                    case "5":
                        // Uncomment below line to run Task 6
                        // Task6(connect);
                        break;

                    // Task 7
                    case "6":
                        // Uncomment below line to run Task 7
                        // Task7(connect);
                        break;

                    case "7":
                        Console.WriteLine("Exited.");
                        always = false;
                        break;

                    default:
                        Console.WriteLine("Invalid option. Try again!");
                        break;
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("Interactive prompt failed:\n" + e);
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            // Initialize dictionary to store connection details from config.txt
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary = generateConfig("..\\..\\..\\config.txt");

            // Retrieve connection information from configuration file
            string ip        = dictionary["ip"];
            int    port      = Convert.ToInt32(dictionary["port"]);
            string Namespace = dictionary["namespace"];
            string username  = dictionary["username"];
            string password  = dictionary["password"];

            try
            {
                // Using IRISADOConnection to connect
                IRISADOConnection connect = new IRISADOConnection();

                // Create connection string
                connect.ConnectionString = "Server = " + ip + "; Port = " + port + "; Namespace =  " + Namespace + "; Password = "******"; User ID = " + username;
                connect.Open();
                Console.WriteLine("Connected to InterSystems IRIS.");

                // Starting interactive prompt
                bool always = true;
                while (always)
                {
                    Console.WriteLine("1. View top 10");
                    Console.WriteLine("2. Create Portfolio table");
                    Console.WriteLine("3. Add to Portfolio");
                    Console.WriteLine("4. Update Portfolio");
                    Console.WriteLine("5. Delete from Portfolio");
                    Console.WriteLine("6. View Portfolio");
                    Console.WriteLine("7. Quit");
                    Console.WriteLine("What would you like to do? ");

                    String option = Console.ReadLine();
                    switch (option)
                    {
                    // Task 2
                    case "1":
                        Task2(connect);
                        break;

                    // Task 3
                    case "2":
                        Task3(connect);
                        break;

                    // Task 4
                    case "3":
                        Task4(connect);
                        break;

                    // Task 5
                    case "4":
                        Task5(connect);
                        break;

                    // Task 6
                    case "5":
                        Task6(connect);
                        break;

                    // Task 7
                    case "6":
                        Task7(connect);
                        break;

                    case "7":
                        Console.WriteLine("Exited.");
                        always = false;
                        break;

                    default:
                        Console.WriteLine("Invalid option. Try again!");
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Interactive prompt failed:\n" + e);
            }
        }