コード例 #1
0
        private void AddLineItem(Command command)
        {
            var cmd = command as AddGubernatorialLineItemsCommand;

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

            ValidateCommand(cmd);
            if (cmd != null)
            {
                foreach (var item in cmd.ResultDetail)
                {
                    var presidentalLineItem = new GubernatorialResultLineItem()
                    {
                        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;
        }