© 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 - Prior Attainment in Census

Overview of Example

 

Example Call

            List<PriorAtt> prat = SIMSInterface.Priorattainment.GetPriorAttainment();
            json = Newtonsoft.Json.JsonConvert.SerializeObject(prat, Formatting.Indented);
            System.IO.File.WriteAllText(Path.Combine(OutputFolder, "prat.json"), json);

Output Class

public class PriorAtt
    {
        public string censusPriorAttainmentPersonId { get; set; }
        public string mathsHighestGradeCode { get; set; }
        public string mathsHighestGradeDescription { get; set; }
        public string mathsPriorAttainmentCode { get; set; }
        public string mathsPriorAttainmentDescription { get; set; }
        public string mathsFundingExemptionCode { get; set; }
        public string mathsFundingExemptionDescription { get; set; }

        // Englishpublic 
        public string englishHighestGradeCode { get; set; }
        public string englishHighestGradeDescription { get; set; }
        //string englishHighestGradeLangCode = censusPriorAttainment.EnglishHighestGradeLang.Code;
        //string englishHighestGradeLangDescription = censusPriorAttainment.EnglishHighestGradeLang.Description;
        public string englishPriorAttainmentCode { get; set; }
        public string englishPriorAttainmentDescription { get; set; }
        public string englishFundingExemptionCode { get; set; }
        public string englishFundingExemptionDescription { get; set; }
    }

Code Sample

public static List<PriorAtt> GetPriorAttainment()
        {
            // census prior attainment
            // reference SchoolCensusProcesses & Entities and Lookups
            List<PriorAtt> priorAttList = new List<PriorAtt>(); 
            SIMS.Processes.LookupCache.Populate();

            SIMS.Processes.CensusImportPriorAttainment censusImportPriorAttainment = new CensusImportPriorAttainment();
            censusImportPriorAttainment.PopulatePriorAttainments("2022");

            foreach (CensusPriorAttainment censusPriorAttainment in censusImportPriorAttainment.PriorAttainmentList.Value)
            {
                PriorAtt PA = new PriorAtt();
                PA.censusPriorAttainmentPersonId = censusPriorAttainment.PersonId.ToString();

                // Maths
                PA.mathsHighestGradeCode = censusPriorAttainment.MathsHighestGrade.Code;
                PA.mathsHighestGradeDescription = censusPriorAttainment.MathsHighestGrade.Description;
                PA.mathsPriorAttainmentCode = censusPriorAttainment.MathsPriorAttainmentCode.Code;
                PA.mathsPriorAttainmentDescription = censusPriorAttainment.MathsPriorAttainmentCode.Description;
                PA.mathsFundingExemptionCode = censusPriorAttainment.MathsFundingExemption.Code;
                PA.mathsFundingExemptionDescription = censusPriorAttainment.MathsFundingExemption.Description;

                // English
                PA.englishHighestGradeCode = censusPriorAttainment.EnglishHighestGrade.Code;
                PA.englishHighestGradeDescription = censusPriorAttainment.EnglishHighestGrade.Description;
                //PA.englishHighestGradeLangCode = censusPriorAttainment.EnglishHighestGradeLang.Code;
                //PA.englishHighestGradeLangDescription = censusPriorAttainment.EnglishHighestGradeLang.Description;
                PA.englishPriorAttainmentCode = censusPriorAttainment.EnglishPriorAttainmentCode.Code;
                PA.englishPriorAttainmentDescription = censusPriorAttainment.EnglishPriorAttainmentCode.Description;
                PA.englishFundingExemptionCode = censusPriorAttainment.EnglishFundingExemption.Code;
                PA.englishFundingExemptionDescription = censusPriorAttainment.EnglishFundingExemption.Description;
                priorAttList.Add(PA);
            }

            return priorAttList;
        }

Example Output

[
  {
    "censusPriorAttainmentPersonId": "12108",
    "mathsHighestGradeCode": "5",
    "mathsHighestGradeDescription": "5 - Grade 5",
    "mathsPriorAttainmentCode": "1",
    "mathsPriorAttainmentDescription": "Achieved by end year 11",
    "mathsFundingExemptionCode": "N",
    "mathsFundingExemptionDescription": "No exemption",
    "englishHighestGradeCode": "8",
    "englishHighestGradeDescription": "8 - Grade 8",
    "englishPriorAttainmentCode": "1",
    "englishPriorAttainmentDescription": "Achieved by end year 11",
    "englishFundingExemptionCode": "N",
    "englishFundingExemptionDescription": "No exemption"
  },