示例#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);
        }
示例#2
0
        public void completeContractNoteItems(string pdfFilePath)
        {
            this.pdfFilePath = pdfFilePath;
            templateIsFound  = true;
            Rule rule = contractNote.ruleManager.getRuleWithSource(Path.GetDirectoryName(pdfFilePath));

            contractNoteItems[0].Value = rule.Instance;
            string securityCode, securityName;

            masterListManager.searchSecurityInfo(contractNoteItems[3].Value, contractNoteItems[4].Value, out securityCode, out securityName);
            contractNoteItems[3].Value  = securityCode;
            contractNoteItems[4].Value  = securityName;
            contractNoteItems[5].Value  = contractNoteItems[5].Value.Replace(" ", "");
            contractNoteItems[6].Value  = ContractNote.getAdjustedDate(contractNoteItems[6].Value);
            contractNoteItems[7].Value  = ContractNote.getAdjustedDate(contractNoteItems[7].Value);
            contractNoteItems[8].Value  = ContractNote.getAdjustedNumber(contractNoteItems[8].Value);
            contractNoteItems[9].Value  = ContractNote.getAdjustedCurrency(contractNoteItems[9].Value);
            contractNoteItems[10].Value = ContractNote.getAdjustedCurrency(contractNoteItems[10].Value);
            contractNoteItems[12].Value = ContractNote.getAdjustedCurrency(contractNoteItems[12].Value);
            contractNoteItems[13].Value = ContractNote.getAdjustedCurrency(contractNoteItems[13].Value);
            contractNoteItems[18].Value = ContractNote.getAdjustedNumber(contractNoteItems[18].Value);
            contractNoteItems[19].Value = ContractNote.getAdjustedCurrency(contractNoteItems[19].Value);
            contractNoteItems[23].Value = string.Format(@"{0}-{1}-{2}-{3}", contractNoteItems[0].Value, contractNoteItems[16].Value, contractNoteItems[1].Value, contractNoteItems[14].Value);
        }