public static Dictionary <String, Double> execute(ISpaceProxy tradeDataSpace, Object[] tradeIds, Double rate)
        {
            Dictionary <String, Double> rtnVal = new Dictionary <string, Double>();
            IReadByIdsResult <Trade>    result = tradeDataSpace.ReadByIds <Trade>(tradeIds);
            List <Trade> tlist = new List <Trade>();

            foreach (Trade t in result)
            {
                tlist.Add(t);
            }
            runAnalysis(tlist, rate);
            foreach (Trade t in tlist)
            {
                String key = t.getBook();
                if (rtnVal.ContainsKey(key))
                {
                    rtnVal[key] = rtnVal[key] + t.NPV;
                }
                else
                {
                    rtnVal.Add(key, t.NPV);
                }
            }
            return(rtnVal);
        }
Пример #2
0
    public User[] findUsersByIds()
    {
        object[] ids = new object[3] {
            1L, 2L, 3L
        };

        IReadByIdsResult <User> result = proxy.ReadByIds <User>(ids);

        return(result.ResultsArray);
    }
Пример #3
0
        private IEnumerable <Book> QueryForBooksByAuthor(ISpaceProxy spaceProxy)
        {
            var authorQuery = new SqlQuery <Author>("LastName=?");

            authorQuery.SetParameter(1, "AuthorX");
            var authors = spaceProxy.ReadMultiple <Author>(authorQuery);

            var books = new List <Book>();

            foreach (var author in authors)
            {
                books.AddRange(spaceProxy.ReadByIds <Book>(author.BookIds.Cast <object>().ToArray()));
            }


            return(books);
        }