Exemple #1
0
 private void CalculateWinners(Raffle raffle)
 {
     foreach (var item in raffle.RaffleItems) {
         HeapInsertRollsFor(raffle.RaffleParticipants);
         GetWinnersFor(item);
     }
 }
Exemple #2
0
        public RaffleWinners(Raffle raffle)
        {
            Raffle = raffle;
            heap = new PriorityQueue<RaffleParticipant, int>(new ExtractMax());
            random = new RNGCryptoServiceProvider();
            Winners = new ObservableCollection<Winner>();

            CalculateWinners(Raffle);
        }
Exemple #3
0
        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();
 }