コード例 #1
0
        void InitializeForm()
        {
            //call function for get the attachment files for  Final Corrective Action.
            GetAttachments(IncidentId);

            IncidentId           = (IsEditContext) ? IncidentId : NewIncidentId;
            lblStatusMsg.Visible = false;

            LocalIncident = EHSIncidentMgr.SelectIncidentById(new PSsqmEntities(), IncidentId);
            if (LocalIncident == null)
            {
                return;
            }

            pnlAction.Visible = true;
            if (PageMode == PageUseMode.ViewOnly)
            {
                divTitle.Visible  = true;
                lblFormTitle.Text = Resources.LocalizedText.CorrectiveAction;
            }

            rptAction.DataSource = EHSIncidentMgr.GetCorrectiveActionList(IncidentId, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ), PageMode == PageUseMode.ViewOnly ? false : true);
            rptAction.DataBind();

            pnlAction.Enabled = PageMode == PageUseMode.ViewOnly ? false : EHSIncidentMgr.CanUpdateIncident(LocalIncident, IsEditContext, SysPriv.action, LocalIncident.INCFORM_LAST_STEP_COMPLETED);

            if (PageMode == PageUseMode.ViewOnly && rptAction.Items.Count == 0)
            {
                rptAction.Visible = false;
            }
        }
コード例 #2
0
        private decimal GetTaskLocation(TASK_STATUS task)
        {
            decimal plantID = SessionManager.UserContext.HRLocation.Plant.PLANT_ID;

            switch ((TaskRecordType)task.RECORD_TYPE)
            {
            case TaskRecordType.HealthSafetyIncident:
            case TaskRecordType.PreventativeAction:
                INCIDENT incident = EHSIncidentMgr.SelectIncidentById(new PSsqmEntities(), task.RECORD_ID);
                if (incident != null && incident.DETECT_PLANT_ID.HasValue)
                {
                    plantID = (decimal)incident.DETECT_PLANT_ID;
                }
                break;

            case TaskRecordType.Audit:
                AUDIT audit = EHSAuditMgr.SelectAuditById(new PSsqmEntities(), task.RECORD_ID);
                if (audit != null && audit.DETECT_PLANT_ID.HasValue)
                {
                    plantID = (decimal)audit.DETECT_PLANT_ID;
                }
                break;
            }

            return(plantID);
        }
コード例 #3
0
        void InitializeForm()
        {
            lblStatusMsg.Visible = false;
            pnlContain.Visible   = true;

            LocalIncident = EHSIncidentMgr.SelectIncidentById(new PSsqmEntities(), IncidentId);
            if (LocalIncident == null)
            {
                return;
            }

            PLANT plant = SQMModelMgr.LookupPlant(entities, (decimal)LocalIncident.DETECT_PLANT_ID, "");

            if (plant != null)
            {
                IncidentLocationTZ = plant.LOCAL_TIMEZONE;
            }

            pnlContain.Visible = true;
            if (PageMode == PageUseMode.ViewOnly)
            {
                divTitle.Visible  = true;
                lblFormTitle.Text = Resources.LocalizedText.InitialAction;
            }

            rptContain.DataSource = EHSIncidentMgr.GetContainmentList(IncidentId, WebSiteCommon.LocalTime(DateTime.UtcNow, IncidentLocationTZ), PageMode == PageUseMode.ViewOnly ? false : true);
            rptContain.DataBind();

            pnlContain.Enabled = PageMode == PageUseMode.ViewOnly ? false : EHSIncidentMgr.CanUpdateIncident(LocalIncident, IsEditContext, SysPriv.originate, LocalIncident.INCFORM_LAST_STEP_COMPLETED);
        }
コード例 #4
0
        public static void NotifyOnCreate(decimal incidentId, decimal plantId)
        {
            var entities = new PSsqmEntities();

            decimal companyId = SessionManager.UserContext.HRLocation.Company.COMPANY_ID;
            decimal busOrgId  = SessionManager.UserContext.HRLocation.BusinessOrg.BUS_ORG_ID;
            var     emailIds  = new HashSet <decimal>();

            INCIDENT incident         = EHSIncidentMgr.SelectIncidentById(entities, incidentId);
            string   incidentLocation = EHSIncidentMgr.SelectIncidentLocationNameByIncidentId(incidentId);
            string   incidentType     = EHSIncidentMgr.SelectIncidentTypeByIncidentId(incidentId);

            List <ATTACHMENT> attachList = SQM.Website.Classes.SQMDocumentMgr.SelectAttachmentListByRecord(40, incidentId, "", "");

            List <NOTIFY> notifications = SQMModelMgr.SelectNotifyHierarchy(companyId, busOrgId, plantId, 0, TaskRecordType.HealthSafetyIncident);

            foreach (NOTIFY n in notifications)
            {
                if (n.NOTIFY_PERSON1 != null)
                {
                    emailIds.Add((decimal)n.NOTIFY_PERSON1);
                }
                if (n.NOTIFY_PERSON2 != null)
                {
                    emailIds.Add((decimal)n.NOTIFY_PERSON2);
                }
            }

            if (emailIds.Count > 0)
            {
                string appUrl = SQMSettings.SelectSettingByCode(entities, "MAIL", "TASK", "MailURL").VALUE;
                if (string.IsNullOrEmpty(appUrl))
                {
                    appUrl = "the website";
                }

                string emailSubject = "Incident Created: " + incidentType + " (" + incidentLocation + ")";
                string emailBody    = "A new incident has been created:<br/>" +
                                      "<br/>" +
                                      incidentLocation + "<br/>" +
                                      incidentType + "<br/>" +
                                      "<br/>" +
                                      incident.DESCRIPTION + "<br/>" +
                                      "<br/>" +
                                      "Please log in to " + appUrl + " to view the incident.";

                foreach (decimal eid in emailIds)
                {
                    string emailAddress = (from p in entities.PERSON where p.PERSON_ID == eid select p.EMAIL).FirstOrDefault();

                    Thread thread = new Thread(() => WebSiteCommon.SendEmail(emailAddress, emailSubject, emailBody, "", "web", attachList));
                    thread.IsBackground = true;
                    thread.Start();

                    //WebSiteCommon.SendEmail(emailAddress, emailSubject, emailBody, "");
                }
            }
        }
コード例 #5
0
        protected void UpdateDisplayState(DisplayState state, decimal incidentID)
        {
            try
            {
                switch (state)
                {
                case DisplayState.IncidentList:
                    SearchIncidents();
                    SessionManager.ClearReturns();
                    break;

                case DisplayState.IncidentNotificationNew:
                    SessionManager.ClearReturns();
                    if (rddlNewActionType.SelectedItem != null)
                    {
                        INCIDENT newIncident = new INCIDENT();
                        newIncident.DETECT_PLANT_ID = Convert.ToDecimal(ddlActionLocation.SelectedValue);
                        newIncident.ISSUE_TYPE_ID   = (decimal)EHSIncidentTypeId.PreventativeAction;
                        newIncident.ISSUE_TYPE      = rddlNewActionType.SelectedValue;
                        if (newIncident.DETECT_PLANT_ID < 1 || newIncident.ISSUE_TYPE_ID < 1)
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error creating new PrevAction');", true);
                        }
                        else
                        {
                            SessionManager.ReturnObject = newIncident;
                            SessionManager.ReturnStatus = true;
                            Response.Redirect("/EHS/EHS_PrevActionForm.aspx");
                        }
                    }
                    break;

                case DisplayState.IncidentNotificationEdit:
                    SessionManager.ClearReturns();
                    INCIDENT theIncident = EHSIncidentMgr.SelectIncidentById(entities, incidentID);
                    if (theIncident != null)
                    {
                        SessionManager.ReturnObject = theIncident;
                        SessionManager.ReturnStatus = true;
                        string stepCmd = "";
                        if (!string.IsNullOrEmpty(Request.QueryString["s"]))                                   // from inbox/calendar assume this is a task assignment. direct to corrective actions page
                        {
                            stepCmd = ("?s=" + Request.QueryString["s"]);
                        }
                        Response.Redirect("/EHS/EHS_PrevActionForm.aspx" + stepCmd);
                    }
                    break;

                default:
                    SessionManager.ClearReturns();
                    break;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error updating PrevAction display state:'" + ex.Message + ");", true);
            }
        }
コード例 #6
0
        public int PopulateInitialForm(PSsqmEntities ctx)
        {
            int status = 0;

            INCIDENT incident = EHSIncidentMgr.SelectIncidentById(ctx, IncidentId, true);

            //if incident is not null populate the form
            if (incident != null)
            {
                PLANT plant = SQMModelMgr.LookupPlant(ctx, (decimal)incident.DETECT_PLANT_ID, "");
                if (plant != null)
                {
                    IncidentLocationTZ = plant.LOCAL_TIMEZONE;
                }

                BindCausation(incident);

                pnlCausation.Enabled = PageMode == PageUseMode.ViewOnly ? false : EHSIncidentMgr.CanUpdateIncident(incident, IsEditContext, SysPriv.originate, incident.INCFORM_LAST_STEP_COMPLETED);
            }

            return(status);
        }
コード例 #7
0
        void InitializeForm(PSsqmEntities ctx)
        {
            lblStatusMsg.Visible = false;
            pnlAlert.Visible     = true;
            //pnlBaseForm2.Visible = true;
            localCtx      = ctx;
            LocalIncident = EHSIncidentMgr.SelectIncidentById(localCtx, IncidentId);
            //populate form when LocalIncident is not null
            //if (LocalIncident == null)
            //{
            //    return;
            //}
            if (LocalIncident != null)
            {
                GetAttachments(IncidentId);

                //To get Privilege information and if Privilege is CEO-Group then CEO-Comments section is editable.
                string PrivInfo = SessionManager.UserContext.Person.PRIV_GROUP.ToString();
                if (PrivInfo == "CEO-GROUP")
                {
                    tbCeoComments.ReadOnly = false;
                }

                INCFORM_ALERT incidentAlert = EHSIncidentMgr.LookupIncidentAlert(localCtx, IncidentId);

                SQMBasePage.SetLocationList(ddlLocations, SQMModelMgr.SelectBusinessLocationList(1m, 0, true), 0);

                ddlNotifyGroup.DataSource     = SQMModelMgr.SelectPrivGroupList("A", true);
                ddlNotifyGroup.DataValueField = "PRIV_GROUP";
                ddlNotifyGroup.DataTextField  = "DESCRIPTION";
                ddlNotifyGroup.DataBind();

                ddlResponsibleGroup.DataSource     = SQMModelMgr.SelectPrivGroupList("A", true);
                ddlResponsibleGroup.DataValueField = "PRIV_GROUP";
                ddlResponsibleGroup.DataTextField  = "DESCRIPTION";
                ddlResponsibleGroup.DataBind();

                rdpDueDate = SQMBasePage.SetRadDateCulture(rdpDueDate, "");
                rdpDueDate.SelectedDate = DateTime.UtcNow.AddDays(1);

                List <NOTIFYACTION> notifyList = SQMModelMgr.SelectNotifyActionList(localCtx, null, null);
                NOTIFYACTION        dfltNotify = notifyList.Where(l => l.NOTIFY_SCOPE == "IN-0" && l.SCOPE_TASK == "400").FirstOrDefault(); // get default alert notification groups

                btnSave.Enabled = false;

                pnlAlert.Enabled = btnSave.Visible = EHSIncidentMgr.CanUpdateIncident(LocalIncident, true, SysPriv.admin, LocalIncident.INCFORM_LAST_STEP_COMPLETED);

                if (incidentAlert == null)
                {
                    if (dfltNotify != null)
                    {
                        ddlNotifyGroup.Items.Where(i => dfltNotify.NOTIFY_DIST.Split(',').Contains(i.Value)).ToList().ForEach(i => i.Checked = true);
                    }
                    lblAlertStatus.Text = "";
                }
                else
                {
                    ddlLocations.Items.Where(i => incidentAlert.LOCATION_LIST.Split(',').Contains(i.Value)).ToList().ForEach(i => i.Checked = true);
                    //  tbAlertDesc.Text = incidentAlert.ALERT_DESC;

                    tbComments.Text = incidentAlert.COMMENTS;

                    // Get CEO-comments value from database and display it.
                    tbCeoComments.Text = incidentAlert.CEO_COMMENTS;

                    ddlNotifyGroup.Items.Where(i => incidentAlert.ALERT_GROUP.Split(',').Contains(i.Value)).ToList().ForEach(i => i.Checked = true);
                    if ((ddlResponsibleGroup.FindItemByValue(incidentAlert.RESPONSIBLE_GROUP)) != null)
                    {
                        ddlResponsibleGroup.SelectedValue = incidentAlert.RESPONSIBLE_GROUP;
                    }
                    rdpDueDate.SelectedDate = incidentAlert.DUE_DT;
                    lblAlertStatus.Text     = XLATList.Where(l => l.XLAT_GROUP == "TASK_STATUS" && l.XLAT_CODE == "0").FirstOrDefault().DESCRIPTION;
                }

                lblNotifyGroup.Text = "";
                //Apply condotional code to desplay data in grid of Process Description
                if (LocalIncident.INCFORM_INJURYILLNESS != null)
                {
                    if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.BUSINESS_TYPE))
                    {
                        BusinessType.Style.Add("display", "none");
                    }
                    else
                    {
                        lblBusinessTypeVal.Text = XLATList.Where(p => p.XLAT_CODE == LocalIncident.INCFORM_INJURYILLNESS.BUSINESS_TYPE).Select(p => p.DESCRIPTION_SHORT).FirstOrDefault();
                        //  display: block;
                        //    BusinessType.Style.Add("display", "block");
                    }
                }
                else
                {
                    BusinessType.Style.Add("display", "none");
                }


                if (LocalIncident.INCFORM_INJURYILLNESS != null)
                {
                    if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.MACRO_PROCESS_TYPE))
                    {
                        MacroProcessType.Style.Add("display", "none");
                    }
                    else
                    {
                        lblMacroProcessTypeVal.Text = XLATList.Where(p => p.XLAT_CODE == LocalIncident.INCFORM_INJURYILLNESS.MACRO_PROCESS_TYPE).Select(p => p.DESCRIPTION_SHORT).FirstOrDefault();
                        //  MacroProcessType.Style.Add("display", "block");
                    }
                }
                else
                {
                    MacroProcessType.Style.Add("display", "none");
                }

                if (LocalIncident.INCFORM_INJURYILLNESS != null)
                {
                    if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.SPECIFIC_PROCESS_TYPE))
                    {
                        SpecificProcessType.Style.Add("display", "none");
                    }
                    else
                    {
                        lblSpecificProcessTypeVal.Text = XLATList.Where(p => p.XLAT_CODE == LocalIncident.INCFORM_INJURYILLNESS.SPECIFIC_PROCESS_TYPE).Select(p => p.DESCRIPTION_SHORT).FirstOrDefault();
                        //SpecificProcessType.Style.Add("display", "block");
                    }
                }
                else
                {
                    SpecificProcessType.Style.Add("display", "none");
                }

                if (LocalIncident.INCFORM_INJURYILLNESS != null)
                {
                    if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.EQUIPMENT_MANUFACTURER_NAME))
                    {
                        EquipmentManufacturerName.Style.Add("display", "none");
                    }
                    else
                    {
                        lblEquipmentManufacturerNameVal.Text = LocalIncident.INCFORM_INJURYILLNESS.EQUIPMENT_MANUFACTURER_NAME;
                        // EquipmentManufacturerName.Style.Add("display", "block");
                    }
                }
                else
                {
                    EquipmentManufacturerName.Style.Add("display", "none");
                }


                foreach (RadComboBoxItem item in ddlNotifyGroup.Items.Where(i => i.Checked == true).ToList())
                {
                    lblNotifyGroup.Text += string.IsNullOrEmpty(lblNotifyGroup.Text) ? item.Text : (", " + item.Text);
                }

                if (BindTAlertaskList(EHSIncidentMgr.GetAlertTaskList(localCtx, LocalIncident.INCIDENT_ID)) > 0)
                {
                    btnSave.Enabled = true;
                }
            }
            else
            {
                btnSave.Visible  = false;
                pnlAlert.Visible = false;
            }
        }
コード例 #8
0
        public void BindIncidentSummary(decimal incidentID)
        {
            PSsqmEntities ctx = new PSsqmEntities();

            XLATList = SQMBasePage.SelectXLATList(new string[2] {
                "INCIDENT_STATUS", "TASK_STATUS"
            });
            string none = "None entered";             // TODO:  get this from XLAT table
            string more = " ...";

            pnlIncidentSummary.Visible = true;
            INCIDENT incident = EHSIncidentMgr.SelectIncidentById(ctx, incidentID, true);

            if (incident == null)
            {
                ;                 // error
                return;
            }

            lblDetail.Text = incident.DESCRIPTION;

            if (incident.INCFORM_CONTAIN != null && incident.INCFORM_CONTAIN.Count > 0)
            {
                lblContainment.Text = incident.INCFORM_CONTAIN.Count > 1 ? incident.INCFORM_CONTAIN.ElementAt(0).ITEM_DESCRIPTION + more : incident.INCFORM_CONTAIN.ElementAt(0).ITEM_DESCRIPTION;
            }
            else
            {
                lblContainment.Text = none;
            }

            if (incident.INCFORM_ROOT5Y != null && incident.INCFORM_ROOT5Y.Count > 0)
            {
                lblContainment.Text = incident.INCFORM_ROOT5Y.Count > 1 ? incident.INCFORM_ROOT5Y.ElementAt(0).ITEM_DESCRIPTION + more : incident.INCFORM_ROOT5Y.ElementAt(0).ITEM_DESCRIPTION;
            }
            else
            {
                lblContainment.Text = none;
            }

            if (incident.INCFORM_ACTION != null && incident.INCFORM_ACTION.Count > 0)
            {
                lblContainment.Text = incident.INCFORM_ACTION.Count > 1 ? incident.INCFORM_ACTION.ElementAt(0).ITEM_DESCRIPTION + more : incident.INCFORM_ACTION.ElementAt(0).ITEM_DESCRIPTION;
            }
            else
            {
                lblContainment.Text = none;
            }

            if (incident.INCFORM_APPROVAL != null && incident.INCFORM_APPROVAL.Count > 0)
            {
                lblSignoff.Text = incident.INCFORM_APPROVAL.ElementAt(0).APPROVER_PERSON + SQMBasePage.FormatDate((DateTime)incident.INCFORM_APPROVAL.ElementAt(0).APPROVAL_DATE, "d", false);
                if (incident.INCFORM_APPROVAL.Count > 1)
                {
                    lblSignoff.Text = incident.INCFORM_APPROVAL.ElementAt(1).APPROVER_PERSON + SQMBasePage.FormatDate((DateTime)incident.INCFORM_APPROVAL.ElementAt(1).APPROVAL_DATE, "d", false);
                }
            }
            else
            {
                lblContainment.Text = XLATList.Where(l => l.XLAT_GROUP == "TASK_STATUS" && l.XLAT_CODE == "1").FirstOrDefault().DESCRIPTION_SHORT;                  // pending
            }
        }
コード例 #9
0
        protected void UpdateDisplayState(DisplayState state, decimal incidentID)
        {
            try
            {
                switch (state)
                {
                case DisplayState.IncidentList:
                    SearchIncidents();
                    SessionManager.ClearReturns();
                    break;

                case DisplayState.IncidentNotificationNew:
                    SessionManager.ClearReturns();
                    if (rddlNewIncidentType.SelectedItem != null)
                    {
                        INCIDENT newIncident = new INCIDENT();
                        newIncident.DETECT_PLANT_ID = Convert.ToDecimal(ddlIncidentLocation.SelectedValue);
                        newIncident.ISSUE_TYPE_ID   = Convert.ToDecimal(rddlNewIncidentType.SelectedValue);

                        if (newIncident.DETECT_PLANT_ID < 1 || newIncident.ISSUE_TYPE_ID < 1)
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error creating new Incident');", true);
                        }
                        else
                        {
                            SessionManager.ReturnObject = newIncident;
                            SessionManager.ReturnStatus = true;
                            if (EHSIncidentMgr.IsUseCustomForm(Convert.ToDecimal(rddlNewIncidentType.SelectedValue)))
                            {
                                Response.Redirect("/EHS/EHS_InjuryIllnessForm.aspx");
                            }
                            else
                            {
                                Response.Redirect("/EHS/EHS_IncidentForm.aspx");
                            }
                        }
                    }
                    break;

                case DisplayState.IncidentNotificationEdit:
                case DisplayState.IncidentAlert:
                    SessionManager.ClearReturns();
                    INCIDENT theIncident = EHSIncidentMgr.SelectIncidentById(entities, incidentID);
                    if (theIncident != null)
                    {
                        SessionManager.ReturnObject = theIncident;
                        SessionManager.ReturnStatus = true;
                        if (state == DisplayState.IncidentAlert)
                        {
                            SessionManager.ReturnContext = "a";                                         // pass 'alert' context to incident pages
                        }
                        if (EHSIncidentMgr.IsUseCustomForm((decimal)theIncident.ISSUE_TYPE_ID))
                        {
                            Response.Redirect("/EHS/EHS_InjuryIllnessForm.aspx");
                        }
                        else
                        {
                            Response.Redirect("/EHS/EHS_IncidentForm.aspx");
                        }
                    }

                    break;

                default:
                    SessionManager.ClearReturns();
                    break;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Error updating Incident display state:'" + ex.Message + ");", true);
            }
        }
コード例 #10
0
        void PopulateByIncidentId(decimal incidentId)
        {
            var entities = new PSsqmEntities();

            var incident = EHSIncidentMgr.SelectIncidentById(entities, incidentId);

            string plantName = EHSIncidentMgr.SelectPlantNameById((decimal)incident.DETECT_PLANT_ID);

            lblPlantName.Text  = String.Format("Location: {0}", plantName);
            lblIncidentId.Text = String.Format("Incident ID: {0}", incidentId);
            //lblCaseId.Text = String.Format("Incident ID: {0}", incidentId);

            string  incidentType   = EHSIncidentMgr.SelectIncidentTypeByIncidentId(incidentId);
            decimal incidentTypeId = EHSIncidentMgr.SelectIncidentTypeIdByIncidentId(incidentId);
            decimal companyId      = incident.DETECT_COMPANY_ID;
            var     questions      = EHSIncidentMgr.SelectIncidentQuestionList(incidentTypeId, companyId, 0);

            questions.AddRange(EHSIncidentMgr.SelectIncidentQuestionList(incidentTypeId, companyId, 1));

            // Date/Time

            ltrDate.Text = incident.INCIDENT_DT.ToLongDateString();

            var timeQuestion = questions.FirstOrDefault(q => q.QuestionId == (decimal)EHSQuestionId.TimeOfDay);

            if (timeQuestion != null)
            {
                string timeAnswer = (from a in entities.INCIDENT_ANSWER
                                     where
                                     a.INCIDENT_ID == incident.INCIDENT_ID &&
                                     a.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.TimeOfDay
                                     select a.ANSWER_VALUE).FirstOrDefault();

                if (!string.IsNullOrEmpty(timeAnswer))
                {
                    ltrTime.Text = Convert.ToDateTime(timeAnswer).ToShortTimeString();
                }
            }

            // Incident Type

            ltrIncidentType.Text = incidentType;

            // Description

            ltrDescription.Text = "<div style=\"width: 600px; word-wrap: break-word;\">" + Server.HtmlEncode(incident.DESCRIPTION) + "</div>";

            // Root Cause(s)

            var rootCauseQuestion = questions.FirstOrDefault(q => q.QuestionId == (decimal)EHSQuestionId.RootCause);

            if (rootCauseQuestion != null)
            {
                string rootCauseAnswer = (from a in entities.INCIDENT_ANSWER
                                          where
                                          a.INCIDENT_ID == incidentId &&
                                          a.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.RootCause
                                          select a.ANSWER_VALUE).FirstOrDefault();

                if (!string.IsNullOrEmpty(rootCauseAnswer))
                {
                    ltrRootCause.Text = "<div style=\"width: 600px; word-wrap: break-word;\">" + Server.HtmlEncode(rootCauseAnswer) + "</div>";
                }
            }


            // Containment

            var containmentQuestion = questions.FirstOrDefault(q => q.QuestionId == (decimal)EHSQuestionId.Containment);

            if (containmentQuestion != null)
            {
                string containmentAnswer = (from a in entities.INCIDENT_ANSWER
                                            where
                                            a.INCIDENT_ID == incidentId &&
                                            a.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Containment
                                            select a.ANSWER_VALUE).FirstOrDefault();

                if (!string.IsNullOrEmpty(containmentAnswer))
                {
                    ltrContainment.Text = "<div style=\"width: 600px; word-wrap: break-word;\">" + Server.HtmlEncode(containmentAnswer) + "</div>";
                }
            }

            // Corrective Actions

            var correctiveQuestion = questions.FirstOrDefault(q => q.QuestionId == (decimal)EHSQuestionId.CorrectiveActions);

            if (correctiveQuestion != null)
            {
                string correctiveAnswer = (from a in entities.INCIDENT_ANSWER
                                           where
                                           a.INCIDENT_ID == incidentId &&
                                           a.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.CorrectiveActions
                                           select a.ANSWER_VALUE).FirstOrDefault();

                if (!string.IsNullOrEmpty(correctiveAnswer))
                {
                    ltrCorrectiveActions.Text = "<div style=\"width: 600px; word-wrap: break-word;\">" + Server.HtmlEncode(correctiveAnswer) + "</div>";
                }
            }

            // Photos

            BindAttachmentsIncident(incident.INCIDENT_ID);
        }