public async Task <ActionResult> Search(SearchPersonModel model) { List <Person> persons = new List <Person>(); if (!String.IsNullOrWhiteSpace(model.Email)) { //search by email PersonListOptions options = new PersonListOptions() { Email = model.Email }; persons = await ArenaAPIHelper.GetPersons(options); } else if (!String.IsNullOrWhiteSpace(model.PhoneNumber)) { //search by phone PersonListOptions options = new PersonListOptions() { PhoneNumber = ValidationHelper.CleanPhoneNumber(model.PhoneNumber) }; persons = await ArenaAPIHelper.GetPersons(options); } return(PartialView("_persons", persons)); }
private void AddPerson(SearchPersonModel p, IList <SearchPersonModel> list, int originid, int?entrypointid) { if (p.IsNew) { p.AddPerson(originid, p.EntryPoint.Value.ToInt(), p.Campus.Value.ToInt()); } else { if (entrypointid != 0 && (!p.person.EntryPointId.HasValue || p.person.EntryPointId == 0)) { p.person.EntryPointId = entrypointid; } if (originid != 0 && (!p.person.OriginId.HasValue || p.person.OriginId == 0)) { p.person.OriginId = originid; } DbUtil.Db.SubmitChanges(); } if (p.FamilyId < 0) // fix up new family pointers { var q = from m in list where m.FamilyId == p.FamilyId select m; var list2 = q.ToList(); foreach (var m in list2) { m.FamilyId = p.person.FamilyId; } } Util2.CurrentPeopleId = p.person.PeopleId; Session["ActivePerson"] = p.person.Name; }
private ActionResult GetView(SearchPersonModel searchPersonModel) { var Persons = _PersonRepository.GetBy(_sessionSearch.PersonSearchSpec); searchPersonModel.Init(Persons, _sessionSearch.PersonSearchSpec); return View(searchPersonModel); }
private SearchPersonModel NewPerson(int FamilyId, SearchAddModel m) { var cv = new CodeValueModel(); var p = new SearchPersonModel { FamilyId = FamilyId, index = m.List.Count, Gender = new CodeInfo(99, cv.GenderCodesWithUnspecified()), Marital = new CodeInfo(99, cv.MaritalStatusCodes99()), Campus = new CodeInfo(m.CampusId, cv.AllCampuses0()), EntryPoint = new CodeInfo(m.EntryPointId, cv.EntryPoints()), context = m.type, }; #if DEBUG p.First = "David"; p.Last = "Carr." + DateTime.Now.Millisecond; p.Gender = new CodeInfo(0, cv.GenderCodesWithUnspecified()); p.Marital = new CodeInfo(0, cv.MaritalStatusCodes99()); p.dob = "na"; p.Email = "na"; p.Phone = "na"; p.Address = "na"; p.Zip = "na"; p.HomePhone = "na"; #endif m.List.Add(p); return(p); }
private SearchPersonModel NewPerson(int FamilyId, SearchModel m) { var p = new SearchPersonModel { FamilyId = FamilyId, index = m.List.Count, gender = 99, marital = 99, campus = m.CampusId, entrypoint = m.EntryPointId, context = m.type, }; #if DEBUG p.first = "David"; p.last = "Carr." + DateTime.Now.Millisecond; p.gender = 0; p.marital = 0; p.dob = "na"; p.email = "na"; p.phone = "na"; p.address = "na"; p.zip = "na"; p.homephone = "na"; #endif m.List.Add(p); return(p); }
public ActionResult Select(int id, SearchModel m) { if (m.List.AsEnumerable().Any(li => li.PeopleId == id)) { return(View("List", m)); } var p = DbUtil.Db.LoadPersonById(id); var s = new SearchPersonModel { PeopleId = id, FamilyId = m.type == "family" ? m.typeid.Value : p.FamilyId, first = p.FirstName, goesby = p.NickName, last = p.LastName, marital = p.MaritalStatusId, email = p.EmailAddress, suffix = p.SuffixCode, title = p.TitleCode, dob = p.DOB, gender = p.GenderId, phone = p.CellPhone, context = m.type, }; s.LoadFamily(); m.List.Add(s); if (m.OnlyOne) { return(Complete(m.typeid.ToString(), m)); } return(View("List", m)); }
public ActionResult Search(SearchPersonModel searchPersonModel, int? page) { _sessionSearch.PersonSearchSpec.PageSize = 20; if (Request["page"] != null) _sessionSearch.PersonSearchSpec.CurrentPage = Convert.ToInt32(Request["page"]); return GetView(searchPersonModel); }
public ActionResult Search(SearchPersonModel searchPersonModel) { _sessionSearch.PersonSearchSpec.CurrentPage = 1; _sessionSearch.PersonSearchSpec.Filter.TextSearch.Clear(); if (searchPersonModel.SearchTerm != null) _sessionSearch.PersonSearchSpec.Filter.TextSearch.AddTerms(searchPersonModel.SearchTerm); return GetView(searchPersonModel); }
public ActionResult Find(String email) { SearchPersonModel viewModel = new SearchPersonModel(); if (!String.IsNullOrWhiteSpace(email)) { viewModel.Email = email; ViewData["fromRegister"] = true; return(View(viewModel)); } viewModel.Email = String.Empty; return(View(viewModel)); }
public IActionResult Search(SearchPersonModel searchPersonModel) { var clan = searchPersonModel.Clan == 0 ? null : _clanAndPeopleService.Clans.First(c => c.Id == searchPersonModel.Clan); var clanSearch = clan == null ? string.Empty : $"{clan.Family}, {clan.FamilyName}"; var results = _clanAndPeopleService.People.Where(p => (searchPersonModel.Clan == 0 || p.ClanId == searchPersonModel.Clan) && (string.IsNullOrWhiteSpace(searchPersonModel.FirstName) || (p.FirstName != null && p.FirstName.Equals(searchPersonModel.FirstName, StringComparison.CurrentCultureIgnoreCase))) && (string.IsNullOrWhiteSpace(searchPersonModel.LastName) || (p.LastName != null && p.LastName.Equals(searchPersonModel.LastName, StringComparison.CurrentCultureIgnoreCase))) && (string.IsNullOrWhiteSpace(searchPersonModel.EmailAddress) || (p.EmailAddress != null && p.EmailAddress.Equals(searchPersonModel.EmailAddress, StringComparison.CurrentCultureIgnoreCase))) && (string.IsNullOrWhiteSpace(searchPersonModel.Occupation) || p.Occupation != null && (p.Occupation.Equals(searchPersonModel.Occupation, StringComparison.CurrentCultureIgnoreCase)))); return(View("List", results)); }
public IEnumerable <PersonModel> GetPeople(SearchPersonModel spm) { var people = _context.People.Where(p => (string.IsNullOrEmpty(spm.PrivateNo) || p.PrivateNo == spm.PrivateNo) && (string.IsNullOrEmpty(spm.FirstName) || p.FirstName == spm.FirstName) && (string.IsNullOrEmpty(spm.LastName) || p.LastName == spm.LastName) && (string.IsNullOrEmpty(spm.Phone) || p.Phone == spm.Phone) && (spm.Profession == Profession.None || p.Profession == spm.Profession) && (!spm.AgeMin.HasValue || (DateTime.Now - p.BirthDate).Days / 365 >= spm.AgeMin) && (!spm.AgeMax.HasValue || (DateTime.Now - p.BirthDate).Days / 365 <= spm.AgeMax) && (!spm.RegDateFrom.HasValue || p.RegistrationDate > spm.RegDateFrom) && (!spm.RegDateTo.HasValue || p.RegistrationDate < spm.RegDateTo) && (!spm.RemoveDateFrom.HasValue || p.RemoveDate > spm.RemoveDateFrom) && (!spm.RemoveDateTo.HasValue || p.RemoveDate < spm.RemoveDateTo) ).ToList(); List <PersonModel> pms = new List <PersonModel>(people.Select(pm => new PersonModel() { BirthDate = pm.BirthDate, FirstName = pm.FirstName, ID = pm.ID, LastName = pm.LastName, Phone = pm.Phone, PrivateNo = pm.PrivateNo, Profession = pm.Profession, RegistrationDate = pm.RegistrationDate, RemoveDate = pm.RemoveDate, Age = (DateTime.Now - pm.BirthDate).Days / 365, IsActive = pm.IsActive })); return(pms); }
public ActionResult Select(int id, SearchAddModel m) { if (m.List.AsEnumerable().Any(li => li.PeopleId == id)) { return(View("List", m)); } var cv = new CodeValueModel(); var p = DbUtil.Db.LoadPersonById(id); var s = new SearchPersonModel { PeopleId = id, FamilyId = m.type == "family" ? m.typeid.ToInt() : p.FamilyId, First = p.FirstName, GoesBy = p.NickName, Last = p.LastName, Marital = new CodeInfo(p.GenderId, cv.MaritalStatusCodes99()), Email = p.EmailAddress, Suffix = p.SuffixCode, Title = p.TitleCode, dob = p.DOB, Gender = new CodeInfo(p.GenderId, cv.GenderCodesWithUnspecified()), Phone = p.CellPhone, context = m.type, EntryPoint = new CodeInfo(p.EntryPointId, cv.EntryPoints()), Campus = new CodeInfo(p.CampusId, cv.AllCampuses0()), }; s.LoadFamily(); m.List.Add(s); if (m.OnlyOne) { return(Complete(m)); } return(View("List", m)); }
//GET: People public async Task <IActionResult> Index(SearchPersonModel spm) { return(View(_ps.GetPeople(spm))); }
public SearchPersonModel NewPerson(int familyid) { var p = new SearchPersonModel { FamilyId = familyid, index = List.Count, Gender = new CodeInfo(99, "Gender"), Marital = new CodeInfo(99, "Marital"), Campus = new CodeInfo(CampusId, "Campus"), EntryPoint = new CodeInfo(EntryPointId, "EntryPoint"), context = type, Title = new CodeInfo("", "Title"), }; if (familyid == 0) { p.FamilyId = NextNewFamilyId(); p.isNewFamily = true; } #if DEBUG p.First = "David"; p.Last = "Carr." + DateTime.Now.Millisecond; p.Gender = new CodeInfo(0, "Gender"); p.Marital = new CodeInfo(0, "Marital"); p.dob = "na"; p.Email = "na"; p.Phone = "na"; #endif List.Add(p); return p; }