public VotingCard(ShareHolder shareHolder, List <Candidate> candidates, VotingCardType type) : this() { if (shareHolder.StatusAtMeeting == StatusAtMeeting.Absent) { throw new InvalidOperationException("Could not create VotingCard for absent shareholder"); } if (candidates == null) { throw new ArgumentNullException(""); } this.ShareHolderId = shareHolder.ShareHolderId; this.VotingCardType = type; foreach (var candidate in candidates) { if (candidate.CanBeVoted(type)) { var line = new VotingCardLine() { CandidateId = candidate.Id, CandidateName = candidate.Name, }; VotingCardLines.Add(line); } } this.NumberOfCandidates = VotingCardLines.Count(); this.NumberOfShares = shareHolder.NumberOfShares; }
public VotingByHand(ShareHolder shareHolder, List <Statement> statements) { if (shareHolder.StatusAtMeeting == StatusAtMeeting.Absent) { throw new ArgumentException("Could create VotingByHandCard for Absent ShareHolders"); } VotingByHandLines = new List <VotingByHandLine>(); this.ShareHolderId = shareHolder.ShareHolderId; this.ShareHolder = shareHolder; this.ShareHolderCode = shareHolder.ShareHolderCode; this.ShareHolderName = shareHolder.Name; this.NumberOfShares = shareHolder.NumberOfShares; foreach (var item in statements) { var line = new VotingByHandLine() { StatementId = item.Id, StatementDesc = item.Description }; this.VotingByHandLines.Add(line); } }