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); }
private Linq.Consent CreateDefaultConsent(Entities edc, string _nr, List <Customs.Warnning> warnings) { Linq.Consent _ret = Consent.DefaultConsent(edc, GetCustomsProcess(Process), _nr); string _msg = "Created default consent document with number: {0}. The Consent period is {1} months"; warnings.Add(new Customs.Warnning(String.Format(_msg, _nr, _ret.ConsentPeriod), false)); return(_ret); }
/// <summary> /// Initializes a new instance of the <see cref="IPR" /> class. /// </summary> /// <param name="entities">The entities.</param> /// <param name="iprdata">The _iprdata.</param> /// <param name="clearence">The clearence.</param> /// <param name="declaration">The declaration.</param> public IPR(Entities entities, CWInterconnection.IPRAccountData iprdata, Clearence clearence, SADDocumentType declaration) : this() { Linq.Consent _consentLookup = GetAtIndex <Consent>(entities.Consent, iprdata.ConsentLookup); AccountClosed = false; AccountBalance = iprdata.NetMass; Archival = false; Batch = iprdata.BatchId; Cartons = iprdata.CartonsMass; ClearenceIndex = clearence; ClosingDate = CAS.SharePoint.Extensions.SPMinimum; ConsentPeriod = _consentLookup.ConsentPeriod; Currency = declaration.Currency; CustomsDebtDate = iprdata.CustomsDebtDate; DocumentNo = clearence.DocumentNo; Duty = iprdata.Duty; DutyName = iprdata.DutyName; Grade = iprdata.GradeName; GrossMass = iprdata.GrossMass; InvoiceNo = iprdata.Invoice; IPRDutyPerUnit = iprdata.DutyPerUnit; IPRLibraryIndex = null; IPR2ConsentTitle = _consentLookup; IPR2PCNPCN = GetAtIndex <PCNCode>(entities.PCNCode, iprdata.PCNTariffCodeLookup); IPRUnitPrice = iprdata.UnitPrice; IPRVATPerUnit = iprdata.VATPerUnit; this.IPR2JSOXIndex = null; NetMass = iprdata.NetMass; OGLValidTo = iprdata.ValidToDate; ProductivityRateMax = _consentLookup.ProductivityRateMax; ProductivityRateMin = _consentLookup.ProductivityRateMin; SKU = iprdata.SKU; TobaccoName = iprdata.TobaccoName; TobaccoNotAllocated = iprdata.NetMass; Title = "-- creating -- "; Value = iprdata.Value; VATName = iprdata.VATName; VAT = iprdata.VAT; ValidFromDate = _consentLookup.ValidFromDate; ValidToDate = _consentLookup.ValidToDate; if (iprdata.CartonsMass > 0) { AddDisposal(entities, Convert.ToDecimal(iprdata.CartonsMass)); } }