public static SubEntity BuildMemberBoardSubEntity(BoardCertificationsAdminDetailView parent, CertificationAgencyDto certificationAgencyDto) { _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == BoardCertificationsAdminDetailView._memberBoardSubEntity); if (_subEntity == null) _subEntity = new SubEntity() { EntityName = BoardCertificationsAdminDetailView._memberBoardSubEntity, DisplayName = "Member Boards", CanCreateNew = true }; else _subEntity.Records = new List<SubEntityRecord>(); AddExistingRecords(parent, certificationAgencyDto); AddNewRecordTemplate(parent, certificationAgencyDto); return _subEntity; }
private List<Field> BuildFields(CertificationAgencyDto certificationAgencyDto, bool newRecord) { var fields = new List<Field>(); if (!newRecord) fields.Add(new Field(_id, "Id", FieldTypes.Label, certificationAgencyDto.Id)); else fields.Add(new Field(_id, "Id", FieldTypes.Hidden, 0)); fields.Add(new Field(_name, "Name", FieldTypes.Text, certificationAgencyDto.Name, true)); fields.Add(new Field(_isEnabled, "Enabled", FieldTypes.Checkbox, newRecord ? true : certificationAgencyDto.IsEnabled)); return fields; }
private List<SubEntity> BuildSubEntities(CertificationAgencyDto certificationAgencyDto) { var subEntities = new List<SubEntity>(); subEntities.Add(MemberBoardHelper.BuildMemberBoardSubEntity(this, certificationAgencyDto)); _viewModel.SubEntities.Clear(); return subEntities; }
private static void AddNewRecordTemplate(BoardCertificationsAdminDetailView parent, CertificationAgencyDto certificationAgencyDto) { _subEntity.NewRecordTemplate = new SubEntityRecord() { Fields = { new Field(_agencyId, _agencyId, FieldTypes.Hidden, certificationAgencyDto.Id), new Field(_boardName, "Name", FieldTypes.Text, string.Empty, true), new Field(_boardEnabled, "Enabled", FieldTypes.Checkbox, true) } }; }
private static void AddExistingRecords(BoardCertificationsAdminDetailView parent, CertificationAgencyDto certificationAgencyDto) { var request = new ListCertificationBoardsRequest() { CertificationAgencyId = certificationAgencyDto.Id }; var boards = parent.ProcessRequest<ListCertificationBoardsResponse>(request).CertificationBoards; foreach (var board in boards) { var record = new SubEntityRecord(); var fields = new List<Field>(); fields.Add(new Field(_id, _id, FieldTypes.Hidden, board.Id)); fields.Add(new Field(_agencyId, _agencyId, FieldTypes.Hidden, board.CertificationAgencyId)); fields.Add(new Field(_boardName, "Name", FieldTypes.Text, board.Name, true)); fields.Add(new Field(_boardEnabled, "Enabled", FieldTypes.Checkbox, board.IsEnabled)); record.Fields = fields; record.SubEntities.Add(BuildCertificationSpecialtySubEntity(parent, board)); _subEntity.Records.Add(record); } }