Beispiel #1
0
        private void AddDocuments(InterlexCrawlerEntities.DocumentGroup newDocumentGroup, DocumentGroupModel crawleredDocumentGroup)
        {
            var documentOrder = 1;

            foreach (var crawledDocument in crawleredDocumentGroup.Documents)
            {
                var fileLower = crawledDocument.Name.ToLower();
                var document  = new InterlexCrawlerEntities.Document();
                document.DocumentName   = fileLower;
                document.Identifier     = crawledDocument.Identifier;
                document.DocumentFormat = crawledDocument.Format;
                document.Operation      = (int)crawledDocument.Operation;
                document.DocumentOrder  = documentOrder;
                document.Url            = crawledDocument.Url;
                document.Md5            = crawledDocument.Md5;

                newDocumentGroup.Documents.Add(document);

                documentOrder++;
            }
        }
Beispiel #2
0
        private void AddDocumentGroup(DocumentGroupModel crawledDocumentGroup)
        {
            var newDocumentGroup = new InterlexCrawlerEntities.DocumentGroup();

            newDocumentGroup.CrawlerId           = crawledDocumentGroup.CrawlerId;
            newDocumentGroup.Identifier          = Guid.NewGuid().ToString();
            newDocumentGroup.DocumentGroupName   = crawledDocumentGroup.Name;
            newDocumentGroup.DocumentGroupFormat = "application/zip";
            newDocumentGroup.Lang              = crawledDocumentGroup.TwoLetterLanguage;
            newDocumentGroup.Operation         = (int)DocumentGroupModelOperation.Add;
            newDocumentGroup.DocumentGroupDate = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss");

            // Byte Array Data
            newDocumentGroup.DataContent = Zip.DocumentGroup(crawledDocumentGroup);
            this.AddDocuments(newDocumentGroup, crawledDocumentGroup);

            using (var context = new InterlexCrawlerEntities())
            {
                context.DocumentGroups.Add(newDocumentGroup);
                context.SaveChanges();
                context.PChangeOperationStatus(newDocumentGroup.Identifier, (int)DocumentGroupModelOperation.Add, "DatabaseDocumentManager", null);
            }
        }