private void FindConsentRecord(Entities edc, IEnumerable <SADRequiredDocuments> sadRequiredDocumentsEntitySet, DateTime customsDebtDate, List <Customs.Warnning> warnings, NamedTraceLogger.TraceAction trace) { trace("Entering AccountData.FindConsentRecord", 130, TraceSeverity.Verbose); SADRequiredDocuments _rd = (from _dx in sadRequiredDocumentsEntitySet let CustomsProcedureCode = _dx.Code.ToUpper() where CustomsProcedureCode.Contains(GlobalDefinitions.CustomsProcedureCodeC600) || CustomsProcedureCode.Contains(GlobalDefinitions.CustomsProcedureCodeC601) || CustomsProcedureCode.Contains(GlobalDefinitions.CustomsProcedureCode1PG1) select _dx ).FirstOrDefault(); Linq.Consent _cnst = null; if (_rd == null) { string _msg = "There is not attached any consent document with code = C600/C601/1PG1"; warnings.Add(new Customs.Warnning(_msg, false)); trace("Wanning ay AccountData.FindConsentRecord: " + _msg, 143, TraceSeverity.Monitorable); _cnst = CreateDefaultConsent(edc, String.Empty.NotAvailable(), warnings); } else { string _nr = _rd.Number.Trim(); _cnst = Consent.Find(edc, _nr); if (_cnst == null) { _cnst = CreateDefaultConsent(edc, _nr, warnings); } this.ConsentLookup = _cnst.Id.Value; } this.SetValidToDate(customsDebtDate, _cnst); }