protected void lnkPlantView_Click(object sender, EventArgs e)
        {
            PLANT plant = (PLANT)SessionManager.EffLocation.Plant;

            TextBox tbPlantName    = (TextBox)hfBase.FindControl("tbPlantName"); tbPlantName.Text = plant.PLANT_NAME;
            TextBox tbPlantDesc    = (TextBox)hfBase.FindControl("tbPlantDesc"); tbPlantDesc.Text = plant.DISP_PLANT_NAME;
            TextBox tbPlantLocCode = (TextBox)hfBase.FindControl("tbPlantLocCode"); tbPlantLocCode.Text = plant.DUNS_CODE;

            cbTrackFinData.Checked = (bool)plant.TRACK_FIN_DATA;
            cbTrackEWData.Checked  = (bool)plant.TRACK_EW_DATA;
            Label lblLastUpdate = (Label)hfBase.FindControl("lblPlantLastUpdate"); lblLastUpdate.Text = plant.LAST_UPD_BY;

            lblPlantLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false);
            // Label lblLastUpdateDate = (Label)hfBase.FindControl("lblPlantLastUpdateDate"); lblLastUpdateDate.Text = WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString();

            LoadPlantSelects(plant);

            if (plant.ADDRESS != null)
            {
                ADDRESS address = plant.ADDRESS.FirstOrDefault();
                if (address != null)
                {
                    tbAddress1.Text = address.STREET1;
                    tbAddress2.Text = address.STREET2;
                    tbCity.Text     = address.CITY;
                    tbState.Text    = address.STATE_PROV;
                    tbPostal.Text   = address.POSTAL_CODE;
                }
            }

            LocalOrg().EditObject = plant;
        }
Beispiel #2
0
        public void BindProfilePeriodHdr(TaskItem taskItem)
        {
            pnlEHSItemHdr.Visible = true;

            if (taskItem.Plant != null)
            {
                lblProfilePlant_out.Text = taskItem.Plant.PLANT_NAME;
            }

            lblResponsible_out.Text = (string)taskItem.Detail.ToString();

            if (taskItem.RecordID == 0)
            {
                trEHSIncident.Visible    = false;
                trEHSInputPeriod.Visible = trEHSInput.Visible = true;
                lblInputPeriod_out.Text  = SQMBasePage.FormatDate(taskItem.TaskDate, "MMMM yyyy", false);
                lblInput_out.Text        = taskItem.Description;
            }
            else
            {
                trEHSInput.Visible      = trEHSInputPeriod.Visible = false;
                trEHSIncident.Visible   = true;
                lblIncidentID_out.Text  = WebSiteCommon.FormatID(taskItem.RecordID, 6);
                lblDescription_out.Text = taskItem.Description;
            }
        }
 public void BindProblemCaseHeader(ProblemCase problemCase, bool showAll)
 {
     pnlProbCaseHdr.Visible = true;
     if (problemCase.ProbCase.PROBCASE_TYPE == "EHS")
     {
         lblCaseID.Text = hfLblCaseIDEHS.Value;
     }
     lblCaseID_out.Text   = problemCase.CaseID;
     lblCaseType_out.Text = WebSiteCommon.GetXlatValue("incidentType", problemCase.ProbCase.PROBCASE_TYPE);
     lblCaseDesc_out.Text = problemCase.ProbCase.DESC_SHORT;
     // trProbCaseHdrRow2.Visible = showAll;
     if (showAll)
     {
         int progress = problemCase.CheckCaseStatus();
         lblCreateDate_out.Text = SQMBasePage.FormatDate((DateTime)problemCase.ProbCase.CREATE_DT, "d", false);
         lblUpdateDate_out.Text = SQMBasePage.FormatDate((DateTime)problemCase.ProbCase.LAST_UPD_DT, "d", false);
         //lblCaseProgress_out.Text = progress.ToString();
         if (problemCase.ProbCase.CLOSE_DT.HasValue)
         {
             lblCaseStatus_out.Text = WebSiteCommon.GetXlatValue("recordStatus", "C") + ": " + SQMBasePage.FormatDate((DateTime)problemCase.ProbCase.CLOSE_DT, "d", false);
         }
         else
         {
             lblCaseStatus_out.Text = WebSiteCommon.GetXlatValue("caseStep", (Math.Max((decimal)problemCase.ProbCase.PROGRESS, 1) - 1).ToString());
             if (problemCase.ProbCase.STATUS == "I")
             {
                 imgCaseStatus.ImageUrl = "/images/defaulticon/16x16/no.png";
                 imgCaseStatus.Visible  = true;
             }
         }
     }
 }
        public void rptTaskStrip_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    TaskItem item = (TaskItem)e.Item.DataItem;

                    Label lbl = (Label)e.Item.FindControl("lblDueDate");
                    lbl.Text = SQMBasePage.FormatDate((DateTime)item.Task.DUE_DT, "d", false);

                    if (item.Taskstatus == TaskStatus.EscalationLevel1 || item.Taskstatus == TaskStatus.EscalationLevel2)
                    {
                        ImageButton img = (ImageButton)e.Item.FindControl("imgTaskStatus");
                        img.ImageUrl = TaskMgr.TaskStatusImage(item.Taskstatus);
                        img.ToolTip  = item.Taskstatus.ToString();
                        img.Visible  = true;
                    }

                    if (SessionManager.IsUserAgentType("ipad,iphone"))
                    {
                        ImageButton btn = (ImageButton)e.Item.FindControl("btnTaskDetails");
                        btn.Visible = true;
                    }
                }
                catch
                {
                }
            }
        }
Beispiel #5
0
        public void gvDocs_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                try
                {
                    Label       lbl = (Label)e.Row.Cells[0].FindControl("lblPosted");
                    HiddenField hf  = (HiddenField)e.Row.Cells[0].FindControl("hfPostedBy");
                    lbl.Text = hf.Value;
                    hf       = (HiddenField)e.Row.Cells[0].FindControl("hfPostedDate");
                    lbl.Text = lbl.Text + " " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime(Convert.ToDateTime(hf.Value), SessionManager.UserContext.TimeZoneID), "d", true);  //WebSiteCommon.LocalTime(Convert.ToDateTime(hf.Value), SessionManager.UserContext.TimeZoneID).ToShortDateString();

                    hf       = (HiddenField)e.Row.Cells[0].FindControl("hfDisplayArea");
                    lbl      = (Label)e.Row.Cells[0].FindControl("lblDisplayArea");
                    lbl.Text = WebSiteCommon.GetXlatValue("docDisplayType", hf.Value);

                    hf = (HiddenField)e.Row.Cells[0].FindControl("hfFileName");
                    string ext = hf.Value.Substring(hf.Value.LastIndexOf('.') + 1).ToLower();
                    if (!string.IsNullOrEmpty(ext))
                    {
                        Image img = (Image)e.Row.Cells[0].FindControl("imgFileType");
                        img.ImageUrl = "~/images/filetype/icon_" + ext + ".gif";
                    }
                }
                catch
                {
                }
            }
        }
        protected void rgIncidentActionList_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;

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


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

                    lbl = (Label)e.Item.FindControl("lblDueDT");
                    INCIDENT_ANSWER entry = data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == 65).FirstOrDefault();  // due date
                    if (entry != null && !string.IsNullOrEmpty(entry.ANSWER_VALUE))
                    {
                        lbl.Text = SQMBasePage.FormatDate(Convert.ToDateTime(entry.ANSWER_VALUE), "d", false);
                        entry    = data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == 64).FirstOrDefault(); // responsible person
                        if (entry != null && !string.IsNullOrEmpty(entry.ANSWER_VALUE))
                        {
                            lbl      = (Label)e.Item.FindControl("lblResponsible");
                            lbl.Text = entry.ANSWER_VALUE;
                        }
                    }

                    RadGrid gv = (RadGrid)e.Item.FindControl("rgIncidentActions");
                    List <INCIDENT_ANSWER> incidentActionList = new List <INCIDENT_ANSWER>();
                    incidentActionList.AddRange(data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == 24 || l.INCIDENT_QUESTION_ID == 27).ToList());
                    if (incidentActionList.Count > 0)
                    {
                        baseRowIndex  = e.Item.RowIndex;
                        gv.DataSource = incidentActionList;
                        gv.DataBind();
                        gv.Visible = true;
                    }

                    LinkButton lb8d = (LinkButton)e.Item.FindControl("lb8d");
                    if (lb8d != null && UserContext.RoleAccess() <= AccessMode.Partner)
                    {
                        lb8d.Visible = false;
                    }
                }

                catch
                {
                }
            }
        }
Beispiel #7
0
        protected void lnkPlantView_Click(object sender, EventArgs e)
        {
            PLANT plant = (PLANT)SessionManager.EffLocation.Plant;

            TextBox tbPlantName    = (TextBox)hfBase.FindControl("tbPlantName"); tbPlantName.Text = plant.PLANT_NAME;
            TextBox tbPlantDesc    = (TextBox)hfBase.FindControl("tbPlantDesc"); tbPlantDesc.Text = plant.DISP_PLANT_NAME;
            TextBox tbPlantLocCode = (TextBox)hfBase.FindControl("tbPlantLocCode"); tbPlantLocCode.Text = plant.DUNS_CODE;
            TextBox tbAltPlantCode = (TextBox)hfBase.FindControl("tbAltPlantCode"); tbAltPlantCode.Text = plant.ALT_DUNS_CODE;

            cbTrackFinData.Checked = (bool)plant.TRACK_FIN_DATA;
            cbTrackEWData.Checked  = (bool)plant.TRACK_EW_DATA;
            Label lblLastUpdate = (Label)hfBase.FindControl("lblPlantLastUpdate"); lblLastUpdate.Text = plant.LAST_UPD_BY;

            lblPlantLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false);
            // Label lblLastUpdateDate = (Label)hfBase.FindControl("lblPlantLastUpdateDate"); lblLastUpdateDate.Text = WebSiteCommon.LocalTime((DateTime)plant.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString();

            LoadPlantSelects(plant);

            if (plant.ADDRESS != null)
            {
                ADDRESS address = plant.ADDRESS.FirstOrDefault();
                if (address != null)
                {
                    tbAddress1.Text = address.STREET1;
                    tbAddress2.Text = address.STREET2;
                    tbCity.Text     = address.CITY;
                    tbState.Text    = address.STATE_PROV;
                    tbPostal.Text   = address.POSTAL_CODE;
                }
            }

            int[] recList = new int[5] {
                30, 40, 45, 50, 90
            };
            PLANT_ACTIVE        pa = null;
            List <PLANT_ACTIVE> plantActiveList = new List <PLANT_ACTIVE>();

            foreach (int recType in recList)
            {
                PLANT_ACTIVE plantActive = new PLANT_ACTIVE();
                plantActive.PLANT_ID     = plant.PLANT_ID;
                plantActive.RECORD_TYPE  = recType;
                plantActive.ENABLE_EMAIL = true;
                if ((pa = plant.PLANT_ACTIVE.Where(p => p.RECORD_TYPE == recType).FirstOrDefault()) != null)
                {
                    plantActive.EFF_START_DATE       = pa.EFF_START_DATE;
                    plantActive.EFF_END_DATE         = pa.EFF_END_DATE;
                    plantActive.ENABLE_EMAIL         = pa.ENABLE_EMAIL;
                    plantActive.ENABLE_INACTIVE_HIST = pa.ENABLE_INACTIVE_HIST;
                }
                plantActiveList.Add(plantActive);
            }
            BindPlantActive(plantActiveList);

            LocalOrg().EditObject = plant;
        }
Beispiel #8
0
        private void DisplayBusOrg()
        {
            BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg;

            DropDownList ddl = (DropDownList)hfBase.FindControl("ddlCurrencyCodes");

            if (ddl.Items.Count == 0)
            {
                SQMBasePage.FillCurrencyDDL(ddl, "USD");

                List <BUSINESS_ORG> parent_orgs = SQMModelMgr.SelectBusOrgList(entities, SessionManager.EffLocation.Company.COMPANY_ID, 0, true);
                ddl                = (DropDownList)hfBase.FindControl("ddlParentBusOrg");
                ddl.DataSource     = parent_orgs;
                ddl.DataTextField  = "ORG_NAME";
                ddl.DataValueField = "BUS_ORG_ID";
                ddl.DataBind();

                List <Settings> status_codes = SQMSettings.Status;
                ddl                = (DropDownList)hfBase.FindControl("ddlStatus");
                ddl.DataSource     = status_codes;
                ddl.DataTextField  = "short_desc";
                ddl.DataValueField = "code";
                ddl.DataBind();
            }

            if (busOrg != null)
            {
                if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1)
                {
                    SetFindControlValue("lblParentBU_out", hfBase, "Top Level");
                }
                else
                {
                    if (SessionManager.ParentBusinessOrg == null)
                    {
                        SessionManager.ParentBusinessOrg = SQMModelMgr.LookupParentBusOrg(entities, busOrg);
                    }
                    BUSINESS_ORG parentOrg = (BUSINESS_ORG)SessionManager.ParentBusinessOrg;
                    SetFindControlValue("lblParentBU_out", hfBase, parentOrg.ORG_NAME);
                }

                // editable fields
                SetFindControlValue("tbOrgname", hfBase, busOrg.ORG_NAME);
                SetFindControlValue("tbOrgLocCode", hfBase, busOrg.DUNS_CODE);
                SetFindControlValue("ddlCurrencyCodes", hfBase, busOrg.PREFERRED_CURRENCY_CODE);
                SetFindControlValue("ddlStatus", hfBase, busOrg.STATUS);
                if (busOrg.PARENT_BUS_ORG_ID > 0)
                {
                    SetFindControlValue("ddlParentBusOrg", hfBase, busOrg.PARENT_BUS_ORG_ID.ToString());
                }
                SetFindControlValue("lblLastUpdate_out", hfBase, busOrg.LAST_UPD_BY);
                lblLastUpdateDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)busOrg.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false);
            }
        }
 private void DisplayReport()
 {
     EnableControls(divNavArea.Controls, true);
     EnableControls(divWorkArea.Controls, true);
     EnableControls(divCostTable.Controls, false);
     uclSearchBar.TitleItem.Text = costReport.ReportID;
     tbCRName.Text             = costReport.CostReport.COST_REPORT_NAME;
     tbCRDesc.Text             = costReport.CostReport.COST_REPORT_DESC;
     lblCRTotalCostActual.Text = FormatValue((decimal)costReport.CostReport.SUM_ACT_COST, 2);
     lblCRTotalCostAvoid.Text  = FormatValue((decimal)costReport.CostReport.SUM_POT_COST, 2);
     lblUpdateBy.Text          = costReport.CostReport.LAST_UPD_BY;
     lblUpdateDate.Text        = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)costReport.CostReport.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false);
     uclIncidents.BindQualityIssueList(costReport.IncidentList, false);
 }
Beispiel #10
0
 public void BindProfileSelectHdr(EHSProfile profile)
 {
     ToggleVisible(pnlProfileSelectHdr);
     if (profile == null)
     {
         lblLocCodePlant_out.Text = lblLocationType_out.Text = lblProfileUpdateBy_out.Text = lblProfileUpdate_out.Text = "";
     }
     else
     {
         lblLocCodePlant_out.Text    = profile.Plant.DUNS_CODE;
         lblLocationType_out.Text    = WebSiteCommon.GetXlatValue("locationType", profile.Plant.LOCATION_TYPE);
         lblProfileUpdateBy_out.Text = profile.Profile.LAST_UPD_BY;
         lblProfileUpdate_out.Text   = SQMBasePage.FormatDate((DateTime)profile.Profile.LAST_UPD_DT, "d", false);
     }
 }
Beispiel #11
0
        public void gvAuditList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                try
                {
                    HiddenField hf  = (HiddenField)e.Row.Cells[0].FindControl("hfAuditDate");
                    Label       lbl = (Label)e.Row.Cells[0].FindControl("lblAuditDate");
                    lbl.Text = SQMBasePage.FormatDate(Convert.ToDateTime(hf.Value), "d", false);

                    hf       = (HiddenField)e.Row.Cells[0].FindControl("hfAuditID");
                    lbl      = (Label)e.Row.Cells[0].FindControl("lblAuditID");
                    lbl.Text = WebSiteCommon.FormatID(Convert.ToInt32(hf.Value), 6);
                }
                catch
                {
                }
            }
        }
Beispiel #12
0
        public void BindProfileInputHdr(EHSProfile profile)
        {
            ToggleVisible(pnlProfileInputHdr);
            lblPlantName_out.Text  = profile.Plant.PLANT_NAME;
            lblPeriodFrom_out.Text = SQMBasePage.FormatDate(profile.InputPeriod.PeriodDate, "MM/yyyy", false);
            lblDueDate_out.Text    = SQMBasePage.FormatDate(profile.InputPeriod.DueDate.AddMonths(1), "d", false);
            DateTime   lastUpdateDate;
            TaskStatus status = profile.PeriodStatus(new string[0] {
            }, true, out lastUpdateDate);

            lblInputStatus1_out.Text = profile.InputPeriod.NumRequiredComplete.ToString();
            lblInputStatus2_out.Text = profile.InputPeriod.NumRequired.ToString();

            lblLastUpdateBy_out.Text = lblLastUpdate_out.Text = "";
            EHS_PROFILE_INPUT lastinput = profile.InputPeriod.GetLastInput();

            if (lastinput == null || lastinput.LAST_UPD_DT.HasValue == false)
            {
                if (profile.InputPeriod.PlantAccounting != null && !string.IsNullOrEmpty(profile.InputPeriod.PlantAccounting.LAST_UPD_BY))
                {
                    lblLastUpdateBy_out.Text = profile.InputPeriod.PlantAccounting.LAST_UPD_BY;
                    if (profile.InputPeriod.PlantAccounting.LAST_UPD_DT.HasValue)
                    {
                        lblLastUpdate_out.Text = SQMBasePage.FormatDate((DateTime)profile.InputPeriod.PlantAccounting.LAST_UPD_DT, "", false);
                    }
                }
            }
            else
            {
                lblLastUpdateBy_out.Text = lastinput.LAST_UPD_BY;
                lblLastUpdate_out.Text   = SQMBasePage.FormatDate((DateTime)lastinput.LAST_UPD_DT, "", false);
            }

            CURRENCY_XREF exchangeRate = profile.InputPeriod.PeriodExchangeRate(profile.Plant);

            if (exchangeRate != null && exchangeRate.EFF_MONTH > 0)
            {
                phRateStatus.Visible = true;
                lblCurrency.Text     = profile.Plant.CURRENCY_CODE;
                lblRateStatus.Text   = (System.Environment.NewLine + SQMBasePage.FormatDate(new DateTime(exchangeRate.EFF_YEAR, exchangeRate.EFF_MONTH, DateTime.DaysInMonth(exchangeRate.EFF_YEAR, exchangeRate.EFF_MONTH)), "d", false));
            }
        }
 public void BindDeptartment(DEPARTMENT dept)
 {
     isNew = true;
     ToggleVisible(pnlEditDept);
     tbDeptName.Text        = dept.DEPT_NAME;
     tbDeptCode.Text        = dept.DEPT_CODE;
     lblDeptLastUpdate.Text = dept.LAST_UPD_BY;
     if (dept.LAST_UPD_DT != null)
     {
         lblDeptLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)dept.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); // WebSiteCommon.LocalTime((DateTime)dept.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString();
         isNew = false;
     }
     if (string.IsNullOrEmpty(dept.STATUS))
     {
         SetStatusList(ddlDeptStatus, "A");
     }
     else
     {
         SetStatusList(ddlDeptStatus, dept.STATUS);
     }
 }
 public void BindPlantLine(PLANT_LINE line)
 {
     isNew = true;
     ToggleVisible(pnlLineEdit);
     tbLineName.Text        = line.PLANT_LINE_NAME;
     tbLineDownRate.Text    = line.DOWNTIME_RATE.ToString();
     lblLineLastUpdate.Text = line.LAST_UPD_BY;
     if (line.LAST_UPD_DT != null)
     {
         lblLineLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)line.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false);  //WebSiteCommon.LocalTime((DateTime)line.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString();
         isNew = false;
     }
     if (string.IsNullOrEmpty(line.STATUS))
     {
         SetStatusList(ddlLineStatus, "A");
     }
     else
     {
         SetStatusList(ddlLineStatus, line.STATUS);
     }
 }
 public void rptCRList_OnItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         try
         {
             IncidentCostReport rpt = (IncidentCostReport)e.Item.DataItem;
             LinkButton         lnk = (LinkButton)e.Item.FindControl("lnkViewCRID");
             lnk.Text = WebSiteCommon.FormatID(Convert.ToDecimal(lnk.CommandArgument), 6);
             Label lbl = (Label)e.Item.FindControl("lblCRCreateDT");
             lbl.Text = SQMBasePage.FormatDate(Convert.ToDateTime(lbl.Text), "d", false);
             lbl      = (Label)e.Item.FindControl("lblCRType");
             lbl.Text = WebSiteCommon.GetXlatValue("issueResponsible", lbl.Text);
             Ucl_IncidentList uclIncidents = (Ucl_IncidentList)e.Item.FindControl("uclIncidents");
             uclIncidents.BindQualityIssueList(rpt.IncidentList, false);
         }
         catch
         {
         }
     }
 }
 public void BindLaborType(LABOR_TYPE labor)
 {
     isNew = true;
     ToggleVisible(pnlLaborEdit);
     tbLaborName.Text        = labor.LABOR_NAME;
     tbLaborCode.Text        = labor.LABOR_CODE;
     tbLaborRate.Text        = labor.LABOR_RATE.ToString();
     lblLaborLastUpdate.Text = labor.LAST_UPD_BY;
     if (labor.LAST_UPD_DT != null)
     {
         lblLaborLastUpdateDate.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)labor.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false);  //WebSiteCommon.LocalTime((DateTime)labor.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString();
         isNew = false;
     }
     if (string.IsNullOrEmpty(labor.STATUS))
     {
         SetStatusList(ddlLaborStatus, "A");
     }
     else
     {
         SetStatusList(ddlLaborStatus, labor.STATUS);
     }
 }
Beispiel #17
0
        public void rptDocList_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    DOCUMENT doc = (DOCUMENT)e.Item.DataItem;
                    Label    lbl = (Label)e.Item.FindControl("lblPosted");
                    lbl.Text = doc.UPLOADED_BY;
                    lbl.Text = lbl.Text + " " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)doc.UPLOADED_DT, SessionManager.UserContext.TimeZoneID), "d", true);  //WebSiteCommon.LocalTime((DateTime)doc.UPLOADED_DT, SessionManager.UserContext.TimeZoneID).ToShortDateString();

                    lbl      = (Label)e.Item.FindControl("lblDisplayArea");
                    lbl.Text = WebSiteCommon.GetXlatValue("docDisplayType", doc.DISPLAY_TYPE.ToString());
                    if (doc.RECORD_ID > 0)
                    {
                        lbl = (Label)e.Item.FindControl("lblDocReference");
                        if (doc.DOCUMENT_SCOPE == "BLI")
                        {
                            PLANT plant = SQMModelMgr.LookupPlant((decimal)doc.RECORD_ID);
                            if (plant != null)
                            {
                                lbl.Text = plant.PLANT_NAME;
                            }
                        }
                    }

                    string ext = doc.FILE_NAME.Substring(doc.FILE_NAME.LastIndexOf('.') + 1).ToLower();
                    if (!string.IsNullOrEmpty(ext))
                    {
                        Image img = (Image)e.Item.FindControl("imgFileType");
                        img.ImageUrl = "~/images/filetype/icon_" + ext + ".gif";
                    }
                }
                catch
                {
                }
            }
        }
        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
                {
                }
            }
        }
        public void LoadProfileInput(DateTime targetDate, EHSProfileStatus selectStatus)
        {
            AccessMode accessMode = UserContext.CheckAccess("EHS", "311");

            LocalProfile().LoadPeriod(targetDate);
            if (LocalProfile().InputPeriod != null)
            {
                LocalProfile().MapPlantAccountingInputs(true, false);

                uclInputHdr.BindProfileInputHdr(LocalProfile());
                EHSProfileStatus status = BindProfileInputList(LocalProfile().MeasureList(true, accessMode).ToList(), LocalProfile().Profile);
                if (status == EHSProfileStatus.Normal)
                {
                    if (LocalProfile().Profile.APPROVER_ID == SessionManager.UserContext.Person.PERSON_ID || accessMode >= AccessMode.Admin)
                    {
                        cbFinalApproval.Enabled = true;
                    }
                    if (LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID.HasValue&& LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                    {
                        cbFinalApproval.Checked  = true;
                        cbFinalApproval.Enabled  = false;
                        hfWasApproved.Value      = lblFinalApprovalBy.Text = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID, ""));
                        lblFinalApprovalBy.Text += ("  " + SQMBasePage.FormatDate((DateTime)LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT, "", false));
                    }
                    else
                    {
                        cbFinalApproval.Checked = false;
                        hfWasApproved.Value     = lblFinalApprovalBy.Text = "";
                    }
                }
                MessageDisplay(selectStatus == EHSProfileStatus.Normal ? status : selectStatus);
                btnSave1.Enabled = btnSave2.Enabled = btnCancel1.Enabled = btnCancel2.Enabled = UserContext.CheckAccess("EHS", "311") >= AccessMode.Update ? true : false;
            }
            else
            {
                MessageDisplay(EHSProfileStatus.NoInputs);
            }
        }
Beispiel #20
0
        public void LoadProfileInput(DateTime targetDate, EHSProfileStatus selectStatus)
        {
            UserContext.CheckUserPrivilege(SysPriv.originate, SysScope.envdata);
            LocalProfile().LoadPeriod(targetDate);
            if (LocalProfile().InputPeriod != null)
            {
                LocalProfile().MapPlantAccountingInputs(true, false);

                uclInputHdr.BindProfileInputHdr(LocalProfile());
                EHSProfileStatus status = BindProfileInputList(LocalProfile().MeasureList(true, UserContext.GetScopePrivileges(SysScope.envdata)).ToList(), LocalProfile().Profile);
                if (status == EHSProfileStatus.Normal)
                {
                    if (LocalProfile().Profile.APPROVER_ID == SessionManager.UserContext.Person.PERSON_ID || UserContext.CheckUserPrivilege(SysPriv.approve, SysScope.envdata))
                    {
                        cbFinalApproval.Enabled = true;
                    }
                    if (LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID.HasValue&& LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                    {
                        cbFinalApproval.Checked  = true;
                        cbFinalApproval.Enabled  = false;
                        hfWasApproved.Value      = lblFinalApprovalBy.Text = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID, ""));
                        lblFinalApprovalBy.Text += ("  " + SQMBasePage.FormatDate((DateTime)LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT, "", false));
                    }
                    else
                    {
                        cbFinalApproval.Checked = false;
                        hfWasApproved.Value     = lblFinalApprovalBy.Text = "";
                    }
                }
                MessageDisplay(selectStatus == EHSProfileStatus.Normal ? status : selectStatus);
                btnSave1.Enabled = btnSave2.Enabled = btnCancel1.Enabled = btnCancel2.Enabled = UserContext.GetMaxScopePrivilege(SysScope.envdata) < SysPriv.notify ? true : false;
            }
            else
            {
                MessageDisplay(EHSProfileStatus.NoInputs);
            }
        }
Beispiel #21
0
        protected void rgProfilePeriodList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                HiddenField  hf;
                Label        lbl;

                try
                {
                    EHSProfilePeriod period = (EHSProfilePeriod)e.Item.DataItem;

                    LinkButton lnk = (LinkButton)e.Item.FindControl("lnkPeriod");
                    lnk.Text            = SQMBasePage.FormatDate(period.PeriodDate, "MMMM yyyy", false);
                    lnk.CommandArgument = period.PeriodDate.ToShortDateString();

                    Ucl_MetricList ucl = (Ucl_MetricList)e.Item.FindControl("uclInputsList");
                    ucl.BindInputsList(period, "");
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #22
0
        protected void rgAuditList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                HiddenField  hf;
                Label        lbl;

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

                lbl      = (Label)e.Item.FindControl("lblAuditId");
                lbl.Text = WebSiteCommon.FormatID(data.Audit.AUDIT_ID, 6);

                if (data.Audit.DESCRIPTION.Length > 120)
                {
                    lbl      = (Label)e.Item.FindControl("lblDescription");
                    lbl.Text = data.Audit.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("lblAuditBy");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person);
                }

                lbl = (Label)e.Item.FindControl("lblAuditStatus");

                if (data.Audit.CURRENT_STATUS == "C")
                {
                    DateTime clsDate = (DateTime)data.Audit.CLOSE_DATE_DATA_COMPLETE;
                    lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "C") + " " + SQMBasePage.FormatDate(clsDate, "d", false);
                }
                else
                {
                    if (data.DaysToClose == 0)
                    {
                        DateTime tmp = ((DateTime)data.Audit.AUDIT_DT).AddDays(data.AuditType.DAYS_TO_COMPLETE);
                        lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "X") + "<br/>(" + SQMBasePage.FormatDate(tmp, "d", false) + ")";
                    }
                    else if (data.Audit.PERCENT_COMPLETE > 0)
                    {
                        lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "I") + "<br/>(" + data.DaysToClose + ")";
                    }
                    else
                    {
                        lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "A") + "<br/>(" + data.DaysToClose + ")";
                    }
                }

                LinkButton lnk = (LinkButton)e.Item.FindControl("lbAuditId");

                if (SessionManager.UserContext.Person.PERSON_ID == data.Person.PERSON_ID)
                {
                    lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~" + data.Status;
                }
                else if (!data.Status.Equals("C"))
                {
                    lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~D";
                }
                else
                {
                    lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~C";
                }
            }
        }
Beispiel #23
0
        public int MetricSeries(EHSCalcsCtl.SeriesOrder seriesOrder, decimal[] plantIDS, string targetScope)
        {
            int         status = 0;
            int         item   = 0;
            GaugeSeries series = null;

            this.Results.Initialize();
            PLANT plant = null;

            switch (seriesOrder)
            {
            case EHSCalcsCtl.SeriesOrder.PlantMeasure:
                int numYears   = this.ToDate.Year - this.FromDate.Year + 1;
                int numPeriods = ((this.ToDate.Year - this.FromDate.Year) * 12) + (this.ToDate.Month - this.FromDate.Month) + 1;
                foreach (decimal plantID in plantIDS)
                {
                    try
                    {
                        if (plantID > 0)
                        {
                            plant  = SQMModelMgr.LookupPlant(plantID);
                            series = new GaugeSeries().CreateNew(1, plant.PLANT_NAME, "");
                        }
                        else
                        {
                            series = new GaugeSeries().CreateNew(1, "overall", "");
                        }

                        for (int n = 0; n < numPeriods; n++)
                        {
                            DateTime thePeriod = this.FromDate.AddMonths(n);
                            if (TargetMetric(targetScope, new decimal[1] {
                                plantID
                            }, thePeriod) >= 0 && this.Results.ValidResult)
                            {
                                series.ItemList.Add(new GaugeSeriesItem().CreateNew(1, n + 1, 0, this.Results.Result, SQMBasePage.FormatDate(thePeriod, "yyyy/MM", false)));
                            }
                            else
                            {
                                series.ItemList.Add(new GaugeSeriesItem().CreateNew(1, n + 1, 0, 0, SQMBasePage.FormatDate(thePeriod, "yyyy/MM", false)));
                            }
                        }

                        this.Results.metricSeries.Add(series);
                    }
                    catch
                    {
                    }
                }
                break;

            default:
                series = new GaugeSeries().CreateNew(1, "", "");
                foreach (decimal plantID in plantIDS)
                {
                    plant = SQMModelMgr.LookupPlant(plantID);

                    if (TargetMetric(targetScope, new decimal[1] {
                        plantID
                    }, DateTime.MinValue) >= 0 && this.Results.ValidResult)
                    {
                        series.ItemList.Add(new GaugeSeriesItem().CreateNew(1, item++, 0, this.Results.Result, plant.PLANT_NAME));
                        series.Name = this.Results.Text;
                    }
                }
                this.Results.metricSeries.Add(series);
                break;
            }

            if (this.Results.metricSeries.Count > 0)
            {
                this.Results.ValidResult = true;
            }

            return(status);
        }
Beispiel #24
0
        protected void DisplayUser()
        {
            PERSON           person = LocalPerson();
            BusinessLocation businessLocation;
            SETTINGS         sets      = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER");
            SQM_ACCESS       sysAccess = SQMModelMgr.LookupCredentials(entities, person.SSO_ID, "", false);

            divPageBody.Visible = true;
            ddlPlantSelect.ClearCheckedItems();
            ddlCustPlantSelect.ClearCheckedItems();

            DisplayErrorMessage(null);

            if (person == null || string.IsNullOrEmpty(person.STATUS))                 // new user
            {
                winUserEdit.Title        = hfAddUser.Value;
                businessLocation         = new BusinessLocation();
                businessLocation.Company = SessionManager.EffLocation.Company;
                SetStatusList("ddlUserStatus", "A", true);
                tbUserSSOID.Enabled = true;
                tbUserSSOID.Text    = "";
                tbUserSSOID.Focus();
            }
            else
            {
                winUserEdit.Title   = hfUpdateUser.Value;
                tbUserSSOID.Enabled = false;
                tbUserFirstName.Focus();

                lblPlantAccess.Text = "";
                if (person.PLANT_ID > 0)
                {
                    ddlHRLocation.SelectedValue = person.PLANT_ID.ToString();
                    if (ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()) != null)
                    {
                        ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()).Checked = true;
                    }
                }

                if (!string.IsNullOrEmpty(person.NEW_LOCATION_CD))
                {
                    RadComboBoxItem plantItem = null;
                    string[]        locs      = person.NEW_LOCATION_CD.Split(',');
                    foreach (string locid in locs)
                    {
                        if ((plantItem = ddlPlantSelect.Items.FindItemByValue(locid)) != null)
                        {
                            ddlPlantSelect.Items.FindItemByValue(locid).Checked = true;
                            if (locs.Length > 2)
                            {
                                lblPlantAccess.Text += lblPlantAccess.Text.Length == 0 ? plantItem.Text : (", " + plantItem.Text);
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(person.OLD_LOCATION_CD))
                {
                    string[] locs = person.OLD_LOCATION_CD.Split(',');
                    foreach (string locid in locs)
                    {
                        if (ddlCustPlantSelect.Items.FindItemByValue(locid) != null)
                        {
                            ddlCustPlantSelect.Items.FindItemByValue(locid).Checked = true;
                        }
                    }
                }
            }

            // AW20131106 - do not want to be able to change a SSO ID once a person has been added
            if (!string.IsNullOrEmpty(person.SSO_ID.Trim()))
            {
                tbUserSSOID.Text = person.SSO_ID;
            }

            tbUserFirstName.Text = person.FIRST_NAME;
            tbUserLastName.Text  = person.LAST_NAME;
            tbUserTitle.Text     = person.JOB_TITLE;
            tbUserPhone.Text     = person.PHONE;
            tbUserEmail.Text     = person.EMAIL;
            SetStatusList("ddlUserStatus", person.STATUS, true);
            if (sysAccess != null && sysAccess.LAST_LOGON_DT.HasValue)
            {
                lblUserLoginDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)sysAccess.LAST_LOGON_DT, WebSiteCommon.GetXlatValue("timeZone", person.PREFERRED_TIMEZONE)), "g", true);
            }
            else
            {
                lblUserLoginDate_out.Text = "";
            }
            lblUserLastUpdate.Text = person.LAST_UPD_BY + "  " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)person.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "g", true);

            if (ddlUserLanguage.Items.FindByValue(person.PREFERRED_LANG_ID.ToString()) != null)
            {
                ddlUserLanguage.SelectedValue = person.PREFERRED_LANG_ID.ToString();
            }
            if (ddlUserTimezone.Items.FindByValue(person.PREFERRED_TIMEZONE) != null)
            {
                ddlUserTimezone.SelectedValue = person.PREFERRED_TIMEZONE;
            }

            ddlUserRole.Items.Clear();
            ddlUserRole.Items.AddRange(WebSiteCommon.PopulateRadListItems("userRole"));
            for (int i = ddlUserRole.Items.Count - 1; i >= 0; i--)
            {
                AccessMode roleMode = SessionManager.RoleAccessMode(Convert.ToInt32(ddlUserRole.Items[i].Value));
                if (SessionManager.IsEffLocationPrimary() && roleMode == AccessMode.Partner)
                {
                    ddlUserRole.Items.Remove(i);
                }
                if (!SessionManager.IsEffLocationPrimary() && roleMode != AccessMode.Partner)               // restrict roles of non-primary company users
                {
                    ddlUserRole.Items.Remove(i);
                }
                else if (UserContext.RoleAccess() < AccessMode.SA && roleMode > AccessMode.Admin)      // only QAI admin may see or edit sys admin role
                {
                    ddlUserRole.Items.Remove(i);
                }
            }

            string rolesDesc = "";

            if (ddlUserRole.Items.FindItemByValue(person.ROLE.ToString()) != null)
            {
                ddlUserRole.SelectedValue = person.ROLE.ToString();
            }

            if (sets == null || sets.VALUE.ToUpper() != "Y")      // prompt for user escalation
            {
                cbUserRcvEscalation.Visible = true;
                if (person.RCV_ESCALATION.HasValue)
                {
                    cbUserRcvEscalation.Checked = (bool)person.RCV_ESCALATION;
                }
            }
            else
            {
                cbUserRcvEscalation.Visible = false;        // enable escalation for anyone
                cbUserRcvEscalation.Checked = true;
            }

            if (person.ROLE <= 100 || person.PERSON_ACCESS.Where(a => a.ACCESS_PROD == "SQM").Count() > 0)
            {
                ddlCustPlantSelect.Enabled = true;
            }
            else
            {
                ddlCustPlantSelect.Enabled       = false;
                ddlCustPlantSelect.SelectedIndex = 0;
            }

            List <SysModule> sysmodList = SQMSettings.SystemModuleItems();
            string           prod = "";
            RadComboBoxItem  item = null; RadComboBoxItem itemSep = null;

            ddlModuleAccess.Items.Clear();
            lblModuleAccess.Text = "";
            foreach (SysModule sysmod in sysmodList.Where(l => l.prod != "CQM").ToList())
            {
                if (string.IsNullOrEmpty(sysmod.mod))
                {
                    prod                = sysmod.prod;
                    itemSep             = new RadComboBoxItem(((HiddenField)pnlUserEdit.FindControl("hf" + prod)).Value, prod);
                    itemSep.IsSeparator = true;
                    ddlModuleAccess.Items.Add(itemSep);
                }
                else
                {
                    item = new RadComboBoxItem(sysmod.desc, sysmod.topic);
                    ddlModuleAccess.Items.Add(item);
                    if (GetSelectedUserRole() <= 100)
                    {
                        item.Checked = true;
                    }
                    else if ((sysmod.prod == "SQM" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "201").Count() > 0) ||
                             (sysmod.prod == "EHS" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "301").Count() > 0))
                    {
                        item.Checked = true;
                    }
                    else if (person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == sysmod.topic).Count() > 0)
                    {
                        item.Checked = true;
                    }
                    // exclusions
                    if (!SessionManager.IsEffLocationPrimary())  // restrict module selections if not primary company user
                    {
                        if (sysmod.prod != "SQM")
                        {
                            itemSep.Enabled        = item.Enabled = item.Checked = false;
                            ddlModuleAccess.Height = 120;
                        }
                    }
                    if (item.Checked)
                    {
                        lblModuleAccess.Text += lblModuleAccess.Text.Length == 0 ? item.Text : (", " + item.Text);
                    }
                }
            }

            if (!SessionManager.IsEffLocationPrimary())
            {
                ddlCustPlantSelect.Enabled  = false;
                cbUserRcvEscalation.Visible = cbUserRcvEscalation.Checked = false;
            }

            string script = "function f(){OpenUserEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
        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
            }
        }
        public void rptProfileStatus_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Label lbl;
                try
                {
                    EHSProfile profile = (EHSProfile)e.Item.DataItem;

                    Button btn = (Button)e.Item.FindControl("btnRollup");
                    btn.CommandArgument = profile.Plant.PLANT_ID.ToString();
                    btn = (Button)e.Item.FindControl("btnRollupYTD");
                    btn.CommandArgument = profile.Plant.PLANT_ID.ToString();

                    DateTime   lastUpdateDate;
                    TaskStatus status = profile.PeriodStatus(new string[0] {
                    }, true, out lastUpdateDate);

                    lbl       = (Label)e.Item.FindControl("lblInputs");
                    lbl.Text += profile.InputPeriod.NumComplete + " of " + profile.MeasureList(false).Count + " (Total)";
                    lbl       = (Label)e.Item.FindControl("lblReqdInputs");
                    lbl.Text  = profile.InputPeriod.NumRequiredComplete.ToString() + " of " + profile.InputPeriod.NumRequired.ToString() + " (Required)";
                    LinkButton lnk = (LinkButton)e.Item.FindControl("lnkInputs");
                    lnk.CommandArgument = profile.Plant.PLANT_ID.ToString();

                    lbl = (Label)e.Item.FindControl("lblRollupStatus");
                    lnk = (LinkButton)e.Item.FindControl("lnkHistory");
                    lnk.CommandArgument = profile.Plant.PLANT_ID.ToString();
                    if (profile.InputPeriod.PlantAccounting != null && profile.InputPeriod.PlantAccounting.FINALIZE_DT != null)
                    {
                        lbl.Text    = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)profile.InputPeriod.PlantAccounting.FINALIZE_ID, ""));
                        lbl.Text   += " ";
                        lbl.Text   += SQMBasePage.FormatDate((DateTime)profile.InputPeriod.PlantAccounting.FINALIZE_DT, "d", false);
                        lnk.Visible = true;
                    }

                    string currencyCode = SQMModelMgr.LookupPlant(profile.Plant.PLANT_ID).CURRENCY_CODE;
                    lbl      = (Label)e.Item.FindControl("lblRateStatus");
                    lbl.Text = currencyCode + ": ";
                    CURRENCY_XREF currentRate = CurrencyConverter.CurrentRate(currencyCode, profile.InputPeriod.PeriodYear, profile.InputPeriod.PeriodMonth);
                    if (currentRate != null && currentRate.EFF_MONTH > 0)
                    {
                        lbl.Text += (System.Environment.NewLine + SQMBasePage.FormatDate(new DateTime(currentRate.EFF_YEAR, currentRate.EFF_MONTH, DateTime.DaysInMonth(currentRate.EFF_YEAR, currentRate.EFF_MONTH)), "d", false));
                    }

                    if (profile.InputPeriod.PlantAccounting != null)
                    {
                        SETTINGS    sets = SQMSettings.GetSetting("EHS", "ACCTFIELDS"); // try to retrieve fields to display for this client
                        Ucl_EHSList ucl  = (Ucl_EHSList)e.Item.FindControl("uclProdList");
                        ucl.BindProdFieldsList(profile, sets == null ? "" : sets.VALUE);

                        if (profile.InputPeriod.PlantAccounting.APPROVER_ID.HasValue && profile.InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                        {
                            lbl       = (Label)e.Item.FindControl("lblFinalStatus");
                            lbl.Text  = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)profile.InputPeriod.PlantAccounting.APPROVER_ID, ""));
                            lbl.Text += " ";
                            lbl.Text += SQMBasePage.FormatDate((DateTime)profile.InputPeriod.PlantAccounting.APPROVAL_DT, "", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ;
                }
            }
        }
Beispiel #27
0
        public void rptTaskList_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    TaskItem         item = (TaskItem)e.Item.DataItem;
                    Ucl_IncidentList ucl;
                    Ucl_EHSList      ecl;
                    LinkButton       lnk;
                    Label            lbl;
                    Image            img;
                    //TaskStatus status;
                    TaskRecordType taskType = (TaskRecordType)item.RecordType;
                    switch (taskType)
                    {
                    case TaskRecordType.QualityIssue:        // quality issue
                        lnk = (LinkButton)e.Item.FindControl("lnkTask");
                        if (!string.IsNullOrEmpty(item.Task.DESCRIPTION))
                        {
                            lnk.Text = item.Title + "<br>(" + item.Task.DESCRIPTION + ")";
                        }
                        else
                        {
                            lnk.Text = item.Title;
                        }

                        INCIDENT incident = (INCIDENT)item.Detail;
                        QI_OCCUR qiIssue  = (QI_OCCUR)item.Reference;
                        lnk.CommandArgument = item.RecordKey;
                        lbl          = (Label)e.Item.FindControl("lblDueDate");
                        lbl.Text     = SQMBasePage.FormatDate((DateTime)item.Task.DUE_DT, "d", false);
                        img          = (Image)e.Item.FindControl("imgTaskStatus");
                        img.ImageUrl = TaskMgr.TaskStatusImage(item.Taskstatus);
                        img.ToolTip  = item.Taskstatus.ToString();
                        QualityIncidentData issue = new QualityIncidentData();
                        issue.Incident         = incident;
                        issue.QIIssue          = qiIssue;
                        issue.Plant            = item.Plant;
                        issue.PlantResponsible = item.PlantResponsible;
                        issue.Person           = item.Person;
                        issue.Part             = item.Part;
                        List <QualityIncidentData> incidentList = new List <QualityIncidentData>();
                        ucl = (Ucl_IncidentList)e.Item.FindControl("uclIssueList");
                        ucl.LinksDisabled = true;
                        ucl.BindQualityIncidentHeader(issue, true);
                        break;

                    case TaskRecordType.ProblemCase:        // 8D problem case
                        lnk      = (LinkButton)e.Item.FindControl("lnkTask");
                        lnk.Text = item.Title;
                        PROB_CASE probCase = (PROB_CASE)item.Detail;
                        lnk.CommandArgument = item.RecordKey;
                        lbl          = (Label)e.Item.FindControl("lblDueDate");
                        lbl.Text     = SQMBasePage.FormatDate((DateTime)item.Task.DUE_DT, "d", false);
                        img          = (Image)e.Item.FindControl("imgTaskStatus");
                        img.ImageUrl = TaskMgr.TaskStatusImage(item.Taskstatus);
                        img.ToolTip  = item.Taskstatus.ToString();
                        ProblemCase theCase = new ProblemCase();
                        theCase.ProbCase = probCase;
                        theCase.SetAliasID();
                        ucl = (Ucl_IncidentList)e.Item.FindControl("uclIssueList");
                        ucl.LinksDisabled = true;
                        ucl.BindProblemCaseHeader(theCase, item);
                        break;

                    case TaskRecordType.ProfileInput:         // Profile inputs
                    case TaskRecordType.ProfileInputApproval: // approval
                    case TaskRecordType.ProfileInputFinalize: // finalize
                        lnk                 = (LinkButton)e.Item.FindControl("lnkTask");
                        lnk.Text            = item.Title;
                        lnk.CommandArgument = item.RecordKey;
                        lbl                 = (Label)e.Item.FindControl("lblDueDate");
                        lbl.Text            = SQMBasePage.FormatDate((DateTime)item.Task.DUE_DT, "d", false);
                        img                 = (Image)e.Item.FindControl("imgTaskStatus");
                        img.ImageUrl        = TaskMgr.TaskStatusImage(item.Taskstatus);
                        img.ToolTip         = item.Taskstatus.ToString();
                        ecl                 = (Ucl_EHSList)e.Item.FindControl("uclEHSPeriod");
                        ecl.BindProfilePeriodHdr(item);
                        break;

                    case TaskRecordType.HealthSafetyIncident:        // Health & safety incidents
                        lnk                 = (LinkButton)e.Item.FindControl("lnkTask");
                        lnk.Text            = item.Title;
                        lnk.CommandArgument = item.RecordKey;
                        lbl                 = (Label)e.Item.FindControl("lblDueDate");
                        lbl.Text            = SQMBasePage.FormatDate((DateTime)item.Task.DUE_DT, "d", false);
                        img                 = (Image)e.Item.FindControl("imgTaskStatus");
                        img.ImageUrl        = TaskMgr.TaskStatusImage(item.Taskstatus);
                        img.ToolTip         = item.Taskstatus.ToString();
                        INCIDENT EHSIncident = (INCIDENT)item.Detail;
                        ucl = (Ucl_IncidentList)e.Item.FindControl("uclIssueList");
                        ucl.LinksDisabled = true;
                        ucl.BindIncidentListHeader(EHSIncident, item);
                        break;

                    case TaskRecordType.PreventativeAction:       // preventative action
                        lnk                 = (LinkButton)e.Item.FindControl("lnkTask");
                        lnk.Text            = item.Title;
                        lnk.CommandArgument = item.RecordKey;
                        lbl                 = (Label)e.Item.FindControl("lblDueDate");
                        lbl.Text            = SQMBasePage.FormatDate((DateTime)item.Task.DUE_DT, "d", false);
                        img                 = (Image)e.Item.FindControl("imgTaskStatus");
                        img.ImageUrl        = TaskMgr.TaskStatusImage(item.Taskstatus);
                        img.ToolTip         = item.Taskstatus.ToString();
                        INCIDENT EHSAction = (INCIDENT)item.Detail;
                        ucl = (Ucl_IncidentList)e.Item.FindControl("uclIssueList");
                        ucl.LinksDisabled = true;
                        ucl.BindIncidentListHeader(EHSAction, item);
                        break;

                    default:
                        break;
                    }

                    if (item.Taskstatus == TaskStatus.EscalationLevel1 || item.Taskstatus == TaskStatus.EscalationLevel2)
                    {
                        if (UserContext.RoleAccess() < AccessMode.Admin)
                        {
                            lnk         = (LinkButton)e.Item.FindControl("lnkTask");
                            lbl         = (Label)e.Item.FindControl("lblTask");
                            lbl.Text    = lnk.Text;
                            lnk.Visible = false;
                            lbl.Visible = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
        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);
                }
            }
        }
        public void gvInputsList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                Label    lbl;
                DateTime dt;
                UOM      uom = null;

                try
                {
                    HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfPRMRID");
                    lbl = (Label)e.Row.Cells[0].FindControl("lblMetricName");

                    EHS_PROFILE_MEASURE measure = currentProfile.Profile.EHS_PROFILE_MEASURE.Where(l => l.PRMR_ID == Convert.ToDecimal(hf.Value)).FirstOrDefault();
                    lbl.Text = measure.EHS_MEASURE.MEASURE_NAME.Trim();
                    lbl      = (Label)e.Row.Cells[0].FindControl("lblMetricCode");
                    lbl.Text = measure.EHS_MEASURE.MEASURE_CD;

                    if ((bool)measure.IS_REQUIRED)
                    {
                        e.Row.Cells[1].Attributes.Add("Class", "required");
                    }

                    hf = (HiddenField)e.Row.Cells[0].FindControl("hfStatus");
                    if (hf.Value == "D")
                    {
                        Image img = (Image)e.Row.Cells[0].FindControl("imgStatus");
                        img.ImageUrl = "~/images/defaulticon/16x16/delete.png";
                        img.Visible  = true;
                    }

                    if (measure.EHS_MEASURE.MEASURE_CATEGORY == "ENGY" || measure.EHS_MEASURE.MEASURE_CATEGORY == "EUTL")
                    {
                        e.Row.Cells[0].Attributes.Add("Class", "textStd energyColor");
                    }
                    else if (measure.EHS_MEASURE.MEASURE_CATEGORY == "PROD" || measure.EHS_MEASURE.MEASURE_CATEGORY == "SAFE")
                    {
                        ;
                    }
                    else
                    {
                        e.Row.Cells[0].Attributes.Add("Class", "textStd wasteColor");
                    }

                    lbl = (Label)e.Row.Cells[0].FindControl("lblInvoiceDateFrom");
                    if (!string.IsNullOrEmpty(lbl.Text))
                    {
                        dt       = Convert.ToDateTime(lbl.Text);
                        lbl.Text = SQMBasePage.FormatDate(dt, "d", false);
                    }
                    lbl = (Label)e.Row.Cells[0].FindControl("lblInvoiceDateTo");
                    if (!string.IsNullOrEmpty(lbl.Text))
                    {
                        dt       = Convert.ToDateTime(lbl.Text);
                        lbl.Text = SQMBasePage.FormatDate(dt, "d", false);
                    }

                    lbl = (Label)e.Row.Cells[0].FindControl("lblValue");
                    if (!string.IsNullOrEmpty(lbl.Text))
                    {
                        decimal val;
                        if (Decimal.TryParse(lbl.Text, out val))
                        {
                            lbl.Text = SQMBasePage.FormatValue(val, 2);
                        }
                    }

                    lbl = (Label)e.Row.Cells[0].FindControl("lblCost");
                    if (!string.IsNullOrEmpty(lbl.Text))
                    {
                        decimal val;
                        if (Decimal.TryParse(lbl.Text, out val))
                        {
                            if (val < 0)
                            {
                                lbl.Text = "";
                                lbl      = (Label)e.Row.Cells[0].FindControl("lblCredit");
                            }
                            lbl.Text = SQMBasePage.FormatValue(val, 2);
                        }
                    }

                    lbl = (Label)e.Row.Cells[0].FindControl("lblValueUOM");
                    uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == Convert.ToDecimal(lbl.Text));
                    if (uom != null)
                    {
                        lbl.Text = uom.UOM_CD;
                    }
                }
                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;
        }