Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/Program.cs
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/Program.cs?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/Program.cs
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/Program.cs
 Wed Jul 22 03:40:44 2009
@@ -62,9 +62,10 @@
         /// <summary>p
         /// The program entry class. Note how this simply inherits from the 
provided base class.
         /// </summary>
-        class MyHost 
+        class MyHost : IDisposable
         {
-           
+            private ServiceHost host;
+
             public void startUp()
             {
                 string shortHostName = System.Net.Dns.GetHostName();
@@ -81,7 +82,7 @@
 
                 //Create a ServiceHost for the Orderprocessor service.
                 Type serviceType = typeof(OrderProcessor);
-                ServiceHost host = new ServiceHost(serviceType, 
TradeServiceUriBase);
+                host = new ServiceHost(serviceType, TradeServiceUriBase);
                 addEndpointsAndBehaviors(host, TradeServiceUriBase);
                 host.Open();
 
@@ -107,6 +108,15 @@
                 
                 return host;
             }
+
+            public void Dispose()
+            {
+                if (host != null)
+                {
+                    host.Abort();
+                    host.Close();
+                }
+            }
         }
 
         [STAThread]
@@ -114,11 +124,21 @@
         {
             Console.SetWindowSize(Console.LargestWindowWidth - 30, 
Console.LargestWindowHeight - 30);
             Console.Title = ".NET StockTrader Order Processor Service Host";
-            MyHost myHost = new MyHost();
-            myHost.startUp();
-            
-            Console.WriteLine(" {0} is started.", Console.Title);
-            Console.WriteLine();
+
+            using (MyHost myHost = new MyHost())
+            {
+                try
+                {
+                    myHost.startUp();
+
+                    Console.WriteLine(" {0} is started.", Console.Title);
+                    Console.WriteLine();
+                }
+                catch (Exception ex)
+                {
+                    StockTraderUtility.Logger.WriteException(ex);
+                }
+            }
             Console.WriteLine("Press Enter to quit.");
             Console.ReadLine();
         }

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/OrderProcessorService.cs
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/OrderProcessorService.cs?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/OrderProcessorService.cs
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/OrderProcessorService.cs
 Wed Jul 22 03:40:44 2009
@@ -120,7 +120,7 @@
             if (queuedOrder.orderID % Settings.DISPLAYNUMBERORDERITERATIONS == 
0)
             {
                 string message = string.Format("Processing Order {0}, symbol 
{1}, type {2}.", queuedOrder.orderID.ToString(), queuedOrder.symbol, 
queuedOrder.orderType);
-                StockTraderUtility.writeConsoleMessage(message + 
"\n",EventLogEntryType.Information,false, Settings.EVENT_LOG);
+                StockTraderUtility.Logger.WriteDebugMessage(message + "\n");
             }
             ProcessOrder orderService = new ProcessOrder();
             orderService.ProcessAndCompleteOrder(queuedOrder);

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/BusinessServiceClient/BSLClient.cs
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/BusinessServiceClient/BSLClient.cs?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/BusinessServiceClient/BSLClient.cs
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/BusinessServiceClient/BSLClient.cs
 Wed Jul 22 03:40:44 2009
@@ -77,7 +77,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.login
 Error: " + e.ToString(),EventLogEntryType.Error,true,Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.login
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -113,7 +113,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getOrders
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getOrders
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -149,7 +149,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getTopOrders
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getTopOrders
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -167,7 +167,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getAccountData
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getAccountData
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -185,7 +185,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getAccountProfileData
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getAccountProfileData
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -204,7 +204,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.updateAccountProfile
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.updateAccountProfile
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -253,7 +253,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getHoldings
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getHoldings
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -325,7 +325,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getHoldingsBySymbolSubTotaled
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getHoldingsBySymbolSubTotaled
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -346,7 +346,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getHolding
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getHolding
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -364,7 +364,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.logout
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.logout
 Error: " + e.ToString());
             }
         }
 
@@ -387,7 +387,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.register
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.register
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -410,7 +410,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getClosedOrders
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getClosedOrders
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -429,7 +429,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.buy
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.buy
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -451,7 +451,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.sell
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.sell
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -490,7 +490,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getQuotes
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getQuotes
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -507,7 +507,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getQuote
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getQuote
 Error: " + e.ToString());
                 throw;
             }
         }
@@ -523,7 +523,7 @@
             }
             catch (Exception e)
             {
-                
StockTraderUtility.writeErrorConsoleMessage("StockTraderWebApplicationServiceClient.getMarketSummary
 Error: " + e.ToString(), EventLogEntryType.Error, true, Settings.EVENT_LOG);
+                
StockTraderUtility.Logger.WriteErrorMessage("StockTraderWebApplicationServiceClient.getMarketSummary
 Error: " + e.ToString());
                 throw;
             }
         }

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx
 Wed Jul 22 03:40:44 2009
@@ -66,5 +66,10 @@
                     CssClass="button" OnClick="AdvancedConfig_Click" />
             </td>
         </tr>
+        <tr>
+            <td colspan="2">
+                <asp:Label ID="ConfirmationText" runat="server" 
Font-Size="Smaller" Visible="false"/>
+            </td>
+        </tr>
     </table>
 </asp:Content>

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs
 Wed Jul 22 03:40:44 2009
@@ -96,9 +96,18 @@
                 bsRequest.Bs = this.BsName.SelectedItem.Value;
                 bsRequest.Ops = this.OpsName.SelectedItem.Value;
                 configClient.SetBSToOPS(bsRequest);
+                
+                ConfirmationText.Text = ("Configuration successfully changed 
to: "+Settings.CLIENT_LABEL+" -> " + clientRequest.Bs + " -> " + bsRequest.Ops);
+                ConfirmationText.ForeColor = System.Drawing.Color.Green;
+                ConfirmationText.Visible = true;
+
             }
             catch
             {
+                ConfirmationText.Text = ("Unsuccessful Configuration");
+                ConfirmationText.ForeColor = System.Drawing.Color.Red;
+                ConfirmationText.Visible = true;
+
                 throw;
             }
         }

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs
 Wed Jul 22 03:40:44 2009
@@ -38,17 +38,24 @@
             Page.Validate();
             if (Page.IsValid)
             {
-                ConfigServiceClient configClient = new ConfigServiceClient();
-
-                ServiceLocation newOps = new ServiceLocation();
-                newOps.ServiceName = this.ServiceName.Text;
-                newOps.ServiceURL = this.NewURL.Text;
-                newOps.Sec = this.IsSec.Checked;
-
-                //update the service location
-                configClient.SetServiceLocation(newOps);
-
-                Response.Redirect(Settings.PAGE_CONFIGURATION_ADVANCED);
+                try
+                {
+                    ConfigServiceClient configClient = new 
ConfigServiceClient();
+
+                    ServiceLocation newOps = new ServiceLocation();
+                    newOps.ServiceName = this.ServiceName.Text;
+                    newOps.ServiceURL = this.NewURL.Text;
+                    newOps.Sec = this.IsSec.Checked;
+
+                    //update the service location
+                    configClient.SetServiceLocation(newOps);
+
+                    Response.Redirect(Settings.PAGE_CONFIGURATION_ADVANCED);
+                }
+                catch
+                {
+                    throw;
+                }
             }
         }
 

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx
 Wed Jul 22 03:40:44 2009
@@ -117,5 +117,10 @@
                     ValidationGroup="NoValidationGroup" 
OnClick="BackButton_Click" />
             </td>
         </tr>
+        <tr>
+            <td colspan = "2">
+                <asp:Label ID="ConfirmationText" runat="server" 
Font-Size="Smaller" Visible="false"/>
+            </td>
+        </tr>
     </table>
 </asp:Content>

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx.cs
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx.cs?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx.cs
 (original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdvanced.aspx.cs
 Wed Jul 22 03:40:44 2009
@@ -156,9 +156,16 @@
                 bsRequest.Ops = newOps.ServiceName;
                 // send ws call
                 configClient.SetBSToOPS(bsRequest);
+
+                ConfirmationText.Text = ("Configuration successfully changed 
to: "+Settings.CLIENT_LABEL+" -> " + clientRequest.Bs + " -> " + bsRequest.Ops);
+                ConfirmationText.ForeColor = System.Drawing.Color.Green;
+                ConfirmationText.Visible = true;
             }
             catch
             {
+                ConfirmationText.Text = ("Unsuccessful Configuration");
+                ConfirmationText.ForeColor = System.Drawing.Color.Red;
+                ConfirmationText.Visible = true;
                 throw;
             }
 

Modified: 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config
URL: 
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config?rev=796609&r1=796608&r2=796609&view=diff
==============================================================================
--- 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config 
(original)
+++ 
incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config 
Wed Jul 22 03:40:44 2009
@@ -29,7 +29,11 @@
 
   <appSettings>
 
+    <!--Possible values for logger mode: CONSOLE, EVENT_VIEWER-->
+    <add key="LOGGER_MODE" value="CONSOLE"/>
     <add key="EVENT_LOG" value="Trade Web App"/>
+    <add key="LOGGING_ENABLED" value="ON"/>
+
     <add key="MAX_DISPLAY_ORDERS" value="20"/>
     <add key="MAX_DISPLAY_TOP_ORDERS" value="5"/>
     <add key="DISPLAY_DUPLICATE_KEY_EXCEPTIONS" value="true"/>
@@ -45,6 +49,7 @@
     <add key="CLIENT_LABEL" value="DOTNET_CLIENT"/>
     <add key="BS_LABEL" value="DOTNET_BS"/>
     <add key="OPS_LABEL" value="DOTNET_OPS"/>
+        
   </appSettings>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">


Reply via email to