© 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 - Student Photographs

Background

This document explains how student photos can be updated in code.  Please note that it is usually cheaper to buy a copy of photo importer or photo importer for independent schools

Photo Requirements

A number of factors influence how effectively photographs are displayed on a computer screen. The most important of these is the number of colours or grey tones used in the image. The more colours or tones used in the image, the more realistic the image will appear. However, this also increases the size of the image and the space required for storage.

Another factor is the size of the image itself. Computer graphics are usually expressed in pixels rather than inches or centimetres. The Photograph Importer facility in SIMS requires that the images should be displayed with 256 colours and be 480 pixels wide by 640 pixels high for optimum resolution." 

(SIMS 7 Manual)

Phase 1 – Login

[This is covered in other documentation – Sample login code is provided with consultancy.]

Phase 2 – Select a student

SIMS.Processes.StudentBrowseProcess studentBrowse = new SIMS.Processes.StudentBrowseProcess();
SIMS.Entities.StudentSummarys students = studentBrowse.GetStudents(
    "Current"
    , SIMS.Entities.Cache.WildcardAny		
                                        // Any for free text filter
    , SIMS.Entities.Cache.WildcardAny		
    , studentBrowse.RegistrationGroupAny.Code	// Any
    , SIMS.Entities.Cache.WildcardAny
    , studentBrowse.HouseAny.Code		// Any house
    , studentBrowse.TierAny.Code			// Any Tier
    , DateTime.Now					// Effective Date
    , false);					// Photos
foreach (SIMS.Entities.StudentSummary st in students)
{
    student s = new student(st);
    listBoxStudents.Items.Add(s);
}

Phase 3 - Identify the new photo

openFileDialog openFileDialogPhoto = new openFileDialog();
openFileDialogPhoto.DefaultExt = "bmp";
openFileDialogPhoto.Filter = "Image files|*.bmp;*.jpg;*.jpeg;*.gif|All files|*.*";
openFileDialogPhoto.ShowReadOnly = true;
openFileDialogPhoto.Title = "Select photograph";
openFileDialogPhoto.ShowDialog();

Phase 4 – Assign the new photo to the student

student s = (student)(listBoxStudents.SelectedItem);
SIMS.Entities.IIDEntity identity = new SIMS.Entities.Person(s.ID); 
SIMS.Processes.EditStudentInformation edStudInfo = new SIMS.Processes.EditStudentInformation();
edStudInfo.Load(identity, System.DateTime.Now); 
Image bitmap = new Bitmap(Image.FromFile(openFileDialogPhoto.FileName)); 
SIMS.Utilities.ImageTypeConverter imageConv = new SIMS.Utilities.ImageTypeConverter();
edStudInfo.Student.PhotoAttribute.Value = imageConv.GetImageInBinary(bitmap);
if (edStudInfo.Student.Valid())
{
    edStudInfo.Save();
    pictureBoxBefore.Image = bitmap;
    pictureBoxAfter.Image = null;
    pictureBoxAfter.Refresh();
    pictureBoxBefore.Refresh();
}
else
{
    string mess = "";
    foreach (SIMS.Entities.ValidationError err in edStudInfo.Student.ValidationErrors)
    {
        mess += err.Message;
    }
}
Validate and save;

Referenced DLLS

The test application used the above dlls. 

 

Copyright

 

Images are usually the copyright of the photographer.  Users should ensure that they comply with any copyright restrictions imposed by the copyright holder(s).