public static List<SubEntityRecord> GetDropdownValues(ProviderAdminDetailView parent, int providerId) { IEnumerable<ProviderCertificationSpecialtyDto> existintCerts = new List<ProviderCertificationSpecialtyDto>(); if (providerId != 0) existintCerts = GetProviderCertificationSpecialties(parent, providerId); var request = new ListCertificationSpecialtiesRequest(); var certificationSpecialties = parent.ProcessRequest<ListCertificationSpecialtiesResponse>(request).CertificationSpecialties; var records = new List<SubEntityRecord>(); foreach (var certificationSpecialty in certificationSpecialties.Where(c => c.IsEnabled && c.CertificationAgencyIsEnabled && !existintCerts.Any(e => e.CertificationSpecialtyId == c.Id))) { var record = new SubEntityRecord(); record.DisplayName = certificationSpecialty.Name + " (" + certificationSpecialty.CertificationBoardName + ", " + certificationSpecialty.CertificationAgencyName + ")"; record.Id = certificationSpecialty.Id; record.Fields.Add(new Field(_providerId, _providerId, FieldTypes.Hidden, providerId)); record.Fields.Add(new Field(_certificationSpecialtyId, _certificationSpecialtyId, FieldTypes.Hidden, certificationSpecialty.Id)); record.Fields.Add(new Field(_certificationSpecialtyName, "Certification Specialty", FieldTypes.Label, certificationSpecialty.Name)); record.Fields.Add(new Field(_certificationBoardName, "Board Name", FieldTypes.Label, certificationSpecialty.CertificationBoardName)); record.Fields.Add(new Field(_certificationAgencyName, "Certification Agency", FieldTypes.Label, certificationSpecialty.CertificationBoardName)); record.Fields.Add(new Field(_yearOfIssuance, "Year Of Issuance", FieldTypes.Text, null, true)); records.Add(record); } return records; }
private static SubEntity BuildCertificationSpecialtySubEntity(BoardCertificationsAdminDetailView parent, CertificationBoardDto boardDto) { var subEntity = new SubEntity() { EntityName = BoardCertificationsAdminDetailView._certificationSpecialtySubEntity, DisplayName = "Certification Specialties", CanCreateNew = true }; var request = new ListCertificationSpecialtiesRequest() { CertificationBoardId = boardDto.Id}; var response = parent.ProcessRequest<ListCertificationSpecialtiesResponse>(request); foreach (var specialty in response.CertificationSpecialties) { var record = new SubEntityRecord(); record.Fields.Add(new Field(_id, _specialtyId, FieldTypes.Hidden, specialty.Id)); record.Fields.Add(new Field(_boardId, _boardId, FieldTypes.Hidden, boardDto.Id)); record.Fields.Add(new Field(_specialtyName, "Name", FieldTypes.Text, specialty.Name, true)); record.Fields.Add(new Field(_specialtyEnabled, "Enabled", FieldTypes.Checkbox, specialty.IsEnabled)); record.Fields.Add(new Field(_isSubSpecialty, "Sub-Specialty", FieldTypes.Checkbox, specialty.IsSubspecialty)); subEntity.Records.Add(record); } subEntity.NewRecordTemplate.Fields.Add(new Field(_boardId, _boardId, FieldTypes.Hidden, boardDto.Id)); subEntity.NewRecordTemplate.Fields.Add(new Field(_specialtyName, "Name", FieldTypes.Text, string.Empty, true)); subEntity.NewRecordTemplate.Fields.Add(new Field(_specialtyEnabled, "Enabled", FieldTypes.Checkbox, true)); subEntity.NewRecordTemplate.Fields.Add(new Field(_isSubSpecialty, "Sub-Specialty", FieldTypes.Checkbox, false)); return subEntity; }