SIMS 7 - Sample Code - Census Funding and Monitoring
Overview of Example
We can obtain data from census screens as follows:
Example Call
List<FAMDetail> fam = SIMSInterface.FAM.FAMGet();
json = Newtonsoft.Json.JsonConvert.SerializeObject(fam, Formatting.Indented);
System.IO.File.WriteAllText(Path.Combine(OutputFolder, "fam.json"), json);
Output Class
public class FAMDetail
{
public int id { get; set; }
public string name { get; set; }
/// <summary>
/// Learner Funding and Monitoring(FAM) Type
/// </summary>
public string Type { get; set; }
/// <summary>
/// Learner Funding and Monitoring(FAM) Code
/// </summary>
public string Code { get; set; }
/// <summary>
/// Learner Funding and Monitoring(FAM) Hours
/// </summary>
public string Hours { get; set; }
}
Code Sample
public static List<FAMDetail> FAMGet()
{
EditStudentFundingAndMonitoring esfm = new EditStudentFundingAndMonitoring();
esfm.LoadStudents(2023);
List<FAMDetail> details = new List<FAMDetail>();
foreach (StudentFAM s in esfm.StudFAMs.Value)
{
FAMDetail f = new FAMDetail();
f.id = s.personIdAttribute.Value;
f.name = s.Name;
f.Type = s.FamTypeAttribute.Value;
f.Code = "?"; // Not clear from the picture
f.Hours = s.TotalHours.ToString(); // Check that this is the number needed.
details.Add(f);
}
return details;
}
Example Output
{
"id": 14261,
"name": "Abbot,Benjamin",
"Type": "",
"Code": "?",
"Hours": "0"
},