© 2018 Capita Business Services Ltd. All rights reserved.

Capita Education Software Solutions is a trading name of Capita Business Services Ltd. Our Registered office is 30 Berners Street, London, W1T 3LR and our registered number is 02299747. Further information about Capita plc can be found in our legal statement.

SIMS 7 - Sample Code - Curriculum Year at DOL

Overview of Example

 

Example Call

 List<SIMSInterface.NCatYOL> NCYearsForLeavers = SIMSInterface.GetNCYearatDOL.GetNCatYOLList();
            json = Newtonsoft.Json.JsonConvert.SerializeObject(NCYearsForLeavers, Formatting.Indented);
            System.IO.File.WriteAllText(Path.Combine(OutputFolder, "ncys.json"), json);

Output Class

    public class NCatYOL
    {
        public int id;
        public string NCYear;
    }

Code Sample

public static List<NCatYOL> GetNCatYOLList()
{
    List<NCatYOL> CatList = new List<NCatYOL>();

    //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(
        "Leaver"                                 // Leavers
        , SIMS.Entities.Cache.WildcardAny          // Surname any                                                                                                                        
        , SIMS.Entities.Cache.WildcardAny          // Forename Any                    
        , studentBrowse.RegistrationGroupAny.Code  // Any                    
        , studentBrowse.YearGroupAny.Code                              // The current year gp                    
        , studentBrowse.HouseAny.Code             // Any house                    
        , studentBrowse.TierAny.Code              // Any Tier                    
        , DateTime.Now                            // Effective Date                    
        , false);                                 // Photos
    foreach (SIMS.Entities.StudentSummary student in students)
    {
        EditStudentInformation studentsedt = new EditStudentInformation();
        studentsedt.Load(new Person(student.ID), DateTime.Now);


        NCatYOL ncy = new NCatYOL();
        ncy.id = student.PersonID;
        string ncYear = "?";
        if(!string.IsNullOrEmpty(studentsedt.Student.NationalCurriculumYearForLeaver))
        { 
            ncYear = studentsedt.Student.NationalCurriculumYearForLeaver ;
        }
        else
        {
            if (studentsedt.Student.NationalCurriculumYear !=null)
            {
                ncYear = studentsedt.Student.NationalCurriculumYear.Description;
            }
        }    
        ncy.NCYear = ncYear;
        CatList.Add(ncy);
        // Other fields are available if required.
    }


    return CatList;
}

Example Output

  [
  {
    "id": 12105,
    "NCYear": "Curriculum Year 11"
  }]

 

NB: Code could be selected in place of the description above.