Author: bendewey
Date: Thu Jan 7 03:29:53 2010
New Revision: 896748
URL: http://svn.apache.org/viewvc?rev=896748&view=rev
Log:
STONEHENGE-110 part2
Updates to dotnet BS and OPS to support safe errors, and case-insensitive db
names
Modified:
incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs
incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs
Modified:
incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs
URL:
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs?rev=896748&r1=896747&r2=896748&view=diff
==============================================================================
---
incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs
(original)
+++
incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs
Thu Jan 7 03:29:53 2010
@@ -183,7 +183,10 @@
finally
{
//Always close the DAL, this releases its primary DB
connection.
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -222,7 +225,10 @@
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -263,7 +269,10 @@
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -304,7 +313,10 @@
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -352,7 +364,10 @@
StockTraderUtility.Logger.WriteDebugMessage("Leaving login for
" + uniqueId);
//Always close the DAL, this releases its primary DB
connection.
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -369,6 +384,8 @@
userID = GetUserIdClaim();
}
+ StockTraderUtility.Logger.WriteDebugMessage("Getting orders
for for " + userID);
+
var configClient = new ConfigServiceClient();
var bsRequest = new BSConfigRequest();
bsRequest.BSName = Settings.BS_LABEL;
@@ -391,7 +408,10 @@
}
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -408,6 +428,8 @@
userID = GetUserIdClaim();
}
+ StockTraderUtility.Logger.WriteDebugMessage("Getting top
orders for for " + userID);
+
var configClient = new ConfigServiceClient();
var bsRequest = new BSConfigRequest();
bsRequest.BSName = Settings.BS_LABEL;
@@ -430,7 +452,10 @@
}
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -469,7 +494,10 @@
}
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -509,7 +537,10 @@
}
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -550,7 +581,10 @@
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -620,7 +654,10 @@
}
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
}
@@ -651,7 +688,10 @@
//ALWAYS call dal.Close is using StockTrader
DAL implementation;
//this is equivalent to calling
Connection.Close() in the DAL --
//but for a generic DB backend as far as the
BSL is concerned.
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
}
@@ -728,7 +768,10 @@
finally
{
- dalCustomer.Close();
+ if (dalCustomer != null)
+ {
+ dalCustomer.Close();
+ }
}
}
@@ -763,7 +806,10 @@
finally
{
- dalMarketSummary.Close();
+ if (dalMarketSummary != null)
+ {
+ dalMarketSummary.Close();
+ }
}
}
@@ -799,7 +845,10 @@
finally
{
- dalMarketSummary.Close();
+ if (dalMarketSummary != null)
+ {
+ dalMarketSummary.Close();
+ }
}
}
@@ -955,7 +1004,10 @@
}
finally
{
- dalOrder.Close();
+ if (dalOrder != null)
+ {
+ dalOrder.Close();
+ }
}
}
}
@@ -993,7 +1045,10 @@
}
finally
{
- dalOrder.Close();
+ if (dalOrder != null)
+ {
+ dalOrder.Close();
+ }
}
}
}
Modified:
incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs
URL:
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs?rev=896748&r1=896747&r2=896748&view=diff
==============================================================================
---
incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs
(original)
+++
incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs
Thu Jan 7 03:29:53 2010
@@ -57,9 +57,9 @@
public static string GetAssemblyNameFromDBName(string DBName)
{
- if (DBName.Equals("MSSQL"))
+ if (DBName.Equals("MSSQL",
StringComparison.InvariantCultureIgnoreCase))
return "Trade.DALSQLServer";
- else if (DBName.Equals("MySQL"))
+ else if (DBName.Equals("MySQL",
StringComparison.InvariantCultureIgnoreCase))
return "Trade.DALMySQL";
else
throw new Exception("Database name, " + DBName + ", not
supported");
Modified:
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs
URL:
http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs?rev=896748&r1=896747&r2=896748&view=diff
==============================================================================
---
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs
(original)
+++
incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs
Thu Jan 7 03:29:53 2010
@@ -126,16 +126,20 @@
order.holdingID = holdingid;
dalOrder.closeOrder(order);
//Done!
- Console.WriteLine("The order of type " + order.orderType + "
and quantity " + order.quantity + " has been processed");
+ StockTraderUtility.Logger.WriteDebugMessage("The order of type
" + order.orderType + " and quantity " + order.quantity + " has been
processed");
return;
}
- catch
+ catch (Exception ex)
{
+ StockTraderUtility.Logger.WriteException(ex);
throw;
}
finally
{
- dalOrder.Close();
+ if (dalOrder != null)
+ {
+ dalOrder.Close();
+ }
}
}