You are viewing a plain text version of this content. The canonical link for it is here.
Posted to stonehenge-commits@incubator.apache.org by dr...@apache.org on 2009/04/17 21:03:03 UTC

svn commit: r766155 - /incubator/stonehenge/trunk/stocktrader/dotnet/setup_utilities/SetupActions/SetupAction.cs

Author: drewbai
Date: Fri Apr 17 21:03:03 2009
New Revision: 766155

URL: http://svn.apache.org/viewvc?rev=766155&view=rev
Log:
ScottGo change to setup.cs
Readme.mht was not committed because it has been superseded.

Modified:
    incubator/stonehenge/trunk/stocktrader/dotnet/setup_utilities/SetupActions/SetupAction.cs

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/setup_utilities/SetupActions/SetupAction.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/setup_utilities/SetupActions/SetupAction.cs?rev=766155&r1=766154&r2=766155&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/setup_utilities/SetupActions/SetupAction.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/setup_utilities/SetupActions/SetupAction.cs Fri Apr 17 21:03:03 2009
@@ -47,11 +47,11 @@
         private string SQL_CONN = null;
         public static readonly string CONNSTRING_SQLAUTH = "server={0};Database={1};user id={2};password={3};Pooling=false;";
         //newstrings 
-        string CREATE_LOADACCOUNTPROFILEXML = @"Setup\DATALOAD\CreateInsertXMLAccountProfileProc.sql";
-        string CREATE_LOADACCOUNTXML = @"Setup\DATALOAD\CreateInsertXMLAccountProc.sql";
-        string CREATE_LOADHOLDINGXML = @"Setup\DATALOAD\CreateInsertXMLHoldingProc.sql";
-        string CREATE_LOADORDERSXML = @"Setup\DATALOAD\CreateInsertXMLOrdersProc.sql";
-        string CREATE_LOADQUOTEXML = @"Setup\DATALOAD\CreateInsertXMLQuoteProc.sql";
+        string CREATE_LOADACCOUNTPROFILEXML = @"setup_utilities\DATALOAD\CreateInsertXMLAccountProfileProc.sql";
+        string CREATE_LOADACCOUNTXML = @"setup_utilities\DATALOAD\CreateInsertXMLAccountProc.sql";
+        string CREATE_LOADHOLDINGXML = @"setup_utilities\DATALOAD\CreateInsertXMLHoldingProc.sql";
+        string CREATE_LOADORDERSXML = @"setup_utilities\DATALOAD\CreateInsertXMLOrdersProc.sql";
+        string CREATE_LOADQUOTEXML = @"setup_utilities\DATALOAD\CreateInsertXMLQuoteProc.sql";
         string CONNSTRING_WINAUTH = @"EMPTY";
         string MSG_CHECK_SQL_AUTH = string.Empty;
         
@@ -62,7 +62,7 @@
         public string dbPassword = null;
         public string authType = null;
         public static readonly string tradeuser = "trade";
-        public static readonly string tradepassword = "trade";
+        public static readonly string tradepassword = "yyy";
         public static readonly string TRADEDB = "StockTraderDB";
         public const string TRADEDB_CREATE_FILE = "createdb.sql";
 
@@ -78,7 +78,7 @@
             dbPassword = ConfigurationManager.AppSettings.Get("dbPassword");
             authType = ConfigurationManager.AppSettings.Get("authType");
 
-            //string CREATE_LOADACCOUNTPROFILEXML = @"Setup\DATALOAD\" + createfilename;
+            //string CREATE_LOADACCOUNTPROFILEXML = @"setup_utilities\DATALOAD\" + createfilename;
             //string CREATE_LOADACCOUNTXML = string.Empty;
             //string CREATE_LOADHOLDINGXML = string.Empty;
             //string CREATE_LOADORDERSXML = string.Empty;
@@ -116,6 +116,7 @@
             SqlCommand sqlCommand = new SqlCommand(createCommand, sqlConnection);
             sqlCommand.CommandType = CommandType.Text;
             sqlCommand.ExecuteNonQuery();
+            Console.Write(".");
 
             ///ACCOUNT_LOAD_XML
             file = new System.IO.StreamReader(installPath + CREATE_LOADACCOUNTXML);
@@ -124,6 +125,7 @@
             sqlCommand = new SqlCommand(createCommand, sqlConnection);
             sqlCommand.CommandType = CommandType.Text;
             sqlCommand.ExecuteNonQuery();
+            Console.Write(".");
 
             ///HOLDING_LOAD_XML
             file = new System.IO.StreamReader(installPath + CREATE_LOADHOLDINGXML);
@@ -132,6 +134,7 @@
             sqlCommand = new SqlCommand(createCommand, sqlConnection);
             sqlCommand.CommandType = CommandType.Text;
             sqlCommand.ExecuteNonQuery();
+            Console.Write(".");
 
             ///ORDERS_LOAD_XML
             file = new System.IO.StreamReader(installPath + CREATE_LOADORDERSXML);
@@ -140,6 +143,7 @@
             sqlCommand = new SqlCommand(createCommand, sqlConnection);
             sqlCommand.CommandType = CommandType.Text;
             sqlCommand.ExecuteNonQuery();
+            Console.Write(".");
 
             ///QUOTE_LOAD_XML
             file = new System.IO.StreamReader(installPath + CREATE_LOADQUOTEXML);
@@ -148,6 +152,7 @@
             sqlCommand = new SqlCommand(createCommand, sqlConnection);
             sqlCommand.CommandType = CommandType.Text;
             sqlCommand.ExecuteNonQuery();
+            Console.Write(".");
 
             sqlConnection.Close();
         }
@@ -211,10 +216,12 @@
                 string strCreateDB = "CREATE DATABASE [" + repositoryName + "];";
                 sqlCommand.CommandText = strCreateDB;
                 sqlCommand.ExecuteNonQuery();
+                Console.Write(".");
 
                 //Config DB
                 sqlCommand.CommandText = configDB;
                 sqlCommand.ExecuteNonQuery();
+                Console.Write(".");
 
                 string createlogin = "IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = N'" + userid + "') " +
                                          "CREATE LOGIN [" + userid + "] WITH PASSWORD='" + password + "', DEFAULT_DATABASE=" +
@@ -225,6 +232,7 @@
                 //create login
                 sqlCommand.CommandText = createlogin;
                 sqlCommand.ExecuteNonQuery();
+                Console.Write(".");
 
                 //Logout of Master
 
@@ -239,6 +247,8 @@
                 sqlConnection = new SqlConnection(SQL_CONN);
                 Server server = new Server(new ServerConnection(sqlConnection));
                 server.ConnectionContext.ExecuteNonQuery(createuser);
+                Console.Write(".");
+
                 //Logout of Trade DB
                 sqlConnection.Close();
                 System.Data.SqlClient.SqlConnection.ClearAllPools();
@@ -252,6 +262,7 @@
                 //new SMO functionality
                 server = new Server(new ServerConnection(sqlConnection));
                 server.ConnectionContext.ExecuteNonQuery("exec sp_addrolemember 'db_owner','" + userid + "'");
+                Console.Write(".");
 
                 //Logout
                 sqlConnection.Close();
@@ -269,12 +280,13 @@
                 }
 
                 ///Create Schema for DB
-                System.IO.StreamReader file = new System.IO.StreamReader(installPath + @"Setup\DATALOAD\" + createfilename);
+                System.IO.StreamReader file = new System.IO.StreamReader(installPath + @"setup_utilities\DATALOAD\" + createfilename);
                 string createCommand = file.ReadToEnd();
                 file.Close();
                 sqlCommand = new SqlCommand(createCommand, sqlConnection);
                 sqlCommand.CommandType = CommandType.Text;
                 sqlCommand.ExecuteNonQuery();
+                Console.Write(".");
                 sqlConnection.Close();
                 return;
             }
@@ -309,35 +321,35 @@
                 {
                     case 0:
                         {
-                            xmlFile = installPath + "Setup\\DATALOAD\\" + repository + "\\Account.xml";
+                            xmlFile = installPath + "setup_utilities\\DATALOAD\\" + repository + "\\Account.xml";
                             sql = "InsertAccountFromXML";
                             table = "dbo.ACCOUNT";
                             break;
                         }
                     case 1:
                         {
-                            xmlFile = installPath + "Setup\\DATALOAD\\" + repository + "\\AccountProfile.xml";
+                            xmlFile = installPath + "setup_utilities\\DATALOAD\\" + repository + "\\AccountProfile.xml";
                             sql = "InsertAccountProfileFromXML";
                             table = null;
                             break;
                         }
                     case 2:
                         {
-                            xmlFile = installPath + "Setup\\DATALOAD\\" + repository + "\\Quote.xml";
+                            xmlFile = installPath + "setup_utilities\\DATALOAD\\" + repository + "\\Quote.xml";
                             sql = "InsertQuoteFromXML";
                             table = null;
                             break;
                         }
                     case 3:
                         {
-                            xmlFile = installPath + "Setup\\DATALOAD\\" + repository + "\\Holding.xml";
+                            xmlFile = installPath + "setup_utilities\\DATALOAD\\" + repository + "\\Holding.xml";
                             sql = "InsertHoldingFromXML";
                             table = "dbo.HOLDING";
                             break;
                         }
                     case 4:
                         {
-                            xmlFile = installPath + "Setup\\DATALOAD\\" + repository + "\\Orders.xml";
+                            xmlFile = installPath + "setup_utilities\\DATALOAD\\" + repository + "\\Orders.xml";
                             sql = "InsertOrdersFromXML";
                             table = "dbo.ORDERS";
                             break;
@@ -353,6 +365,7 @@
                     cmd.Connection = conn;
                     cmd.CommandType = CommandType.Text;
                     cmd.ExecuteNonQuery();
+                    Console.Write(".");
                 }
                 using (StreamReader sr = new StreamReader(xmlFile))
                 {
@@ -367,6 +380,7 @@
                 try
                 {
                     cmd2.ExecuteNonQuery();
+                    Console.Write(".");
                 }
                 catch (Exception e)
                 {
@@ -378,6 +392,7 @@
                     cmd2.Connection = conn;
                     cmd2.CommandType = CommandType.Text;
                     cmd2.ExecuteNonQuery();
+                    Console.Write(".");
                 }
                 conn.Close();
             }