Пример #1
0
            /// <summary>
            /// Returns the first action of the given kind, between the processor and the processedObject.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processor"></param>
            /// <param name="processedObject"></param>
            /// <returns></returns>
            public TradeAction GetFirst(TradeAction.Kind kind, Somebody processor, Something processedObject)
            {
                ICollection<Persistent> result = kind.FindMany("Processor = {0} AND ProcessedObject = {1}", new Object[] { processor, processedObject });
                TradeAction first = null;

                foreach (TradeAction action in result)
                {
                    if (first == null || action.When < first.When)
                    {
                        first = action;
                    }
                }

                return first;
            }
Пример #2
0
            /// <summary>
            /// Returns the latest action of the given kind, for the given processor.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processor"></param>
            /// <returns></returns>
            public TradeAction GetLatestForProcessor(TradeAction.Kind kind, Somebody processor)
            {
                ICollection<Persistent> result = kind.FindMany("Processor = {0}", new Object[] { processor });
                TradeAction latest = null;

                foreach (TradeAction action in result)
                {
                    if (latest == null || action.When > latest.When)
                    {
                        latest = action;
                    }
                }

                return latest;
            }