Example #1
0
        public int GetMainCount()
        {
            int count = 0;

            if (Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll"))
            {
                count = SortMainObject.GetAllSortsCount(ViewMode);
            }
            else if (Config.User.IsInAnyRole("OrgManager"))
            {
                if (((OrgOptionEnum)OrgMode) == OrgOptionEnum.OrgArtifacts)
                {
                    count = SortMainObject.GetSortForOrgCount(Config.User.EmployeeId, OrgOption);
                }
                else
                {
                    count = SortMainObject.GetSortForUserCount(Config.User.EmployeeId);
                }
            }
            else
            {
                count = SortMainObject.GetSortForUserCount(Config.User.EmployeeId);
            }

            return(count);
        }
Example #2
0
        public void Save()
        {
            bool needSave = false;

            if (SortMainId > 0)
            {
                var o = SortMainObject.GetSortMain(SortMainId).OpenNetData;

                if (o == null)
                {
                    o = new OpenNetObject(SortMainId);
                }

                if (o.SortMainId != SortMainId)
                {
                    o.SortMainId = SortMainId;
                }

                if (AccessNumber?.Trim() != o.AccessNumber)
                {
                    o.AccessNumber = AccessNumber?.Trim();
                    needSave       = true;
                }

                if (DocLocation?.Trim() != o.DocLocation)
                {
                    o.DocLocation = DocLocation?.Trim();
                    needSave      = true;
                }

                if (FieldOfficeAym?.Trim() != o.FieldOfficeAym)
                {
                    o.FieldOfficeAym = FieldOfficeAym?.Trim();
                    needSave         = true;
                }

                if (DeclassificationStatus != o.DeclassificationStatus)
                {
                    o.DeclassificationStatus = DeclassificationStatus;
                    needSave = true;
                }

                if (DeclassificationDate != o.DeclassificationDate)
                {
                    o.DeclassificationDate = DeclassificationDate;
                    needSave = true;
                }

                if (Keywords?.Trim() != o.Keywords)
                {
                    o.Keywords = Keywords?.Trim();
                    needSave   = true;
                }

                if (needSave)
                {
                    o.Save();
                }
            }
        }
Example #3
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 #4
0
        public void Save()
        {
            bool needSave = false;

            if (SortMainId > 0)
            {
                var o = SortMainObject.GetSortMain(SortMainId);
                if (o != null)
                {
                    if (AccessReleaseDate != o.AccessReleaseDate)
                    {
                        o.AccessReleaseDate = AccessReleaseDate;
                        needSave            = true;
                    }

                    if (ExemptionNumber?.Trim() != o.ExemptionNumber)
                    {
                        o.ExemptionNumber = ExemptionNumber?.Trim();
                        needSave          = true;
                    }

                    if (needSave)
                    {
                        o.Save();
                    }
                }
            }
        }
Example #5
0
        public void Save()
        {
            bool dataChanged = CheckDataChanged();

            repo.SaveProtectedData(this);
            SortMainObject.CheckStatusUpdate(SortMainId, dataChanged);
        }
Example #6
0
        public void Save()
        {
            bool needSave = false;

            if (SortMainId > 0)
            {
                var o = SortMainObject.GetSortMain(SortMainId);
                if (o != null)
                {
                    if (!string.IsNullOrWhiteSpace(Abstract) && Abstract.Trim().Length > 5000)
                    {
                        Abstract = Abstract.Trim().Substring(0, 5000);
                    }

                    if (Abstract?.Trim() != o.Abstract)
                    {
                        o.Abstract = Abstract?.Trim();
                        needSave   = true;
                    }

                    if (needSave)
                    {
                        o.Save();
                    }
                }
            }
        }
Example #7
0
        public static Stream GenerateCover(int sortMainId)
        {
            var sort = SortMainObject.GetSortMain(sortMainId);

            if (sort != null)
            {
                var  toReturn = new MemoryStream();
                DocX doc      = null;

                if (sort.Title.Trim().Substring(0, 7).Equals("INL-CON", StringComparison.OrdinalIgnoreCase) ||
                    sort.Title.Trim().Substring(0, 7).Equals("INL-JOU", StringComparison.OrdinalIgnoreCase))
                {
                    doc = GetJouCover();
                }
                else
                {
                    doc = GetExtCover();
                }

                doc.ReplaceText("{publicationdate}", sort.PublicationDate?.ToString("MMMM yyyy") ?? string.Empty);
                doc.ReplaceText("{stititle}", sort.Title?.RemoveNonAscii() ?? string.Empty);
                doc.ReplaceText("{publishtitle}", sort.PublishTitle?.RemoveNonAscii() ?? string.Empty);
                doc.ReplaceText("{authors}", string.Join(", ", sort.Authors.Select(n => n.FullName))?.RemoveNonAscii() ?? string.Empty);
                doc.ReplaceText("{doctype}", sort.ProductTypeDisplayName?.RemoveNonAscii() ?? string.Empty);
                doc.ReplaceText("{contractnumber}", string.Join(", ", sort.Funding.Select(n => n.ContractNumber))?.RemoveNonAscii() ?? string.Empty);
                doc.ReplaceText("{fundingoffice}", string.Join(", ", sort.Funding.Select(n => n.TitleFundingSourceName))?.RemoveNonAscii() ?? string.Empty);

                doc.SaveAs(toReturn);
                return(toReturn);
            }

            return(null);
        }
Example #8
0
        public static void SendToLoiess(SortMainObject sort)
        {
            var funding = sort.Funding.Where(n => n.FundingTypeId == 2 && !string.IsNullOrWhiteSpace(n.TrackingNumber)).ToList();

            if (funding != null && funding.Count > 0)
            {
                foreach (var f in funding)
                {
                    var stims = new StimsData();
                    stims.SourceId        = sort.SortMainId.Value;
                    stims.TrackingNumber  = f.TrackingNumber;
                    stims.StimsNumber     = sort.TitleStr;
                    stims.StimsType       = sort.ProductTypeDisplayName;
                    stims.Title           = sort.PublishTitle;
                    stims.JournalName     = sort.JournalName;
                    stims.PublicationDate = sort.PublicationDate;
                    stims.JournalVolume   = sort.JournalVolume;
                    stims.JournalNumber   = sort.JournalSerial;
                    stims.OstiId          = sort.OstiId;
                    stims.OstiSaveDate    = sort.OstiDate.Value;
                    stims.DoiNum          = sort.DoiNum;
                    stims.AuthorNames     = string.Join("|", sort.Authors.Select(n => n.FullName));
                    stims.FirstInlAuthor  = sort.Authors.FirstOrDefault(n => n.IsPrimary)?.FullName;

                    UploadDataToLoiEss(stims);
                }
            }
        }
Example #9
0
 public void Save()
 {
     if (SortMainObject.CheckUserHasWriteAccess(SortMainId))
     {
         SortMainObject.UpdateReminderDate(SortMainId, ReminderDate);
     }
 }
 public void Save()
 {
     if (SortMainObject.CheckUserHasWriteAccess(SortMainId))
     {
         SortMainObject.UpdateDelayToDate(SortMainId, DelayToDate, DelayReason);
     }
 }
Example #11
0
        public static List <SortMainObject> GetMainData(ViewModeOptionEnum viewMode, int?orgMode, string orgOption)
        {
            var data = new List <SortMainObject>();

            orgMode = orgMode ?? 0;

            if (Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll"))
            {
                data = SortMainObject.GetAllSorts(viewMode);
            }
            else if (Config.User.IsInAnyRole("OrgManager"))
            {
                if (((OrgOptionEnum)orgMode) == OrgOptionEnum.OrgArtifacts)
                {
                    data = SortMainObject.GetSortForUserOrg(Config.User.EmployeeId, orgOption);
                }
                else
                {
                    data = SortMainObject.GetSortForUser(Config.User.EmployeeId);
                }
            }
            else
            {
                data = SortMainObject.GetSortForUser(Config.User.EmployeeId);
            }

            return(data);
        }
Example #12
0
 public void HydrateData()
 {
     Sort        = SortMainObject.GetSortMain(SortMainId);
     Attachments = SortAttachmentObject.GetSortAttachments(SortMainId);
     Sort?.CheckForMissingData();
     UserHasWriteAccess = Sort?.UserHasWriteAccess() ?? true;
     UserHasReadAccess  = Sort?.UserHasReadAccess() ?? true;
 }
Example #13
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult ProtectedDataSave(ProtectedDataModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();
            }

            return(null);
        }
Example #14
0
        public ActionResult DeleteArtifact(int?id)
        {
            if (id.HasValue)
            {
                SortMainObject.GetSortMain(id.Value)?.Delete();
            }

            return(RedirectToAction("Index", "Home"));
        }
Example #15
0
        public ActionResult ForceEdms(int?id)
        {
            if (id.HasValue)
            {
                SortMainObject.SetForceEdms(id.Value);
            }

            return(RedirectToAction("Index", new { id }));
        }
Example #16
0
        public ActionResult ChangeCoverPageRequired(int?sortMainId, bool?coverPageRequired)
        {
            if (sortMainId.HasValue && coverPageRequired.HasValue)
            {
                SortMainObject.UpdateCoverPageRequired(sortMainId.Value, coverPageRequired.Value);
            }

            return(RedirectToAction("Index", "Artifact", new { id = sortMainId }));
        }
Example #17
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AbstractSave(AbstractModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();
            }

            return(null);
        }
Example #18
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult ConferenceSave(ConferenceModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();
            }

            return(null);
        }
Example #19
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult JorunalSave(JournalModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();
            }

            return(null);
        }
Example #20
0
        public DueDateModel(int sortMainId, bool?altLocation)
        {
            SortMainId  = sortMainId;
            AltLocation = altLocation;
            var sort = SortMainObject.GetSortMain(SortMainId);

            DueDate = DateTime.Now.AddDays(30);
            Title   = sort?.TitleStr;
        }
Example #21
0
        public static void ImportLatest()
        {
            string sql = @"select 
                                m.MainId as LrsId,
                                m.OwnerEmployeeId as OwnerEmployeeId, 
                                'Approved' as ReviewStatus,
                                100 as ReviewProgress,
                                m.DocumentType,
                                m.Title,
                                m.StiNumber,
                                m.Revision,
                                m.CreateDate,
                                m.ActivityDate as ModifiedDate,
                                m.ApprovalDate as ApprovedDate,
                                m.Abstract,
                                m.ConferenceName,
                                m.ConferenceSponsor,
                                m.ConferenceLocation,
                                m.COnferenceBeginDate,
                                m.ConferenceEndDate,
                                m.JournalName,
                                m.RelatedSti
                            from dat_Main m
                            where m.[Status] = 'Completed'
                            and m.DocumentTYpe != 'DoeId'
                            and m.ContainsSciInfo = 1
                            and m.SortId is null
                            and m.OstiId is null
                            and m.ApprovalDate > '8/1/2018'";

            var artifacts = Config.LrsConn.Query <ArtifactData>(sql).ToList();

            foreach (var ad in artifacts)
            {
                var obj = SortMainObject.GetSortMainForStiNumber(ad.StiNumber, ad.Revision);
                if (obj == null)
                {
                    ad.Contacts         = GetContacts(ad.LrsId);
                    ad.Authors          = GetAuthors(ad.LrsId);
                    ad.Fundings         = GetFunding(ad.LrsId);
                    ad.Reviewers        = GetReviewers(ad.LrsId);
                    ad.Subjects         = GetMetaData(ad.LrsId, "SubjectCategories");
                    ad.Keywords         = GetMetaData(ad.LrsId, "Keywords");
                    ad.CoreCapabilities = GetMetaData(ad.LrsId, "CoreCapabilities");
                    int?id = ad.Import();
                    if (id.HasValue)
                    {
                        UpdateLrsSortId(ad.LrsId, id.Value);
                    }
                }
                else
                {
                    UpdateLrsSortId(ad.LrsId, obj.SortMainId.Value);
                }
            }
        }
Example #22
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddCoreCapabilities(MetadataModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();

                return(PartialView("Partials/_coreCapabilitiesList", SortMetaDataObject.GetSortMetaDatas(model.SortMainId, MetaDataTypeEnum.CoreCapabilities)));
            }

            return(null);
        }
Example #23
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public JsonResult AddAttachment(AttachmentModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();

                return(Json(model.SortAttachmentId));
            }

            return(null);
        }
Example #24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Sort Main Id</param>
        /// <returns></returns>
        public ActionResult GetAttachments(int?id)
        {
            var model = new List <SortAttachmentObject>();

            if (id.HasValue && SortMainObject.CheckUserHasReadAccess(id.Value))
            {
                model = SortAttachmentObject.GetSortAttachments(id.Value);
            }

            return(PartialView("Partials/_attachmentList", model));
        }
Example #25
0
        public void Save()
        {
            var data = SortMainObject.GetSortMain(SortMainId);

            if (data != null)
            {
                data.OstiId     = OstiId;
                data.StatusEnum = StatusEnum.Published;
                data.Save();
            }
        }
Example #26
0
        public ActionResult ResetReleaseDelay(int?id)
        {
            if (id.HasValue)
            {
                if (SortMainObject.CheckUserHasWriteAccess(id.Value))
                {
                    SortMainObject.ResetDelayToDate(id.Value);
                }
            }

            return(RedirectToAction("Index", "Artifact", new{ id }));
        }
Example #27
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddContact(ContactModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();

                return(PartialView("Partials/_contactList", ContactObject.GetContacts(model.SortMainId)));
            }

            Response.StatusCode = (int)HttpStatusCode.BadRequest;
            return(null);
        }
Example #28
0
        public ActionResult SendReminderEmails()
        {
            var data = SortMainObject.GetNeedReminder();

            if (data != null && data.Count > 0)
            {
                TempData["Emailed"] = $"Reminder Email will be sent to {data.Count} Artifact owners.";
                data.ForEach(n => Email.SendEmail(n, EmailTypeEnum.Reminder, true));
            }

            return(RedirectToAction("EditEmail"));
        }
Example #29
0
        public bool Search()
        {
            UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext);
            string    uri = string.Empty;

            if (!string.IsNullOrWhiteSpace(SearchData))
            {
                SortMainObject.SearchForUser(SearchData, IncludeTitle, IncludeAbstract, IncludeReviewer).ForEach(n => Results.Add(new SearchResult(n.SortMainId.Value, url.Action("Index", "Artifact", new { id = n.SortMainId }), n.DisplayTitle, n.Title, n.StatusDisplayName)));
            }

            return(Results.Count > 0);
        }
Example #30
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddSponsor(MetadataModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();

                return(PartialView("Partials/_sponsorOrgList", SortMetaDataObject.GetSortMetaDatas(model.SortMainId, MetaDataTypeEnum.SponsoringOrgs)));
            }

            Response.StatusCode = (int)HttpStatusCode.BadRequest;
            return(null);
        }