/// <summary> /// Depending on AccessMode, this constructor returns an instance of our WCF client class, or /// a direct instance of our TradeServices implementation class. /// </summary> public BSLClient() { switch (Settings.ACCESS_MODE) { //In-process activation---instantiate BSL directly, no need for client interface. case StockTraderUtility.BSL_INPROCESS: { BSL = new TradeService(); break; } //Remote activation. //Note the same WCF client is used regardless of the //specific webservice implementation platform. For StockTrader, our client //interface for SOA modes is always the same: BusinessServiceClient. //We differentiate WebSphere only becuase StockTrader has some additional UI and //backend service functionality not provided by J2EE/Trade 6.1, and we need to detect //in just a couple of places in the Web app so we do not make method calls to an //implementation that has not implemented those methods. But as you see here, the //WCF client is always the same regardless. default: { BSL = new BusinessServiceClient(new Settings()); break; } } }
public void emptyMethodAction() { try { this.Channel.emptyMethodAction(); } catch { this.Channel = null; throw; } }
/// <summary> /// Logs user in/authenticates against StockTrader database. /// </summary> /// <param name="userid">User id to authenticate.</param> /// <param name="password">Password for authentication</param> public AccountDataModel login(string userID, string password) { try { return this.Channel.login(userID, password); } catch { this.Channel = null; throw; } }
/// <summary> /// Gets specific top n orders for a user. Transforms data from DataContract to model UI class for HTML display. /// </summary> /// <param name="userID">User id to retrieve data for.</param> public List<OrderDataModel> getTopOrders(string userID) { try { return this.Channel.getTopOrders(userID); } catch { this.Channel = null; throw; } }
/// <summary> /// Gets a holding for a user. Transforms data from DataContract to model UI class for HTML display. /// </summary> /// <param name="userID">User id to retrieve data for.</param> /// <param name="holdingid">Holding id to retrieve data for.</param> public HoldingDataModel getHolding(string userID, int holdingID) { try { return this.Channel.getHolding(userID, holdingID); } catch { this.Channel = null; throw; } }
/// <summary> /// Gets a single quote based on symbol. /// </summary> /// <param name="symbol">Symbol to get data for.</param> public List<QuoteDataModel> getQuotes(string symbolString) { try { return this.Channel.getQuotes(symbolString); } catch { this.Channel = null; throw; } }
/// <summary> /// Gets a single quote based on symbol. /// </summary> /// <param name="symbol">Symbol to get data for.</param> public QuoteDataModel getQuote(string symbol) { try { return this.Channel.getQuote(symbol); } catch { this.Channel = null; throw; } }
/// <summary> /// Gets the current market summary. This results in an expensive DB query in the DAL; hence look to cache data returned for 60 second or so. /// </summary> public MarketSummaryDataModelWS getMarketSummary() { try { return this.Channel.getMarketSummary(); } catch { this.Channel = null; throw; } }
/// <summary> /// Registers/adds new user to database. /// </summary> /// <param name="userID">User id for account creation/login purposes as specified by user.</param> /// <param name="password">Password as specified by user.</param> /// <param name="fullname">Name as specified by user.</param> /// <param name="address">Address as specified by user.</param> /// <param name="email">Email as specified by user.</param> /// <param name="creditcard">Credit card number as specified by user.</param> /// <param name="openBalance">Open balance as specified by user. </param> public AccountDataModel register(string userID, string password, string fullname, string address, string email, string creditcard, decimal openBalance) { try { return this.Channel.register(userID, password, fullname, address, email, creditcard, openBalance); } catch { this.Channel = null; throw; } }
/// <summary> /// Performs a holding sell operation. /// </summary> /// <param name="userID">User id to create/submit order for.</param> /// <param name="holdingID">Holding id to sell off.</param> /// <param name="quantity">Shares to sell.</param> public OrderDataModel sell(string userID, int holdingID, int orderProcessingMode) { try { return this.Channel.sell(userID, holdingID, orderProcessingMode); } catch { this.Channel = null; throw; } }
/// <summary> /// Performs a stock buy operation. /// </summary> /// <param name="userID">User id to create/submit order for.</param> /// <param name="symbol">Stock symbol to buy.</param> /// <param name="quantity">Shares to buy</param> public OrderDataModel buy(string userID, string symbol, double quantity, int orderProcessingMode) { try { return this.Channel.buy(userID, symbol, quantity, orderProcessingMode); } catch { this.Channel = null; throw; } }
/// <summary> /// Logs a user out--updates logout count. /// </summary> /// <param name="userID">User id to logout.</param> public void logout(string userID) { try { this.Channel.logout(userID); } catch { this.Channel = null; throw; } return; }
/// <summary> /// Updates account profile data for a user. /// </summary> /// <param name="profileData">Profile data model class with updated info.</param> public AccountProfileDataModel updateAccountProfile(AccountProfileDataModel profileData) { try { return this.Channel.updateAccountProfile(profileData); } catch { this.Channel = null; throw; } }
/// <summary> /// Gets account data for a user. Transforms data from DataContract to model UI class for HTML display. /// </summary> /// <param name="userID">User id to retrieve data for.</param> public AccountDataModel getAccountData(string userID) { try { return this.Channel.getAccountData(userID); } catch { this.Channel = null; throw; } }
/// <summary> /// Allows user to sell part of a holding vs. all. Not implemented by Trade 6.1 on WebSphere. /// </summary> /// <param name="userID">User id to submit sell for.</param> /// <param name="holdingID">Holding id to sell.</param> /// <param name="quantity">Number of shares to sell.</param> public OrderDataModel sellEnhanced(string userID, int holdingID, double quantity) { try { return this.Channel.sellEnhanced(userID, holdingID, quantity); } catch { this.Channel = null; throw; } }
/// <summary> /// Gets holding data for a user. Transforms data from DataContract to model UI class for HTML display. /// </summary> /// <param name="userID">User id to retrieve data for.</param> public List<HoldingDataModel> getHoldings(string userID) { try { return this.Channel.getHoldings(userID); } catch { this.Channel = null; throw; } }
/// <summary> /// Simple online check method. /// </summary> public void isOnline() { try { this.Channel.isOnline(); return; } catch { this.Channel = null; throw; } }
public TradeDetailsController(ITradeServices tradeServices) { _tradeServices = tradeServices; }