Exemplo n.º 1
0
        public static bool isValidCandidateForField(string field, string candidate)
        {
            int fieldIndex = getIndexForField(field);

            switch (fieldIndex)
            {
            case 3:    //Security Code
                return(MasterListManager.isExistSecurityCode(candidate));

            case 5:    //Contract Type
                return(ContractNote.isEqual(candidate, "SELL") || ContractNote.isEqual(candidate, "BUY"));
            }
            if (fieldType[fieldIndex] == 'C')
            {
                return(ContractNote.getValidationOfCurrency(ContractNote.getAdjustedCurrency(candidate)));
            }
            if (fieldType[fieldIndex] == 'D')
            {
                return(ContractNote.getValidationOfDate(ContractNote.getAdjustedDate(candidate)));
            }
            if (fieldType[fieldIndex] == 'M')
            {
                if (candidate.Length >= 4 && candidate[candidate.Length - 4] == '-')
                {
                    candidate = candidate.Remove(candidate.Length - 4, 1).Substring(1);
                }
                return(candidate.Length > 1 && ContractNote.getValidationOfNumber(candidate.Substring(1)));
            }
            return(candidate.Length > 0);
        }
Exemplo n.º 2
0
 public static int getIndexForField(string field)
 {
     for (int i = 0; i < FIELD_COUNT; i++)
     {
         if (ContractNote.isEqual(field, fields[i]))
         {
             return(i);
         }
     }
     return(-1);
 }
Exemplo n.º 3
0
 public void searchSecurityInfo(string code, string name, out string securityCode, out string securityName)
 {
     name = getFilteredName(name);
     for (int i = 0; i < count; i++)
     {
         if (ContractNote.isEqual(securityNameList[i], name, 0.95))
         {
             securityCode = securityCodeList[i];
             securityName = securityNameList[i];
             return;
         }
     }
     securityCode = getFilteredCode(code);
     securityName = name;
 }
Exemplo n.º 4
0
 bool isInstance(List <Word> wordList)
 {
     for (int i = 0; i < wordList.Count; i++)
     {
         if (ContractNote.isEqual(contractNoteTemplateId, wordList[i].word))
         {
             return(true);
         }
         if (wordList[i].word.Contains(contractNoteTemplateId))
         {
             return(true);
         }
     }
     return(false);
 }
        public string getCandidate(ContractNoteTemplateFieldCandidate fieldCandidate, List <Word> wordList)
        {
            if (!ContractNote.isEqual(fieldCandidate.key, word))
            {
                return(null);
            }

            string referenceWord = findAdjacencyWord(fieldCandidate, wordList, fieldCandidate.referenceDirection);

            if (referenceWord == null)
            {
                return(null);
            }
            if (!referenceWord.Equals("NULL") && !ContractNote.isPrefix(fieldCandidate.referenceFieldPrefix, referenceWord))
            {
                return(null);
            }

            return(findAdjacencyWord(fieldCandidate, wordList, fieldCandidate.valueDirection, false));
        }