© 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 - Communication Log

Warning.  The code included here was from a 2011 publication and has not been rechecked. If problems arise in use then please contact us for assistance. The principles have not changed.

Scope

This document only discusses the interfaces for managing the communication log.

References

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.

List of file inclusions for comms log sample

The SIMS .net Communications Log Processes

Entries in the communication log tie the message to the student in SIMS .net via the Communications Processes and Entities.

Get Communications Logs Method

Retrieve the logs summaries for a student.

There are 3 overloaded Search methods available for getting the data from the Communications log.

This is a pure SIMS call and does not need to interface with the Communications Web Service to retrieve data.

Assembly: AdmissionsProcesses.dll

Process: SIMS.Processes.Admissions.CommunicationBrowser

Method: Search

Entities populated: SIMS.Entities.Admissions.CommunicationSummary

Code example:

private const int BenAbbotId = 5253;
private void button2_Click(object sender, EventArgs e)
{
  SIMS.Processes.Admissions.CommunicationBrowser c = new  
                     SIMS.Processes.Admissions.CommunicationBrowser();
  c.Search(BenAbbotId);
  foreach (SIMS.Entities.Admissions.CommunicationSummary s in c.Communications)
  {
    string notes = s.Notes;
    int commId = s.ID;
    string type = s.Type;
  }
}

Get Communication Log Detail Method

Retrieve the detail of the log for a student

This is a pure SIMS call and does not need to interface with the Communications Web Service to retrieve data.

Assembly: AdmissionsProcesses.dll

Process: SIMS.Processes.Admissions.CommunicationDetails

Method: Load  

Entities populated: SIMS.Entities.Admissions.Communication

Code example:

private const int BenAbbotId = 5253;
private void button2_Click(object sender, EventArgs e)
{
  SIMS.Processes.Admissions.CommunicationBrowser c = new  
                     SIMS.Processes.Admissions.CommunicationBrowser();
  c.Search(BenAbbotId);
  foreach (SIMS.Entities.Admissions.CommunicationSummary s in c.Communications)
  {
    string notes = s.Notes;
    int commId = s.ID;
    string type = s.Type;
    SIMS.Processes.Admissions.CommunicationDetail com
      = new SIMS.Processes.Admissions.CommunicationDetail();
    com.Load(commId);
    string text = com.Communication.Notes;
  }
}

Delete Communication Log Method

Delete an entry from the communication log.

This is a pure SIMS call and does not need to interface with the Communications Web Service to retrieve data.

Assembly: AdmissionsProcesses.dll

Process: SIMS.Processes.Admissions.CommunicationBrowse

Method: DeleteCommunication

Description: There are 2 overloaded methods to delete from the communications log.

Code example:

using (CommunicationBrowser commsBrowser = new CommunicationBrowser())
{
    commsBrowser.Search(studentID));
    int countCommsLog = commsBrowser.Communications.Count;
			
    foreach( CommunicationSummary commSummary in commsBrowser.Communications )
    {
        string notes = commSummary.Notes.ToString();
        int communicationID = commSummary.ID;
        ...
	 // delete the one thats no longer required using the summary.....
        commsBrowser.DeleteCommunication(commSummary);
    }
	
    // or delete the one using the ID.....
    commsBrowser.DeleteCommunication(commsBrowser.Communications[0].ID));
}  

Add Communication Log Method

Delete an entry from the communication log.

This is a pure SIMS call and does not need to interface with the Communications Web Service to retrieve data.

Assembly: AdmissionsProcesses.dll

Process: SIMS.Processes.Admissions.CommunicationDetail

Method: Save()

Description: Sample for how to add an entry to the communications log.

Code example:

private const int BenAbbotId = 5253;
private const int FrancesMumAbbotId = 175;
private void addToCommsLog()
{
  SIMS.Processes.LookupCache.Populate();
  SIMS.Processes.Admissions.CommunicationBrowser browser 
    = new CommunicationBrowser();
  SIMS.Processes.Admissions.CommunicationDetail m_HostedProcess 
    = new CommunicationDetail();
  m_HostedProcess.New();
  m_HostedProcess.Communication.Type = new CommunicationType();
  m_HostedProcess.SetUpContextAndPriority();
  // Communicatee           
  SIMS.Processes.EditContact editCont = new EditContact();
  editCont.Populate(new Person(FrancesMumAbbotId));
  IIDEntity personCont = editCont.Contact;
  CommunicationPerson commPersonCont 
     = new CommunicationPerson((PersonSummary)personCont);
  commPersonCont.ForenameAttribute.Value 
     = ((PersonSummary)personCont).ChosenName;
  commPersonCont.SetNew();
  // About person - student
  SIMS.Processes.EditStudentInformationReadOnly editStud 
     = new EditStudentInformationReadOnly();
  editStud.Load(new Person(BenAbbotId), DateTime.Now.Date);
  IIDEntity personq = editStud.Student;
  CommunicationPerson commPerson 
     = new CommunicationPerson((PersonSummary)personq);
  commPerson.ForenameAttribute.Value = ((PersonSummary)personq).ChosenName;
  commPerson.SetNew();
  // Load all of the lookups
  CommunicationDirections directs =   
    (CommunicationDirections)m_HostedProcess.GetCommunicationDirections();
  CommunicationContextCollection contexts = 
  (CommunicationContextCollection)m_HostedProcess.GetCommunicationContextCollection();
  CommunicationPriorities prioritys = 
    (CommunicationPriorities)m_HostedProcess.GetCommunicationPriorities();
  CommunicationTypes types = 
    (CommunicationTypes)m_HostedProcess.GetCommunicationTypes();
  CommunicationLogTypes logTypes =
     (CommunicationLogTypes)m_HostedProcess.GetCommunicationLogTypes();
  // Pick a value - partner application will obviously need to allow the user to   
  // choose it rather than selecting the first random value
  foreach (CommunicationDirection direct in directs)
  {
    m_HostedProcess.Communication.Direction = direct;
    break;
  }
  foreach (CommunicationContext context in contexts)
  {
    m_HostedProcess.Communication.Context = context;
    break;
  }
  foreach (CommunicationPriority priority in prioritys)
  {
    m_HostedProcess.Communication.Priority = priority;
    break;
  }
  foreach (CommunicationType type in types)
  {
    m_HostedProcess.Communication.TypeAttribute.Value = type;
    break;
  }
  foreach (CommunicationLogType t in logTypes)
  {
    m_HostedProcess.Communication.LogTypeAttribute.Value = t;
    break;
  }
  // Now complete the information before saving
  m_HostedProcess.Communication.About.Add(commPerson);
  m_HostedProcess.SetCommunicatee(commPersonCont);
  m_HostedProcess.Communication.NotesAttribute.Value 
      = "These are from the Testbed: " + DateTime.Now.ToString();
  m_HostedProcess.Save();
  string whatsup = "";
  if (!m_HostedProcess.Valid())
  {
    // Failed to save – See why…
    ValidationErrors errors = new ValidationErrors();
    m_HostedProcess.ValidationErrors(errors);
    foreach(ValidationError e in errors)
      whatsup += e.Message;
  }
  return;
}