Beispiel #1
0
        public static async void SetMagellanIds(FbConnection fbConnection, int tenantId, List <Students> students, List <SimpleCache> schoolTerms)
        {
            foreach (var student in students)
            {
                foreach (var career in student.Career)
                {
                    // Find SchoolTerm
                    var schoolTerm = schoolTerms.Find(t => t.EcfId.Equals(career.EcfValues.SchoolTermId));

                    if (schoolTerm != null)
                    {
                        career.MagellanValues.SchoolTermId = schoolTerm.MagellanId;

                        // Find SchoolClassTerm
                        DbResult dbResult = await RecordExists.SchoolClassTerm(fbConnection, tenantId, career.EcfValues.ClassTermId);

                        if (dbResult.Success)
                        {
                            career.MagellanValues.ClassTermId = (int)dbResult.Value;

                            // Find SchoolClass
                            dbResult = await RecordExists.SchoolClassByTerm(fbConnection, tenantId, career.EcfValues.ClassTermId);

                            if (dbResult.Success)
                            {
                                career.MagellanValues.SchoolClassId = (int)dbResult.Value;

                                // Find SchoolClassAttendance
                                dbResult = await RecordExists.StudentSchoolClassAttendances(fbConnection, tenantId, career.MagellanValues.ClassTermId, student.MagellanId);

                                if (dbResult.Success)
                                {
                                    career.MagellanValues.StudentTermId = (int)dbResult.Value;
                                }
                            }
                        }
                    }
                }
            }
        }