internal V_AIM(SeamlessViewsContext Context, ST ST) : base(Context) { _student_code = ST.STKEY; _first_name = ST.FIRST_NAME; _middle_name = ST.SECOND_NAME; _surname = ST.SURNAME; _gender = ST.GENDER == "M" ? "MALE" : ST.GENDER == "F" ? "FEMAL" : ""; _date_of_birth = ST.BIRTHDATE.HasValue ? ST.BIRTHDATE.Value.ToString("dd/MM/yyyy") : null; _LBOTE = ST.LBOTE == "N" ? 0 : 1; _ATSI = ST.KOORIE == "K" || ST.KOORIE == "T" || ST.KOORIE == "B" || ST.KOORIE == "U" ? 1 : 0; _disability_status = ST.DISABILITY == "Y" ? 1 : 0; _EMA = ST.ED_ALLOW == "Y" ? 1 : 0; _ESL = ST.ENG_SPEAK == "N" ? 1 : 0; _home_group = ST.HOME_GROUP; _year_level = ST.SCHOOL_YEAR == "00" ? "P" : ST.SCHOOL_YEAR; }
internal V_ST_ATTEND(SeamlessViewsContext Context, ST ST) : base(Context) { _SID = ST.REGISTRATION; _STKEY = ST.STKEY; _SURNAME = ST.SURNAME; _FIRST_NAME = ST.FIRST_NAME; _PREF_NAME = ST.PREF_NAME; _HOME_GROUP = ST.HOME_GROUP; _hgrpdesc = ST.HOME_GROUP_KGC?.DESCRIPTION ?? ST.HOME_GROUP; _SCHOOL_YEAR = ST.SCHOOL_YEAR; _yrlvldesc = ST.SCHOOL_YEAR_KCY?.SHORT_DESC ?? ST.SCHOOL_YEAR; _HOUSE = ST.HOUSE; _FAMILY = ST.FAMILY; _STATUS = ST.STATUS; _NOTES = ST.NOTES; _OVERSEAS = ST.OVERSEAS; _ACCESS_ALERT = ST.ACCESS_ALERT; _ATTENDANCE_MEMO = ST.ATTENDANCE_MEMO; _TAG = ST.TAG; _FAMB = ST.FAMB; _CAMPUS = ST.CAMPUS; _MEDICAL_ALERT = ST.MEDICAL_ALERT; }
internal V_RISK(SeamlessViewsContext Context, ST ST, bool KGDAvailable, bool KGGAvailable) : base(Context) { var year = DateTime.Now.Year; var eslCutOff = new DateTime(year, 1, 1); _FIRST_REG_NO = ST.FIRST_REG_NO; _STKEY = ST.STKEY; _ENTRY = ST.ENTRY?.ToString("MM/dd/yyyy"); _SCHOOL_YEAR = ST.SCHOOL_YEAR; _HOME_GROUP = ST.HOME_GROUP; _STUDENT = $"{ST.SURNAME}, {ST.FIRST_NAME}"; var attendance = ST. STKEY_SXAB_STKEY .Where(sxab => sxab.ABSENCE_DATE.Value.Year == year) .Select(sxab => new { sxab.STKEY, sxab.ABSENCE_DATE, AM = sxab.AM_ACT_TYPE_KCT, PM = sxab.PM_ACT_TYPE_KCT, Source = 0 // SXAB }) .Concat( ST.STKEY_SXABCONV_STKEY .Where(conv => conv.ABSENCE_DATE.Value.Year == year) .Select(conv => new { conv.STKEY, conv.ABSENCE_DATE, AM = conv.AM_TYPE_KCT, PM = conv.PM_TYPE_KCT, Source = 1 // SXABCONV })) .GroupBy( r => new { r.STKEY, r.ABSENCE_DATE }, (k, g) => new { k.STKEY, k.ABSENCE_DATE, AM = g.Aggregate((r1, r2) => r2.AM.KCTKEY > 0 && (r1.Source == 1 && (r2.Source == 0 || r2.AM.KCTKEY > r1.AM.KCTKEY)) || (r1.Source == 0 && r2.Source == 0 && r2.AM.KCTKEY > r1.AM.KCTKEY) ? r2 : r1).AM, PM = g.Aggregate((r1, r2) => r2.PM.KCTKEY > 0 && (r1.Source == 1 && (r2.Source == 0 || r2.PM.KCTKEY > r1.PM.KCTKEY)) || (r1.Source == 0 && r2.Source == 0 && r2.PM.KCTKEY > r1.PM.KCTKEY) ? r2 : r1).PM }).ToList(); var absences = attendance.Aggregate(0m, (v, r) => (r.AM.KCTKEY >= 200 && r.AM.CURRICULUM == "N" ? .5m : 0m) + (r.PM.KCTKEY >= 200 && r.PM.CURRICULUM == "N" ? .5m : 0m)); var daysMarked = attendance.Aggregate(0m, (v, r) => (r.AM.KCTKEY > 0 ? .5m : 0m) + (r.PM.KCTKEY > 0 ? .5m : 0m)); _UNAPPROVED = attendance.Aggregate(0m, (v, r) => (r.AM.KCTKEY == 208 || r.AM.KCTKEY == 300 || r.AM.KCTKEY == 500 ? .5m : 0m) + (r.PM.KCTKEY == 208 || r.PM.KCTKEY == 300 || r.PM.KCTKEY == 500 ? .5m : 0m)); _ATTEND_PERCENT = daysMarked > 0m ? (daysMarked - absences) / daysMarked * 100m : 0m; _ENGREA = ST.STKEY_STVDI_SKEY.Where(r => r.VDIMENSION == "ENGREA" && r.SCORE != "NA").Aggregate((STVDI)null, (a, r) => a == null || r.YEAR_SEMESTER.CompareTo(a.YEAR_SEMESTER) > 0 ? r : a)?.SCORE ?? ""; _ENGWRI = ST.STKEY_STVDI_SKEY.Where(r => r.VDIMENSION == "ENGWRI" && r.SCORE != "NA").Aggregate((STVDI)null, (a, r) => a == null || r.YEAR_SEMESTER.CompareTo(a.YEAR_SEMESTER) > 0 ? r : a)?.SCORE ?? ""; _MATNUM = ST.STKEY_STVDI_SKEY.Where(r => r.VDIMENSION == "MATNUM" && r.SCORE != "NA").Aggregate((STVDI)null, (a, r) => a == null || r.YEAR_SEMESTER.CompareTo(a.YEAR_SEMESTER) > 0 ? r : a)?.SCORE ?? ""; _MATSTR = ST.STKEY_STVDI_SKEY.Where(r => r.VDIMENSION == "MATSTR" && r.SCORE != "NA").Aggregate((STVDI)null, (a, r) => a == null || r.YEAR_SEMESTER.CompareTo(a.YEAR_SEMESTER) > 0 ? r : a)?.SCORE ?? ""; _INTERNAL_SUSPENSION = attendance.Aggregate(0m, (v, r) => (r.AM.KCTKEY == 400 ? .5m : 0m) + (r.PM.KCTKEY == 400 ? .5m : 0m)); _EXTERNAL_SUSPENSION = attendance.Aggregate(0m, (v, r) => (r.AM.KCTKEY == 401 ? .5m : 0m) + (r.PM.KCTKEY == 401 ? .5m : 0m)); _OCCUPATION_CODE = ST.FAMILY_OCCUPATION; _ALERTS = $"{ST.KOORIE ?? "N"}{(ST.BIRTH_COUNTRY_KGT?.REFUGEE == "Y" ? "Y" : (ST.ESL(eslCutOff, 7) == "Y" && ST.VISA_SUBCLASS_KCV?.REFUGEE == "Y" ? "Y" : "N"))}{ST.DISABILITY ?? "N"}{ST.INTEGRATION ?? "N"}{ST.YOUTH_ALLOW ?? "N"}{ST.ACCESS_ALERT ?? "N"}{ST.RISK_ALERT ?? "N"}{ST.MEDICAL_ALERT ?? "N"}"; _GENDER = ST.GENDER; _LIVING_ARR = ST.LIVING_ARR; _EXIT_DATE = ST.EXIT_DATE?.ToString("dd/MM/yyyy"); // KGD isn't currently included in any typical eduHub services if (KGDAvailable) { _EXIT_0 = ST.STATUS == "LEFT" ? (ST.SCHOOL_YEAR.CompareTo("09") < 0 || ST.SCHOOL_YEAR == "UG" ? ST.NEXT_SCHOOL_SKGS?.NAME ?? "" : ST.EXIT_DEST01_KGD?.DESCRIPTION ?? "") : ""; } else { _EXIT_0 = ST.STATUS == "LEFT" ? ST.NEXT_SCHOOL_SKGS?.NAME ?? "" : ""; } // KGG isn't currently included in any typical eduHub services if (KGGAvailable) { _EXIT_6 = ST.EXIT_CAT01_KGG?.DESCRIPTION; } else { _EXIT_6 = null; } }
internal V_ST(SeamlessViewsContext Context, ST ST) : base(Context) { var KCY = ST.SCHOOL_YEAR_KCY; var DF = ST.FAMILY_DF; var UM = DF.MAILKEY_UM; _STKEY = ST.STKEY; // STUDENT _STUDENT = $"{ST.SURNAME} {ST.PREF_NAME} {ST.SCHOOL_YEAR} {ST.HOME_GROUP}"; // PARENT1 if (ST.CONTACT_A == "A") { _PARENT1 = $"{DF.TITLE_A} {DF.NAME_A.Substring(0, 1)} {DF.SURNAME_A}"; } else if (ST.CONTACT_A == "B") { _PARENT1 = $"{DF.TITLE_B} {DF.NAME_B.Substring(0, 1)} {DF.SURNAME_B}"; } else if (ST.CONTACT_A == "N") { _PARENT1 = null; } else if (DF.SURNAME_A == DF.SURNAME_B) { _PARENT1 = $"{DF.TITLE_A} {DF.NAME_A.Substring(0, 1)} & {DF.TITLE_B} {DF.NAME_B.Substring(0, 1)} {DF.SURNAME_A}"; } else if (DF.SURNAME_A != null && DF.SURNAME_B != null) { _PARENT1 = $"{DF.TITLE_A} {DF.NAME_A.Substring(0, 1)} {DF.SURNAME_A} & {DF.TITLE_B} {DF.NAME_B.Substring(0, 1)} {DF.SURNAME_B}"; } else if (DF.SURNAME_A == null && DF.SURNAME_B != null) { _PARENT1 = $"{DF.TITLE_B} {DF.NAME_B.Substring(0, 1)} {DF.SURNAME_B}"; } else if (DF.SURNAME_B == null && DF.SURNAME_A != null) { _PARENT1 = $"{DF.TITLE_A} {DF.NAME_A.Substring(0, 1)} {DF.SURNAME_A}"; } else { _PARENT1 = "STUDENT HAS NO LISTED PARENTS"; } _LIVING_ARR = ST.LIVING_ARR; // PARENT2 if (ST.CONTACT_A == "A") { _PARENT2 = $"{DF.TITLE_A} {DF.SURNAME_A}"; } else if (ST.CONTACT_A == "B") { _PARENT2 = $"{DF.TITLE_B} {DF.SURNAME_B}"; } else if (ST.CONTACT_A == "N") { _PARENT2 = null; } else if (DF.SURNAME_A == DF.SURNAME_B) { _PARENT2 = $"{DF.TITLE_A} & {DF.TITLE_B} {DF.SURNAME_A}"; } else if (DF.SURNAME_A != null && DF.SURNAME_B != null) { _PARENT1 = $"{DF.TITLE_A} {DF.SURNAME_A} & {DF.TITLE_B} {DF.SURNAME_B}"; } else if (DF.SURNAME_A == null && DF.SURNAME_B != null) { _PARENT1 = $"{DF.TITLE_B} {DF.SURNAME_B}"; } else if (DF.SURNAME_B == null && DF.SURNAME_A != null) { _PARENT1 = $"{DF.TITLE_A} {DF.SURNAME_A}"; } else { _PARENT1 = "STUDENT HAS NO LISTED PARENTS"; } _SURNAME = ST.SURNAME; _FIRST_NAME = ST.FIRST_NAME; _SECOND_NAME = ST.SECOND_NAME; _PREF_NAME = ST.PREF_NAME; _TITLE = ST.TITLE; _AB_STUDY = ST.AB_STUDY; _EMA = ST.ED_ALLOW; _BIRTHDATE = ST.BIRTHDATE; _CAMPUS = ST.CAMPUS; _ENTRY = ST.ENTRY; _GENDER = ST.GENDER; _HOME_GROUP = ST.HOME_GROUP; _HOME_LANG = ST.HOME_LANG; _HOUSE = ST.HOUSE; _KOORIE = ST.KOORIE; _NOTES = ST.NOTES; _RELATION_A01 = ST.RELATION_A01; _SCHOOL_YEAR = ST.SCHOOL_YEAR; _FAM_ORDER = ST.FAM_ORDER; _DESCRIPTION = KCY.DESCRIPTION; _STATUS = ST.STATUS; _STUDENT_PIC = ST.STUDENT_PIC; _TAG = ST.TAG; _YOUTH_ALLOW = ST.YOUTH_ALLOW; _FAMILY = ST.FAMILY; _LOTE_HOME_CODE = ST.LOTE_HOME_CODE; _SGB_FUNDED = ST.SGB_FUNDED; _INTERNATIONAL_ST_ID = ST.INTERNATIONAL_ST_ID; _CONTACT_A = ST.CONTACT_A; _IMMUNISE_CERT_STATUS = ST.IMMUNISE_CERT_STATUS; _LBOTE = ST.LBOTE; _DFKEY = DF.DFKEY; _SURNAME_A = DF.SURNAME_A; _NAME_A = DF.NAME_A; _TITLE_A = DF.TITLE_A; _E_MAIL_A = DF.E_MAIL_A; _SURNAME_B = DF.SURNAME_B; _NAME_B = DF.NAME_B; _E_MAIL_B = DF.E_MAIL_B; _TITLE_B = DF.TITLE_B; _MAILKEY = DF.MAILKEY; _NO_STUDENTS = DF.NO_STUDENTS; _LOTE_HOME_CODE_A = DF.LOTE_HOME_CODE_A; _LOTE_HOME_CODE_B = DF.LOTE_HOME_CODE_B; _OCCUP_STATUS_A = DF.OCCUP_STATUS_A; _OCCUP_STATUS_B = DF.OCCUP_STATUS_B; _WORK_CONT_A = DF.WORK_CONT_A; _BH_AT_HOME_A = DF.BH_AT_HOME_A; _BH_CONTACT_A = DF.BH_CONTACT_A; _AH_AT_HOME_A = DF.AH_AT_HOME_A; _AH_CONTACT_A = DF.AH_CONTACT_A; _PREF_MAIL_MECH_A = DF.PREF_MAIL_MECH_A; _FAX_A = DF.FAX_A; _WORK_CONT_B = DF.WORK_CONT_B; _BH_AT_HOME_B = DF.BH_AT_HOME_B; _BH_CONTACT_B = DF.BH_CONTACT_B; _AH_AT_HOME_B = DF.AH_AT_HOME_B; _AH_CONTACT_B = DF.AH_CONTACT_B; _PREF_MAIL_MECH_B = DF.PREF_MAIL_MECH_B; _FAX_B = DF.FAX_B; _FAM_OCCUP = ST.FAMILY_OCCUPATION; _UMKEY = UM.UMKEY; _ADDRESS01 = UM.ADDRESS01; _ADDRESS02 = UM.ADDRESS02; _ADDRESS03 = UM.ADDRESS03; _POSTCODE = UM.POSTCODE; _STATE = UM.STATE; _TELEPHONE = UM.TELEPHONE; _FAX = UM.FAX; }