public void Save() { if (Current.IsAdmin) { MainObject.GetMain(MainId)?.Delete(Reason); } }
public JsonResult ExportArtifactToSort(int?id) { var main = MainObject.GetMain(id ?? 0); if (main == null) { return(Json( new { Status = false, Message = "Unable to find the Artifact to send to SORT" } )); } var msg = main.UploadToSort(); if (string.IsNullOrWhiteSpace(msg)) { return(Json( new { Status = true, Message = "" } )); } return(Json( new { Status = false, Message = msg } )); }
public void Save() { bool needSave = false; if (MainId > 0) { var o = MainObject.GetMain(MainId); 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(); } } } }
/// <summary> /// /// </summary> /// <param name="id">Main ID</param> /// <param name="rid">Review ID</param> /// <returns></returns> public ActionResult MarkReviewFinished(int?id, int?rid) { if (id.HasValue && rid.HasValue) { MainObject.GetMain(id.Value)?.MarkReviewComplete(rid.Value); } return(RedirectToAction("Index", "Home")); }
public string GetStiNumber(int?id) { if (id.HasValue) { return(MainObject.GetMain(id.Value)?.StiNumber); } return(string.Empty); }
/// <summary> /// /// </summary> /// <param name="id">Main ID</param> /// <param name="rid">Review ID</param> /// <returns></returns> public ActionResult MarkNotReviewing(int?id, int?rid) { if (id.HasValue && rid.HasValue) { MainObject.GetMain(id.Value)?.MarkNotReviewing(rid.Value); } return(RedirectToAction("Index", "Home")); }
/// <summary> /// /// </summary> /// <param name="id">Main Id</param> /// <returns></returns> public ActionResult Restart(int?id) { if (id.HasValue && MainObject.CheckUserHasWriteAccess(id.Value)) { MainObject.GetMain(id.Value)?.ReStart(); } return(RedirectToAction("Index", new { id })); }
public ActionResult MarkCompleted(int?id) { if (id.HasValue && MainObject.CheckUserHasWriteAccess(id.Value)) { MainObject.GetMain(id.Value)?.MarkReviewComplete(); } return(RedirectToAction("Index", new { id })); }
public void HydrateData() { Main = MainObject.GetMain(MainId); Ouo3 = Main?.Ouo3 ?? false; Ouo7 = Main?.Ouo7 ?? false; Ouo7EmployeeId = Main?.Ouo7EmployeeId ?? UserObject.CurrentUser.EmployeeId; Main?.CheckForMissingData(); }
/// <summary> /// /// </summary> /// <param name="id">Main ID</param> /// <param name="rid">Review ID</param> /// <returns></returns> public ActionResult MarkReviewApproved(int?id, int?rid, bool?ouo3, bool?ouo7, string ouo7sn) { if (id.HasValue && rid.HasValue) { MainObject.GetMain(id.Value)?.MarkReviewApproved(rid.Value, ouo3, ouo7, ouo7sn); } return(RedirectToAction("Index", "Home")); }
/// <summary> /// /// </summary> /// <param name="id">Main Id</param> /// <param name="type">Review Type</param> /// <returns></returns> public ActionResult StartReviews(int?id, string type) { if (id.HasValue && id.Value > 0) { var main = MainObject.GetMain(id.Value); if (main != null && main.UserHasWriteAccess()) { main.StartReviews(type); } } return(RedirectToAction("Index", new { id })); }
public ActionResult ToggleRush(int?id) { if (id.HasValue) { var main = MainObject.GetMain(id.Value); if (main != null) { main.ToggleRushFlag(); } } return(RedirectToAction("Index", "Home")); }
public ActionResult Claim(int?id) { if (id.HasValue) { var main = MainObject.GetMain(id.Value); if (main != null) { main.ClaimReview(); } } return(RedirectToAction("Index", "Home")); }
public void Save() { bool needSave = false; if (MainId > 0) { var o = MainObject.GetMain(MainId); if (o != null) { if (ConferenceName?.Trim() != o.ConferenceName) { o.ConferenceName = ConferenceName?.Trim(); needSave = true; } if (ConferenceSponsor?.Trim() != o.ConferenceSponsor) { o.ConferenceSponsor = ConferenceSponsor?.Trim(); needSave = true; } if (ConferenceLocation?.Trim() != o.ConferenceLocation) { o.ConferenceLocation = ConferenceLocation?.Trim(); needSave = true; } if (ConferenceBeginDate != o.ConferenceBeginDate) { o.ConferenceBeginDate = ConferenceBeginDate; needSave = true; } if (ConferenceEndDate != o.ConferenceEndDate) { o.ConferenceEndDate = ConferenceEndDate; needSave = true; } if (needSave) { o.Save(); } } } }
public DeleteModel(int mainId) { MainId = mainId; StiNumber = MainObject.GetMain(MainId)?.DisplayTitle; }
public List <MainObject> ExecuteReport() { List <MainObject> retList = new List <MainObject>(); //so here we do our sp call string conString = Business.Config.ConnectionString; using (SqlConnection con = new SqlConnection(conString)) { con.Open(); SqlCommand cmd = new SqlCommand("usp_SearchLrs", con); cmd.CommandTimeout = 1200; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("@DateOn", System.Data.SqlDbType.Int).Value = (int)SearchDateType; cmd.Parameters.Add("@StartTime", System.Data.SqlDbType.DateTime).Value = StartTime; cmd.Parameters.Add("@EndTime", System.Data.SqlDbType.DateTime).Value = EndTime; cmd.Parameters.Add("@SearchContact", System.Data.SqlDbType.Bit).Value = SearchContact; cmd.Parameters.Add("@SearchReviewer", System.Data.SqlDbType.Bit).Value = SearchReviewer; cmd.Parameters.Add("@SearchAuthor", System.Data.SqlDbType.Bit).Value = SearchAuthor; cmd.Parameters.Add("@SearchFunding", System.Data.SqlDbType.Bit).Value = SearchFunding; cmd.Parameters.Add("@SearchIntellectual", System.Data.SqlDbType.Bit).Value = SearchIntellectual; cmd.Parameters.Add("@Status", System.Data.SqlDbType.VarChar, 25).Value = string.IsNullOrWhiteSpace(Status) ? (object)DBNull.Value : Status; cmd.Parameters.Add("@Title", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(Title) ? (object)DBNull.Value : Title; cmd.Parameters.Add("@OwnerEmployeeId", System.Data.SqlDbType.VarChar, 6).Value = string.IsNullOrWhiteSpace(Owner) ? (object)DBNull.Value : Owner; cmd.Parameters.Add("@StiNumber", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(StiNumber) ? (object)DBNull.Value : StiNumber; cmd.Parameters.Add("@Revision", System.Data.SqlDbType.Int).Value = Revision.HasValue ? Revision.Value : (object)DBNull.Value; cmd.Parameters.Add("@Subject", System.Data.SqlDbType.VarChar, 1024).Value = SubjectId.HasValue ? MemoryCache.GetSubjectCategory(SubjectId.Value).FullSubject : (object)DBNull.Value; cmd.Parameters.Add("@CoreCapability", System.Data.SqlDbType.VarChar, 1024).Value = CoreCapabilityId.HasValue ? MemoryCache.GetCoreCapability(CoreCapabilityId.Value).Name : (object)DBNull.Value; cmd.Parameters.Add("@Keyword", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(Keyword) ? (object)DBNull.Value : Keyword; if (!string.IsNullOrWhiteSpace(DocumentType)) { cmd.Parameters.Add("@DocumentType", System.Data.SqlDbType.VarChar, 25).Value = DocumentType; switch (DocumentType) { case "Conference": if (SearchConference) { cmd.Parameters.Add("@SearchConference", System.Data.SqlDbType.Bit).Value = SearchConference; cmd.Parameters.Add("@ConferenceName", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(ConferenceName) ? (object)DBNull.Value : ConferenceName; cmd.Parameters.Add("@ConferenceSponsor", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(ConferenceSponsor) ? (object)DBNull.Value : ConferenceSponsor; cmd.Parameters.Add("@ConferenceLocation", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(ConferenceLocation) ? (object)DBNull.Value : ConferenceLocation; cmd.Parameters.Add("@ConferenceStart", System.Data.SqlDbType.DateTime).Value = ConferenceStart ?? (object)DBNull.Value; cmd.Parameters.Add("@ConferenceEnd", System.Data.SqlDbType.DateTime).Value = ConferenceEnd ?? (object)DBNull.Value; } break; case "Journal": if (SearchJournal) { cmd.Parameters.Add("@SearchJournal", System.Data.SqlDbType.Bit).Value = SearchJournal; cmd.Parameters.Add("@JournalName", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(JournalName) ? (object)DBNull.Value : JournalName; } break; } } if (SearchContact) { cmd.Parameters.Add("@ContactEmployeeId", System.Data.SqlDbType.VarChar, 10).Value = string.IsNullOrWhiteSpace(Contact) ? (object)DBNull.Value : Contact; cmd.Parameters.Add("@ContactWorkOrg", System.Data.SqlDbType.VarChar, 4000).Value = ContactWorkOrg.Count > 0 ? string.Join(",", ContactWorkOrg) : (object)DBNull.Value; } if (SearchReviewer) { cmd.Parameters.Add("@ReviewerEmployeeId", System.Data.SqlDbType.VarChar, 10).Value = string.IsNullOrWhiteSpace(Reviewer) ? (object)DBNull.Value : Reviewer; } if (SearchAuthor) { cmd.Parameters.Add("@AuthorName", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(Author) ? (object)DBNull.Value : Author; cmd.Parameters.Add("@Affiliation", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(Affiliation) ? (object)DBNull.Value : Affiliation; cmd.Parameters.Add("@OrcidId", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(OrcidId) ? (object)DBNull.Value : OrcidId; cmd.Parameters.Add("@AuthorWorkOrg", System.Data.SqlDbType.VarChar, 4000).Value = AuthorWorkOrg.Count > 0 ? string.Join(",", AuthorWorkOrg) : (object)DBNull.Value; cmd.Parameters.Add("@AuthorCountryId", System.Data.SqlDbType.VarChar, 4000).Value = AuthorCountryId.Count > 0 ? string.Join(",", AuthorCountryId) : (object)DBNull.Value; cmd.Parameters.Add("@AuthorStateId", System.Data.SqlDbType.VarChar, 4000).Value = AuthorStateId.Count > 0 ? string.Join(",", AuthorStateId) : (object)DBNull.Value; } if (SearchFunding) { cmd.Parameters.Add("@FiscalYear", System.Data.SqlDbType.VarChar, 4).Value = string.IsNullOrWhiteSpace(FundingYear) ? (object)DBNull.Value : FundingYear; cmd.Parameters.Add("@ContractNumber", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(ContractNumber) ? (object)DBNull.Value : ContractNumber; cmd.Parameters.Add("@FundingOrg", System.Data.SqlDbType.VarChar, 4000).Value = FundingOrg.Count > 0 ? string.Join(",", FundingOrg) : (object)DBNull.Value; if (FundingTypeId.HasValue) { cmd.Parameters.Add("@FundingTypeId", System.Data.SqlDbType.Int).Value = FundingTypeId.Value; switch (FundingTypeId.Value) { case 1: //DOE cmd.Parameters.Add("@DoeFundingCategoryId", System.Data.SqlDbType.Int).Value = DoeFundingCategoryId ?? (object)DBNull.Value; cmd.Parameters.Add("@MilestoneTrackingNumber", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(MilestoneTrackingNumber) ? (object)DBNull.Value : MilestoneTrackingNumber; break; case 6: //Grant case 7: //NEUP cmd.Parameters.Add("@GrantNumber", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(GrantNumber) ? (object)DBNull.Value : GrantNumber; break; case 2: //LDRD cmd.Parameters.Add("@TrackingNumber", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(TrackingNumber) ? (object)DBNull.Value : TrackingNumber; cmd.Parameters.Add("@ProjectNumber", System.Data.SqlDbType.VarChar, 250).Value = string.IsNullOrWhiteSpace(TrackingNumber) ? (object)DBNull.Value : TrackingNumber; cmd.Parameters.Add("@PrincipalInvEmployeeId", System.Data.SqlDbType.VarChar, 6).Value = string.IsNullOrWhiteSpace(PrincipalInvEmployeeId) ? (object)DBNull.Value : PrincipalInvEmployeeId; break; case 4: //Other cmd.Parameters.Add("@OtherDescription", System.Data.SqlDbType.VarChar, 8000).Value = string.IsNullOrWhiteSpace(OtherDescription) ? (object)DBNull.Value : OtherDescription; break; case 5: //spp cmd.Parameters.Add("@SppApproved", System.Data.SqlDbType.Bit).Value = SppApproved; if (!SppApproved) { cmd.Parameters.Add("@NotSppReason", System.Data.SqlDbType.VarChar, 8000).Value = string.IsNullOrWhiteSpace(ApproveNoReason) ? (object)DBNull.Value : ApproveNoReason; } if (SppCategoryId.HasValue) { cmd.Parameters.Add("@SppCategoryId", System.Data.SqlDbType.Int).Value = SppCategoryId.Value; switch (SppCategoryId.Value) { case 1: //Federal cmd.Parameters.Add("@FederalAgencyId", System.Data.SqlDbType.Int).Value = FederalAgencyId ?? (object)DBNull.Value; break; case 6: //Other cmd.Parameters.Add("@OtherDesc", System.Data.SqlDbType.VarChar, 8000).Value = string.IsNullOrWhiteSpace(OtherDescription) ? (object)DBNull.Value : OtherDescription; break; case 7: //Foreign cmd.Parameters.Add("@ForeignCountry", System.Data.SqlDbType.Int).Value = SppCountryId ?? (object)DBNull.Value; cmd.Parameters.Add("@ForeignInfo", System.Data.SqlDbType.VarChar, 8000).Value = string.IsNullOrWhiteSpace(SppAdditionalInfo) ? (object)DBNull.Value : SppAdditionalInfo; cmd.Parameters.Add("@OtherDescription", System.Data.SqlDbType.VarChar, 8000).Value = string.IsNullOrWhiteSpace(OtherDescription) ? (object)DBNull.Value : OtherDescription; break; } } break; } } } if (SearchIntellectual) { cmd.Parameters.Add("@IdrNumber", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(IdrNumber) ? (object)DBNull.Value : IdrNumber; cmd.Parameters.Add("@DocketNumber", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(DocketNumber) ? (object)DBNull.Value : DocketNumber; cmd.Parameters.Add("@IntellectTitle", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(IntellectTitle) ? (object)DBNull.Value : IntellectTitle; cmd.Parameters.Add("@Aty", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(Aty) ? (object)DBNull.Value : Aty; cmd.Parameters.Add("@Ae", System.Data.SqlDbType.VarChar, 1024).Value = string.IsNullOrWhiteSpace(Ae) ? (object)DBNull.Value : Ae; } SqlDataReader rdr = cmd.ExecuteReader(); using (IDbConnection dataConn = Config.Conn) { dataConn.Open(); while (rdr.Read()) { int id = (int)rdr["MainId"]; retList.Add(MainObject.GetMain(id, dataConn)); } dataConn.Close(); } rdr.Close(); con.Close(); } return(retList); }
public void Save() { bool needSave = false; bool needPoc = false; var o = MainObject.GetMain(MainId ?? 0) ?? new MainObject(); if (o != null) { if (!o.MainId.HasValue) { o.DocumentType = DocumentType; needSave = true; needPoc = true; } if (Title?.Trim() != o.Title) { o.Title = Title?.Trim(); needSave = true; } if (JournalName?.Trim() != o.JournalName) { o.JournalName = JournalName?.Trim(); needSave = true; } if (ContainsSciInfo != o.ContainsSciInfo) { o.ContainsSciInfo = ContainsSciInfo; needSave = true; } if (ContainsTechData != o.ContainsTechData) { o.ContainsTechData = ContainsTechData; needSave = true; } if (TechDataPublic != o.TechDataPublic) { o.TechDataPublic = TechDataPublic; needSave = true; } if (Ouo3.HasValue && Ouo3.Value != o.Ouo3) { o.Ouo3 = Ouo3.Value; needSave = true; } if (Ouo3b != o.Ouo3b) { o.Ouo3b = Ouo3b; needSave = true; } if (Ouo4 != o.Ouo4) { o.Ouo4 = Ouo4; needSave = true; } if (Ouo5 != o.Ouo5) { o.Ouo5 = Ouo5; needSave = true; } if (Ouo6 != o.Ouo6) { o.Ouo6 = Ouo6; needSave = true; } if (Ouo7 != o.Ouo7) { o.Ouo7 = Ouo7; needSave = true; } if (Ouo7EmployeeId != o.Ouo7EmployeeId) { o.Ouo7EmployeeId = Ouo7EmployeeId; needSave = true; } if (DocumentType != o.DocumentType) { o.DocumentType = DocumentType; needSave = true; } if (LimitedExp != o.LimitedExp) { o.LimitedExp = LimitedExp; needSave = true; } if (needSave) { o.Save(); MainId = o.MainId; } // Add owner as contact if this was the first time saving. if (needPoc && MainId.HasValue) { ContactObject.Add(MainId.Value, Current.User.EmployeeId); } } }
public void SaveRejection() { MainObject.GetMain(MainId)?.MarkReviewRejected(CommentReviewId.Value, RejectComment); }
public void Save() { repo.SaveReviewComment(this); Email.SendEmail(MainObject.GetMain(MainId), ReviewObject.GetReview(ReviewId), EmailTypeEnum.ReviewerCommented, Comment); MainObject.UpdateActivityDateToNow(MainId); }