public override void Deduct(ParticipationRecord ParticipationRecord)
        {
            ArcheryParticipationRecord archeryRecord = (ArcheryParticipationRecord)ParticipationRecord;
            War -= archeryRecord.War;
            Demo -= archeryRecord.Demo;
            for (int i = archeryRecord.BowmanParticipations; i >0; i--)
            {
                if (BowmanParticipations > 0)
                    BowmanParticipations--;
                else if (HuntsmanParticipations > 0)
                    HuntsmanParticipations--;
                else
                    BowmanParticipations--;
            }
            for (int i = archeryRecord.BowmanWins; i >0; i--)
            {
                if (BowmanWins > 0)
                    BowmanWins--;
                else if (HuntsmanWins > 0)
                    HuntsmanWins--;
                else
                    BowmanWins--;
            }

            HuntsmanParticipations -= archeryRecord.HuntsmanParticipations;
            HuntsmanWins -= archeryRecord.HuntsmanWins;
        }
 public override void Deduct(ParticipationRecord ParticipationRecord)
 {
     MinistryParticipationRecord minRecord = (MinistryParticipationRecord)ParticipationRecord;
     Participation -= minRecord.Participation;
     War -= minRecord.War;
     Demo -= minRecord.Demo;
     DemoInitiation -= minRecord.DemoInitiation;
 }
 protected override bool DoesRankMeetCriteria(ParticipationRecord record)
 {
     MinistryParticipationRecord minRecord = (MinistryParticipationRecord)record.Photocopy();
     minRecord.Deduct(this.minimumRecordForRank);
     return (minRecord.Demo >= 0 &&
             minRecord.DemoInitiation >= 0 &&
             minRecord.War >= 0 &&
             minRecord.Participation >= 0);
 }
 protected override string ExplainMissingRequirements(ParticipationRecord record)
 {
     StringBuilder explanationBuilder = new StringBuilder("Requirements Missing For " + this.GetRankName() + ": ");
     MinistryParticipationRecord testRecord = (MinistryParticipationRecord)record.Photocopy();
     testRecord.Deduct(this.minimumRecordForRank);
     explanationBuilder.Append(GetFriendlyMissingMessage("Ministry Participations", testRecord.Participation));
     explanationBuilder.Append(GetFriendlyMissingMessage("demonstration initiations", testRecord.DemoInitiation));
     explanationBuilder.Append(GetFriendlyMissingMessage("war participations", testRecord.War));
     explanationBuilder.Append(GetFriendlyMissingMessage("demonstrations", testRecord.Demo));
     return explanationBuilder.ToString();
 }
        protected override bool DoesRankMeetCriteria(ParticipationRecord record)
        {
            ArcheryParticipationRecord archeryRecord = (ArcheryParticipationRecord)record.Photocopy();
            archeryRecord.Deduct(this.minimumRecordForRank);

            return (archeryRecord.BowmanParticipations >= 0 &&
                    archeryRecord.BowmanWins >= 0 &&
                    archeryRecord.Demo >= 0 &&
                    archeryRecord.HuntsmanParticipations >= 0 &&
                    archeryRecord.HuntsmanWins >= 0 &&
                    archeryRecord.War >= 0);
        }
        protected override bool DoesRankMeetCriteria(ParticipationRecord record)
        {
            ArtsParticipationRecord artsRecord = (ArtsParticipationRecord)record.Photocopy();
               artsRecord.Deduct(this.minimumRecordForRank);

               return (artsRecord.DemoParticipations >= 0 &&
                    artsRecord.JourneymanListParticipations >= 0 &&
                    artsRecord.JourneymanListWins >= 0 &&
                    artsRecord.KnightsListParticipations >= 0 &&
                    artsRecord.KnightsListWins >= 0 &&
                    artsRecord.MasterworksMade >= 0 &&
                    artsRecord.WarParticipations >= 0);
        }
        protected override bool DoesRankMeetCriteria(ParticipationRecord record)
        {
            CombatParticipationRecord testRecord = (CombatParticipationRecord)record.Photocopy();
            testRecord.Deduct(this.minimumRecordForRank);

            return (testRecord.DemonstrationParticipations >= 0 &&
                    testRecord.WarParticipations >= 0 &&
                    testRecord.SergeantsListParticipations >= 0 &&
                    testRecord.SergeantsListWins >= 0 &&
                    testRecord.KnightsListParticipations >= 0 &&
                    testRecord.KnightsListWins >= 0 &&
                    testRecord.KnightsListArmoredParticipations >= 0 &&
                    testRecord.KnightsListArmoredWins >= 0);
        }
        protected override string ExplainMissingRequirements(ParticipationRecord record)
        {
            StringBuilder explanationBuilder = new StringBuilder("Requirements Missing For " + this.GetRankName() + ": ");
               ArtsParticipationRecord testRecord = (ArtsParticipationRecord)record.Photocopy();
               testRecord.Deduct(this.minimumRecordForRank);

               explanationBuilder.Append(GetFriendlyMissingMessage("demonstrations", testRecord.DemoParticipations));
               explanationBuilder.Append(GetFriendlyMissingMessage("war participations", testRecord.WarParticipations));
               explanationBuilder.Append(GetFriendlyMissingMessage("Journeyman's List Participations", testRecord.JourneymanListParticipations));
               explanationBuilder.Append(GetFriendlyMissingMessage("Journeyman's List Wins", testRecord.JourneymanListWins));
               explanationBuilder.Append(GetFriendlyMissingMessage("Knights's List Participations", testRecord.KnightsListParticipations));
               explanationBuilder.Append(GetFriendlyMissingMessage("Knights's List Wins", testRecord.KnightsListWins));
               explanationBuilder.Append(GetFriendlyMissingMessage("Masterworks Made", testRecord.MasterworksMade));
               return explanationBuilder.ToString();
        }
 protected override string ExplainMissingRequirements(ParticipationRecord record)
 {
     StringBuilder explanationBuilder = new StringBuilder("Requirements Missing For " + this.GetRankName()+": ");
     CombatParticipationRecord testRecord = (CombatParticipationRecord)record.Photocopy();
     testRecord.Deduct(this.minimumRecordForRank);
     explanationBuilder.Append(GetFriendlyMissingMessage("demonstrations", testRecord.DemonstrationParticipations));
     explanationBuilder.Append(GetFriendlyMissingMessage("war participations", testRecord.WarParticipations));
     explanationBuilder.Append(GetFriendlyMissingMessage("Sergeant's List Participations", testRecord.SergeantsListParticipations));
     explanationBuilder.Append(GetFriendlyMissingMessage("Sergeant's List Wins", testRecord.SergeantsListWins));
     explanationBuilder.Append(GetFriendlyMissingMessage("Knight's List Participations", testRecord.KnightsListParticipations));
     explanationBuilder.Append(GetFriendlyMissingMessage("Knight's List Wins", testRecord.KnightsListWins));
     explanationBuilder.Append(GetFriendlyMissingMessage("Knight's List (Armored) Participations", testRecord.KnightsListArmoredParticipations));
     explanationBuilder.Append(GetFriendlyMissingMessage("Knight's List (Armored) Wins", testRecord.KnightsListArmoredWins));
     return explanationBuilder.ToString();
 }
        public override void Deduct(ParticipationRecord ParticipationRecord)
        {
            CombatParticipationRecord combatParticipationRecord = (CombatParticipationRecord)ParticipationRecord;
            //Demo points are isolated.
            DemonstrationParticipations -= combatParticipationRecord.DemonstrationParticipations;
            //War points are isolated.
            WarParticipations -= combatParticipationRecord.WarParticipations;

            //Sergeant's List Participations.
            for (int i = combatParticipationRecord.SergeantsListParticipations; i > 0; i--)
            {
                //Need sergeant's list? Start with sergeant's list.
                if (SergeantsListParticipations > 0)
                    SergeantsListParticipations--;
                //All out of sergeant's list?  You can use knight's list.
                else if (KnightsListParticipations > 0)
                    KnightsListParticipations--;
                //doh.  This is going to fail.
                else
                    SergeantsListParticipations--;
            }

            //Sergeant's List Wins.
            for (int i = combatParticipationRecord.SergeantsListWins; i > 0; i--)
            {
                if (SergeantsListWins > 0)
                    SergeantsListWins--;
                else if (KnightsListWins > 0)
                    KnightsListWins--;
                else if (KnightsListArmoredWins > 0)
                    KnightsListArmoredWins--;
                else
                    SergeantsListWins--;

            }

            //Knight's List Participations.
            KnightsListParticipations -= combatParticipationRecord.KnightsListParticipations;

            //Knight's List Wins.
            KnightsListWins -= combatParticipationRecord.KnightsListWins;

            //Knight's List Armored Participation
            KnightsListArmoredParticipations -= combatParticipationRecord.KnightsListArmoredParticipations;

            //Knight's List Armored Wins
            KnightsListArmoredWins -= combatParticipationRecord.KnightsListArmoredWins;
        }
Beispiel #11
0
        public void RegisterUserParticipation(int billId, string userId)
        {
            var bill = _db.Single <BillDataModel>(b => b.Id == billId);
            var user = _db.Single <ApplicationUser>(u => u.Id == userId);

            var participationRecord = new ParticipationRecord()
            {
                UserId = user.Id,
                BillId = bill.Id,
                Stage  = bill.Stage,
                House  = bill.House
            };

            _db.Add <ParticipationRecord>(participationRecord);
            _db.CommitChanges();
        }
 protected override void ConsumeRecord(ParticipationRecord record)
 {
     record.Deduct(this.minimumRecordForRank);
 }