/// <summary> /// Create a new SubSection. /// </summary> public SubSection CreateSubSection(string label) { var subSection = new SubSection(this, label); SubSections.Add(subSection); return(subSection); }
/// <summary> /// Create a new Field in this Section /// </summary> public Field CreateField(Guid dataEntryFieldId, string label, SubSection subSection = null) { if (Fields.Any(x => x.DataEntryFieldId == dataEntryFieldId)) { throw new Exception("Duplicate Data Entry Fields are not allowed."); } if (subSection != null && subSection.SectionId != Id) { throw new Exception("Field cannot be created. The SubSection does not belong to this Section."); } // Create the Field var field = new Field(this, dataEntryFieldId, label); // Set the SubSection if (subSection != null) { field.SetSubSection(subSection.Id); } // Add the Field Fields.Add(field); return(field); }
/// <summary> /// Get a List of Fields in a Specific SubSection. /// </summary> public List <Field> GetFieldsInSubsection(SubSection subSection) { return(Fields.Where(x => x.SubSectionId == subSection.Id).ToList()); }