Example #1
0
        private void uclSearchBar_OnSearchClick()
        {
            decimal caseID = 0;

            pnlSearchList.Visible = true;
            divPageBody.Visible   = divNavArea.Visible = false;

            if (CaseCtl().Context == "EHS")
            {
                uclCaseList.LinksDisabled = UserContext.CheckAccess("EHS", "321") < AccessMode.Update ? true : false;
            }
            else
            {
                uclCaseList.LinksDisabled      = UserContext.CheckAccess("SQM", "221") < AccessMode.Update ? true : false;
                uclSearchBar.NewButton.Visible = true;
            }

            string[]  plantArray = ddlPlantSelect.Items.Where(i => i.Checked == true).Select(i => i.Value).ToArray();
            decimal[] plantIDS   = Array.ConvertAll(plantArray, new Converter <string, decimal>(decimal.Parse));

            CaseCtl().CaseList = ProblemCase.SelectProblemCaseList(SessionManager.PrimaryCompany().COMPANY_ID, CaseCtl().Context, ddlStatusSelect.SelectedValue);
            uclCaseList.BindProblemCaseListRepeater(ProblemCase.QualifyCaseList(CaseCtl().CaseList, plantIDS).OrderByDescending(l => l.ProbCase.CREATE_DT).ToList(), CaseCtl().Context);

            uclSearchBar.ReturnButton.Visible = false;
        }
 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;
             }
         }
     }
 }
Example #3
0
        public static List <PROB_CASE> SelectUserCaseList(List <PROB_CASE> problemCaseList)
        {
            var userCaseList = new List <PROB_CASE>();

            using (PSsqmEntities entities = new PSsqmEntities())
            {
                try
                {
                    foreach (PROB_CASE probCase in problemCaseList)
                    {
                        List <INCIDENT> incidentList = ProblemCase.LookupProbIncidentList(entities, probCase);
                        foreach (INCIDENT incident in incidentList)
                        {
                            if (SessionManager.PlantAccess((decimal)incident.DETECT_PLANT_ID) || (incident.RESP_PLANT_ID.HasValue && SessionManager.PlantAccess((decimal)incident.RESP_PLANT_ID)))
                            {
                                userCaseList.Add(probCase);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    //  SQMLogger.LogException(ex);
                }
            }

            return(userCaseList);
        }
        public void BindProblemCaseHeader(ProblemCase problemCase, TaskItem taskItem)
        {
            pnlIncidentTaskHdr.Visible     = true;
            lblIncidentDescription.Visible = lblActionDescription.Visible = false;
            lblCaseDescription.Visible     = true;

            if (taskItem.Plant != null)
            {
                lblCasePlant_out.Text = taskItem.Plant.PLANT_NAME;
            }
            lblResponsible_out.Text = SQMModelMgr.FormatPersonListItem(taskItem.Person);
            lblCase2ID_out.Text     = problemCase.CaseID;
            lblCase2Desc_out.Text   = problemCase.ProbCase.DESC_SHORT;
        }
 protected void lnkProblemCaseRedirect(Object sender, EventArgs e)
 {
     try
     {
         LinkButton lnk      = (LinkButton)sender;
         PROB_CASE  probCase = ProblemCase.LookupCaseByIncident(Convert.ToDecimal(lnk.CommandArgument));
         if (probCase != null)
         {
             SessionManager.ReturnObject = probCase.PROBCASE_ID;
             SessionManager.ReturnStatus = true;
             Response.Redirect("/Problem/Problem_Case.aspx?c=EHS");
         }
     }
     catch {; }
 }
Example #6
0
        private void uclCaseDelete(string cmdArg)
        {
            int status = ProblemCase.DeleteProblemCase(CaseCtl().problemCase.ProbCase.PROBCASE_ID);

            if (status == 0)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveError');", true);
            }
            else
            {
                CaseCtl().Clear();
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true);
            }

            uclSearchBar_OnSearchClick();
        }
Example #7
0
        private void SetupPage()
        {
            if (langList == null || langList.Count == 0)
            {
                langList = SQMModelMgr.SelectLanguageList(new PSsqmEntities(), true);
                uclPrefsEdit.SetLanguageList(langList);
            }

            BusinessLocation businessLocation = new BusinessLocation(); businessLocation = SessionManager.UserContext.HRLocation;

            uclPrefsEdit.BindUser(null, SessionManager.UserContext.HRLocation, SessionManager.UserContext.WorkingLocation);

            if (UserContext.CheckAccess("CQM", "home", "92") == AccessMode.None)
            {
                uclPrefsEdit.DelegateList.Attributes.Add("disabled", "true");
            }

            // quality tasks
            if (uclTaskList.TaskListRepeater.Items.Count < 1)
            {
                bool            hasDelegates;
                List <TaskItem> taskList = new List <TaskItem>();
                // taskList = QualityIssue.IncidentTaskList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, SessionManager.UserContext.Person.PERSON_ID, false, out hasDelegates);

                // EHS inputs
                if (UserContext.CheckAccess("EHS", "input", "301") > AccessMode.View)
                {
                    if (respForList == null || respForList.Count == 0)
                    {
                        respForList = SQMModelMgr.SelectDelegateList(SessionManager.UserContext.Person.PERSON_ID);
                        respForList.Insert(0, SessionManager.UserContext.Person);
                    }
                    decimal[] pids = respForList.Select(l => l.PERSON_ID).ToArray();
                    taskList.AddRange(EHSModel.ProfileTaskList(EHSModel.GetIncompleteInputs(pids, DateTime.Now.AddMonths(-12))));
                }
                // Problem cases
                if (UserContext.CheckAccess("CQM", "prob", "151") > AccessMode.View)
                {
                    taskList.AddRange(ProblemCase.CaseTaskList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, SessionManager.UserContext.Person.PERSON_ID, false, out hasDelegates));
                }

                // taskList = taskList.OrderBy(l => l.RecordType).ThenBy(l => l.RecordID).ToList();
                uclTaskList.BindTaskList(taskList);
            }
        }
Example #8
0
        public PROB_PREVENT CreateProblemPrevent(ProblemCase theCase)
        {
            this.ProbCase.PROB_PREVENT             = new PROB_PREVENT();
            this.ProbCase.PROB_PREVENT.PROBCASE_ID = this.ProbCase.PROBCASE_ID;
            TASK_STATUS task = theCase.TeamTask.TaskList.Where(l => l.TASK_STEP == "7" && l.TASK_TYPE == "C").FirstOrDefault();

            int itemseq = 0;

            foreach (PLANT plant in SQMModelMgr.SelectPlantList(theCase.Entities, theCase.ProbCase.COMPANY_ID, 0))
            {
                PROB_PREVENT_LIST item = new PROB_PREVENT_LIST();
                item.PROBCASE_ID       = theCase.ProbCase.PROBCASE_ID;
                item.PREVENT_ITEM      = ++itemseq;
                item.PREVENT_ITEM_TYPE = "L";
                item.PREVENT_ITEM_REF  = plant.PLANT_ID;
                if (task != null && task.DUE_DT.HasValue)
                {
                    item.TARGET_DT = task.DUE_DT;
                }
                else
                {
                    item.TARGET_DT = DateTime.Now.AddDays(10);
                }
                this.ProbCase.PROB_PREVENT_LIST.Add(item);
            }

            PROB_PREVENT_LIST docitem = new PROB_PREVENT_LIST();

            docitem.PROBCASE_ID       = theCase.ProbCase.PROBCASE_ID;
            docitem.PREVENT_ITEM_TYPE = "D";
            docitem.PREVENT_ITEM      = 1;
            if (task != null && task.DUE_DT.HasValue)
            {
                docitem.TARGET_DT = task.DUE_DT;
            }
            else
            {
                docitem.TARGET_DT = DateTime.Now.AddDays(10);
            }
            this.ProbCase.PROB_PREVENT_LIST.Add(docitem);

            return(this.ProbCase.PROB_PREVENT);
        }
Example #9
0
        // Needed to move javascript to parent page - problem with ajax panel?
        //protected override void OnPreRender(EventArgs e)
        //{
        //	//Page.ClientScript.RegisterClientScriptInclude("PreventionLocation", this.ResolveClientUrl("~/scripts/prevention_location.js"));
        //	base.OnPreRender(e);
        //}


        public void BuildCaseComboBox()
        {
            PSsqmEntities entities = new PSsqmEntities();

            if (rcbCases.Items.Count == 0)
            {
                List <PROB_CASE> caseList     = ProblemCase.SelectProblemCaseList(SessionManager.PrimaryCompany().COMPANY_ID, "EHS", "A");
                List <PROB_CASE> userCaseList = ProblemCase.SelectUserCaseList(caseList);

                var userCaseListSorted = userCaseList.OrderByDescending(x => x.PROBCASE_ID);

                rcbCases.Items.Clear();
                rcbCases.Items.Add(new Telerik.Web.UI.RadComboBoxItem("[Select a Problem Case]", ""));
                foreach (PROB_CASE c in userCaseListSorted)
                {
                    var    incidentId = (from po in entities.PROB_OCCUR where po.PROBCASE_ID == c.PROBCASE_ID select po.INCIDENT_ID).FirstOrDefault();
                    string descriptor = string.Format("{0:000000} - {1} ({2})", incidentId, c.DESC_SHORT, ((DateTime)c.CREATE_DT).ToShortDateString());
                    rcbCases.Items.Add(new Telerik.Web.UI.RadComboBoxItem(descriptor, c.PROBCASE_ID.ToString()));
                }
            }
        }
Example #10
0
        public static List <ProblemCase> QualifyCaseList(List <PROB_CASE> problemCaseList, decimal[] plantIDS)
        {
            var   qualCaseList = new List <ProblemCase>();
            PLANT plant        = null;

            using (PSsqmEntities entities = new PSsqmEntities())
            {
                try
                {
                    foreach (PROB_CASE probCase in problemCaseList)
                    {
                        INCIDENT incident = ProblemCase.LookupProbIncidentList(entities, probCase).FirstOrDefault();
                        if (incident != null && ((incident.DETECT_PLANT_ID.HasValue && plantIDS.Contains((decimal)incident.DETECT_PLANT_ID)) || (incident.RESP_PLANT_ID.HasValue && plantIDS.Contains((decimal)incident.RESP_PLANT_ID))))
                        {
                            if (plant == null || plant.PLANT_ID != incident.DETECT_PLANT_ID)
                            {
                                plant = SQMModelMgr.LookupPlant((decimal)incident.DETECT_PLANT_ID);
                            }
                            ProblemCase problemCase = new ProblemCase();
                            problemCase.IncidentList = new List <INCIDENT>();
                            problemCase.ProbCase     = probCase;
                            problemCase.IncidentList.Add(incident);
                            problemCase.Plant = plant;
                            if (incident.INCIDENT_TYPE == "QI")
                            {
                                ;  // todo get qi_occur and part number
                            }
                            qualCaseList.Add(problemCase);
                        }
                    }
                }
                catch (Exception ex)
                {
                    //  SQMLogger.LogException(ex);
                }
            }

            return(qualCaseList);
        }
Example #11
0
        private static System.Data.EntityState CaseState(ProblemCase theCase)
        {
            // check if any parts of the case have changed.  do this to ensure we update the case0 record time stamp when children are updated
            System.Data.EntityState theState = theCase.ProbCase.EntityState;

            if (theCase.ProbCase.EntityState != System.Data.EntityState.Unchanged)
            {
                return(theState);
            }
            if (theCase.ProbCase.PROB_DEFINE != null && theCase.ProbCase.PROB_DEFINE.EntityState != System.Data.EntityState.Unchanged)
            {
                theState = theCase.ProbCase.PROB_DEFINE.EntityState;
            }
            if (theCase.ProbCase.PROB_CONTAIN != null && theCase.ProbCase.PROB_CONTAIN.EntityState != System.Data.EntityState.Unchanged)
            {
                theState = theCase.ProbCase.PROB_CONTAIN.EntityState;
            }
            if (theCase.ProbCase.PROB_CAUSE != null && theCase.ProbCase.PROB_CAUSE.EntityState != System.Data.EntityState.Unchanged)
            {
                theState = theCase.ProbCase.PROB_CAUSE.EntityState;
            }
            if (theCase.ProbCase.PROB_CAUSE_ACTION != null && theCase.ProbCase.PROB_CAUSE_ACTION.Count > 0)
            {
                foreach (PROB_CAUSE_ACTION action in theCase.ProbCase.PROB_CAUSE_ACTION)
                {
                    if (action.EntityState != System.Data.EntityState.Unchanged)
                    {
                        return(action.EntityState);
                    }
                }
            }
            if (theCase.ProbCase.PROB_VERIFY != null && theCase.ProbCase.PROB_VERIFY.EntityState != System.Data.EntityState.Unchanged)
            {
                theState = theCase.ProbCase.PROB_VERIFY.EntityState;
            }

            return(theState);
        }
        public static int DeleteIncident(decimal incidentId)
        {
            int    status = 0;
            string delCmd = " IN (" + incidentId + ") ";

            using (PSsqmEntities ctx = new PSsqmEntities())
            {
                try
                {
                    decimal probCaseId = (from po in ctx.PROB_OCCUR where po.INCIDENT_ID == incidentId select po.PROBCASE_ID).FirstOrDefault();

                    if (probCaseId > 0)
                    {
                        status = ProblemCase.DeleteProblemCase(probCaseId);
                    }

                    List <decimal> attachmentIds = (from a in ctx.ATTACHMENT where a.RECORD_TYPE == 40 && a.RECORD_ID == incidentId
                                                    select a.ATTACHMENT_ID).ToList();

                    if (attachmentIds != null && attachmentIds.Count > 0)
                    {
                        status = ctx.ExecuteStoreCommand("DELETE FROM ATTACHMENT_FILE WHERE ATTACHMENT_ID IN (" + String.Join(",", attachmentIds) + ")");
                        status = ctx.ExecuteStoreCommand("DELETE FROM ATTACHMENT WHERE ATTACHMENT_ID IN (" + String.Join(",", attachmentIds) + ")");
                    }

                    status = ctx.ExecuteStoreCommand("DELETE FROM PROB_OCCUR WHERE INCIDENT_ID" + delCmd);
                    status = ctx.ExecuteStoreCommand("DELETE FROM INCIDENT_ANSWER WHERE INCIDENT_ID" + delCmd);
                    status = ctx.ExecuteStoreCommand("DELETE FROM INCIDENT WHERE INCIDENT_ID" + delCmd);
                }
                catch (Exception ex)
                {
                    SQMLogger.LogException(ex);
                }
            }

            return(status);
        }
Example #13
0
        public static ProblemCase UpdateProblemCase(ProblemCase theCase)
        {
            ProblemCase retCase = null;

            try
            {
                theCase.ProbCase = (PROB_CASE)SQMModelMgr.SetObjectTimestamp((object)theCase.ProbCase, SessionManager.UserContext.UserName(), CaseState(theCase));
                if (theCase.ProbCase.EntityState == System.Data.EntityState.Added || theCase.ProbCase.EntityState == System.Data.EntityState.Detached)
                {
                    theCase.Entities.AddToPROB_CASE(theCase.ProbCase);
                }
                if (!string.IsNullOrEmpty(theCase.StepComplete))
                {
                    theCase.TeamTask.SetTaskComplete(theCase.StepComplete, "C", 0, true);
                    if (theCase.StepComplete == "8" && theCase.ProbCase.CLOSE_DT.HasValue == false)
                    {
                        DateTime closeDate = DateTime.UtcNow;
                        theCase.ProbCase.PROB_CLOSE.NOTIFY_DT = theCase.ProbCase.CLOSE_DT = closeDate;
                        theCase.ProbCase.PROB_CLOSE.STATUS    = "C";
                        foreach (PROB_OCCUR occur in theCase.ProbCase.PROB_OCCUR)
                        {
                            theCase.Entities.ExecuteStoreCommand("UPDATE INCIDENT SET CLOSE_DATE_8D = {0} WHERE INCIDENT_ID = " + occur.INCIDENT_ID, closeDate);
                        }
                    }
                }
                int progress;

                if (theCase.ProbCase.PROB_CONTAIN != null)
                {
                    for (int n = 0; n < theCase.ProbCase.PROB_CONTAIN.PROB_CONTAIN_ACTION.Count; n++)
                    {
                        PROB_CONTAIN_ACTION contain = theCase.ProbCase.PROB_CONTAIN.PROB_CONTAIN_ACTION.ElementAt(n);
                        if (contain.STATUS == "D")
                        {
                            theCase.Entities.DeleteObject(contain);
                        }
                    }
                }
                if (theCase.ProbCase.PROB_CAUSE_ACTION != null)
                {
                    for (int n = 0; n < theCase.ProbCase.PROB_CAUSE_ACTION.Count; n++)
                    {
                        PROB_CAUSE_ACTION action = theCase.ProbCase.PROB_CAUSE_ACTION.ElementAt(n);
                        if (action.STATUS == "D")
                        {
                            theCase.Entities.DeleteObject(action);
                        }
                    }
                }
                if (theCase.ProbCase.PROB_PREVENT != null)
                {
                    for (int n = 0; n < theCase.ProbCase.PROB_PREVENT_LIST.Count; n++)
                    {
                        PROB_PREVENT_LIST prevent = theCase.ProbCase.PROB_PREVENT_LIST.ElementAt(n);
                        if (prevent.CONFIRM_STATUS == "D")
                        {
                            theCase.Entities.DeleteObject(prevent);
                        }
                    }
                }

                theCase.ProbCase.PROGRESS = theCase.CheckCaseStatus(); // theCase.CheckCaseNextStep();

                theCase.Entities.SaveChanges();

                if (theCase.IsNew)
                {
                    if (SessionManager.DocumentContext == null)
                    {
                        SessionManager.DocumentContext = new SQM.Shared.DocumentScope().CreateNew(SessionManager.UserContext.WorkingLocation.Company.COMPANY_ID, "BLI", 0, "", SessionManager.UserContext.WorkingLocation.Plant.PLANT_ID, "", 0);
                    }
                    SQM.Website.Classes.SQMDocumentMgr.UpdateAttachmentRecordID(theCase.Entities, 21, SessionManager.DocumentContext.SessionID, theCase.ProbCase.PROBCASE_ID);
                }

                theCase.TeamTask.UpdateTaskList(theCase.ProbCase.PROBCASE_ID);

                theCase.UpdateStatus = CaseUpdateStatus.Success;
                retCase              = theCase;
                retCase.IsNew        = false;
                theCase.StepComplete = "";
            }
            catch (Exception e)
            {
                theCase.UpdateStatus = CaseUpdateStatus.SaveError;
                retCase = theCase;
                // SQMLogger.LogException(e);
            }
            return(retCase);
        }
        void PopulateByProblemCaseId(decimal problemCaseId)
        {
            PROB_CASE probCase = ProblemCase.LookupCase(entities, problemCaseId);

            if (probCase != null)
            {
                List <INCIDENT> incidentList = ProblemCase.LookupProbIncidentList(entities, probCase);

                ltrDate.Text = probCase.CREATE_DT.ToString();
                if (incidentList.Count > 0)
                {
                    var incident = incidentList[0];

                    string plantName = EHSIncidentMgr.SelectPlantNameById((decimal)incident.DETECT_PLANT_ID);
                    lblPlantName.Text  = String.Format("Location: {0}", plantName);
                    lblIncidentId.Text = String.Format("Incident ID: {0}", incident.INCIDENT_ID);
                    //lblCaseId.Text = String.Format("Problem Case ID: {0}", probCase.PROBCASE_ID);

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

                    // Date/Time

                    ltrDate.Text = incidentList[0].INCIDENT_DT.ToLongDateString();

                    var timeQuestion = questions.FirstOrDefault(q => q.QuestionId == 5);
                    if (timeQuestion != null)
                    {
                        string timeAnswer = (from a in entities.INCIDENT_ANSWER
                                             where
                                             a.INCIDENT_ID == incident.INCIDENT_ID &&
                                             a.INCIDENT_QUESTION_ID == 5
                                             select a.ANSWER_VALUE).FirstOrDefault();

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

                    // Incident Type

                    ltrIncidentType.Text = incidentType;

                    // Description

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


                    // Root Cause(s)

                    List <PROB_CAUSE_STEP> probCauses = (from i in entities.PROB_CAUSE_STEP
                                                         where
                                                         i.PROBCASE_ID == problemCaseId &&
                                                         i.IS_ROOTCAUSE == true
                                                         select i).ToList();
                    if (probCauses.Count > 0)
                    {
                        ltrRootCause.Text = "<ul>";
                        foreach (var pc in probCauses)
                        {
                            ltrRootCause.Text += "<li>" + Server.HtmlEncode(pc.WHY_OCCUR) + "</li>";
                        }
                        ltrRootCause.Text += "</ul>";
                    }

                    // Containment

                    var containment = (from i in entities.PROB_CONTAIN
                                       where
                                       i.PROBCASE_ID == problemCaseId
                                       select new
                    {
                        Disposition = i.INITIAL_DISPOSITION,
                        Action = i.INITIAL_ACTION,
                        Results = i.INITIAL_RESULTS
                    }).FirstOrDefault();

                    if (containment != null)
                    {
                        ltrContainment.Text = "<ul><li>Initial Disposition: " + Server.HtmlEncode(containment.Disposition) + "</li>" +
                                              "<li>Action: " + Server.HtmlEncode(containment.Action) + "</li>" +
                                              "<li>Results: " + Server.HtmlEncode(containment.Results) + "</li>" +
                                              "</ul>";
                    }

                    // Corrective Actions

                    var correctiveActions = (from i in entities.PROB_CAUSE_ACTION
                                             where
                                             i.PROBCASE_ID == problemCaseId
                                             select i.ACTION_DESC).ToList();
                    if (correctiveActions.Count > 0)
                    {
                        ltrCorrectiveActions.Text = "<ul>";
                        foreach (var caDesc in correctiveActions)
                        {
                            ltrCorrectiveActions.Text += "<li>" + Server.HtmlEncode(caDesc) + "</li>";
                        }
                        ltrCorrectiveActions.Text += "</ul>";
                    }

                    // Photos

                    BindAttachmentsProbCase(incident.INCIDENT_ID, probCase.PROBCASE_ID);
                }
                else
                {
                    pnlContent.Visible = false;
                    pnlError.Visible   = true;
                }
            }
        }
        protected void rgCaseList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridHeaderItem)
            {
                GridHeaderItem gh = e.Item as GridHeaderItem;
                if (staticAppContext == "QI")
                {
                    //gh.Cells[4].Text = "";
                    //gh.Cells[4].Visible = false;
                    ;
                }
                else
                {
                    ;
                }
            }

            if (e.Item is GridDataItem)
            {
                try
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    HiddenField  hf   = (HiddenField)item["Reports"].FindControl("hfProblemCaseType");

                    LinkButton lbReportQi  = (LinkButton)item["Reports"].FindControl("lbReport");
                    HyperLink  hlReportEhs = (HyperLink)item["Reports"].FindControl("hlReport");

                    lbReportQi.Attributes.Add("CaseType", hf.Value);

                    //lbReportQi.Visible = (hf.Value != "EHS");
                    lbReportQi.Visible  = true;
                    hlReportEhs.Visible = (hf.Value == "EHS");

                    ProblemCase probCase = (ProblemCase)e.Item.DataItem;

                    Label lbl = (Label)e.Item.FindControl("lblCaseID");
                    lbl.Text = WebSiteCommon.FormatID(probCase.ProbCase.PROBCASE_ID, 6);
                    LinkButton lnk = (LinkButton)e.Item.FindControl("lbCaseId");

                    lbl = (Label)e.Item.FindControl("lblIncidentID");
                    if (probCase.IncidentList != null && probCase.IncidentList.Count > 0)
                    {
                        lbl.Text = WebSiteCommon.FormatID(probCase.IncidentList[0].INCIDENT_ID, 6);
                    }

                    lbl = (Label)e.Item.FindControl("lblStatus");
                    if (probCase.ProbCase.CLOSE_DT.HasValue)
                    {
                        lbl.Text = WebSiteCommon.GetXlatValue("recordStatus", "C") + ": " + SQMBasePage.FormatDate((DateTime)probCase.ProbCase.CLOSE_DT, "d", false);
                    }
                    else
                    {
                        lbl.Text = WebSiteCommon.GetXlatValue("caseStep", (Math.Max((decimal)probCase.ProbCase.PROGRESS, 1) - 1).ToString());
                        hf       = (HiddenField)e.Item.FindControl("hfStatus");
                        if (hf.Value == "I")
                        {
                            Image img = (Image)e.Item.FindControl("imgStatus");
                            img.ImageUrl = "/images/defaulticon/16x16/no.png";
                            img.Visible  = true;
                        }
                    }
                }
                catch
                {
                }
            }
        }
Example #16
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)
                {
                }
            }
        }
Example #17
0
 public ProblemCase Update()
 {
     this.problemCase = ProblemCase.UpdateProblemCase(this.problemCase);
     return(this.problemCase);
 }