private void GiveMandatesToInitiaitiveCandidatesInMirs(int mirsCount, int partiesCountTable1, bool[] workingPartyFlagsTable1, int[,] votesTable1, decimal[] _mirMandateQuotesTable1)
{
Logger.logger.Info("\r\n==Определяне на мандати за независими кандидате==");
//check which INITIATIVE candidates pass the mir quote and give them a MANDATE
int initPartiesCount = _partiesAll.Count(p => p.Type == PartyType.InitCommittee);
int[,] _givenMandatesTable1 = new int[mirsCount, partiesCountTable1];
Logger.logger.InfoFormat("Брой инициативни комитети: {0}", initPartiesCount);
if (initPartiesCount > 0)
{
for (int i = 0; i < partiesCountTable1; i++)
{
if (_partiesAll[i].Type != PartyType.InitCommittee)
{
continue;
}
for (int j = 0; j < mirsCount; j++)
{
int partyMirVotesCnt = votesTable1[j, i];
decimal mirMandateQuote = _mirMandateQuotesTable1[j];
if (partyMirVotesCnt > mirMandateQuote)
{
Logger.logger.InfoFormat("Инициативен комитет {0} има {1} вота в МИР {2} ({3} от {4}) и получава мандат", _partiesAll[i].DisplayName, partyMirVotesCnt, _mirsAll[j].DisplayName, partyMirVotesCnt >= mirMandateQuote ? ">=" : "<", mirMandateQuote);
_givenMandatesTable1[j, i] += 1;
_mirMandatesAvailable[j] -= 1;
//INITITIVE COMMITTEE can have only 1 mandate in only 1 MIR
_results.Add(new Result { MirId = _mirsAll[i].Id, PartyId = _partiesAll[i].Id, MandatesCount = 1 });
}
workingPartyFlagsTable1[i] = false;
//Logger.logger.InfoFormat("{0} excluded from working parties", _parties[i].DisplayName);
}
}
}
else
{
Logger.Info("Няма разпределяне на мандати за независими кандидати");
}
}