示例#1
0
        static SummarizationCompleteMessage CreateNextMessage(ProductQuantityUpdateMessage inputMessage)
        {
            var outputMessage = new SummarizationCompleteMessage()
            {
                EntityId         = inputMessage.MeasurementPointId,
                EntityType       = EntityType.MeasurementPoint,
                IntervalType     = IntervalType.Hourly,
                ContractDayStart = inputMessage.ContractDayStart,
                ContractDayEnd   = inputMessage.ContractDayEnd
            };

            return(outputMessage);
        }
        static List <SummarizationCompleteMessage> CreateNextMessages(SummarizationCompleteMessage inputMessage)
        {
            var list = new List <SummarizationCompleteMessage>();

            IntervalType?intervalType = SummarizationUtility.GetNextInterval(inputMessage.IntervalType);

            if (intervalType == null)
            {
                return(null);
            }

            var outputMessage = new SummarizationCompleteMessage()
            {
                EntityId         = inputMessage.EntityId,
                EntityType       = inputMessage.EntityType,
                IntervalType     = intervalType ?? IntervalType.Monthly,
                ContractDayStart = inputMessage.ContractDayStart,
                ContractDayEnd   = inputMessage.ContractDayEnd
            };

            list.Add(outputMessage);

            if (inputMessage.EntityType == EntityType.MeasurementPoint &&
                inputMessage.IntervalType == IntervalType.Hourly)
            {
                var locationMessage = new SummarizationCompleteMessage()
                {
                    EntityId         = inputMessage.EntityId,
                    EntityType       = EntityType.Location,
                    IntervalType     = IntervalType.Hourly,
                    ContractDayStart = inputMessage.ContractDayStart,
                    ContractDayEnd   = inputMessage.ContractDayEnd
                };

                list.Add(locationMessage);
            }

            return(list);
        }