Esempio n. 1
0
        /// <summary>
        /// Insert on submit the disposal.
        /// </summary>
        /// <param name="edc">The _edc.</param>
        /// <param name="quantity">The quantity.</param>
        /// <param name="clearance">The clearance.</param>
        /// <exception cref="CAS">CAS.SmartFactory.IPR.WebsiteModel.Linq.AddDisposal;_qunt > 0;null</exception>
        public void AddDisposal(Entities edc, decimal quantity, Clearence clearance)
        {
            Disposal _dsp = AddDisposal(edc, DisposalEnum.Tobacco, ref quantity);

            _dsp.Clearance = clearance;
            if (quantity > 0)
            {
                string _msg = String.Format("Cannot add Disposal to IPR  {0} because there is not material on the IPR.", this.Id.Value);
                throw CAS.SharePoint.Web.GenericStateMachineEngine.ActionResult.Exception
                          (new CAS.SharePoint.ApplicationError("CAS.SmartFactory.IPR.WebsiteModel.Linq.AddDisposal", "_qunt > 0", _msg, null), _msg);
            }
        }
Esempio n. 2
0
 internal void ClearThroughCustom(InvoiceContent value, Action <Disposal> reCalculate)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value", "At ClearThroughCustom value cannot be null");
     }
     this.Disposal2InvoiceContentIndex = value;
     this.Clearance     = value.InvoiceIndex.ClearenceIndex;
     this.CustomsStatus = Linq.CustomsStatus.Started;
     this.InvoiceNo     = value.InvoiceIndex.BillDoc;
     reCalculate(this);
 }
Esempio n. 3
0
        /// <summary>
        /// Creates the clearance.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <param name="good">The good.</param>
        /// <returns></returns>
        public static Clearence CreataClearance(Entities entities, string procedure, ClearenceProcedure procedureCode, SADGood good)
        {
            Clearence _newClearance = CreateClearance(procedure, procedureCode);

            _newClearance.Clearence2SadGoodID = good;
            _newClearance.DocumentNo          = good.SADDocumentIndex.DocumentNumber;
            _newClearance.ReferenceNumber     = good.SADDocumentIndex.ReferenceNumber;
            _newClearance.UpdateTitle(entities);
            entities.Clearence.InsertOnSubmit(_newClearance);
            entities.SubmitChanges();
            _newClearance.UpdateTitle(entities);
            return(_newClearance);
        }
Esempio n. 4
0
        /// <summary>
        /// Starts the clearance and creates an object of <see cref="Clearence" />.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The customs procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <param name="trace">The trace action.</param>
        /// <returns>Return new <see cref="Clearence"/> entity.</returns>
        public static Clearence CreateClearance(Entities entities, string procedure, ClearenceProcedure procedureCode, NamedTraceLogger.TraceAction trace)
        {
            trace("Entering Clearence.CreateClearance", 98, TraceSeverity.Verbose);
            Clearence _newClearance = CreateClearance(procedure, procedureCode);

            entities.Clearence.InsertOnSubmit(_newClearance);
            _newClearance.UpdateTitle(entities);
            trace("Clearence.CreateClearance at SubmitChanges", 103, TraceSeverity.Verbose);
            entities.SubmitChanges();
            _newClearance.UpdateTitle(entities);
            trace("Finished Clearence.CreateClearance", 106, TraceSeverity.Verbose);
            return(_newClearance);
        }
Esempio n. 5
0
        private static Clearence CreateClearance(string code, ClearenceProcedure procedure)
        {
            Clearence _newClearence = new Clearence()
            {
                Archival           = false,
                DocumentNo         = String.Empty.NotAvailable(),
                ProcedureCode      = code,
                ReferenceNumber    = String.Empty.NotAvailable(),
                SPStatus           = false,
                ClearenceProcedure = procedure
            };

            return(_newClearence);
        }
Esempio n. 6
0
 /// <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));
     }
 }