Edit stocklist. add stocks,
This commit is contained in:
@ -246,10 +246,9 @@ namespace StockDal
|
||||
{
|
||||
StockMarketList = new Dictionary<string, DiTraderStockRow>();
|
||||
DumpObjects = new List<DiTraderStockRow>();
|
||||
GlobalStopwatch.PrintSecs("After dictionaries setup ");
|
||||
//var connStocks = _stockPersonConnect.GetAllConnectionsByPersId(persId);
|
||||
//GlobalStopwatch.PrintSecs("After dictionaries setup ");
|
||||
var groupedStocks = _stockRepository.GetStocksGroupedPerPerson(persId);
|
||||
GlobalStopwatch.PrintSecs("After groupedStocks fetched ");
|
||||
//GlobalStopwatch.PrintSecs("After groupedStocks fetched ");
|
||||
|
||||
var lastGroup = string.Empty;
|
||||
var stockList = new List<string>();
|
||||
@ -261,9 +260,9 @@ namespace StockDal
|
||||
{
|
||||
_testSettings.StockWishes = stockList.ToArray();
|
||||
stockList.Clear();
|
||||
GlobalStopwatch.PrintSecs("Before GetStockStatus");
|
||||
//GlobalStopwatch.PrintSecs("Before GetStockStatus");
|
||||
saveStockData( _scrapePage.GetMyStockStatus(lastGroup));
|
||||
GlobalStopwatch.PrintSecs("After GetStockStatus");
|
||||
//GlobalStopwatch.PrintSecs("After GetStockStatus");
|
||||
lastGroup = groupedStock.StockGroup;
|
||||
}
|
||||
else
|
||||
@ -286,14 +285,6 @@ namespace StockDal
|
||||
saveStockData(_scrapePage.GetMyStockStatus(lastGroup));
|
||||
}
|
||||
|
||||
//OpenBrowser(null);
|
||||
//Find_Data();
|
||||
//OpenBrowser();
|
||||
//Find_Data();
|
||||
//OpenBrowser(true);
|
||||
//Find_Data();
|
||||
|
||||
|
||||
if (DumpObjects.Any())
|
||||
{
|
||||
SaveLogging();
|
||||
|
||||
@ -15,7 +15,35 @@ namespace StockDAL
|
||||
{
|
||||
using (var context = new StockContext())
|
||||
{
|
||||
var sm = context.Stocks.Add(stockMember);
|
||||
if (stockMember.Id > 0)
|
||||
{
|
||||
var entity = (from stk in context.Stocks
|
||||
where stk.Id == stockMember.Id
|
||||
select stk).FirstOrDefault();
|
||||
if (entity != null)
|
||||
{
|
||||
entity.StockId = stockMember.StockId;
|
||||
entity.StockExtId = stockMember.StockExtId;
|
||||
entity.ActValue = stockMember.ActValue;
|
||||
entity.ActAmount= stockMember.ActAmount;
|
||||
entity.SoldDate = stockMember.SoldDate;
|
||||
entity.ActDate = stockMember.ActDate;
|
||||
entity.SoldStockPrice = stockMember.SoldStockPrice;
|
||||
entity.SoldValue = stockMember.SoldValue;
|
||||
entity.PostAmount = stockMember.PostAmount;
|
||||
entity.Comment = stockMember.Comment;
|
||||
entity.BuyDate = stockMember.BuyDate;
|
||||
entity.BuyValue = stockMember.BuyValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sm = context.Stocks.Add(stockMember);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var sm = context.Stocks.Add(stockMember);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
@ -111,7 +139,7 @@ namespace StockDAL
|
||||
join stk in context.Stocks on prs.StockId equals stk.Id
|
||||
join grp in context.StockGroups on stk.StockId equals grp.StockName
|
||||
where prs.PersonId == persId
|
||||
orderby grp.GroupName, grp.StockName
|
||||
orderby grp.GroupName, grp.StockName
|
||||
select new StockGrpPers
|
||||
{
|
||||
PersId = persId,
|
||||
|
||||
Reference in New Issue
Block a user