Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AccountData" /> class.
        /// </summary>
        /// <param name="edc">The <see cref="Entities" /> object.</param>
        /// <param name="clearance">The clearance.</param>
        /// <param name="messageType">Type of the customs message.</param>
        /// <param name="warnings">The list of warnings.</param>
        /// <param name="trace">The trace.</param>
        public virtual void GetAccountData(Entities edc, Clearence clearance, MessageType messageType, List <Warnning> warnings, NamedTraceLogger.TraceAction trace)
        {
            trace("Entering AccountData.GetAccountData", 50, TraceSeverity.Verbose);
            DocumentNo = clearance.DocumentNo;
            DateTime _customsDebtDate = clearance.Clearence2SadGoodID.SADDocumentIndex.CustomsDebtDate.Value;

            this.CustomsDebtDate = _customsDebtDate;
            AnalizeGood(edc, clearance.Clearence2SadGoodID, messageType);
            IEnumerable <SADRequiredDocuments> _rdoc = clearance.Clearence2SadGoodID.SADRequiredDocuments(edc);

            this.Invoice = (from _dx in _rdoc
                            let CustomsProcedureCode = _dx.Code.ToUpper()
                                                       where CustomsProcedureCode.Contains("N380") || CustomsProcedureCode.Contains("N935")
                                                       select new { Number = _dx.Number }
                            ).First().Number;
            FindConsentRecord(edc, _rdoc, _customsDebtDate, warnings, trace);
            AnalyzeGoodsDescription(edc, clearance.Clearence2SadGoodID.GoodsDescription); //TODO to IPR
            PCNTariffCodeLookup = PCNCode.AddOrGet(edc, clearance.Clearence2SadGoodID.PCNTariffCode, TobaccoName).Id.Value;
        }