private void BtnEditGroup_Click(object sender, EventArgs e) { var group = ((MemberWithGroup)TvGroupsMembers.SelectedObject).Group; var editGroup = new CreateGroup(ref group); editGroup.ShowDialog(); ((MemberWithGroup)TvGroupsMembers.SelectedObject).GroupName = group.Name; TvGroupsMembers.UpdateObject((MemberWithGroup)TvGroupsMembers.SelectedObject); }
private async void TvOrganization_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { _isItOrganization = true; ClearAllLabels(); TvGroupsMembers.ClearObjects(); TvGroupsMembers.AlwaysGroupByColumn = olvColumn4; if (TvOrganization.SelectedObject != null) { var organization = (Organization)TvOrganization.SelectedObject; var db = new DataBase(); var groups = await db.Groups.Where(d => !d.Deleted && d.OrganizationNode.Any(f => !f.Deleted && f.OrganizationId == organization.Id)) .ToListAsync(); foreach (var group in groups) { var members = await db.Members .Where(d => !d.Deleted && d.GroupNode.Any(f => !f.Deleted && f.GroupId == group.Id)) .ToListAsync(); var membersWithGroupList = members.Select(member => new MemberWithGroup { Picture = member.Picture, Birthdate = member.Birthdate, Id = member.Id, Description = member.Description, City = member.City, LastName = member.LastName, ZipCode = member.ZipCode, Gender = member.Gender, FirstName = member.FirstName, State = member.State, Street = member.Street, HouseNumber = member.HouseNumber, Country = member.Country, CreateDate = member.CreateDate, GroupName = @group.Name, Group = group, MemberDate = member.MemberDate, Member = member }) .ToList(); TvGroupsMembers.AddObjects(membersWithGroupList); } OrganizationLabels(ref organization); } }
private void BtnEditMember_Click(object sender, EventArgs e) { var member = ((MemberWithGroup)TvGroupsMembers.SelectedObject).Member; var editGroup = new CreateMember(ref member); editGroup.ShowDialog(); ((MemberWithGroup)TvGroupsMembers.SelectedObject).Member = member; ((MemberWithGroup)TvGroupsMembers.SelectedObject).Birthdate = member.Birthdate; ((MemberWithGroup)TvGroupsMembers.SelectedObject).City = member.City; ((MemberWithGroup)TvGroupsMembers.SelectedObject).Country = member.Country; ((MemberWithGroup)TvGroupsMembers.SelectedObject).CreateDate = member.CreateDate; ((MemberWithGroup)TvGroupsMembers.SelectedObject).Description = member.Description; ((MemberWithGroup)TvGroupsMembers.SelectedObject).FirstName = member.FirstName; ((MemberWithGroup)TvGroupsMembers.SelectedObject).Gender = member.Gender; ((MemberWithGroup)TvGroupsMembers.SelectedObject).HouseNumber = member.HouseNumber; ((MemberWithGroup)TvGroupsMembers.SelectedObject).LastName = member.LastName; ((MemberWithGroup)TvGroupsMembers.SelectedObject).MemberDate = member.MemberDate; ((MemberWithGroup)TvGroupsMembers.SelectedObject).Picture = member.Picture; ((MemberWithGroup)TvGroupsMembers.SelectedObject).State = member.State; ((MemberWithGroup)TvGroupsMembers.SelectedObject).Street = member.Street; ((MemberWithGroup)TvGroupsMembers.SelectedObject).ZipCode = member.ZipCode; TvGroupsMembers.UpdateObject((MemberWithGroup)TvGroupsMembers.SelectedObject); }