public Result <List <Position> > ListPosition() { IEnumerable <Position> lst = PositionRA.List(); DataBiz.PositionMerge(ref lst); return(Result(lst.ToList())); }
public Result <List <AccountPosition> > ListAccountPosition(int account_id) { List <AccountPosition> list = new List <AccountPosition>(); List <Position> list_in = (account_id == 0) ? PositionRA.List() : PositionRA.List4Account(account_id); list_in.ForEach(p => { list.Add(new AccountPosition() { account_id = p.account_id, account_name = p.account_name, code = p.code, name = p.name, count = 0, count_in = p.count }); }); List <Tuple <int, JY.PositionItem> > list_sys = new List <Tuple <int, JY.PositionItem> >(); if (account_id > 0) { TradeBiz.QueryPosition(account_id).ForEach(p => { list_sys.Add(new Tuple <int, JY.PositionItem>(account_id, p)); }); } else { string[] keys = TradeRA.KeySearch("A_*"); foreach (var key in keys) { int id = int.Parse(key.Substring(2)); TradeBiz.QueryPosition(id).ForEach(p => { list_sys.Add(new Tuple <int, JY.PositionItem>(id, p)); }); } } foreach (var t in list_sys) { AccountPosition ap = list.Find(p => p.account_id == t.Item1 && p.code == t.Item2.code); if (ap == null) { list.Add(new AccountPosition() { account_id = t.Item1, account_name = AccountRA.GetName(t.Item1), code = t.Item2.code, name = t.Item2.name, count = (int)decimal.Parse(t.Item2.count), count_in = 0 }); } else { ap.count = (int)decimal.Parse(t.Item2.count); } } return(Result(list)); }