SIMS 7 - Sample Code - Use of student browser details
Overview of Example
This example shows the use of student browse and detail to get a set of information about students.
Example Call
List<StudentORCombined> sorc = SIMSInterface.Combined_OnRoll.GetDetails();
json = Newtonsoft.Json.JsonConvert.SerializeObject(sorc, Formatting.Indented);
System.IO.File.WriteAllText(Path.Combine(OutputFolder, "sorc.json"), json);
Output Class
public class StudentORCombined
{
/// <summary>
/// SIMS Internal ID
/// </summary>
public int id { get; set; }
/// <summary>
/// Surname to help understand the process.
/// </summary>
public string LegalSurname { get; set; }
/// <summary>
/// Forename to help understand the process.
/// </summary>
public string LegalForename { get; set; }
/// <summary>
/// List of the young carer records
/// </summary>
public List<CarerDetail> YoungCarerDetails = new List<CarerDetail>();
/// <summary>
/// NC Year or NC Year at point of leaving
/// </summary>
public string NCYear { get; set; }
/// <summary>
/// Alternative provision details
/// </summary>
public List<APDetail> APDetails = new List<APDetail>();
/// <summary>
/// List of previous names
/// </summary>
public List<Names> PreviousNames = new List<Names>();
/// <summary>
/// Learner Supports - Secondary only
/// </summary>
public List<LearnerSupport> learnerSupports = new List<LearnerSupport>();
}
Code Sample
public static List<SIMSInterface.StudentORCombined> GetDetails()
{
List<StudentORCombined> StudentList = new List<StudentORCombined>();
//https://www.sims-partners.com/Products/SIMS7/InternalAPIs/StudentBrowse
// We need to initialize the Calendar Cache (Pre - requisite – no explanation offered).
// Requires reference to CalendarProcesses.dll
SIMS.Entities.CalendarCache calCache = new SIMS.Entities.CalendarCache();
//Create the Browse Process
SIMS.Processes.StudentBrowseProcess studentBrowse = new SIMS.Processes.StudentBrowseProcess();
SIMS.Entities.StudentSummarys students = studentBrowse.GetStudents(
"Current" // Current students
, SIMS.Entities.Cache.WildcardAny // Surname any
, SIMS.Entities.Cache.WildcardAny // Forename Any
, studentBrowse.RegistrationGroupAny.Code // Any
, studentBrowse.YearGroupAny.Code // ANy YG
, studentBrowse.HouseAny.Code // Any house
, studentBrowse.TierAny.Code // Any Tier
, DateTime.Now // Effective Date
, false); ; ; // Photos
foreach (SIMS.Entities.StudentSummary student in students)
{
EditStudentInformation studentEdit = new EditStudentInformation();
studentEdit.Load(new Person(student.ID), DateTime.Now);
StudentORCombined studentDetails = new StudentORCombined();
#region identity
// Identitiy
studentDetails.id = student.ID;
studentDetails.LegalSurname = student.LegalSurname;
studentDetails.LegalForename = student.Forename;
#endregion
#region Young carer
// Young carerer
foreach (SIMS.Entities.StudentYoungCarer y in studentEdit.Student.AdditionalInformation.StudentYoungCarers)
{
CarerDetail carerDetail = new CarerDetail();
carerDetail.Start = y.StartDateAttribute.Value;
carerDetail.End = y.EndDateAttribute.Value;
carerDetail.IdentifiedBy = y.StudentYoungCarerTypeAttribute.Value.Description;
carerDetail.Notes = y.CommentAttribute.Value;
studentDetails.YoungCarerDetails.Add(carerDetail);
}
#endregion
#region NC Year
// NC Year
studentDetails.NCYear = "Null";
if (studentEdit.Student.NationalCurriculumYear != null)
{
studentDetails.NCYear = studentEdit.Student.NationalCurriculumYear.Code;
}
#endregion
#region AP
//Alternative placement setting type APSettingType
//Alternative provision placement reason PlacementReason
foreach (StudentAlternativeProvisionPlacement pl in
studentEdit.Student.RegDetails.StudentAlternativeProvisionPlacements)
{
//Alternative placement setting type APSettingType
//Alternative provision placement reason PlacementReason
APDetail plac = new APDetail();
plac.Type = "Null";
plac.Reason = "Null";
if (pl.APSettingAttribute.Value != null)
plac.Type = pl.APSettingAttribute.Value.Description;
if (pl.APReasonAttribute.Value != null)
plac.Reason = pl.APReasonAttribute.Value.Description;
//Alternative provision placement entry date EntryDate
if (pl.StartDateAttribute.Value != null)
plac.EntryDate = pl.StartDateAttribute.Value;
//Alternative provision placement leaving date LeavingDate
if (pl.EndDateAttribute.Value != null)
plac.LeavingDate = pl.EndDateAttribute.Value;
plac.Attendance = pl.APAttendance;
plac.Sessions = pl.APSessions;
plac.Notes = pl.NotesAttribute.Value;
studentDetails.APDetails.Add(plac);
}
#endregion
#region PreviousNames
foreach (SIMS.Entities.PreviousName n in studentEdit.Student.PreviousNames.Value)
{
Names names1 = new Names();
names1.Surname = n.Surname;
names1.Forename = n.Forename;
names1.ChangedAt = n.StartDate;
studentDetails.PreviousNames.Add(names1);
// Other fields are available if required.
}
#endregion
#region Learner Support
foreach (SIMS.Entities.StudentLearnerSupport c in studentEdit.Student.AdditionalInformation.LearnerSupports.Value)
{
LearnerSupport s = new LearnerSupport();
s.AwardDate = c.AwardDate;
s.Notes = c.Notes;
if (c.LearnerSupportCode != null)
s.Code = c.LearnerSupportCode.Description;
studentDetails.learnerSupports.Add(s);
}
#endregion
// Now add the student
StudentList.Add(studentDetails);
}
return StudentList;
}
Example Output
[{
"YoungCarerDetails": [
{
"IdentifiedBy": "Parent or Guardian",
"Start": "2024-02-28T00:00:00",
"End": "0001-01-01T00:00:00",
"Notes": "Dad has a wooden leg"
}
],
"APDetails": [],
"PreviousNames": [],
"learnerSupports": [],
"id": 14373,
"LegalSurname": "Abdelkoder",
"LegalForename": "Mohamed",
"NCYear": "7"
}
]