Esempio n. 1
0
        private void AddLineItem(Command command)
        {
            var cmd = command as AddReferendumLineItemsCommand;

            ValidateCommand(cmd);
            if (cmd != null)
            {
                foreach (var item in cmd.ResultDetail)
                {
                    var presidentalLineItem = new ReferendumResultLineItem()
                    {
                        Id            = Guid.NewGuid(),
                        Candidate     = item.Candidate,
                        ResultCount   = item.Result,
                        ModifiedCount = 0,
                        ReceivedTime  = DateTime.Now
                    };
                    LineItems.Add(presidentalLineItem);
                }
            }
        }
Esempio n. 2
0
        private void Modify(Command command)
        {
            //todo Review modify lineitems method
            var cmd = command as ModifyReferendumResultsCommand;

            ValidateCommand(cmd);
            if (cmd != null)
            {
                foreach (var item in cmd.ResultDetail)
                {
                    var presidentalLineItem = new ReferendumResultLineItem()
                    {
                        Id            = Guid.NewGuid(),
                        Candidate     = item.Candidate,
                        ResultCount   = item.Result,
                        ModifiedCount = LineItems.Max(z => z.ModifiedCount) + 1,
                        ReceivedTime  = DateTime.Now
                    };
                    LineItems.Add(presidentalLineItem);
                }
            }
            Status = ResultStatus.Modified;
        }