Example #1
0
        public async Task SaveAsycudaDocument(AsycudaDocumentSet docSet, DocInfo docInfo)
        {
            if (docSet != null)
            {
                if (docSet.Declarant_Reference_Number == "Search Results")
                {
                    return;
                    //  SaveSearchResults();
                }

                UpdateDocSet(docSet, docInfo);
                foreach (var cdoc in docSet.Documents.Where(x => x.xcuda_ASYCUDA_ExtendedProperties.AutoUpdate == true))
                {
                    cdoc.SetupProperties();

                    BaseDataModel.Instance.IntCdoc(cdoc, docSet.Document_Type, docSet);
                }
            }
            else
            {
                //Create New AsycudaDocumentset
                docSet = await CreateNewAsycudaDocumentSet().ConfigureAwait(false);
            }


            using (var ctx = new AsycudaDocumentSetService())
            {
                await ctx.UpdateAsycudaDocumentSet(docSet).ConfigureAwait(false);
            }
        }
Example #2
0
 void UpdateDocSet(AsycudaDocumentSet dset, DocInfo docInfo = null)
 {
     if (docInfo != null)
     {
         dset.Declarant_Reference_Number = docInfo.DeclarantReferenceNumber;
         dset.Customs_ProcedureId        = docInfo.Customs_ProcedureId;
         if (docInfo.Description != null)
         {
             dset.Description = docInfo.Description;
         }
         if (docInfo.Currency_Code != null)
         {
             dset.Currency_Code = docInfo.Currency_Code;
         }
         dset.Document_TypeId = docInfo.Document_TypeId;
         dset.Exchange_Rate   = docInfo.Exchange_Rate;
         if (docInfo.Country_of_origin_code != null)
         {
             dset.Country_of_origin_code = docInfo.Country_of_origin_code;
         }
         if (docInfo.ManifestNumber != null)
         {
             dset.Manifest_Number = docInfo.ManifestNumber;
         }
         if (docInfo.BlNumber != null)
         {
             dset.BLNumber = docInfo.BlNumber;
         }
         // dset.TotalGrossWeight = docInfo.TotalGrossWeight;
     }
 }
Example #3
0
 public async Task SaveAsycudaDocument(xcuda_ASYCUDA doc, DocInfo docInfo)
 {
     if (doc != null &&
         doc.xcuda_ASYCUDA_ExtendedProperties.AutoUpdate == false)
     {
         UpdateDocument(doc, docInfo);
     }
 }
Example #4
0
        private void UpdateDocument(xcuda_ASYCUDA doc, DocInfo docInfo)
        {
            if (doc != null || doc.xcuda_ASYCUDA_ExtendedProperties.AutoUpdate == false)
            {
                doc.SetupProperties();
                doc.xcuda_Declarant.Number = docInfo.DeclarantReferenceNumber;

                if (docInfo.Description != null)
                {
                    doc.xcuda_ASYCUDA_ExtendedProperties.Description = docInfo.Description;
                }
                if (docInfo.Currency_Code != null)
                {
                    doc.xcuda_Valuation.xcuda_Gs_Invoice.Currency_code = docInfo.Currency_Code;
                }
                doc.xcuda_ASYCUDA_ExtendedProperties.Document_TypeId = docInfo.Document_TypeId;
                var dt = BaseDataModel.Instance.Document_Types.FirstOrDefault(x => x.Document_TypeId == docInfo.Document_TypeId);
                if (dt != null)
                {
                    doc.xcuda_Identification.xcuda_Type.Declaration_gen_procedure_code =
                        dt.Declaration_gen_procedure_code;
                    doc.xcuda_Identification.xcuda_Type.Type_of_declaration = dt.Type_of_declaration;
                }

                doc.xcuda_Valuation.xcuda_Gs_Invoice.Currency_rate = (float)docInfo.Exchange_Rate;
                if (docInfo.Country_of_origin_code != null)
                {
                    doc.xcuda_General_information.xcuda_Country.Country_first_destination = docInfo.Country_of_origin_code;
                }

                if (docInfo.ManifestNumber != null)
                {
                    doc.xcuda_Identification.Manifest_reference_number = docInfo.ManifestNumber;
                }
                if (docInfo.BlNumber != null)
                {
                    doc.xcuda_ASYCUDA_ExtendedProperties.BLNumber = docInfo.BlNumber;
                }

                //if (doc.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure == null || doc.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure.Customs_ProcedureId != CustomsProcedureId)
                //{

                var c = new Customs_Procedure();
                c = BaseDataModel.Instance.Customs_Procedures.FirstOrDefault(x => x != null && x.Customs_ProcedureId == docInfo.Customs_ProcedureId);
                if (c == null && docInfo.Document_TypeId != null)
                {
                    c = BaseDataModel.Instance.Document_Types.FirstOrDefault(x => x.Document_TypeId == docInfo.Document_TypeId).DefaultCustoms_Procedure;
                }
                if (c != null)
                {
                    //TODO: implement this
                    //foreach (var item in doc.PreviousDocumentItem
                    //    .Where(x => x.xcuda_Tarification.Extended_customs_procedure != c.Extended_customs_procedure
                    //            || x.xcuda_Tarification.National_customs_procedure != c.National_customs_procedure).ToList())
                    //{
                    //    item.xcuda_Tarification.Extended_customs_procedure = c.Extended_customs_procedure;
                    //    item.xcuda_Tarification.National_customs_procedure = c.National_customs_procedure;
                    //}
                }
                doc.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure   = c;
                doc.xcuda_ASYCUDA_ExtendedProperties.Customs_ProcedureId = docInfo.Customs_ProcedureId;

                var b = docInfo.BlNumber;
                //TODO: Implement this
                //foreach (var item in doc.PreviousDocumentItem.Where(x => x.xcuda_Previous_doc.Summary_declaration != b).ToList())
                //{
                //    item.xcuda_Previous_doc.Summary_declaration = BlNumber;
                //}

                doc.xcuda_ASYCUDA_ExtendedProperties.BLNumber = docInfo.BlNumber;
            }
        }