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);
        }
Exemple #2
0
 private static void GetSADRequiredDocuments(RequiredDocumentsDescription[] document, Entities edc, SADGood entry)
 {
     try
     {
         if (document.NullOrEmpty <RequiredDocumentsDescription>())
         {
             return;
         }
         List <SADRequiredDocuments> rows = new List <SADRequiredDocuments>();
         foreach (RequiredDocumentsDescription requiredDocument in document)
         {
             SADRequiredDocuments newRow = new SADRequiredDocuments()
             {
                 SADRequiredDoc2SADGoodID = entry,
                 Title  = String.Format("{0}: {1}", requiredDocument.GetCode(), requiredDocument.GetNumber()),
                 Code   = requiredDocument.GetCode(),
                 Number = requiredDocument.GetNumber()
             };
             rows.Add(newRow);
         }
         if (rows.Count == 0)
         {
             return;
         }
         edc.SADRequiredDocuments.InsertAllOnSubmit(rows);
         edc.SubmitChanges();
     }
     catch (Exception ex)
     {
         throw new IPRDataConsistencyException("GetSADRequiredDocuments", ex.Message, ex, "Required documents analysis problem");
     }
 }