示例#1
0
        private void AssignSADGood(Entities edc, SADGood sadGood)
        {
            switch (this.DisposalStatus.Value)
            {
            case Linq.DisposalStatus.SHMenthol:
            case Linq.DisposalStatus.Tobacco:
            case Linq.DisposalStatus.Overuse:
                this.Disposal2PCNID = Disposal2IPRIndex.IPR2PCNPCN;
                break;

            case Linq.DisposalStatus.Dust:
            case Linq.DisposalStatus.Waste:
            case Linq.DisposalStatus.Cartons:
            case Linq.DisposalStatus.TobaccoInCigaretes:
            case Linq.DisposalStatus.TobaccoInCigaretesDestinationEU:
            case Linq.DisposalStatus.TobaccoInCigaretesProduction:
            case Linq.DisposalStatus.TobaccoInCutfiller:
            case Linq.DisposalStatus.TobaccoInCutfillerDestinationEU:
            case Linq.DisposalStatus.TobaccoInCutfillerProduction:
                string  _productCodeNumber = sadGood.PCNTariffCode;
                PCNCode _pcn = PCNCode.Find(edc, IsDisposal, _productCodeNumber);
                if (_pcn == null)
                {
                    string _mtmp = "Cannot find pcn code: {0} for the good: {1} with IsDisposal set to {2}";
                    throw new InputDataValidationException(
                              "wrong PCN code in customs message", "PCN Code",
                              string.Format(_mtmp, _productCodeNumber, sadGood.GoodsDescription, IsDisposal),
                              true);
                }
                this.Disposal2PCNID = _pcn;
                break;

            case Linq.DisposalStatus.Invalid:
            case Linq.DisposalStatus.None:
            default:
                break;
            }
            this.SADDate          = sadGood.SADDocumentIndex.CustomsDebtDate;
            this.SADDocumentNo    = sadGood.SADDocumentIndex.DocumentNumber;
            this.CustomsProcedure = sadGood.SPProcedure;
            //TODO remove it
            if (this.JSOXCustomsSummaryIndex == null)
            {
                return;
            }
            this.JSOXCustomsSummaryIndex.SADDate = sadGood.SADDocumentIndex.CustomsDebtDate;
            this.JSOXCustomsSummaryIndex.ExportOrFreeCirculationSAD = sadGood.SADDocumentIndex.DocumentNumber;
            this.JSOXCustomsSummaryIndex.CustomsProcedure           = sadGood.SPProcedure;
            this.JSOXCustomsSummaryIndex.CompensationGood           = this.Disposal2PCNID.CompensationGood;
            this.JSOXCustomsSummaryIndex.RemainingQuantity          = this.RemainingQuantity;
        }
示例#2
0
        /// <summary>
        /// Adds the or get.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="productCodeNumber">The product code number.</param>
        /// <param name="title">The title.</param>
        /// <returns></returns>
        public static PCNCode AddOrGet(Entities entities, string productCodeNumber, string title)
        {
            PCNCode _pcncode = Find(entities, false, productCodeNumber);

            if (_pcncode == null)
            {
                _pcncode = new PCNCode()
                {
                    //TODO PCNCode - auto generation value of the column CompensationGood http://cas_sp:11225/sites/awt/Lists/TaskList/DispForm.aspx?ID=3341
                    CompensationGood  = "Tytoń",
                    Disposal          = false,
                    ProductCodeNumber = productCodeNumber,
                    Title             = title
                };
                entities.PCNCode.InsertOnSubmit(_pcncode);
                entities.SubmitChanges();
            }
            return(_pcncode);
        }