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); }
public ContractNoteItemManager(ContractNote contractNote) { masterListManager = new MasterListManager(); this.contractNote = contractNote; for (int i = 0; i < FIELD_COUNT; i++) { contractNoteItems[i] = new ContractNoteItem(fields[i]); } clear(); }