SIMS 7 - Staff Photographs
Background
This document explains how staff photos can be updated in code.
Images
A number of factors influence how effectively photographs are be 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 on the hard disk.
Another factor for consideration is the size of the image itself. Computer graphics are usually expressed in pixels rather than inches or centimetres. The Photograph Importer in SIMS requires that the images 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 member of staff
SIMS.Processes.BrowseEmployee b = new SIMS.Processes.BrowseEmployee();
b.Load(SIMS.Processes.EmployeeFilter.AllCurrent, "", "", "", "", "", true, DateTime.Now);
foreach (SIMS.Entities.EmployeePhotoSummary em in b.Employees)
{
staff s = new staff(em);
listBoxStaff.Items.Add(s);
}
The highlighted Boolean value returns photos with the browse.
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 member of staff
if (openFileDialogPhoto.FileName != "")
{
Int Staff_ID = 1; // Adrian Blacker
SIMS.Processes.EditEmployee emp = new SIMS.Processes.EditEmployee();
emp.Load(Staff_ID, DateTime.Now);
emp.Employee.PhotoAttribute.Value = Bitmap.FromFile(openFileDialogPhoto.FileName);
emp.Employee.PhotoIDAttribute.Value = 0;
if (emp.SaveValidationCheck())
{
emp.Save(DateTime.Now);
}
}
Validate and save;
Referenced DLLS
The test application used the above dlls.
Copyright
Images are usually copyright of the photographer. Whilst guidance can be given as to as to how images can be updated for staff, it remains the responsibility of the user to ensure that they comply with any copyright restrictions imposed by the copyright holder(s).