protected void Page_Load(object sender, EventArgs e) { PersonsController persons = new PersonsController(); ListPerson.DataSource = persons.PersonsList(); ListPerson.DataBind(); }
void CreatePerson() { Person p = new Person(1); p.FirstName = "test"; p.LastName = "test"; ListPerson.Add(p); }
private void CalculateFilterProperties() { NumberOfChildren = new int[] { 0, 1, 2, 3 }; MinAge = ListPerson.Min(x => x.Age); MaxAge = ListPerson.Max(x => x.Age); MinBirthDate = ListPerson.Min(x => x.BirthDate); MaxBirthDate = ListPerson.Max(x => x.BirthDate); }
public ListPerson GetPerson() { var person = (ListPerson)Session["Person"]; if (person == null) { person = new ListPerson(); Session["Person"] = person; } return(person); }
public ViewModelMain() { var personas = db.Personas.Take(10).ToList(); People = new ObservableCollection<ListPerson> { }; foreach (var p in personas) { ListPerson listPerson = new ListPerson { Nombre = p.PrimerNombre, TipoDocumento = p.TipoDocumento, Documento = p.NoDocumento, Departamento = p.Departamento, Ciudad = p.Ciudad, Telefono = p.Telefono, Celular = p.Celular }; People.Add(listPerson); } TextProperty1 = "Type here"; AddUserCommand = new RelayCommand(AddUser); }
public async Task <IEnumerable <ListPerson> > GetList() { var peopleDb = await _personRepository.FindAllPeople(); var listPeople = new List <ListPerson>(); foreach (var personDb in peopleDb) { var person = new ListPerson { Id = personDb.Key, Label = personDb.Value.PreferredName + " " + FindDates(personDb.Value) }; listPeople.Add(person); } return(listPeople); }
public List <ListPerson> GetData(string sortBy) { List <ListPerson> retval = new List <ListPerson>(); if (this.listedPersons != null) { People ppl = People.FromIdentities(this.listedPersons); Dictionary <int, List <BasicParticipation> > membershipTable = Participations.GetParticipationsForPeople(ppl, Participation.GracePeriod); Participations participationsToLoad = new Participations(); foreach (Person p in ppl) { if (membershipTable.ContainsKey(p.Identity)) { foreach (BasicParticipation bm in membershipTable[p.Identity]) { if (bm.OrganizationId == this.selectedOrgId) { Participation ms = Participation.FromBasic(bm); participationsToLoad.Add(ms); } } } } Participation.LoadPaymentStatuses(participationsToLoad); Dictionary <int, Participation> memberships = new Dictionary <int, Participation>(); foreach (Participation ms in participationsToLoad) { memberships[ms.Identity] = ms; } foreach (Person p in ppl) { ListPerson lp = new ListPerson(p); if (membershipTable.ContainsKey(p.Identity)) { foreach (BasicParticipation bm in membershipTable[p.Identity]) { if (bm.OrganizationId == this.selectedOrgId) { Participation ms = memberships[bm.MembershipId]; lp.JoinedDate = ms.MemberSince; lp.ExpiresDate = ms.Expires; lp.MembershipId = ms.Identity; retval.Add(lp); } } } } } PropertyInfo pi = typeof(ListPerson).GetProperty(sortBy); if (pi != null) { MemberInfo[] miA = pi.PropertyType.GetMember("CompareTo", MemberTypes.Method, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); if (miA.Length > 0) { MethodInfo mi = (MethodInfo)miA[0]; retval.Sort( delegate(ListPerson p1, ListPerson p2) { return(Convert.ToInt32(mi.Invoke(pi.GetValue(p1, null), new[] { pi.GetValue(p2, null) }))); }); } } return(retval); }
public List<ListPerson> GetData (string sortBy) { List<ListPerson> retval = new List<ListPerson>(); if (listedPersons != null) { People ppl = People.FromIdentities(listedPersons); Dictionary<int, List<BasicMembership>> membershipTable = Memberships.GetMembershipsForPeople(listedPersons, Membership.GracePeriod); Memberships membershipsToLoad = new Memberships(); foreach (Person p in ppl) { if (membershipTable.ContainsKey(p.Identity)) { foreach (BasicMembership bm in membershipTable[p.Identity]) { if (bm.OrganizationId == selectedOrgId) { Membership ms = Membership.FromBasic(bm); membershipsToLoad.Add(ms); } } } } Membership.LoadPaymentStatuses(membershipsToLoad); Dictionary<int, Membership> memberships = new Dictionary<int, Membership>(); foreach (Membership ms in membershipsToLoad) { memberships[ms.Identity] = ms; } foreach (Person p in ppl) { ListPerson lp = new ListPerson(p); if (membershipTable.ContainsKey(p.Identity)) { foreach (BasicMembership bm in membershipTable[p.Identity]) { if (bm.OrganizationId == selectedOrgId) { Membership ms = memberships[bm.MembershipId]; lp.JoinedDate = ms.MemberSince; lp.ExpiresDate = ms.Expires; lp.MembershipId = ms.Identity; retval.Add(lp); } } } } } PropertyInfo pi = typeof(ListPerson).GetProperty(sortBy); if (pi != null) { MemberInfo [] miA = pi.PropertyType.GetMember("CompareTo", MemberTypes.Method, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); if (miA.Length > 0) { MethodInfo mi =(MethodInfo) miA[0]; retval.Sort(delegate(ListPerson p1, ListPerson p2) { return Convert.ToInt32(mi.Invoke(pi.GetValue(p1, null), new object[] { pi.GetValue(p2, null) })); }); } } return retval; }
protected override void OnStartup(StartupEventArgs e) { ListPerson = new ListPerson(); base.OnStartup(e); }
void DelPerson() { ListPerson.Remove(SelectedPerson); }