Example #1
0
File: Ocr.cs Project: nico-izo/KOIB
 internal static extern int SetPollData(int iBallot, int iPoll, ref PollData pData);
Example #2
0
 private void CreateBulletinModel(int bulletinNum, SourceData sourceData)
 {
     byte[] data = ConvertModelText(sourceData.Blanks[bulletinNum].Model);
     int buletinCode = sourceData.Blanks[bulletinNum].Marker;
     if (Ocr.Ocr.createBallotModel(data, bulletinNum, buletinCode) != 1)
         Ocr.Ocr.ThrowLastError();
     for (int i = 0; i < sourceData.Blanks[bulletinNum].Sections.Length; i++)
     {
         var election = sourceData.GetElectionByNum(sourceData.Blanks[bulletinNum].Sections[i]);
         var pd = new PollData();
         int candCount = election.Candidates.Length;
         int maxMarks = election.MaxMarks;
         if (candCount != 0)
         {
             pd.polltype = (maxMarks <= 1) ? (int)PollType.Single : (int)PollType.Multi;
             pd.totalNum = candCount;
             pd.MinValid = 1;
             pd.MaxValid = maxMarks;
         }
         else
         {
             pd.polltype = (int)PollType.Referendum;
         }
         if (Ocr.Ocr.SetPollData(bulletinNum, i, ref pd) != 1)
             Ocr.Ocr.ThrowLastError();
     }
 }