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 }); } }
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); }