void InitializeForm()
        {
            List <INCFORM_ROOT5Y> rootCauseList = EHSIncidentMgr.GetRootCauseList(IncidentId, false);

            rootCauseList = EHSIncidentMgr.FormatRootCauseList(LocalIncident, rootCauseList);

            rptRootCause.DataSource = rootCauseList.OrderBy(l => l.PROBLEM_SERIES).ThenBy(l => l.ITEM_SEQ).ToList();
            rptRootCause.DataBind();
        }
Beispiel #2
0
        public void BindCausation(INCIDENT incident)
        {
            try
            {
                if (SessionManager.SessionContext != null)
                {
                    // do we really need to do this on user controls ???
                    String selectedLanguage = SessionManager.UserContext.Language.NLS_LANGUAGE;
                    Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(selectedLanguage);
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedLanguage);

                    base.FrameworkInitialize();
                }

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

                if (incident != null)
                {
                    lblIncidentDesc.Text = incident.DESCRIPTION;
                    IncidentId           = incident.INCIDENT_ID;
                }

                if (incident == null || incident.INCFORM_ROOT5Y == null || incident.INCFORM_ROOT5Y.Count == 0)
                {
                    lblNoneRootCause.Visible = true;
                    divCausation.Visible     = btnSave.Visible = false;
                }
                else
                {
                    List <INCFORM_ROOT5Y> rootCauseList = new List <INCFORM_ROOT5Y>();
                    rootCauseList = EHSIncidentMgr.FormatRootCauseList(incident, incident.INCFORM_ROOT5Y.ToList());

                    lblNoneRootCause.Visible = false;
                    divCausation.Visible     = true;
                    rptRootCause.DataSource  = rootCauseList;
                    rptRootCause.DataBind();

                    INCFORM_CAUSATION causation = incident.INCFORM_CAUSATION == null || incident.INCFORM_CAUSATION.Count == 0 ? null : incident.INCFORM_CAUSATION.ElementAt(0);



                    ddlCausation.Items.Clear();
                    ddlCausation.Items.Add(new RadComboBoxItem("", ""));

                    var ListCausation = EHSMetaDataMgr.SelectMetaDataList("INJURY_CAUSE").ToList();
                    if (IncidentId > max_NewIncident)
                    {
                        ListCausation = ListCausation.Where(p => p.Value.Contains("NEW_IC_")).ToList();
                    }
                    else
                    {
                        ListCausation = ListCausation.Where(p => !p.Value.Contains("NEW_IC_")).ToList();
                    }

                    foreach (EHSMetaData xlat in ListCausation)
                    {
                        ddlCausation.Items.Add(new Telerik.Web.UI.RadComboBoxItem(xlat.TextLong, xlat.Value));
                    }

                    if (SessionManager.GetUserSetting("EHS", "CAUSATION_ADD_FIELDS") != null)
                    {
                        if (SessionManager.GetUserSetting("EHS", "CAUSATION_ADD_FIELDS").VALUE.Contains("team"))
                        {
                            divTeam.Visible = true;
                        }
                    }

                    if (causation != null)
                    {
                        if (ddlCausation.FindItemByValue(causation.CAUSEATION_CD) != null)
                        {
                            ddlCausation.SelectedValue = causation.CAUSEATION_CD;
                        }

                        tbTeam.Text = causation.TEAM_LIST;
                    }

                    btnSave.Visible = PageMode == PageUseMode.ViewOnly ? false : EHSIncidentMgr.CanUpdateIncident(null, true, SysPriv.action, incident.INCFORM_LAST_STEP_COMPLETED);
                }
            }
            catch { }
        }