Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Health and Safety Management System

0.00/5 (No votes)
8 Dec 2011 1  
The Health and Safety Management System is an application that is used to help organizations better manage and mitigate health and safety statistics and KPIs.

Introduction

What does your application/extension do? What business problem does it solve?

The Health and Safety Management System is an application that is used to help organizations better manage and mitigate health and safety statistics and KPIs. The solution is designed to empower users with the tools to capture and report on finely grained health and safety performance metrics.

Workplace safety is serving an ever increasing role with many organizations. Companies are now being held accountable to, not just their own internal stakeholders such as employees and shareholders, but also other external stakeholders such as customers, vendors, and suppliers. Whether it is for internal corporate health and safety KPI measurements, or just for general best practices, organizations are putting more and more visibility into health and safety.

Also, companies are now commonly asking for health and safety accountability from their partners, often before engaging in a relationship. For example, large companies in the energy industries make it a prerequisite that the vendors they engage must have a sound health and safety program business processes in place. Often these relationships include contractual oblications which require the vendor to provide regular health and safety reporting; especially when performing work on a customer work site.

The Health and Safety Management System has been designed to provide an organization with the means to capture and report on key health and safety metrics. The key value propositions for the Health and Safety Management System include;

  • Granular health and safety information gathering, such as;
    • Observations - capturing data that identifies health and safety threats and opportunities,
    • Near Miss Incidents - incidents that occur and do not result in an injury or time loss, And
    • Injury and Time Loss Incidents - managing details about injuries and time loss.
  • Flexible and intuitive user configurable reporting, including;
    • Several "canned" and built-in reports that can be optionally printed or exported to various formats such as Excel or PDF.
    • Powerful OLAP analytics that are highly customizable.
    • Flexible user defined querying that can optionally be saved, reloaded, printed, or exported.
  • Highly configurable, and is easily customizable for each customer.
  • Can be quickly integrated with existing organization systems; such as legacy customer or human resources ERP systems.
  • Can be deployed to either the desktop, web, or the cloud.

How many screens and entities does this application have?

Currently, the Health and Safety Management System has;

  • 19 screens that provide standard data entry interfaces as well as for various administration tasks such as lookup or reference tables, reporting and analytics, and security, And
  • 23 entities (tables).

Did LightSwitch save your business money? How?

LightSwitch provided the means to build the solution very quickly. The quality of the solution matches that of an enterprise class solution that would have taken a great deal of more time and effort to create using other, more common, technologies.

Getting to market quickly is key, as is the quality of the offering. With LightSwitch, a solution can be created using technologies and proven software development best practices. The quality of the solution is something that is automatically applied when using LightSwitch. Enabling the scenarios and requirements was easy using the template based tasks.

Would this application still be built if you didn’t have LightSwitch? If yes, with what?

The solution concept was already on-the-table well before any consideration was being made regarding the technology to use for it. Consideration was made for using one or more technologies, including; ASP.Net MVC, HTML5/JSON, SQL Server, and WCF.

Again, as mentioned earlier, LightSwitch makes for a much faster turnaround in delivery time. Using relatively traditional development technologies would result in much more time before delivering on requirements.

How many users does this application support?

As many as us required. There are no known constraints to suggest that the solution could not be deployed in a large enterprise.

How long did this application take to actually build using LightSwitch?

As of the time of this writing, the solution took only a few days to build. It is estimated that the actual total hours of effort would be 18.

Does this application use any LightSwitch extensions? If so, which ones? Did you write any of these extensions yourself? If so, is it available to the public? Where?

The Health and Safety Management System uses a number of extensions and custom controls. These include:

A key success factor of the development of this solution is to utilize existing extensions and tools whenever possible. The goal was to deliver on requirements as quickly as possible. Using existing tools offered the opportunity to enable scenarios without having to "reinvent the wheel".

How did LightSwitch make your developer life better? Was it faster to build compared to other options you considered?

LightSwitch made a remarkable impact on the developer experience when using LightSwitch for this solution. The investment in effort and time was considerably less than what it would have taken using the other considered technologies.

Links, Screenshots, Videos

Links

Screenshot(s)

HealthAndSafety001.png

The Health and Safety Management Home Page

HealthAndSafety002.png

New Observation entry

HealthAndSafety003.png

Injury and Time Loss

HealthAndSafety004.png

An example report

HealthAndSafety005.png

Some very flexible data mining features...


HealthAndSafety006.png
...with visualizations!

HealthAndSafety007.png

Intuitive user defined queries that can be saved and loaded for later use.

Code and Techniques

As far as coding and techniques go, there here are a few useful tidbits that can be appied to your own LightSwitch projects...

Images and Icons

Applying images and icons to the application added some UX appeal to the overall feel of the application. The process used to add images to headers of each of the screens in the application included;

  1. Creating appropriately sized .png images for screen header image.
  2. Opening the Solution Explorer File View.
  3. Add the image as an Embedded Resource in the Resources folder of the Client project.
    HealthAndSafety008.png
  4. Added an image control to the screen element tree. The element is a SilverLight Image control, so that the element would be borderless...
    HealthAndSafety009.png
  5. A class named MyImageHelper was created in the UserCode folder of the Client project (open Solution Explorer in File View).
    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.IO;
    using System.Reflection;
    using System.Windows.Media.Imaging;
    
    namespace LightSwitchApplication
    {
        public class MyImageHelper
        {
            public static byte[] GetImageByName(string fileName)
            {
                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                Stream stream = currentAssembly.GetManifestResourceStream("LightSwitchApplication.Resources." + fileName);
                return GetStreamAsByteArray(stream);
            }
    
            public static BitmapImage GetBitmapImageByName(string fileName)
            {
                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                Stream stream = currentAssembly.GetManifestResourceStream("LightSwitchApplication.Resources." + fileName);
                return GetBitmapImage(GetStreamAsByteArray(stream));
            }
    
            private static byte[] GetStreamAsByteArray(System.IO.Stream stream)
            {
                if (stream != null)
                {
                    int streamLength = Convert.ToInt32(stream.Length);
                    byte[] fileData = new byte[streamLength];
                    stream.Read(fileData, 0, streamLength);
                    stream.Close();
                    return fileData;
                }
                else
                {
                    return null;
                }
            }
    
            private static BitmapImage GetBitmapImage(byte[] bytes)
            {
                // Create a BitmapImage from a byte[];
                using (MemoryStream ms = new MemoryStream(bytes))
                {
                    var bi = new BitmapImage();
                    bi.SetSource(ms);
                    return bi;
                }
            }
    
        }
    }
  6. Then back in the home page screen, code was implemented to retrieve and use the image on the screen...

            partial void AllIncidents_InitializeDataWorkspace(List<IDataService> saveChangesTo)
            {
             
                IContentItemProxy logo = this.FindControl("HomeHeaderLogo");
                logo.ControlAvailable += new EventHandler<ControlAvailableEventArgs>(HomeHeaderLogo_ControlAvailable);
            }
    
            void HomeHeaderLogo_ControlAvailable(object sender, ControlAvailableEventArgs e)
            {
                // Set image source to PNG logo.
                var img = e.Control as Image;
                if (img != null)
                    img.Source = MyImageHelper.GetBitmapImageByName("HealthAndSafetyLogo.png");
            }
  7. ...the image is applied when the application opens the screen...

    HealthAndSafety010.png

Other Techniques

A couple of other techniques applied to this solution include:

  • Intermediate, or "Dummy", screen - Observations, Near Misses, and Injury Incidents are actually each of a type of Incident entity. When clicking on the hyperlink for any of the incidents in the home page listing, logic was applied so that depending on the type of incident selected, the application would open the appropriate incident type screen.
  • One Detail Screen for Add or Edit - a single screen is used for both adding and editing entities. This is achieved by adding a parameter to the screen, usually an integer parameter representing the id of the entity. Logic on the screen would then interpret whether the application is opening the screen for a new or existing record. For example...

            partial void InjuryIncidentScreen_InitializeDataWorkspace(List<IDataService> saveChangesTo)
            {
              
                Incident incident;
                if (!this.IncidentID.HasValue)
                {
                    incident = new Incident();
    
                    IncidentType incidentType = (from it in DataWorkspace.ApplicationData.IncidentTypes
                                    where it.IncidentTypeName == "Injury"
                                    select it).FirstOrDefault();
    
                    incident.IncidentType = incidentType;
                    incident.HoursLost = 0;
    
                    this.IncidentProperty = incident;
    
                }
                else
                {
                    int incidentId = (int)this.IncidentID;
                    
                    incident = (from i in DataWorkspace.ApplicationData.Incidents
                                         where i.Id == incidentId
                                         select i).FirstOrDefault();
    
                    this.IncidentProperty = incident;
                }  
                
            }
    

Hope you all find this helpful and useful. Cheers!

Post a link to this contest entry on our Facebook wall and let people know they should rate this submission! And don’t forget to follow us on Twitter for contest updates! Good luck!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here