SIMS 7 - General - Overview of SIMS own APIs
Below is a list of the main DLL’s you will need to reference. When needed, other DLL’s to reference will be included in the Interface description.
- AbstractProcesses
- Cache
- CacheProcesses
- DocManagementEntities
- DocManagementProcesses
- GroupEntities
- GroupProcesses
- LoginEntities
- LoginProcesses
- LookupEntities
- LookupProceses
- MidasEntities
- MidasProcesses
- PersonEntities
- PersonProcesses
- SchoolEntities
- SchoolProcesses
- Student Entities
- Student Processes
- AbstractProcesses
- Cache
- CacheProcesses
- DocManagementEntities
- DocManagementProcesses
- GroupEntities
- GroupProcesses
- LoginEntities
- LoginProcesses
- LookupEntities
- LookupProceses
- MidasEntities
- MidasProcesses
- PersonEntities
- PersonProcesses
- SchoolEntities
- SchoolProcesses
- Student Entities
- Student Processes
To logon you will need to pass in a valid SIMS username and password.
string username = "user1";
string password = "abcd";
//instantiate login process then call logon methods.
loginprocess = new SIMS.Processes.Login();
signature = loginprocess.GetDatabaseSignature(username, password,"TPA1",true);
loginprocess.Init(signature,username, password);
//set the document server to online mode if you want to use it.
DatabaseMode dm = new DatabaseMode(false);
Cache.CurrentDatabase.DatabaseMode = dm;
//set this to enable all processes for third party use
Cache.ThirdPartyLogin = true;
Once logged in, the cache can immediately be accessed allowing you to obtain some main core details. Examples of these include school details and SIMS.net application details.
- SIMS.Entities.Cache.CurrentSchool.SchoolName
- SIMS.Entities.Cache.ApplicationName.ToString()
- SIMS.Entities.Cache.CurrentDatabase.DatabaseServerVersion
When you instantiate a process then the relevant cache will also become available. An example of this is for the ‘Student Browse Process’ below.
- SIMS.Entities.StudentCache
- SIMS.Entities.GroupCache
Current User details can also be obtained from the cache. E.g.
string username = Cache.CurrentUser.ShortName;
SIMS.Processes.StudentBrowseProcess studentBrowse = new SIMS.Processes.StudentBrowseProcess();
This Process is designed around obtaining a list of students according to the group criteria that you query on. It will return a collection of StudentSummary Entities which we look at in the point ‘Browsing a List of Students’.
In order to use this process you will need to reference ‘Student Processes.dll’ and ‘Student Entities.dll’
Once the StudentBrowseProcess has been initialised you can use the Cached information in the StudentBrowse process to obtain information as shown below:
// YearGroups
foreach (SIMS.Entities.YearGroup grp in studentBrowse.YearGroups)
{
//Insert Code here
}
//Registration Groups
foreach (SIMS.Entities.RegistrationGroup grp in studentBrowse.RegistrationGroups)
{
//Insert Code here
}
//Houses
foreach (SIMS.Entities.House grp in studentBrowse.Houses)
{
//Insert Code here
}
This call will enable you to get student summary details returned into a collection of entities based on the filter criteria that you pass in. This interface is the one used by the Find Student Browse screen in the SIMS.net route Focus | Student | Student Details.
foreach (SIMS.Entities.YearGroup grp in studentBrowse.RegistrationGroups)
{
SIMS.Entities.StudentSummarys students =GetStudents(
string view,
string surname,
string forename,
string reg,
string year[or grp],
string house,
string tier,
DateTime currentDate,
bool PhotosRequired
);
}
//This call returns a collection of StudentSummary entities. A real-world example of this call is below:
SIMS.Entities.StudentSummarys students = studentBrowse.GetStudents(
"Any"
,SIMS.Entities.Cache.WildcardAny
,SIMS.Entities.Cache.WildcardAny
,studentBrowse.RegistrationGroupAny.Code
,grp.Code
,studentBrowse.HouseAny.Code
,studentBrowse.TierAny.Code
,DateTime.Now
,false)
Examples of the summary data returned include:
- students .StudentSummary..Admissionnumber
- students .StudentSummary.Gender
- students .StudentSummary.Personid
- students .StudentSummary.Surname
Student Details
This process requires the personid of the student concerned and returns a EditStudentInformationReadOnly entity It is used for a detailed look at a student. The reference to ReadOnly says that it can only be used for reading data.
EditStudentInformationReadOnly studentsedt = new EditStudentInformationReadOnly();
StudentEditResult status = studentsedt.Load(new Person(4030),DateTime.Now);
This returns an EditStudentBase Entity which contains a Public Instance Property called Student.
The Student Property contains detailed information relating to the student, examples of the type of data returned include
- studentsedt.Student.Surname
- studentsedt.Student.DateOfBirth
- studentsedt.Student.RegGroup
You can also drill further down and obtain the contact details linked to the student by looking at the collection of StudentContact entities linked to the student. For example
foreach (SIMS.Entities.StudentContact studcontact in studentsedt.Student.StudentContacts.Value )
{
//Studcontact.ContactPerson.ChosenFullName
//insert Code here
}
In the case of attributes that are entities themselves (e.g. mode of travel attribute) then a collection of these pre-defined entities can be obtained from a cache. In the case of Mode of travel these are obtain from the SIMS.Entities.Groupcache as below.
foreach (SIMS.Entities.Travel travel in SIMS.Entities.GroupCache.Travels )
{
//obtain Mode of travel here
}
Editing a Student
Editing a student relies on you calling the EditStudentInformation process. This will load the details for the student whose ID you pass in.
The StudentInformation object contains detailed information on the student which matches the Student Details screen in SIMS.net.
//Instantiate the EditStudentInformationReadOnly object.
Boolean didSuceed = new Boolean();
EditStudentInformation student = new EditStudentInformation();
//Call the load method passing through the person Id of the student and the date you want the details from.
StudentEditResult status = student.Load(new Person(4030),DateTime.Now);
student.Student.SurnameAttribute.Value = "A New Name";
//call the valid method to validate all of the changes you have made before you call the save method.
student.Student.Valid();
student.Save();
Following the above code you can add or change the details for a students contact. Note the contact is an actual SIMS.Entities.Contact held under the EditStudentInformation entity.
student.AddStudentContact(contact1);
//Or edit an existing contact’s details
//Instantiate the EditContact process and then call the populate method passing in a person entity – in this case the contact //linked to the student
SIMS.Processes.EditContact editContact = new EditContact();
editContact.Populate(contact.ContactPerson);
editContact.Contact.ForenameAttribute.Value = "Change the name here";
editContact.Contact.Validate();
editContact.Save();
Additional DLL’s to reference: MidasEntities, MidaProcesses
This process shows how to step through the timetable for a student on a given day. This student is identified by their person_id and the resultant classlist is iteratively stepped through.
TimetableDetailsProcess studTimetable = new TimetableDetailsProcess();
studTimetable.Populate(new Person(5551), DateTime.Parse("01/01/2004"));
MidasStudentTimetable midasTT = studTimetable.studentTimetable;
for(int i = 0; i < midasTT.MaxPeriodsInDay; i++)
{
//Loop Days
for(int j = 0; j < midasTT.DaysInCycle; j++)
{
//Calculate Period
//The period calculated in this way will get the timetable as Mon1,Tue1,Wed…,Mon2,Tue2…etc
int period = ((j * 1000) + i) + 1;
//The period id calculated in the below format [commented] will first get all the periods for day, then for day 2 etc.
// ie, Mon1,Mon2… Tue1,Tue2 and so on
// int period = ((iDays * 1000) + iPeriods) + 1;
//Loop Conflicts
for(int k = 0; k < midasTT.TTClassCount(period); k++)
{
//Get Class
MidasStudentTTClass StudentClass = midasTT.TTClass(period, k);
// Period, Day and Class information
//StudentClass.PeriodDescr.Value,
//StudentClass.Day.Value,
//StudentClass.ClassCode.Value);
}
}
}
Contact Summary entities can be returned in a manner similar to the previous example. The BroweContacts process is passed a number of parameters to filter the result set down to those you have requested.
BrowseContacts contacts = new BrowseContacts();
contacts.Search(
string surname,
string forename,
string town,
string postcode);
foreach (SIMS.Entities.ContactSummary contact in contacts.ContactSummarys )
{
//Insert Code here
}
This call returns a collection of ContactSummary entities which match the criteria you have searched on. Examples of the data you can obtain from the Contactsummary Entity include:
- ContactSummary.Gender
- ContactSummary.MainHomeTelephone
- ContactSummary.MainAddress
- ContactSummary.Personid
- ContactSummary.Surname
Employees can be browsed using this call. Note that Employees includes teachers and non-teachers.
Additional DLL’s to reference: EmployeeEntities, EmployeeProcesses
BrowseEmployee employees = new BrowseEmployee();
Load(EmployeeFilter filter,
string surname,
string forename,
string title,
string gender,
string employeeCode,
bool loadPhoto,
DateTime effectiveDate);
foreach (SIMS.Entities.EmployeeSummary empSum in employees.Employees )
{
//empSum.Forename;
}
This call returns a collection of EmployeeSummary Entities which match the criteria you have searched on. An example of the call being used to return a list of employees with a surname beginning with abbot is:
employees.Load(EmployeeFilter. CurrentTeachers,"abbot", "%", "%", "%", "%", true, DateTime.Now);
Examples of the data you can obtain from EmployeeSummary Entity include
- Employee.Forename
- Employee.Employeecode
Additional DLL’s to reference: EmployeeEntities, EmployeeProcesses
If you want to find out details on Teachers (a specific case of an employee) then the following code will return a collection of Teacher entities
SIMS.Processes.BrowseTeachers browseTeachers = new SIMS.Processes.BrowseTeachers();
browseTeachers.GetTeachers("", "", System.DateTime.Now);
teachers = browseTeachers.Teachers;
foreach (SIMS.Entities.Teacher teacherSingular in teachers)
{
//insert code here.
//e.g. teacherSingular.Forename;
}
This call will return a more detailed singular Entity for the employee you pass the person_id in for.
SIMS.Processes.EditEmployee editEmployee = new EditEmployee();
editEmployee.Load(26, System.DateTime.Now);
// editEmployee.Employee.PersonID.ToString()
Sample data returned
- Forname String
- Surname String
- BankName String
- Gender String
- Role String
- Dateof Appointment DateTime
- TeacherNumber Int
- Ehtnicity Ethnicity Entity
- Religion Religion Entity
- DOB DateTime
Additional DLL’s to reference: MidasEntities, MidasProcesses
This process shows how to step through the timetable for a member of staff on a given day. This staff is identified by their person_id and the resultant classlist is iteratively stepped through.
SIMS.Processes.StaffTimetableDetailsProcess stdp = new StaffTimetableDetailsProcess();
stdp.Populate(new Person(87), DateTime.Parse("01/01/2004"));
//Details can be got via
cd.StaffClasses.Classes(0).DescriptionAttribute;
//or all of them by Looping through Periods per Day
for(int i = 0; i < midasTT.MaxPeriodsInDay; i++)
{//Loop Days
for(int j = 0; j < midasTT.DaysInCycle; j++)
{//Calculate Period
int period = ((j * 1000) + i) + 1;
//Loop Conflicts
for(int k = 0; k < midasTT.TTClassCount(period); k++)
{//Get Class
MidasStudentTTClass StudentClass = midasTT.TTClass(period, k);
//Print Period, Day and Class
// StudentClass.PeriodDescr.Value,
// StudentClass.Day.Value,
// StudentClass.ClassCode.Value);
}
}
}
Once logged in some summary details about the school can be found in the cache. Examples of this include:
- Cache.CurrentSchool.LEAId;
- Cache.CurrentSchool.SchoolId ;
- Cache.CurrentSchool.SchoolName ;
- Cache.CurrentSchool.HeadTeacher ;
Further Details
Additional details (such as address) about the school are available under the MaintainHomeSchool process. This can be used to both obtain extra details and to amend school details.
//instantiate MaintainHomeSchool Process. Then call the Load method passing in the Home school id.
MaintainHomeSchool schoolHome = new MaintainHomeSchool();
schoolHome.Load(Cache.CurrentSchool.SchoolId,false,"SCH:HOME");
// an example of how to pull out the address of the school
BasicSchool homeSchool = schoolHome.HomeSchool;
SIMS.Entities.Address address = homeSchool.SchoolSites.MainSite.SiteAddress;
string schoolAddress = address.SingleLineAddress;
//you can amend any school details (as per normal editing rules) and call the Save method.
schoolHome.Save();
The rooms at the school are stored in the RoomSummary entity. This can be browsed and viewed much the same as other summary entity types.
ViewRoomDetails erd = new ViewRoomDetails();
//RoomSummarys search returns a collection of room entities.
RoomSummarys rooms = erd.GetRooms(Cache.WildcardAny, Cache.WildcardAny);
foreach(RoomSummary room in rooms)
{
//Load this rooms details
erd.LoadRoomDetails(room);
//Instance of School Room for full details
SchoolRoom schoolRoom = erd.SchoolRoom;
//schoolRoom.ShortName;
//schoolRoom.
}
Additional DLL’s to reference: Attendance Entities, Attendance Processes
AttendanceCodes are stored within the Attendance Cache. Other data stored in this cache are the statistical meaning and physical meaning of the mark.
SIMS.Processes.AttendanceCodesProcess.Instance.GetLessonCodes();
foreach (SIMS.Entities.LessonCode lesmark in AttendanceCache.Instance.LessonCodes)
{
//lesmark.Code;
//lesmark.description etc…
}
Additional DLL’s to reference: Attendance Entities, Attendance Processes, LessonMonitorEntities, LessonMonitorProcesses
This code will obtain all of the timetable periods for a day. The parameters taken are surname, forename, timetabled period or date.
SIMS.Entities.BrowsePeriods periods = TakeRegisterBrowseProcess.Instance.GetPeriods("Abell", "A", null,DateTime.Parse("23/11/2006"));
foreach(BrowsePeriod browperiod in periods)
{
//obtain the register of the period
//if browperiod.EventType = '' //do for Lesson or session
RegisterDataBase regDbase = (RegisterDataBase)TakeRegisterProcess.Instance.GetRegisterData(browperiod,browperiod.Teacher);
if (browperiod.EventType == PeriodEventType.Lesson)
{
foreach (SIMS.Entities.MarkBase mark in regDbase.CurrentMarks)
{
if (mark.EventInstanceID == regDbase.ActiveEvent.EventInstanceID)
{
//mark.Comments;
//mark.PersonID;
//mark.MinutesLate;
//mark.Mark;
}
}
}
}
Additional DLL’s to reference: BehaviourEntities, BehaviourProcesses
Both Positive Behaviours (Achievements) and Negative behaviours (Behaviours) are stored within the system.
Various information is needed about behaviours in order to browse for them properly. This information can be stepped through by using the following calls.
foreach (SIMS.Entities.EventStatus statuses in SIMS.Entities.StudentCache.EventStatus)
{
//
}
foreach ( SIMS.Entities.EventLocation location in SIMS.Entities.StudentCache.EventLocations)
{
//Rooms
}
foreach (SIMS.Entities.NegBehaviourType negBehav in SIMS.Entities.StudentCache.NegBehaviourTypes)
{
//possible behaviour types e,g, bullying, smoking
// foreach(SIMS.Entities.NegOutcome outcome in negBehav)
// {
// }
}
foreach (SIMS.Entities.PosBehaviourType posbehav11 in SIMS.Entities.StudentCache.PosBehaviourTypes)
//activity type e.g. english, PE
{
//posbehav1.Description; //etc...
}
Browsing Behaviours
//negative behaviours
Browses on Academic Year, Behaviour Type, Location, action and status
SIMS.Processes.BehaviourIncidentBrowse behaviourBrowse = new BehaviourIncidentBrowse();
behaviourBrowse.Populate(0, 0, 0, 0,0);
foreach (SIMS.Entities.BehaviourIncidentSummary negbehav in behaviourBrowse.BehaviourIncidentSummarys.Value )
{
//insert code here
}
Achievements
SIMS.Processes.AchievementBrowse achievementBrowse = new AchievementBrowse();
achievementBrowse.Populate(0,0,0,0);
foreach (SIMS.Entities.AchievementSummary posbehav in achievementBrowse.AchievementSummarys.Value )
{
//insert code here
}
Amending and saving a behaviour
SIMS.Processes.MaintainBehaviourDetails mbehaviours = new MaintainBehaviourDetails();
SIMS.Entities.PositiveBehaviour posBehaviour1 = new PositiveBehaviour(14);
posBehaviour1.CommentsAttribute.Value = "jon1";
posBehaviour1.BehaviourTypeAttribute.ReadOnly = true;
posBehaviour1.BehaviourType = SIMS.Entities.StudentCache.PosBehaviourTypes.ItemByCode("ACAD") as PosBehaviourType;
mbehaviours.AddPositiveBehaviour(posBehaviour1);
bool b = mbehaviours.StudentBehaviour.Valid();
mbehaviours.SaveBehaviouralDetails();
The SENStudent browse call is designed to retrieve summary data entities of SEN Students based on the filter criteria passed in. This interface is the one used in SIMS.net within the Focus | Student | Special Educational Needs Menu Route.
//instantiate the SENStudentBrowse object
SIMS.Processes.SENStudentBrowse senStudentBrowse = new SIMS.Processes.SENStudentBrowse();
//structure of GetStudents Call
//SENStudentSummarys students = browseProcess.GetStudents(
surnameFilter, //string
forenameFilter, //string
status, //string
tier, //SIMS.Entities.Tier
yearGroup, //SIMS.Entities.YearGroup
regGroup, //SIMS.Entities.RegistrationGroup
house, //SIMS.Entities.House
senStatus, //SIMS.Entities.SENStatus
currentDate, //System.dateTime
retrievePhotos, //bool
exactMatch); //bool
//Sample GetStudents Call. This will retrieve Summary SenStudent information for all current (as of today) on roll students with a SEN status.
SENStudentSummarys senSummarys = SenStudentBrowse.GetStudents(
Cache.WildcardAny,
Cache.WildcardAny,
"Current",
senStudentBrowse.TierAny
,senStudentBrowse.YearGroupAny
,senStudentBrowse.RegistrationGroupAny
,senStudentBrowse.HouseAny
,senStudentBrowse.SENStatusAnySEN
,System.DateTime.Now
,false,
true);
//Once returned the entities can be stepped through for analysis.
foreach(SENStudentSummary senStudentSummary in senSummarys)
{
//sample entity properties include
senStudentSummary.personId
senStudentSummary.Surname
senStudentSummary.Chosename
senStudentSummary.Gender
senStudentSummary.RegGroup
senStudentSummary.Title
}
Detailed SEN information can be obtained for a specific student by calling the EditSENStudent process passing in the personid (Int) that you need.
SIMS.Processes.EditSENStudent editSENStudent = new EditSENStudent();
//create a new IIDEntity for the person, then pass through into the Load method of the EditSENStudent process.
SIMS.Entities.IIDEntity identity = new SIMS.Entities.Person(senStudentSummary.PersonID );
editSENStudent.Load(identity,System.DateTime.Now);
//step through each SENReview.
for(int i = 0;i < editSENStudent.Student.SENReviews.Value.Count;i++)
{
SENReview senReview = editSENStudent.Student.SENReviews.Item(i);
EditSENReview editSenReview = new EditSENReview(editSENStudent.Student,senReview,EditSENReviewSource.SENStudent);
SIMS.Entities.SENPersonSummary coordinator = editSenReview.Review.Coordinator;
string venue = editSenReview.Review.Venue;
SENRelatedContacts relatedContacts = editSenReview.Student.SENRelatedContacts;
}
//step through each SEN Provision
for(int i = 0; i < editSENStudent.Student.SENProvisions.Value.Count;i++)
{
SENProvision senProvision = editSENStudent.Student.SENProvisions.Item(i);
}