Skip to content

Commit 8bf9801

Browse files
committed
Incorporate extended elements in AU demo projects
Enhance the AU demo projects (Consumer and Provider) to incorporate extended elements in the StudentPersonal object.
1 parent cd353df commit 8bf9801

3 files changed

Lines changed: 44 additions & 2 deletions

File tree

Code/Sif3FrameworkDemo/Sif.Framework.Demo.Au.Consumer/ConsumerApp.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,22 @@ void RunStudentPersonalConsumer()
189189

190190
// Create a new student.
191191
if (log.IsInfoEnabled) log.Info("*** Create a new student.");
192+
string[] text = new string[]
193+
{
194+
@"
195+
<MedicalCondition>
196+
<ConditionID>Unique Medical Condition ID</ConditionID>
197+
<Condition>Condition</Condition>
198+
<Severity>Condition Severity</Severity>
199+
<Details>Condition Details</Details>
200+
</MedicalCondition>
201+
"
202+
};
203+
SIF_ExtendedElementsTypeSIF_ExtendedElement extendedElement = new SIF_ExtendedElementsTypeSIF_ExtendedElement { Name = "MedicalConditions", Text = text };
204+
SIF_ExtendedElementsTypeSIF_ExtendedElement[] extendedElements = new SIF_ExtendedElementsTypeSIF_ExtendedElement[] { extendedElement };
192205
NameOfRecordType newStudentName = new NameOfRecordType { FamilyName = "Wayne", GivenName = "Bruce", Type = NameOfRecordTypeType.LGL };
193206
PersonInfoType newStudentInfo = new PersonInfoType { Name = newStudentName };
194-
StudentPersonal newStudent = new StudentPersonal { LocalId = "555", PersonInfo = newStudentInfo };
207+
StudentPersonal newStudent = new StudentPersonal { LocalId = "555", PersonInfo = newStudentInfo, SIF_ExtendedElements = extendedElements };
195208
StudentPersonal retrievedNewStudent = studentPersonalConsumer.Create(newStudent);
196209
if (log.IsInfoEnabled) log.Info("Created new student " + newStudent.PersonInfo.Name.GivenName + " " + newStudent.PersonInfo.Name.FamilyName);
197210

@@ -290,6 +303,22 @@ void RunStudentPersonalConsumer()
290303
foreach (StudentPersonal student in teachingGroupStudents)
291304
{
292305
if (log.IsInfoEnabled) log.Info("Student name is " + student.PersonInfo.Name.GivenName + " " + student.PersonInfo.Name.FamilyName);
306+
307+
if (student.SIF_ExtendedElements != null && student.SIF_ExtendedElements.Length > 0)
308+
{
309+
310+
foreach (SIF_ExtendedElementsTypeSIF_ExtendedElement element in student.SIF_ExtendedElements)
311+
{
312+
313+
foreach (string content in element.Text)
314+
{
315+
if (log.IsInfoEnabled) log.Info("Extended element text is ...\n" + content);
316+
}
317+
318+
}
319+
320+
}
321+
293322
}
294323

295324
}

Code/Sif3FrameworkDemo/Sif.Framework.Demo.Au.Provider/Services/StudentPersonalService.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,22 @@ public class StudentPersonalService : IBasicProviderService<StudentPersonal>
3232

3333
private static StudentPersonal CreateBartSimpson()
3434
{
35+
36+
string[] text = new string[]
37+
{
38+
@"<MedicalCondition>
39+
<ConditionID>Unique Medical Condition ID</ConditionID>
40+
<Condition>Condition</Condition>
41+
<Severity>Condition Severity</Severity>
42+
<Details>Condition Details</Details>
43+
</MedicalCondition>"
44+
};
45+
46+
SIF_ExtendedElementsTypeSIF_ExtendedElement extendedElement = new SIF_ExtendedElementsTypeSIF_ExtendedElement { Name = "MedicalConditions", Text = text };
47+
SIF_ExtendedElementsTypeSIF_ExtendedElement[] extendedElements = new SIF_ExtendedElementsTypeSIF_ExtendedElement[] { extendedElement };
3548
NameOfRecordType name = new NameOfRecordType { Type = NameOfRecordTypeType.LGL, FamilyName = "Simpson", GivenName = "Bart" };
3649
PersonInfoType personInfo = new PersonInfoType { Name = name };
37-
StudentPersonal studentPersonal = new StudentPersonal { RefId = Guid.NewGuid().ToString(), LocalId = "666", PersonInfo = personInfo };
50+
StudentPersonal studentPersonal = new StudentPersonal { RefId = Guid.NewGuid().ToString(), LocalId = "666", PersonInfo = personInfo, SIF_ExtendedElements = extendedElements };
3851

3952
return studentPersonal;
4053
}
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)