© 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 - Census Post Looked After Children

Overview of Example

A decision needs to be made as to whether an application needs the data that would be used to create a census or the data sent in the return.  In many cases it would be more accurate to import the actual census files.

Example Call

 //Post looked after arrangements  PLAA
            List<PLAC> list = SIMSInterface.Census_PostLookedAfter.GetPostLookedafterPupils();
            json = Newtonsoft.Json.JsonConvert.SerializeObject(list, Formatting.Indented);
            System.IO.File.WriteAllText(Path.Combine(OutputFolder, "Post_LookedAfter.json"), json);

Output Class

    public class PLAC
    {
        public int id;
        public string AdoptedStatus;
        public string name; 
        //.. more info is available
    }

Code Sample

 public static List<PLAC> GetPostLookedafterPupils()
        {
            SIMS.Processes.LookupCache.Populate();
            List<PLAC> list = new List<PLAC>();
            SIMS.Processes.CensusImportAdoptedFromCare CIAC = new SIMS.Processes.CensusImportAdoptedFromCare();
            
            //CIAC.PopulateMembersforTopGrid("Spring", "24");
            
            //CIAC.PopulateMembersforBottomGrid("Spring", "24");
            CIAC.PopulateMembersforBottomGrid("Spring", "24");
            // CIAC.AdoptedStatusMembersAdded.Value;
            foreach (CensusAdoptedFromCareMember x in CIAC.AdoptedStatusMembersAdded.Value)
                {
                

                PLAC p = new PLAC();
                if (x.PersonID == 11273)
                {
                    int i = 0;
                }
                p.name = x.Forename + " " + x.Surname;
                p.id = x.PersonID;
                if (x.AdoptedStatusAttribute.Value != null)
                {
                    p.AdoptedStatus = x.AdoptedStatus.Description;
                    
                }
                else
                {
                    p.AdoptedStatus = "Null";
                }
                list.Add(p);
            }
            return list;    
        }

Example Output

[
  {
    "id": 14134,
    "AdoptedStatus": "Adoption from England and Wales",
    "name": "William Cain"
  },
  {
    "id": 13333,
    "AdoptedStatus": "Adoption from England and Wales",
    "name": "Amber Chapman"
  }
]