private void CalculateWinners(Raffle raffle) { foreach (var item in raffle.RaffleItems) { HeapInsertRollsFor(raffle.RaffleParticipants); GetWinnersFor(item); } }
public RaffleWinners(Raffle raffle) { Raffle = raffle; heap = new PriorityQueue<RaffleParticipant, int>(new ExtractMax()); random = new RNGCryptoServiceProvider(); Winners = new ObservableCollection<Winner>(); CalculateWinners(Raffle); }
public RaffleModel(Raffle entity) { RaffleId = entity.RaffleId; Name = entity.Name; Description = entity.Description; Location = entity.Location; ExecutionCount = entity.ExecutionCount; RaffleParticipants = new ObservableCollection<RaffleParticipant>( entity.RaffleParticipants); RaffleItems = new ObservableCollection<RaffleItem>( entity.RaffleItems); Winners = entity.Winners != null ? new ObservableCollection<Winner>(entity.Winners) : new ObservableCollection<Winner>(); }
private void AddRaffle() { var raffle = new Raffle { Name = "<Enter Name, and Select Items and Participants>", Location = new ContactDetails() { Address1 = "<Enter Location and Contact Details>" }, RaffleParticipants = new ObservableCollection<RaffleParticipant>(), RaffleItems = new ObservableCollection<RaffleItem>() }; uow.Raffles.Add(raffle); SelectedRaffle = new RaffleModel(raffle); Raffles.Add(SelectedRaffle); ClearSelectedItems(); ClearSelectedParticipants(); }