SIMS 7 - Group Supervisors and Titles
Staff have various roles for the supervision of a group such as class teacher, year head and alike. These roles are editable and extendable in SIMS
There is a simple way via third party APIs to get the supervisors:
SIMS.Processes.TPGroupManagement tpgm = new SIMS.Processes.TPGroupManagement();
XmlDocument d = new XmlDocument();
d.InnerXml = tpgm.GetXmlGroupSupervisors(DateTime.Now);
Which returns
<GroupSupervisors>
<GroupSupervisor>
<BaseGroupID>33</BaseGroupID>
<SupervisorID>18919</SupervisorID>
<personID>33</personID>
<SupervisorTitleID>4</SupervisorTitleID>
<StartDate>2010-10-27T00:00:00</StartDate>
<EndDate />
</GroupSupervisor>
In order to get the supervisor title or role, you will need to access lookups and code is supplied below for convenience, selecting the Supervisor Title Lookup
Lookups
public class Table
{
public string Name { get; set; }
public List<Entry> TableEntries = new List<Entry>();
}
public class Entry
{
public int? ID { get; set }
public string Code { get; set; }
public string Description { get; set; }
public bool Active { get; set; }
public string Category { get; set; }
public string CatDes { get; set; }
}
public class LookupDump
{
public static List<Table> GetLookupTables()
{
List<Table> lU_Tables = new List<Table>();
//GetStaffLookups(ref lU_Tables);
SIMS.Processes.LookupTypeBrowser lutb = new SIMS.Processes.LookupTypeBrowser();
SIMS.Entities.LookupArea lua = new SIMS.Entities.LookupArea();
foreach (var v in lutb.Browse("%", lutb.LookupAreaAny))
{
if (v is SIMS.Entities.TrueLookupTypeSummary)
{
TrueLookupTypeSummary t = (TrueLookupTypeSummary)v;
Table table = new Table();
table.Name = t.Description;
SIMS.Processes.LookupTypeDetail lutd = new SIMS.Processes.LookupTypeDetail();
lutd.Load(t);
SIMS.Entities.TrueLookupType trueLookupType = new TrueLookupType();
trueLookupType = (TrueLookupType)lutd.LookupType;
foreach (SIMS.Entities.TrueLookupValue lookupValue in trueLookupType.LookupValues.Value)
{
Entry e = new Entry();
e.Code = lookupValue.Code;
e.ID = lookupValue.LookupValueID;
if (lookupValue.Category != null)
{
e.Category = lookupValue.Category.Code;
e.CatDes = lookupValue.Category.Description;
}
e.Description = lookupValue.Description;
e.Active = lookupValue.Active;
table.TableEntries.Add(e);
}
lU_Tables.Add(table);
}
else if (v is SIMS.Entities.GroupLookupTypeSummary)
{
GroupLookupTypeSummary t = (GroupLookupTypeSummary)v;
Table table = new Table();
table.Name = t.Description;
SIMS.Processes.LookupTypeDetail lutd = new SIMS.Processes.LookupTypeDetail();
lutd.Load(t);
SIMS.Entities.GroupLookupType trueLookupType = new GroupLookupType();
trueLookupType = (GroupLookupType)lutd.LookupType;
foreach (SIMS.Entities.GroupLookupValue lookupValue in trueLookupType.LookupValues.Value)
{
Entry e = new Entry();
e.Code = lookupValue.Code;
e.Description = lookupValue.Description;
if (lookupValue.Category != null)
{
e.Category = lookupValue.Category.Code;
e.CatDes = lookupValue.Category.Description;
}
e.Active = lookupValue.Active;
table.TableEntries.Add(e);
}
lU_Tables.Add(table);
}
}
return lU_Tables;
}
}