|
@@ -870,17 +870,27 @@ namespace TEAMModelOS.SDK
|
|
|
if (guardians.Any())
|
|
|
{
|
|
|
guardians.ForEach(x => {
|
|
|
- GuardianStudent guardianStudent = x.students.Find(s => s.id.Equals("stud.Key") && s.code.Equals("schoolId"));
|
|
|
+ GuardianStudent guardianStudent = x.students.Find(s => s.id.Equals(stud.Key) && s.code.Equals(schoolId));
|
|
|
+ if (guardianStudent == null) {
|
|
|
+ x.students.Add(new GuardianStudent { type=2,id=stud.Key,code=schoolId,name=stud.Value.name });
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
- else {
|
|
|
-
|
|
|
+ else {
|
|
|
+ Guardian guardian = new Guardian {
|
|
|
+ id = Guid.NewGuid().ToString(),
|
|
|
+ code= "Base-Guardian",
|
|
|
+ pk= "Guardian",
|
|
|
+ mobile=stud.Value.gPhone,
|
|
|
+ name = stud.Value.gName,
|
|
|
+ students = new List<GuardianStudent> { new GuardianStudent { type = 2, id = stud.Key, code = schoolId, name = stud.Value.name } }
|
|
|
+ };
|
|
|
}
|
|
|
- var guardian = student.guardians.Find(x => !string.IsNullOrWhiteSpace(x.mobile) && x.mobile.Equals(stud.Value.gPhone));
|
|
|
- if (guardian != null)
|
|
|
+ var studentGuardian = student.guardians.Find(x => !string.IsNullOrWhiteSpace(x.mobile) && x.mobile.Equals(stud.Value.gPhone));
|
|
|
+ if (studentGuardian != null)
|
|
|
{
|
|
|
- guardian.name = stud.Value.gName;
|
|
|
- guardian.relation = stud.Value.guardian;
|
|
|
+ studentGuardian.name = stud.Value.gName;
|
|
|
+ studentGuardian.relation = stud.Value.guardian;
|
|
|
}
|
|
|
else
|
|
|
{
|