Ejemplo n.º 1
0
        public DocumentProcessResults Process(DocumentProcessOptions processingOptions)
        {
            try
            {
                DocumentService docService   = new DocumentService();
                EmailService    emailService = new EmailService();

                DocumentProcessResults results = docService.ProcessEktronDocuments(processingOptions);
                Batch batch = docService.GetLastBatchRun(processingOptions.Site);
                emailService.SendEmailToRecipients(processingOptions.Site, batch.batchId);

                return(results);
            }
            catch (Exception e)
            {
                //TODO: Log Exception!
                //return false;
                return(new DocumentProcessResults
                {
                    Status = "ERROR: " + e.ToString(),
                    StartDate = processingOptions.StartDate,
                    EndDate = processingOptions.EndDate
                });
            }
        }
Ejemplo n.º 2
0
        private int PopulateNewBatchDocumentsRepeater()
        {
            DocumentProcessOptions processingOptions = CreateProcessingOptions();
            List <UpdatedDoc>      newBatchList      = docService.GetUpdatedDocumentList(processingOptions);

            rNewBatchDocuments.DataSource     = newBatchList;
            rNewBatchDocuments.ItemDataBound += new RepeaterItemEventHandler(rNewBatchDocuments_ItemDataBound);
            rNewBatchDocuments.DataBind();
            return(newBatchList.Count);
        }
Ejemplo n.º 3
0
        private DocumentProcessOptions CreateProcessingOptions()
        {
            string site  = ddlSite.SelectedItem.Text;
            Batch  batch = docService.GetLastBatchRun(site);
            DocumentProcessOptions processingOptions = new DocumentProcessOptions
            {
                Site      = site,
                StartDate = batch.endDate, //.Date, //TODO: GetStartDate(),
                EndDate   = DateTime.Now,  //.Date, //TODO: GetEndDate(),
                FileTypes = new List <string> {
                    "pdf", "doc"
                },                   //TODO: GetFileTypes(),
                TaxonomyName = null, //TODO: GetTaxonomyName()
            };

            return(processingOptions);
        }
Ejemplo n.º 4
0
        public void GetDocumentsFromEktronTest()
        {
            DocumentService_Accessor target = new DocumentService_Accessor();
            string site = "commercial.owenscorning.com";
            DocumentProcessOptions processingOptions = new DocumentProcessOptions
            {
                Site      = site,
                StartDate = DateTime.Now.AddDays(-90).Date,
                EndDate   = DateTime.Now.AddDays(-1).Date,
                FileTypes = new List <string> {
                    "pdf", "doc"
                },
            };
            //List<UpdatedDoc> expected = null; // TODO: Initialize to an appropriate value
            List <UpdatedDoc> actual;

            actual = target.GetDocumentsFromEktron(processingOptions);
            Assert.IsNotNull(actual);
            //Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Ejemplo n.º 5
0
        protected void bRunBatchSubmit_Click(object sender, EventArgs e)
        {
            listExcludeFromNewBatch = new List <int>();

            for (int i = rNewBatchDocuments.Items.Count - 1; i >= 0; i--)
            {
                RepeaterItem ritem = rNewBatchDocuments.Items[i];
                CheckBox     cbIncludeInNewBatch = (CheckBox)ritem.FindControl("cbIncludeInNewBatch");
                if (!cbIncludeInNewBatch.Checked)
                {
                    listExcludeFromNewBatch.Add(i);
                }
            }

            if (rNewBatchDocuments.Items.Count == listExcludeFromNewBatch.Count)
            {
                return;
            }

            DocumentProcessOptions processingOptions = CreateProcessingOptions();
            DocumentProcessResults results           = docService.ProcessEktronDocuments(processingOptions, listExcludeFromNewBatch);

            if (String.IsNullOrEmpty(results.Status) ||
                !results.Status.ToLower().Contains("error"))
            {
                emailService.SendEmailToRecipients(processingOptions.Site, results.BatchId);
            }
            else
            {
                //TODO: Log Error no Mail Sent
            }

            gvDocuments.Visible    = true;
            gvSendTo.Visible       = false;
            pnlRunNewBatch.Visible = false;

            ddlSite_SelectedIndexChanged(sender, e);
        }