public FinalDecisionViewModel(RequestPerson rp) { if (rp != null) { this.RequestPersonID = rp.Id; } }
public RequestPerson SaveRequestPerson(Request request, Person person) { if (request != null && person != null) { RequestPerson rp = request.AddPerson(person); return(this.requestPersonRepository.SaveOrUpdate(rp)); } return(null); }
public void SendMessage(string ipAddress, string userAgent, string currentUrl, SupportRequestType supportRequestType) { var subject = $"Support Request for Neptune - {DateTime.Now.ToStringDateTime()}"; var message = string.Format(@" <div style='font-size: 12px; font-family: Arial'> <strong>{0}</strong><br /> <br /> <strong>From:</strong> {1} - {2}<br /> <strong>Email:</strong> {3}<br /> <strong>Phone:</strong> {4}<br /> <br /> <strong>Subject:</strong> {5}<br /> <br /> <strong>Description:</strong><br /> {6} <br /> <br /> <br /> <div style='font-size: 10px; color: gray'> OTHER DETAILS:<br /> LOGIN: {7}<br /> IP ADDRESS: {8}<br /> USERAGENT: {9}<br /> URL FROM: {10}<br /> <br /> </div> <div>You received this email because you are set up as a point of contact for support - if that's not correct, let us know: {11}</div>. </div> ", subject, RequestPersonName, RequestPersonOrganization ?? "(not provided)", RequestPersonEmail, RequestPersonPhone ?? "(not provided)", supportRequestType.SupportRequestTypeDisplayName, RequestDescription.HtmlEncodeWithBreaks(), RequestPerson != null ? $"{RequestPerson.GetFullNameFirstLast()} (UserID {RequestPerson.PersonID})" : "(anonymous user)", ipAddress, userAgent, currentUrl, Common.NeptuneWebConfiguration.SitkaSupportEmail); // Create Notification var mailMessage = new MailMessage { From = new MailAddress(Common.NeptuneWebConfiguration.DoNotReplyEmail), Subject = subject, Body = message, IsBodyHtml = true }; // Reply-To Header mailMessage.ReplyToList.Add(RequestPersonEmail); // TO field SupportRequestType.SetEmailRecipientsOfSupportRequest(mailMessage); SitkaSmtpClient.Send(mailMessage); }
public ActionResult RequestPersonModal(int id) { RequestPerson rp = this.requestPersonTasks.GetRequestPerson(id); if (rp != null) { RequestPersonViewModel vm = new RequestPersonViewModel(rp); return(View(vm)); } return(new HttpNotFoundResult()); }
public JsonNetResult RequestProfile(int id) { RequestPerson rp = this.requestPersonTasks.GetRequestPerson(id); if (rp != null) { this.emailTasks.SendProfileRequestEmail(User.Identity.Name, rp.Person); return(JsonNet(string.Empty)); } return(JsonNet("No request person exists with that ID.")); }
public IList <Career> GetHistoricalCurrentCareers(RequestPerson rp, bool useAuditTrail) { if (rp != null && rp.Request != null) { // get historical date DateTime?date = rp.Request.GetLatestScreeningDate(); if (date.HasValue) { IList <Career> list = new List <Career>(); // all valid (date-wise) careers; need to figure out the person's correct function/s at given date IList <Career> candidates = rp.Person.GetCareersAtTimeOf(date.Value); if (candidates != null && candidates.Any()) { // if any date-valid careers are marked current, select those list.Concat(candidates.Where(x => x.IsCurrentCareer)); // if this is an old request and there are no date-valid careers marked current, then select the most recent // TODO as requests age and their subject profiles advance in career, their careers will no longer be marked current. // this is a problem for those with multiple functions, as the logic below will only ensure the most recent is returned. if (list.Count == 0) { list.Add(candidates.First()); candidates.RemoveAt(0); } if (useAuditTrail) { // select the remaining date-valid careers candidates = candidates.Where(x => !x.IsCurrentCareer).ToList(); // of the remaining candidates, include only if that career was flagged 'current' at time of screening. // for this we need to check audit trail. // IMPORTANT: this assumes the that the 'current' careers in the audit trail were correct - not always the case! IList <int> oldCareerIds = this.auditTasks.GetHistoricalCurrentCareers(rp.Person, date.Value).Select(x => x.Id).ToList(); foreach (Career c in candidates) { if (oldCareerIds.Contains(c.Id) || c.IsCurrentCareer) // if our given date is recent, we can rely on the IsCurrentCareer flag { list.Add(c); } } } } return(list); } } return(null); }
public ActionResult UpdateUser(string id) { // Cargar los datos del usuario a modificar RequestAdminUser req = new RequestAdminUser(); ResponseAdminUserList res = new ResponseAdminUserList(); LogicAdminUser logic = new LogicAdminUser(); req.id = int.Parse(id); res = logic.getUserList(req); // Recuperar los campos de la persona RequestPerson reqPer = new RequestPerson(); ResponsePersonList resPer = new ResponsePersonList(); LogicAdminPerson logicPer = new LogicAdminPerson(); reqPer.id = res.lst[0].idPerson; resPer = logicPer.getPerson(reqPer); // Setear los campos del modelo req.attemps = res.lst[0].attemps; req.dateBorn = resPer.lst[0].dateBorn; req.dateRegister = res.lst[0].dateRegister; req.dateUpdate = res.lst[0].dateUpdate; req.document = resPer.lst[0].document; req.firstLastName = resPer.lst[0].firstLastName; req.firstName = resPer.lst[0].firstName; req.flag = 'M'; req.homeAddress = resPer.lst[0].homeAddress; req.homePhone = resPer.lst[0].homePhone; req.idRole = res.lst[0].idRole; req.idPerson = res.lst[0].idPerson; req.loginName = res.lst[0].loginName; req.movilPhone1 = resPer.lst[0].movilPhone1; req.movilPhone2 = resPer.lst[0].movilPhone2; req.name = res.lst[0].name; req.personalKey = res.lst[0].personalKey; req.profession = resPer.lst[0].profession; req.secondLastName = resPer.lst[0].secondLastName; req.secondName = resPer.lst[0].secondName; req.stateRecord = res.lst[0].stateRecord; req.typeDocument = resPer.lst[0].typeDocument; req.userRegister = res.lst[0].userRegister; req.userUpdate = res.lst[0].userUpdate; req.workPhone = resPer.lst[0].workPhone; req.workplace = resPer.lst[0].workplace; Tuple <ResponseAdminUserList, RequestAdminUser, ResponseAdminUserDetail, ResponseAdminUser> response = new Tuple <ResponseAdminUserList, RequestAdminUser, ResponseAdminUserDetail, ResponseAdminUser>(res, req, null, null); return(View(response)); }
public RequestPerson ArchiveRequestPerson(Request request, Person person) { if (request != null && person != null) { RequestPerson rp = request.GetPerson(person); if (rp != null) { rp.Archive = true; return(this.requestPersonRepository.SaveOrUpdate(rp)); } } return(null); }
public RequestPersonHistory SaveRequestPersonHistory(RequestPerson rp, string status, AdminUser user) { if (rp != null && !string.IsNullOrEmpty(status) && user != null) { RequestPersonHistory h = new RequestPersonHistory(); h.RequestPerson = rp; h.RequestPersonStatus = this.GetRequestPersonStatus(status); h.AdminUser = user; h.DateStatusReached = DateTime.Now; rp.AddRequestPersonHistory(h); return(this.requestPersonHistoryRepository.SaveOrUpdate(h)); } return(null); }
public JsonNetResult WithdrawNomination(int id) { RequestPerson rp = this.requestPersonTasks.GetRequestPerson(id); if (rp != null) { AdminUser user = this.userTasks.GetAdminUser(User.Identity.Name); if (this.requestPersonTasks.WithdrawRequestPersonNomination(rp, user)) { return(JsonNet(string.Empty)); } Response.StatusCode = (int)HttpStatusCode.InternalServerError; return(JsonNet("Problem withdrawing nomination for person.")); } return(JsonNet("No request person exists with that ID.")); }
private Workbook ConstructWorkbook() { Workbook workBook = new Workbook(); Worksheet workSheet = AddWorkSheet(ref workBook); workSheet = AddColumnHeadings(workSheet); for (int i = 0; i < this.NominatedRequestPersons.Count; i++) { RequestPerson rp = this.NominatedRequestPersons[i]; workSheet.Cells[i + 1, 0].PutValue(rp.Person.Name); int j = 0; for (j = 0; j < this.ScreeningEntities.Count; j++) { ScreeningEntity se = this.ScreeningEntities[j]; ScreeningRequestPersonEntity srpe = rp.GetMostRecentScreeningRequestPersonEntity(se.ScreeningEntityName); if (srpe != null) { workSheet.Cells[i + 1, j + 1].PutValue(srpe.ScreeningResult.ToString()); workSheet.Cells[i + 1, j + 1].SetStyle(GetCellStyleForResult(srpe.ScreeningResult.ToString())); } } //dsrsg ScreeningRequestPersonRecommendation srpr = rp.GetScreeningRequestPersonRecommendation(); if (srpr != null) { workSheet.Cells[i + 1, j + 1].PutValue(srpr.ScreeningResult.ToString()); workSheet.Cells[i + 1, j + 1].SetStyle(GetCellStyleForResult(srpr.ScreeningResult.ToString())); } //the user's commentary and reason; dsrsg commentary if no screening entity if (!string.IsNullOrEmpty(this.UserScreeningEntityName)) { ScreeningRequestPersonEntity srpe = rp.GetMostRecentScreeningRequestPersonEntity(this.UserScreeningEntityName); if (srpe != null) { workSheet.Cells[i + 1, j + 2].PutValue(srpe.Reason); workSheet.Cells[i + 1, j + 3].PutValue(srpe.Commentary); } } else if (srpr != null) { workSheet.Cells[i + 1, j + 3].PutValue(srpr.Commentary); } } workSheet.AutoFitColumns(); return(workBook); }
public virtual RequestPerson AddPerson(Profiling2.Domain.Prf.Persons.Person person) { IEnumerable <RequestPerson> rps = this.Persons.Where(x => x.Person == person); RequestPerson rp = null; if (rps != null && rps.Count() > 0) { rp = rps.First(); rp.Archive = false; } else { rp = new RequestPerson(); rp.Person = person; rp.Request = this; this.Persons.Add(rp); } return(rp); }
public ResponsePersonList getPerson(RequestPerson req) { ResponsePersonList response = new ResponsePersonList(); try { LogicCommon com = new LogicCommon(); string json = com.HttpPost("Person/getPerson", req); response = JsonConvert.DeserializeObject <ResponsePersonList>(json); return(response); } catch (Exception ex) { response.code = -1; response.message = ex.Message; } return(response); }
protected IList <RequestPerson> GetRequestPersons(string requestPersonStatus) { RequestPerson rpAlias = null; RequestPersonHistory rphAlias = null; RequestPersonStatus rpsAlias = null; Request rAlias = null; RequestHistory rhAlias = null; RequestStatus rsAlias = null; return(Session.QueryOver <RequestPerson>(() => rpAlias) .JoinAlias(() => rpAlias.RequestPersonHistories, () => rphAlias) .JoinAlias(() => rphAlias.RequestPersonStatus, () => rpsAlias) .JoinAlias(() => rpAlias.Request, () => rAlias) .JoinAlias(() => rAlias.RequestHistories, () => rhAlias) .JoinAlias(() => rhAlias.RequestStatus, () => rsAlias) .WhereRestrictionOn(() => rsAlias.RequestStatusName) .IsIn(new string[] { RequestStatus.NAME_SENT_FOR_SCREENING, RequestStatus.NAME_SCREENING_IN_PROGRESS, RequestStatus.NAME_SENT_FOR_CONSOLIDATION }) .And(() => rpsAlias.RequestPersonStatusName == requestPersonStatus) .TransformUsing(Transformers.DistinctRootEntity) .List <RequestPerson>()); }
public JsonNetResult RequestPersonModal(RequestPersonViewModel vm) { if (ModelState.IsValid) { RequestPerson rp = this.requestPersonTasks.GetRequestPerson(vm.Id); if (rp != null) { rp.Notes = vm.Notes; rp = this.requestPersonTasks.SaveRequestPerson(rp); return(JsonNet(new { WasSuccessful = true })); } else { ModelState.AddModelError("Id", "Request person does not exist."); } } return(JsonNet(this.GetErrorsForJson())); }
public RequestPersonDataTableView(object obj) { if (obj != null) { // We surround text values with span tags as workaround for Mvc.Jquery.Datatables not sending these values when processed by // DataTablesResult.Create - DataTables expects an array of certain size. if (obj is RequestPerson) { RequestPerson rp = (RequestPerson)obj; if (rp.Person != null) { this.PersonId = rp.Person.Id; this.Name = "<span>" + rp.Person.Name + "</span>"; this.IdNumber = "<span>" + rp.Person.MilitaryIDNumber + "</span>"; this.Notes = "<span>" + rp.Notes + "</span>"; if (rp.Person.GetCurrentCareers() != null) { IList <string> careers = rp.Person.GetCurrentCareers().Select(x => x.FunctionUnitSummary).ToList <string>(); this.Function = string.Join("<br />", careers); } this.CurrentRank = "<span>" + rp.Person.CurrentRank + "</span>"; this.LatestScreeningSupportStatus = "<span>" + rp.Person.LatestScreeningSupportStatus + "</span>"; this.RequestPersonId = rp.Id; } } else if (obj is RequestProposedPerson) { RequestProposedPerson rpp = (RequestProposedPerson)obj; this.Name = "<span>" + rpp.PersonName + "</span>"; this.IdNumber = "<span>" + rpp.MilitaryIDNumber + "</span>"; this.Notes = "<span>" + rpp.Notes + "</span>"; this.Function = "<span></span>"; this.CurrentRank = "<span></span>"; this.LatestScreeningSupportStatus = "<span></span>"; this.RequestProposedPersonId = rpp.Id; } } }
public JsonNetResult RemovePerson(int requestId, int personId) { Request request = this.requestTasks.Get(requestId); Person person = this.personTasks.GetPerson(personId); if (request != null && person != null) { AdminUser user = this.userTasks.GetAdminUser(User.Identity.Name); if (request.UserHasPermission(user) || User.IsInRole(AdminRole.ScreeningRequestValidator)) { RequestPerson rp = this.requestPersonTasks.ArchiveRequestPerson(request, person); this.requestPersonTasks.SaveRequestPersonHistory(rp, RequestPersonStatus.NAME_REMOVED, user); return(JsonNet(string.Empty)); } else { Response.StatusCode = (int)HttpStatusCode.Forbidden; return(JsonNet("User does not have permission for this request.")); } } Response.StatusCode = (int)HttpStatusCode.NotFound; return(JsonNet("Given Request or Person does not exist.")); }
public bool NominateRequestPerson(RequestPerson rp, AdminUser user) { RequestPersonHistory rph = this.SaveRequestPersonHistory(rp, RequestPersonStatus.NAME_NOMINATED, user); return(rph != null); }
public JsonNetResult Reasons() { string term = Request.QueryString["term"]; if (!string.IsNullOrEmpty(term)) { term = term.Trim(); Regex regex = new Regex("^[0-9]+$"); if (regex.IsMatch(term)) { int requestPersonId; if (int.TryParse(term, out requestPersonId)) { RequestPerson rp = this.requestPersonTasks.GetRequestPerson(requestPersonId); if (rp != null && rp.Request != null) { AdminUser user = this.userTasks.GetAdminUser(User.Identity.Name); // 2014-09-01 we used to check request.UserHasPermission(user) at this point, but actually there are no restrictions // on access for any of the roles that have access to this action anyway, so - no check. IList <object> reasons = new List <object>(); // conditionality participant inputs foreach (ScreeningEntity se in this.screeningTasks.GetScreeningEntities()) { ScreeningRequestPersonEntity srpe = rp.GetScreeningRequestPersonEntity(se.ScreeningEntityName); if (srpe != null) { reasons.Add(new { ScreeningEntity = srpe.ScreeningEntity.ToString(), Result = srpe.ScreeningResult.ToString(), Reason = srpe.Reason, Commentary = srpe.Commentary }); } } // consolidation phase commentary ScreeningRequestPersonRecommendation srpr = rp.GetScreeningRequestPersonRecommendation(); if (srpr != null) { reasons.Add(new { ScreeningEntity = "PWG", Result = srpr.ScreeningResult.ToString(), Commentary = srpr.Commentary }); } // final decision commentary ScreeningRequestPersonFinalDecision srpfd = rp.GetScreeningRequestPersonFinalDecision(); if (srpfd != null) { reasons.Add(new { ScreeningEntity = "SMG", Result = srpfd.ScreeningResult.ToString(), SupportStatus = srpfd.ScreeningSupportStatus.ToString(), Commentary = srpfd.Commentary }); } return(JsonNet(reasons)); } } } } return(JsonNet(string.Empty)); }
/// <summary> /// Sets a row in the person attached /// </summary> /// <param name="row">The row that has already been added to the persons attached table</param> /// <param name="person">The person whose details should be added to the row</param> /// <returns>Pdf row object</returns> private Row SetPersonAttachedRow(ScreeningEntity screeningEntity, Row row, RequestPerson requestPerson) { string personName; Text text; Cell cell; TextInfo textInfo = new TextInfo(); row.VerticalAlignment = VerticalAlignmentType.Top; row.IsBroken = false; //text customization for labels in request details textInfo.FontSize = 12; textInfo.IsTrueTypeFontBold = false; textInfo.Alignment = AlignmentType.Center; //Name Column personName = requestPerson.Person.Name; cell = row.Cells.Add(personName.Trim(), textInfo); //Military ID Column cell = row.Cells.Add(requestPerson.Person.MilitaryIDNumber, textInfo); //Color ScreeningRequestPersonEntity srpe = requestPerson.GetMostRecentScreeningRequestPersonEntity(screeningEntity.ScreeningEntityName); string color = string.Empty; if (srpe != null) { color = srpe.ScreeningResult.ToString(); } cell = row.Cells.Add(); text = new Text(color); if (!string.IsNullOrEmpty(color)) { //Green if (color.Equals(ScreeningResult.GREEN, StringComparison.OrdinalIgnoreCase)) { text.TextInfo.BackgroundColor = new Color("Green"); text.TextInfo.Color = new Color("White"); } //Yellow else if (color.Equals(ScreeningResult.YELLOW, StringComparison.OrdinalIgnoreCase)) { text.TextInfo.BackgroundColor = new Color("Yellow"); text.TextInfo.Color = new Color("Black"); } //Red else if (color.Equals(ScreeningResult.RED, StringComparison.OrdinalIgnoreCase)) { text.TextInfo.BackgroundColor = new Color("Red"); text.TextInfo.Color = new Color("White"); } } text.TextInfo.Alignment = AlignmentType.Center; text.TextInfo.LineSpacing = 6; cell.Paragraphs.Add(text); //Reason cell = row.Cells.Add(srpe != null ? srpe.Reason : string.Empty, textInfo); //Commentary cell = row.Cells.Add(srpe != null ? srpe.Commentary : string.Empty, textInfo); return(row); }
public RequestPersonViewModel(RequestPerson rp) { this.Id = rp.Id; this.Notes = rp.Notes; if (rp.Request != null) { this.RequestId = rp.Request.Id; this.RequestName = rp.Request.Headline; } this.EntityResults = new List <ScreeningResultViewModel>(); string[] entities = ScreeningEntity.GetNames(rp.Request.GetCreatedDate()); foreach (string entity in entities) { ScreeningRequestPersonEntity srpe = rp.GetScreeningRequestPersonEntity(entity); if (srpe != null) { this.EntityResults.Add(new ScreeningResultViewModel() { Name = srpe.ScreeningEntity.ToString(), Result = srpe.ScreeningResult.ToString(), Reason = srpe.Reason, Commentary = srpe.Commentary, Date = srpe.MostRecentHistory.DateStatusReached }); } else { this.EntityResults.Add(new ScreeningResultViewModel() { Name = entity }); } } ScreeningRequestPersonRecommendation srpr = rp.GetScreeningRequestPersonRecommendation(); if (srpr != null) { this.RecommendationResult = new ScreeningResultViewModel() { Name = "Recommended", Result = srpr.ScreeningResult.ToString(), Commentary = srpr.Commentary, Date = srpr.MostRecentHistory.DateStatusReached } } ; ScreeningRequestPersonFinalDecision srpfd = rp.GetScreeningRequestPersonFinalDecision(); if (srpfd != null) { this.FinalResult = new ScreeningResultViewModel() { Name = "Final Decision", Result = srpfd.ScreeningResult.ToString(), Commentary = srpfd.Commentary, Date = srpfd.MostRecentHistory.DateStatusReached }; this.FinalSupportStatus = srpfd.ScreeningSupportStatus.ToString(); } } }
public RecommendationViewModel(RequestPerson rp) { this.RequestPersonID = rp.Id; }
/// <summary> /// Sets a row in the person attached /// </summary> /// <param name="row">The row that has already been added to the persons attached table</param> /// <param name="person">The person whose details should be added to the row</param> /// <returns>Pdf row object</returns> private Row SetPersonAttachedRow(Row row, RequestPerson rp, ScreeningRequestPersonFinalDecision srpfd, int rowNum) { Text text; Cell cell; TextInfo textInfo = new TextInfo(); row.VerticalAlignment = VerticalAlignmentType.Top; row.IsBroken = false; //text customization for labels in request details textInfo.FontSize = 12; textInfo.IsTrueTypeFontBold = false; textInfo.Alignment = AlignmentType.Center; cell = row.Cells.Add(rowNum.ToString(), textInfo); //Career Column IList <Career> careers = this.requestPersonTasks.GetHistoricalCurrentCareers(rp, false); string functions = string.Empty; string rank = string.Empty; if (careers != null && careers.Any()) { IEnumerable <string> list = careers.Select(x => x.FunctionUnitSummary); functions = string.Join("; ", list.Where(x => !string.IsNullOrEmpty(x))); if (careers.First().Rank != null) { rank = careers.First().Rank.ToString(); } } cell = row.Cells.Add(functions, textInfo); cell = row.Cells.Add(rank, textInfo); //Name Column //personName = (person.IsProposed) ? person.PersonName + " (proposed)" : person.PersonName; cell = row.Cells.Add(rp.Person.Name.Trim(), textInfo); //Military ID Column cell = row.Cells.Add(rp.Person.MilitaryIDNumber, textInfo); //Support Status Column string status = string.Empty; if (srpfd != null) { status = srpfd.ScreeningSupportStatus.ToString(); } cell = row.Cells.Add(); text = new Text(status); //if (!System.String.IsNullOrEmpty(person.ScreeningSupportStatus)) //{ //Support Recommended //if (person.ScreeningSupportStatus.Equals("Support Recommended", StringComparison.OrdinalIgnoreCase)) //{ //text.TextInfo.BackgroundColor = new Color("Green"); //text.TextInfo.Color = new Color("White"); //} //Support Not Recommended //else if (person.ScreeningSupportStatus.Equals("Support Not Recommended", StringComparison.OrdinalIgnoreCase)) //{ //text.TextInfo.BackgroundColor = new Color("Red"); //text.TextInfo.Color = new Color("White"); //} //Monitored Support //else //{ //} //} text.TextInfo.Alignment = AlignmentType.Center; //text.TextInfo.LineSpacing = 6; cell.Paragraphs.Add(text); return(row); }
public bool WithdrawRequestPersonNomination(RequestPerson rp, AdminUser user) { RequestPersonHistory rph = this.SaveRequestPersonHistory(rp, RequestPersonStatus.NAME_NOMINATION_WITHDRAWN, user); return(rph != null); }
public RequestPerson SaveRequestPerson(RequestPerson rp) { return(this.requestPersonRepository.SaveOrUpdate(rp)); }