Example #1
0
        private static void ProcessAdLibFileGen()
        {
            ProcessLogObject.Add("Processing AdLib File Generation");
            var sorts = SortMainObject.GetSortNeedingAdlibDocument();

            if (sorts != null && sorts.Count > 0)
            {
                foreach (var sort in sorts)
                {
                    if (SortAttachmentObject.GetFinalDocAttachment(sort.SortMainId.Value) != null)
                    {
                        ProcessLogObject.Add(sort.SortMainId, $"Processing AdLib File");

                        bool   success = false;
                        byte[] file    = Config.DigitalLibraryManager.GenerateExportFile(sort.SortMainId.Value, sort.CoverPageRequired, ref success);
                        if (success)
                        {
                            SortAttachmentObject.AddOstiAttachment(sort.SortMainId.Value, $"Sort_{sort.SortMainId}.pdf", "System", file.Length, file);
                            ProcessLogObject.Add(sort.SortMainId, $"AdLib File Generation was Successful");
                        }
                        else
                        {
                            ProcessLogObject.Add(sort.SortMainId, $"AdLib File Generation Failed");
                        }
                    }
                }
            }
        }
Example #2
0
        public ActionResult CreateOstiDocument(int?id, bool?aRtn)
        {
            if (id.HasValue)
            {
                ProcessLogObject.Add(id, "Start CreateOstiDocument");

                if (SortAttachmentObject.GetFinalDocAttachment(id.Value) != null)
                {
                    bool   success = false;
                    byte[] file    = Config.DigitalLibraryManager.GenerateExportFile(id.Value, SortMainObject.GetSortMain(id.Value).CoverPageRequired, ref success);
                    if (success)
                    {
                        SortAttachmentObject.AddOstiAttachment(id.Value, $"Sort_{id}.pdf", UserObject.CurrentUser.EmployeeId, file.Length, file);
                    }
                    else
                    {
                        TempData.Add("FailMessage", "AdLib Failed to generate the OSTI File! Please try again.");
                    }
                }

                ProcessLogObject.Add(id, "End CreateOstiDocument");
            }

            if (aRtn.HasValue && aRtn.Value)
            {
                return(RedirectToAction("Index", "Artifact", new { id }));
            }

            return(RedirectToAction("Index", "Home"));
        }
Example #3
0
        static void Main(string[] args)
        {
            Write("Starting");
            Config.IsConsoleMode = true;

            try
            {
                ImportFromLrs();
            }
            catch (Exception ex)
            {
                ErrorLogObject.LogError("Console:Main", ex);
                ProcessLogObject.Add("Failed in Main ImportFromLrs", ex.Message);
            }

            try
            {
                ProcessOneYearReminders();
            }
            catch (Exception ex)
            {
                ErrorLogObject.LogError("Console:Main", ex);
                ProcessLogObject.Add("Failed in Main ProcessOneYearReminders", ex.Message);
            }

            try
            {
                ProcessDelayedReminders();
            }
            catch (Exception ex)
            {
                ErrorLogObject.LogError("Console:Main", ex);
                ProcessLogObject.Add("Failed in Main ProcessDelayedReminders", ex.Message);
            }

            try
            {
                ProcessAdLibFileGen();
            }
            catch (Exception ex)
            {
                ErrorLogObject.LogError("Console:Main", ex);
                ProcessLogObject.Add("Failed in Main ProcessAdLibFileGen", ex.Message);
            }

            Config.LastUpdateTime = DateTime.Now;

            Write("Done");
//#if DEBUG
//            System.Console.ReadKey();
//#endif
        }
Example #4
0
        private IHttpActionResult DeleteArtifact(int sortId)
        {
            bool result = false;

            var sort = SortMainObject.GetSortMain(sortId);

            if (sort != null && sort.StatusEnum != StatusEnum.Cancelled)
            {
                ProcessLogObject.Add(sort.SortMainId.Value, "Removed Entry");
                sort.StatusEnum = StatusEnum.Cancelled;
                sort.Save();
                result = true;
            }

            return(Ok(result));
        }
Example #5
0
 private static void ImportFromLrs()
 {
     ProcessLogObject.Add("Retriving LRS Records to Process");
     LrsObject.ImportLatest();
     ProcessLogObject.Add("LRS Successfully Processed.");
 }