Exemple #1
0
        private DataBase.IncomeDocument MapToDomainIncomeDocument(IncomeDocument incomeDocument)
        {
            var doc = new DataBase.IncomeDocument();

            doc.DocumentId     = incomeDocument.DocumentId;
            doc.Date           = incomeDocument.Date;
            doc.DocType        = incomeDocument.DocType;
            doc.ProcessedDate  = incomeDocument.ProcessedDate;
            doc.Receiver       = incomeDocument.Receiver;
            doc.Sender         = incomeDocument.Sender;
            doc.SenderSysId    = incomeDocument.SenderSysId;
            doc.Version        = incomeDocument.Version;
            doc.Status         = incomeDocument.Status;
            doc.SysId          = incomeDocument.SysId;
            doc.FileUploadtype = incomeDocument.FileUploadtype;
            doc.RequestId      = incomeDocument.RequestId;

            return(doc);
        }
Exemple #2
0
        protected override void Execute()
        {
            DateTime = DateTime.Now;

            if (GetLastIastDocument() == false)
            {
                return;
            }

            if (lastDocuments.Count() == 0)
            {
                var dateTime = DateTime.Parse(setting.GetValue("StartDateTime"));
                lastDocuments = new List <IncomeDocument>()
                {
                    new IncomeDocument()
                    {
                        ProcessedDate = dateTime
                    }
                };
            }

            var index = 0;

            do
            {
                LoadIncomeDocumentList(index);

                if (incomeDocumentList.Error == null)
                {
                    if (incomeDocumentList.Documents.Count() > 0)
                    {
                        foreach (var i in incomeDocumentList.Documents)
                        {
                            if (lastDocuments.Any((x) => x.DocumentId != i.DocumentId))
                            {
                                incomeDocument = i;

                                if (AddDataBase() == false)
                                {
                                    return;
                                }

                                linkLoader.Process(incomeDocument);

                                Log.WriteInfo(LoadMessage + incomeDocument.DocumentId);
                            }
                        }
                    }
                    else
                    {
                        Log.WriteInfo(NotExitDocumentMessage);
                    }

                    index += incomeDocumentList.Documents.Count();
                }
                else
                {
                    if (incomeDocumentList.Error is ServiceError ||
                        ((MDLPError)incomeDocumentList.Error).HttpStatusCode == HttpStatusCode.Unauthorized ||
                        ((MDLPError)incomeDocumentList.Error).HttpStatusCode == HttpStatusCode.Forbidden)
                    {
                        mDLPClientAdapter.Reboot();
                    }

                    continue;
                }

                Thread.Sleep(MillisecondCount);
            } while (incomeDocumentList.Error == null && incomeDocumentList.Documents.Count() > 0);

            if (Sleep() == false)
            {
                return;
            }
        }