© 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 - Post 16 Programmes of Study

Overview of Example

This extracts a list which includes a semi-colon separated list of courses.  A list of courses is also provided.

Example Call

            List<POS> Post16POS = SIMSInterface.CourseManager.Getp16CourseList();
            json = Newtonsoft.Json.JsonConvert.SerializeObject(Post16POS, Formatting.Indented);
            System.IO.File.WriteAllText(Path.Combine(OutputFolder, "Post16POS.json"), json);

            // Use the lookup to find the QN.
            List<CourseLookup> courseLookups = SIMSInterface.CourseManager.GetQNLookup();
            json = Newtonsoft.Json.JsonConvert.SerializeObject(courseLookups, Formatting.Indented);
            System.IO.File.WriteAllText(Path.Combine(OutputFolder, "courseLookups.json"), json);

Output Class - Course Lookups

    public class CourseLookup
    {
        public string courseBrowseShortName { get; set; }
        public string courseBrowseLaOrQan { get; set; }
        public string courseBrowseSubject { get; set; }
    }

Output Class - POS

 public class POS
    {
        public string OtherCourses { get; set; }

        public int PersonId { get; set; }
        public int Id { get; set; }
        public DateTime Start { get; set; }
        public DateTime ExpectedEnd { get; set; }
        public DateTime ProgrammeEnd { get; set; }
        public string CoreAim { get; set; }
        public string CompletionStatus { get; set; }
        public string Programme { get; set; }
        public string WithdrawalReason { get; set; }
        public string Traineeship { get; set; }
        public int TTHours { get; set; }
        public int TotalHours { get; set; }
        public int QualHours { get; set; }
        public int NQHours { get; set; }

    }

Code Sample - Course Lookup

 public static List<CourseLookup> GetQNLookup()
        {
            // reference CourseManagerProcess & Entities
            // load the relevant cache and get the previous/current academic year attributes, if relevant. 
            List<CourseLookup> courses = new List<CourseLookup>();
            SIMS.Processes.CurrCache.Populate();
            // get all the active courses that have a QN for the current acad year.
            SIMS.Processes.MaintainCourseBrowse courseBrowseProcess = new SIMS.Processes.MaintainCourseBrowse();
            courseBrowseProcess.PopulateCoursesforSIMSforNewCM("", "", "<Any>", "", "", "ENG", "", "withQAN", SIMS.Entities.CurrCache.AcadYear.StartAttribute.Value, SIMS.Entities.CurrCache.AcadYear.EndAttribute.Value);
            // for the previous acad year
            //courseBrowseProcess.PopulateCoursesforSIMSforNewCM("", "", "<Any>", "", "", "ENG", "", "withQAN", SIMS.Entities.CurrCache.PrevAcadYear.StartAttribute.Value, SIMS.Entities.CurrCache.PrevAcadYear.EndAttribute.Value);

            //// iterate through the course collection
            foreach (SIMS.Entities.MaintainCourseBrowse maintCourseBrowse in courseBrowseProcess.MaintainCourseBrowses.Value)
            {
                if (maintCourseBrowse.ActiveStateAttribute.Value.Description.ToString() == "Active")
                {
                    CourseLookup c = new CourseLookup();
                    // store this ShortName to use with the Post 16 Programme records mapping
                    c.courseBrowseShortName = maintCourseBrowse.ShortNameAttribute.Value.ToString();
                    c.courseBrowseLaOrQan = maintCourseBrowse.La_OR_Qan;
                    c.courseBrowseSubject = maintCourseBrowse.SubjectAttribute.Value.ToString();
                    courses.Add(c);
                    // other possible useful attributes...
                    //string courseBrowseID = maintCourseBrowse.ID.ToString();
                    //string courseBrowseLevel = maintCourseBrowse.LeveltAttribute.Value.ToString();
                    //string courseBrowseCode = maintCourseBrowse.CodeAttribute.Value.ToString();
                    //string courseBrowseDescription = maintCourseBrowse.DescriptionAttribute.Value.ToString();
                }
            }
            return courses;
        }

 

Code Sample -POS

 public static List<POS> Getp16CourseList()
        {
            // reference CourseManagerProcess & Entities
            // load up the Post 16 Programme for an academic year
            SIMS.Processes.MaintainProgrammeOfStudy maintainProgrammeOfStudy = new MaintainProgrammeOfStudy();
            maintainProgrammeOfStudy.Load("2022"); // 2022 is the start of the 2 year course ending in Summer 2024.
            List<POS> POSs = new List<POS>();
            foreach (SIMS.Entities.StudentProgramme studProgramme in maintainProgrammeOfStudy.StudentProgrammes.Value)
            {
                POS p = new POS();
                // this one gets the Courses ShortName...
                // this will have to be used to map to the Course ShortName for the QN and Subject, if relevant. 
                p.OtherCourses = studProgramme.OtherCoursesAttribute.Value;

                p.PersonId = studProgramme.PersonIdAttribute.Value;
                p.Id = studProgramme.StudentProgrammeIdAttribute.Value;
                p.Start = studProgramme.ProgrammeStartAttribute.Value;
                p.ExpectedEnd = studProgramme.ProgrammeExpectedEndAttribute.Value;
                p.ProgrammeEnd = studProgramme.ProgrammeEndAttribute.Value;
                p.CoreAim = studProgramme.CoreAimAttribute.Value; //bool?
                if (studProgramme.ProgrammeCompletionStatusAttribute != null)
                {
                    p.CompletionStatus = studProgramme.ProgrammeCompletionStatusAttribute.Value.Description;
                }
                p.Programme = studProgramme.ProgrammeAttribute.ToString();
                p.WithdrawalReason = studProgramme.WithdrawalReasonAttribute.ToString();
                p.Traineeship = studProgramme.TraineeshipAttribute.ToString();

                p.TTHours = studProgramme.TTHoursAttribute.Value;
                p.TotalHours = studProgramme.TotalHoursAttribute.Value;
                p.NQHours = studProgramme.NonQualHoursAttribute.Value;
                p.QualHours = studProgramme.QualHoursAttribute.Value;

                POSs.Add(p);
            }
            return POSs;
        }

Example Output - Course Lookup

[
  {
    "courseBrowseShortName": "Ar/GCE2Y",
    "courseBrowseLaOrQan": "60144567/3510",
    "courseBrowseSubject": "Art"
  },
  {
    "courseBrowseShortName": "Bi/GCE2Y",
    "courseBrowseLaOrQan": "60142601/1010",
    "courseBrowseSubject": "Biology"
  },

Example Output - POS

[
  {
    "OtherCourses": "Do/TLevC; Ds/TLevS; Wp/TLev3;",
    "PersonId": 12108,
    "Id": 1732,
    "Start": "2022-09-05T00:00:00",
    "ExpectedEnd": "2024-07-31T00:00:00",
    "ProgrammeEnd": "0001-01-01T00:00:00",
    "CoreAim": "",
    "CompletionStatus": "Continuing",
    "Programme": "Study Programme",
    "WithdrawalReason": "",
    "Traineeship": "False",
    "TTHours": 21,
    "TotalHours": 600,
    "QualHours": 600,
    "NQHours": 0
  },