protected void rgCSTIssueList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                HiddenField  hf;
                Label        lbl;

                try
                {
                    QualityIncidentData data = (QualityIncidentData)e.Item.DataItem;

                    if (data.Person != null)
                    {
                        lbl      = (Label)e.Item.FindControl("lblReportedBy");
                        lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person);
                    }

                    Image img = (Image)e.Item.FindControl("imgRespLocation");
                    if (data.PlantResponsible.PLANT_ID != data.Plant.PLANT_ID)
                    {
                        img.Visible = true;
                    }
                    else
                    {
                        img.Visible = false;
                    }

                    if (!string.IsNullOrEmpty(data.QIIssue.SEVERITY))
                    {
                        lbl      = (Label)e.Item.FindControl("lblSeverity");
                        lbl.Text = WebSiteCommon.GetXlatValue("incidentSeverity", data.QIIssue.SEVERITY);
                    }

                    if (rgCSTIssueList.MasterTableView.GetColumn("Attach").Visible&&  data.AttachList != null)
                    {
                        lbl = (Label)e.Item.FindControl("lblAttach");
                        Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx");
                        lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch);
                        attch.BindListAttachment(data.AttachList, "1", 1);
                    }
                }

                catch { }
            }
        }
Пример #2
0
        public void rptResponseList_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    ResponseItem response = (ResponseItem)e.Item.DataItem;

                    Label lbl = (Label)e.Item.FindControl("lblPersonName_out");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson(response.Response.PERSON_ID, ""));
                    if (!string.IsNullOrEmpty(response.Response.REFERENCE_DATA))
                    {
                        Control parent = lbl.Parent;
                        int     idx    = parent.Controls.IndexOf(lbl) + 1;
                        lbl          = new Label();
                        lbl.Text     = response.Response.REFERENCE_DATA;
                        lbl.CssClass = "refText";
                        parent.Controls.AddAt(idx, new LiteralControl("<br />"));
                        parent.Controls.AddAt(idx + 1, lbl);
                    }
                    lbl      = (Label)e.Item.FindControl("lblResponseDate_out");
                    lbl.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime(response.Response.RESPONSE_DT, SessionManager.UserContext.TimeZoneID), "g", true);
                    RadTextBox rt = (RadTextBox)e.Item.FindControl("rtResponseText_out");
                    rt.Text = response.Response.RESPONSE_TEXT;

                    if (response.AttachmentList != null && response.AttachmentList.Count > 0)
                    {
                        Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx");
                        // rt.Parent.Controls.AddAt(rt.Parent.Controls.IndexOf(rt),new LiteralControl("<br/>"));
                        rt.Parent.Controls.AddAt(rt.Parent.Controls.IndexOf(rt) + 1, attch);
                        attch.BindListAttachment(response.AttachmentList, "1", 0, false);
                    }
                }
                catch
                {
                }
            }
        }
        protected void DisplayIssue()
        {
            SetupPage();

            if (ddlIncidentType.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY) != null)
            {
                SQMBasePage.DisplayControlValue(ddlIncidentType, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY, PageUseMode.ViewOnly, "");
                SelectActivityType(null, null);
                trQIActivity.Visible = false;

                switch (IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY)
                {
                case "CST":
                    trPartType.Visible = true;
                    ph8DRef.Visible    = true;      // external problem control system reference number
                    trReceipt.Visible  = false;
                    break;

                case "RCV":
                    trPartType.Visible = false;
                    ph8DRef.Visible    = false;
                    trReceipt.Visible  = true;     // reference receipt or po number
                    break;

                default:
                    trPartType.Visible = false;
                    ph8DRef.Visible    = false;
                    trReceipt.Visible  = false;
                    break;
                }
            }

            tbTotalEstNCQty.ReadOnly = true;

            QI_OCCUR_NC sample = IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.FirstOrDefault();

            if (sample != null)
            {
                if (IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().NONCONF_ID.HasValue)
                {
                    uclNC.Initialize(IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_AREA,
                                     (decimal)IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().NONCONF_ID,
                                     (int)IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().PROBLEM_COUNT, IssueCtl().PageMode);
                }
                else
                {
                    uclNC.Initialize("", 0, 0, IssueCtl().PageMode);
                }

                gvMeasureGrid.DataSource = sample.QI_OCCUR_MEASURE;
                gvMeasureGrid.DataBind();
            }

            SetB2BLocation(Convert.ToDecimal(IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString()));
            if (ddlReportedLocation.Items.FindItemByValue(IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString()) != null)
            {
                SQMBasePage.DisplayControlValue(ddlReportedLocation, IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString(), IssueCtl().PageMode, "textStd");
            }
            else
            {
                // add the reported location in case the viewing user doesn't have it assigned to him
                BusinessLocation reportLoc = new BusinessLocation().Initialize(IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID);
                if (reportLoc != null)
                {
                    ddlReportedLocation.Items.Add(SQMBasePage.SetLocationItem(reportLoc, true));
                    SQMBasePage.DisplayControlValue(ddlReportedLocation, IssueCtl().qualityIssue.DetectedLocation.Plant.PLANT_ID.ToString(), IssueCtl().PageMode, "textStd");
                }
            }

            ddlResponsibleLocation.Items.Clear();
            if (IssueCtl().qualityIssue.Partdata.B2BList != null)
            {
                foreach (BusinessLocation loc in IssueCtl().qualityIssue.Partdata.B2BList)
                {
                    ddlResponsibleLocation.Items.Add(SQMBasePage.SetLocationItem(loc, true));
                }
                //  ddlResponsibleLocation.SelectedValue = qualityIssue.Incident.RESP_PLANT_ID.ToString();
                SQMBasePage.DisplayControlValue(ddlResponsibleLocation, IssueCtl().qualityIssue.Incident.RESP_PLANT_ID.ToString(), IssueCtl().PageMode, "textStd");
            }

            if (IssueCtl().qualityIssue.Partdata != null && IssueCtl().qualityIssue.Partdata.Part != null)
            {
                SQMBasePage.DisplayControlValue(uclPartSearch1.PartTextBox, IssueCtl().qualityIssue.Partdata.PartDisplayNum(IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY), IssueCtl().PageMode, "textStd");
                lblPartDesc.Text = IssueCtl().qualityIssue.Partdata.Part.PART_NAME;
                SQMBasePage.DisplayControlValue(tbRelatedParts, IssueCtl().qualityIssue.IssueOccur.RELATED_PARTS, IssueCtl().PageMode, "textStd");
            }

            ddlDisposition.SelectedIndex = ddlStatus.SelectedIndex = 0;

            if (IssueCtl().qualityIssue.IsNew)
            {
                cbNotify.Checked = true;
                cbNotify.Enabled = false;
                ddlResponseTime.SelectedIndex = 1;
            }
            else
            {
                cbNotify.Checked = false;
                cbNotify.Enabled = true;

                lblIssueDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)IssueCtl().qualityIssue.Incident.CREATE_DT, SessionManager.UserContext.TimeZoneID), "d", false);

                SQMBasePage.DisplayControlValue(radIssueDate, IssueCtl().qualityIssue.Incident.INCIDENT_DT.ToShortDateString(), IssueCtl().PageMode, "textStd");

                SQMBasePage.DisplayControlValue(tbIssueDesc, IssueCtl().qualityIssue.Incident.DESCRIPTION, IssueCtl().PageMode, "textStd");

                lblOriginator_out.Text = IssueCtl().qualityIssue.Incident.CREATE_BY;
                SQMBasePage.DisplayControlValue(ddlIncidentSeverity2, IssueCtl().qualityIssue.IssueOccur.SEVERITY, IssueCtl().PageMode, "textStd");

                SQMBasePage.DisplayControlValue(tbReceipt, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY == "RCV" ? IssueCtl().qualityIssue.IssueOccur.REF_OPERATION : "", IssueCtl().PageMode, "textStd");

                if (ddlPartType.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.PART_TYPE) != null)
                {
                    SQMBasePage.DisplayControlValue(ddlPartType, IssueCtl().qualityIssue.IssueOccur.PART_TYPE, IssueCtl().PageMode, "textStd");
                }

                SQMBasePage.DisplayControlValue(tbNCLotNum, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().LOT_NUM, IssueCtl().PageMode, "textStd");

                try
                {
                    SQMBasePage.DisplayControlValue(tbNCTotalQty, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_QTY.ToString(), IssueCtl().PageMode, "textStd");
                    SQMBasePage.DisplayControlValue(tbNCSampleQty, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_QTY.ToString(), IssueCtl().PageMode, "textStd");
                    SQMBasePage.DisplayControlValue(tbNCNonConformQty, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_NC_QTY.ToString(), IssueCtl().PageMode, "textStd");
                    SQMBasePage.DisplayControlValue(tbTotalEstNCQty, Math.Round((decimal)IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_NC_QTY, 1).ToString(), IssueCtl().PageMode, "labelEmphasis");
                    lnkCalculateNC.Visible = IssueCtl().PageMode == PageUseMode.EditEnabled ? true : false;
                    lblCalculateNC.Visible = IssueCtl().PageMode == PageUseMode.EditEnabled ? false : true;
                }
                catch
                {
                    tbNCTotalQty.Text = tbNCSampleQty.Text = tbNCNonConformQty.Text = tbTotalEstNCQty.Text = "";
                }

                SQMBasePage.DisplayControlValue(tbObservations, IssueCtl().qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_NC.First().SAMPLE_COMMENTS, IssueCtl().PageMode, "textStd");

                cb8DRequired.Checked = (bool)(IssueCtl().qualityIssue.IssueOccur.PROBCASE_REQD.HasValue == true ? IssueCtl().qualityIssue.IssueOccur.PROBCASE_REQD : false);
                if (IssueCtl().PageMode != PageUseMode.EditEnabled)
                {
                    cb8DRequired.Enabled = phNotify.Visible = false;
                }

                SQMBasePage.DisplayControlValue(tb8DRef, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY == "CST" && !string.IsNullOrEmpty(IssueCtl().qualityIssue.IssueOccur.REF_OPERATION) ? IssueCtl().qualityIssue.IssueOccur.REF_OPERATION : "", IssueCtl().PageMode, "refText");

                SQMBasePage.DisplayControlValue(ddlDisposition, IssueCtl().qualityIssue.IssueOccur.DISPOSITION, IssueCtl().PageMode, "textStd");

                if (IssueCtl().PageMode == PageUseMode.Active)
                {
                    if (ddlStatus.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.STATUS) != null)
                    {
                        ddlStatus.SelectedValue = IssueCtl().qualityIssue.IssueOccur.STATUS;
                    }
                }
                else
                {
                    SQMBasePage.DisplayControlValue(ddlStatus, IssueCtl().qualityIssue.IssueOccur.STATUS, IssueCtl().PageMode, "textStd");
                }

                if (ddlCurrency.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.CURRENCY_CODE) != null)
                {
                    SQMBasePage.DisplayControlValue(ddlCurrency, IssueCtl().qualityIssue.IssueOccur.CURRENCY_CODE, IssueCtl().PageMode, "textStd");
                }

                SQMBasePage.DisplayControlValue(tbActCost, IssueCtl().qualityIssue.IssueOccur.EST_ACT_COST.HasValue ? SQMBasePage.FormatValue((decimal)IssueCtl().qualityIssue.IssueOccur.EST_ACT_COST, 2) : "", IssueCtl().PageMode, "textStd");
                SQMBasePage.DisplayControlValue(tbActCostNote, IssueCtl().qualityIssue.IssueOccur.ACT_COST_COMMENT, IssueCtl().PageMode, "textStd");

                SQMBasePage.DisplayControlValue(tbPotCost, IssueCtl().qualityIssue.IssueOccur.EST_POT_COST.HasValue ? SQMBasePage.FormatValue((decimal)IssueCtl().qualityIssue.IssueOccur.EST_POT_COST, 2) : "", IssueCtl().PageMode, "textStd");
                SQMBasePage.DisplayControlValue(tbPotCostNote, IssueCtl().qualityIssue.IssueOccur.POT_COST_COMMENT, IssueCtl().PageMode, "textStd");

                if (IssueCtl().PageMode == PageUseMode.EditEnabled)
                {
                    uclRadAttach.SetReportOption(false);
                    uclRadAttach.GetUploadedFiles(20, IssueCtl().qualityIssue.Incident.INCIDENT_ID, "1");
                }
                else
                {
                    Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx");
                    uclRadAttach.Parent.Controls.AddAt(uclRadAttach.Parent.Controls.IndexOf(uclRadAttach), attch);
                    attch.BindDisplayAttachments(20, IssueCtl().qualityIssue.Incident.INCIDENT_ID, "1", 0);
                    uclRadAttach.Visible = false;
                }

                btnDupIncident.Visible = IssueCtl().PageMode == PageUseMode.EditEnabled ? true : false;

                //uclQISearch1.Load(false);
                if (!string.IsNullOrEmpty(IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS))
                {
                    QualityIssue refIssue = new QualityIssue().Load(Convert.ToDecimal(IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS));
                    if (refIssue != null)
                    {
                        tbDupIssue.Text = IssueCtl().qualityIssue.IssueOccur.RELATED_INCIDENTS + " - " + refIssue.Incident.DESCRIPTION;
                    }
                }
                else
                {
                    tbDupIssue.Text = "";
                }

                // determine selectable list of responsible persons based on the trading partner locations
                GetResponsibleList();

                if (ddlResponseTime.Items.FindItemByValue(IssueCtl().qualityIssue.IssueOccur.INIT_ACTION) != null)
                {
                    SQMBasePage.DisplayControlValue(ddlResponseTime, IssueCtl().qualityIssue.IssueOccur.INIT_ACTION, IssueCtl().PageMode, "textStd");
                }

                // update the ddl based per selected persons in the task list
                foreach (TASK_STATUS task in IssueCtl().qualityIssue.TeamTask.TaskList)
                {
                    RadComboBoxItem resp = null;
                    if ((resp = ddlResponsible.FindItemByValue(task.RESPONSIBLE_ID.ToString())) != null)
                    {
                        resp.Checked = true;
                    }
                }
                if (IssueCtl().PageMode != PageUseMode.EditEnabled)
                {
                    SQMBasePage.DisplayControlValue(ddlResponsible, "", IssueCtl().PageMode, "textSTd");
                }

                //  btnPrintLabel.OnClientClick = "Popup('../Quality/QualityIssue_Label.aspx?issue=" + qualityIssue.IssueOccur.INCIDENT_ID.ToString() + "', 'newPage', 600, 450); return false;";
            }

            uclResponse.BindResponseList(IssueCtl().qualityIssue.TeamResponse.ResponseList, IssueCtl().PageMode == PageUseMode.EditEnabled || IssueCtl().PageMode == PageUseMode.EditPartial ? true : false, true);
            lblIssueResponseCount.Text = IssueCtl().qualityIssue.TeamResponse.ResponseList.Count.ToString();
            phResponseAlert.Visible    = IssueCtl().PageMode == PageUseMode.EditEnabled ? true : false;
        }
        protected void rgPreventativeList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                HiddenField hf;
                Label       lbl;
                string      val = "";

                EHSIncidentData data = (EHSIncidentData)e.Item.DataItem;

                lbl      = (Label)e.Item.FindControl("lblIncidentId");
                lbl.Text = WebSiteCommon.FormatID(data.Incident.INCIDENT_ID, 6);

                lbl      = (Label)e.Item.FindControl("lblDescription");
                lbl.Text = StringHtmlExtensions.TruncateHtml(data.Incident.DESCRIPTION, 100, "...");
                lbl.Text = lbl.Text.Replace("<a href", "<a target=\"blank\" href");

                if (data.Person != null)
                {
                    lbl      = (Label)e.Item.FindControl("lblReportedBy");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person);
                }

                lbl      = (Label)e.Item.FindControl("lblCategory");
                lbl.Text = EHSIncidentMgr.SelectIncidentAnswer(data.Incident, (decimal)EHSQuestionId.InspectionCategory) + "<br/>" +
                           EHSIncidentMgr.SelectIncidentAnswer(data.Incident, (decimal)EHSQuestionId.RecommendationType);

                lbl = (Label)e.Item.FindControl("lblIncStatus");
                try
                {
                    if (data.Status == "U")
                    {
                        lbl.Text = "Audited " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_DATA_COMPLETE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")";
                    }
                    else if (data.Status == "F")
                    {
                        lbl.Text = "Awaiting Funding " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_DATA_COMPLETE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")";
                    }
                    else if (data.Status == "C")
                    {
                        lbl.Text = "Closed  " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE, "d", false) + "<br/><strong>Not Audited</strong>";
                    }
                    else
                    {
                        lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", data.Status) + "<br/>(" + data.DaysOpen + ")";
                    }
                }
                catch
                {
                    ;
                }

                LinkButton lbEditReport = (LinkButton)e.Item.FindControl("lbEditReport");
                lbEditReport.Visible = true;

                try
                {
                    lbl      = (Label)e.Item.FindControl("lblIncidentDT");
                    lbl.Text = SQMBasePage.FormatDate(data.Incident.INCIDENT_DT, "d", false);
                    if ((val = data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == 80).Select(l => l.ANSWER_VALUE).FirstOrDefault()) != null && !string.IsNullOrEmpty(val))
                    {
                        val = val.Substring(0, val.IndexOf(' '));
                        DateTime parseDate;
                        if (DateTime.TryParse(val, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out parseDate))
                        {
                            lbl.Text = parseDate.ToShortDateString();
                        }
                    }
                }
                catch {}
                try {
                    if ((val = data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == 92).Select(l => l.ANSWER_VALUE).FirstOrDefault()) != null && !string.IsNullOrEmpty(val))
                    {
                        val = val.Substring(0, val.IndexOf(' '));
                        DateTime parseDate;
                        if (DateTime.TryParse(val, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out parseDate))
                        {
                            lbl      = (Label)e.Item.FindControl("lblDueDT");
                            lbl.Text = parseDate.ToShortDateString();
                        }
                    }
                }
                catch  {; }

                if (data.RespPerson != null)
                {
                    lbl      = (Label)e.Item.FindControl("lblAssignedTo");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(data.RespPerson);
                }

                if (rgPreventativeList.MasterTableView.GetColumn("Attach").Visible&&  data.AttachList != null)
                {
                    lbl = (Label)e.Item.FindControl("lblAttach");
                    Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx");
                    lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch);
                    attch.BindListAttachment(data.AttachList, "1", 1);
                }
            }
        }
        protected void rgIncidentList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                HiddenField  hf;
                Label        lbl;

                EHSIncidentData data = (EHSIncidentData)e.Item.DataItem;

                lbl      = (Label)e.Item.FindControl("lblIncidentId");
                lbl.Text = WebSiteCommon.FormatID(data.Incident.INCIDENT_ID, 6);

                if (data.Incident.DESCRIPTION.Length > 120)
                {
                    lbl      = (Label)e.Item.FindControl("lblDescription");
                    lbl.Text = data.Incident.DESCRIPTION.Substring(0, 117) + "...";
                }

                lbl      = (Label)e.Item.FindControl("lblDescription");
                lbl.Text = HttpUtility.HtmlEncode(lbl.Text);

                if (data.Person != null)
                {
                    lbl      = (Label)e.Item.FindControl("lblReportedBy");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person);
                }

                lbl = (Label)e.Item.FindControl("lblIncStatus");
                if (data.Status == "C")
                {
                    lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "C") + " " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")";
                }
                else if (data.Status == "C8")
                {
                    lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "C8") + " " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_8D, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")";
                }
                else if (data.Status == "N")
                {
                    lbl.Text = "<strong>" + WebSiteCommon.GetXlatValue("incidentStatus", "N") + "</strong>";
                }
                else
                {
                    lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "A") + "<br/>(" + data.DaysOpen + ")";
                }

                LinkButton lb8d         = (LinkButton)e.Item.FindControl("lb8d");
                LinkButton lbEditReport = (LinkButton)e.Item.FindControl("lbEditReport");
                lb8d.Visible = lbEditReport.Visible = false;                  // mt - for AAM

                HyperLink hlReport = (HyperLink)e.Item.FindControl("hlReport");
                hlReport.Visible = true;

                /*
                 * INCIDENT_ANSWER entry = data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Create8D).FirstOrDefault();
                 * if (entry != null && entry.ANSWER_VALUE == "Yes")
                 * {
                 *      if (UserContext.RoleAccess() > AccessMode.View)
                 *              lb8d.Visible = true;
                 *      else
                 *              lb8d.Visible = false;
                 *
                 *      lbEditReport.Visible = false;
                 *
                 *      var problemCaseId = EHSIncidentMgr.SelectProblemCaseIdByIncidentId(data.Incident.INCIDENT_ID);
                 *      if (problemCaseId > 0)
                 *      {
                 *
                 *              hlReport.NavigateUrl = "/EHS/EHS_Alert_PDF.aspx?pcid=" + EncryptionManager.Encrypt(problemCaseId.ToString());
                 *
                 *              LinkButton lbReport = (LinkButton)e.Item.FindControl("lbReport");
                 *              lbReport.Visible = true;
                 *              lbReport.CommandArgument = problemCaseId.ToString();
                 *              lbReport.Attributes.Add("CaseType", data.Incident.INCIDENT_TYPE);
                 *      }
                 * }
                 * else
                 * {
                 *      lb8d.Visible = false;
                 *      lbEditReport.Visible = true;
                 *
                 *      hlReport.NavigateUrl = "/EHS/EHS_Alert_PDF.aspx?iid=" + EncryptionManager.Encrypt(data.Incident.INCIDENT_ID.ToString());
                 * }
                 */

                if (data.Incident.ISSUE_TYPE_ID == 10)                 // Prevention Verification
                {
                    lbEditReport.Visible = false;
                }

                if (rgIncidentList.MasterTableView.GetColumn("Attach").Visible&& data.AttachList != null)
                {
                    lbl = (Label)e.Item.FindControl("lblAttach");
                    Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx");
                    lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch);
                    attch.BindListAttachment(data.AttachList, "", 1);
                }
            }
        }