Dead code elimination.
This commit is contained in:
@@ -1,338 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.ComponentModel;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Windows.Input;
|
||||
//using MarketData;
|
||||
//using MarketData.MarketDataModel;
|
||||
//using MarketData.Helper;
|
||||
//using MarketData.DataAccess;
|
||||
//using MarketData.Utils;
|
||||
//using TradeBlotter.DataAccess;
|
||||
//using TradeBlotter.Command;
|
||||
//using TradeBlotter.Model;
|
||||
//using TradeBlotter.ViewModels;
|
||||
|
||||
//namespace TradeBlotter.Model
|
||||
//{
|
||||
// public class TradeEntryModel : ModelBase
|
||||
// {
|
||||
// private BlotterTradeModel trade = null;
|
||||
// private readonly TradeRepository tradeRepository;
|
||||
// private RelayCommand saveCommand;
|
||||
// private bool updatePrice = true;
|
||||
// private String statusText="";
|
||||
|
||||
// public TradeEntryModel(BlotterTradeModel trade, TradeRepository tradeRepository,bool updatePrice=true)
|
||||
// {
|
||||
// // base.DisplayName = "TradeEntry";
|
||||
// this.updatePrice = updatePrice;
|
||||
// this.trade = trade;
|
||||
// this.tradeRepository = tradeRepository;
|
||||
// PropertyChanged += OnTradeEntryViewModelPropertyChanged;
|
||||
// UpdateProperties();
|
||||
// }
|
||||
// //public override SaveParameters GetSaveParameters()
|
||||
// //{
|
||||
// // return null;
|
||||
// //}
|
||||
// //public override void SetSaveParameters(SaveParameters saveParameters)
|
||||
// //{
|
||||
// //}
|
||||
// //public override bool CanPersist()
|
||||
// //{
|
||||
// // return false;
|
||||
// //}
|
||||
// public void SetActiveTrade(BlotterTradeModel trade)
|
||||
// {
|
||||
// this.trade = trade;
|
||||
// updatePrice = false;
|
||||
// UpdateProperties();
|
||||
// }
|
||||
// private void UpdateProperties()
|
||||
// {
|
||||
// base.OnPropertyChanged("Symbol");
|
||||
// base.OnPropertyChanged("Price");
|
||||
// base.OnPropertyChanged("CompanyName");
|
||||
// base.OnPropertyChanged("TradeDate");
|
||||
// base.OnPropertyChanged("SelectedTradeType");
|
||||
// base.OnPropertyChanged("SelectedAccount");
|
||||
// base.OnPropertyChanged("SelectedStatus");
|
||||
// base.OnPropertyChanged("TradeId");
|
||||
// base.OnPropertyChanged("Shares");
|
||||
// base.OnPropertyChanged("Exposure");
|
||||
// }
|
||||
// private void OnTradeEntryViewModelPropertyChanged(object sender, PropertyChangedEventArgs eventArgs)
|
||||
// {
|
||||
// if (eventArgs.PropertyName.Equals("Symbol"))
|
||||
// {
|
||||
// if (updatePrice)
|
||||
// {
|
||||
// Price price = null;
|
||||
// if (!Utility.IsEpoch(trade.TradeDate) && !trade.TradeDate.Date.Equals(DateTime.Now.Date))
|
||||
// {
|
||||
// price = PricingDA.GetPrice(trade.Symbol, trade.TradeDate);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// price=MarketDataHelper.GetLatestPrice(trade.Symbol);
|
||||
// if (null == price) price = PricingDA.GetPrice(trade.Symbol);
|
||||
// }
|
||||
// if (null != price)trade.Price = price.Close;
|
||||
// else trade.Price=0;
|
||||
// base.OnPropertyChanged("Price");
|
||||
// }
|
||||
// String companyName = PricingDA.GetNameForSymbol(trade.Symbol);
|
||||
// if (null != companyName)
|
||||
// {
|
||||
// trade.CompanyName = companyName;
|
||||
// base.OnPropertyChanged("CompanyName");
|
||||
// }
|
||||
// }
|
||||
// else if (eventArgs.PropertyName.Equals("TradeDate"))
|
||||
// {
|
||||
// base.OnPropertyChanged("Price");
|
||||
// }
|
||||
// }
|
||||
// public String TradeId
|
||||
// {
|
||||
// get { return -1==trade.TradeId?Constants.CONST_DASHES:trade.TradeId.ToString(); }
|
||||
// set { ;}
|
||||
// }
|
||||
// public List<String> TradeTypeOptions
|
||||
// {
|
||||
// get { return new List<String>() { "Buy", "Sell" }; }
|
||||
// }
|
||||
//// Buy/Sell
|
||||
// public String SelectedTradeType
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (null == trade.BuySell) return null;
|
||||
// else if (trade.BuySell.Equals("S")) return "Sell";
|
||||
// else if (trade.BuySell.Equals("B")) return "Buy";
|
||||
// else return null;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// if(String.IsNullOrEmpty(value)) return;
|
||||
// trade.BuySell = value.Equals("Buy") ? "B" : "S";
|
||||
// if (trade.BuySell.Equals("B"))
|
||||
// {
|
||||
// trade.Status = "OPEN";
|
||||
// trade.SellPrice = double.NaN;
|
||||
// trade.SellDate = Utility.Epoch;
|
||||
// base.OnPropertyChanged("SellPrice");
|
||||
// base.OnPropertyChanged("SellDate");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// trade.Status = "CLOSED";
|
||||
// }
|
||||
// base.OnPropertyChanged("SelectedStatus");
|
||||
// base.OnPropertyChanged("SelectedTradeType");
|
||||
// }
|
||||
// }
|
||||
//// ***************************************** A C C O U N T ***************************
|
||||
// public List<String> AccountOptions
|
||||
// {
|
||||
// get { return PortfolioDA.GetAccounts(); }
|
||||
// }
|
||||
// public String SelectedAccount
|
||||
// {
|
||||
// get { return null==trade.Account||trade.Account.Equals("") ? null : trade.Account; }
|
||||
// set
|
||||
// {
|
||||
// trade.Account = value;
|
||||
// base.OnPropertyChanged("SelectedAccount");
|
||||
// }
|
||||
// }
|
||||
////************************************************************************************
|
||||
// public List<String> TradeStatusOptions
|
||||
// {
|
||||
// get {return new List<String>(){"OPEN","CLOSED"}; }
|
||||
// }
|
||||
// public String SelectedStatus
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return null==trade.Status||trade.Status.Equals("") ? null : trade.Status;
|
||||
// }
|
||||
// }
|
||||
// public DateTime TradeDate
|
||||
// {
|
||||
// get { return trade.TradeDate; }
|
||||
// set
|
||||
// {
|
||||
// trade.TradeDate = value;
|
||||
// Price price = null;
|
||||
// if (!Utility.IsEpoch(trade.TradeDate) && !trade.TradeDate.Date.Equals(DateTime.Now.Date))
|
||||
// {
|
||||
// price = PricingDA.GetPrice(trade.Symbol, trade.TradeDate);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// price = MarketDataHelper.GetLatestPrice(trade.Symbol);
|
||||
// if (null == price) price = PricingDA.GetPrice(trade.Symbol);
|
||||
// }
|
||||
// if (null != price)
|
||||
// {
|
||||
// trade.Price = price.Close;
|
||||
// base.OnPropertyChanged("TradeDate");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// public String Symbol
|
||||
// {
|
||||
// get { return trade.Symbol; }
|
||||
// set
|
||||
// {
|
||||
// trade.Symbol = value;
|
||||
// trade.Symbol = trade.Symbol.ToUpper();
|
||||
// base.OnPropertyChanged("Symbol");
|
||||
// }
|
||||
// }
|
||||
// public double Shares
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return trade.Shares;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// trade.Shares = value;
|
||||
// base.OnPropertyChanged("Shares");
|
||||
// base.OnPropertyChanged("Exposure");
|
||||
// }
|
||||
// }
|
||||
// public String CompanyName
|
||||
// {
|
||||
// get { return trade.CompanyName; }
|
||||
// set
|
||||
// {
|
||||
// trade.CompanyName = value;
|
||||
// base.OnPropertyChanged("CompanyName");
|
||||
// }
|
||||
// }
|
||||
// public String Exposure
|
||||
// {
|
||||
// get { return Utility.FormatCurrency(trade.Exposure); }
|
||||
// set { ;}
|
||||
// }
|
||||
// public String Price
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return Utility.FormatCurrency(trade.Price,3);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// trade.Price = Utility.ParseCurrency(value);
|
||||
// base.OnPropertyChanged("Price");
|
||||
// base.OnPropertyChanged("Exposure");
|
||||
// }
|
||||
// }
|
||||
// public String SellPrice
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return Utility.FormatCurrency(trade.SellPrice);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// if (!trade.Status.Equals("CLOSED")) return;
|
||||
// trade.SellPrice = Utility.ParseCurrency(value);
|
||||
// base.OnPropertyChanged("SellPrice");
|
||||
// }
|
||||
// }
|
||||
// public DateTime? SellDate
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (Utility.IsEpoch(trade.SellDate)) return null;
|
||||
// return trade.SellDate;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// trade.SellDate = value.Value;
|
||||
// base.OnPropertyChanged("SellDate");
|
||||
// }
|
||||
// }
|
||||
// public String Commission
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return Utility.FormatCurrency(trade.Commission);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// trade.Commission = Utility.ParseCurrency(value);
|
||||
// }
|
||||
// }
|
||||
// public String Status
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// UIUtils.UIServices.ClearProperty(3, OnClearPropertyEvent);
|
||||
// return statusText;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// statusText = value;
|
||||
// base.OnPropertyChanged("Status");
|
||||
// }
|
||||
// }
|
||||
// public void OnClearPropertyEvent(Object sender,EventArgs e)
|
||||
// {
|
||||
// statusText = "";
|
||||
// base.OnPropertyChanged("Status");
|
||||
// }
|
||||
//// *******************************************************************************************************
|
||||
//// ****************************************** S A V E C O M M A N D *************************************
|
||||
//// *******************************************************************************************************
|
||||
// public ICommand SaveCommand
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if(saveCommand == null)
|
||||
// {
|
||||
// saveCommand = new RelayCommand(param => this.Save(),param => this.CanSave);
|
||||
// }
|
||||
// return saveCommand;
|
||||
// }
|
||||
// }
|
||||
// public void Save()
|
||||
// {
|
||||
// if (!tradeRepository.ContainsTrade(trade))
|
||||
// {
|
||||
// tradeRepository.AddTrade(trade);
|
||||
// base.OnPropertyChanged("TradeId");
|
||||
// base.OnPropertyChanged("DisplayName");
|
||||
// statusText = "Save completed.";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// tradeRepository.UpdateTrade(trade);
|
||||
// statusText="Update completed.";
|
||||
// }
|
||||
// base.OnPropertyChanged("Status");
|
||||
// }
|
||||
// public bool CanSave
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (null == trade.TradeDate || Utility.IsEpoch(trade.TradeDate)) return false;
|
||||
// if (null == trade.BuySell || !(trade.BuySell.ToUpper().Equals("B") || trade.BuySell.ToUpper().Equals("S"))) return false;
|
||||
// if (null == trade.Status || (!trade.Status.Equals("OPEN") && !trade.Status.Equals("CLOSED"))) return false;
|
||||
// if((trade.Status.Equals("CLOSED")||trade.BuySell.ToUpper().Equals("S"))&&double.IsNaN(trade.SellPrice))return false;
|
||||
// if ((trade.Status.Equals("CLOSED") || trade.BuySell.ToUpper().Equals("S")) && Utility.IsEpoch(trade.SellDate)) return false;
|
||||
// if (null == trade.Symbol) return false;
|
||||
// if (0 == trade.Shares) return false;
|
||||
// if (null == trade.Account || "".Equals(trade.Account)) return false;
|
||||
// if (0 == trade.Price) return false;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user