Esempio n. 1
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
         if (ucl != null)
         {
             ucl.BindDocumentSelect("EHS", 2, true, true, "");
         }
         SetupPage();
     }
     else
     {
         if (!string.IsNullOrEmpty(hfViewOption.Value))
         {
             try
             {
                 decimal viewID = Convert.ToDecimal(hfViewOption.Value);
                 if (viewID > 5)
                 {
                     lnkOpt_Click(viewID, null);
                 }
             }
             catch
             {
                 ;
             }
         }
         DisplayOptions();
     }
 }
Esempio n. 2
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SYS", 10, true, false, hfDocviewMessage.Value);
                    //ucl.BindDocumentSelect("EHS", 2, true, false, hfDocviewMessage.Value);
                }

                SetupPage();
                DisplayCalendar(SessionManager.UserContext.LocalTime);

                if (!string.IsNullOrEmpty(Request.QueryString["v"]))                   // initial view override
                {
                    string viewOption = Request.QueryString["v"];
                    switch (viewOption.ToUpper())
                    {
                    case "T":
                        btnChangeView_Click(btnTaskView, null);
                        break;

                    case "E":
                        btnChangeView_Click(btnEscalateView, null);
                        break;

                    default:
                        btnChangeView_Click(btnCalendarView, null);
                        break;
                    }
                }
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SQM", 2, true, true, "");
                }

                if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is QI_OCCUR)
                {
                    // from inbox
                    isDirected = true;
                    OnIssue_Click(((QI_OCCUR)SessionManager.ReturnObject).INCIDENT_ID);
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                if (SessionManager.ReturnObject != null)
                {
                    if (SessionManager.ReturnObject == "DisplayIssues")
                    {
                        SearchList("");
                        SessionManager.ClearReturns();
                    }
                    else if (SessionManager.ReturnObject == "DisplayReceipts")
                    {
                        SearchReceipts("");
                        SessionManager.ClearReturns();
                    }
                }
            }
        }
        protected void DisplayNonPostback()
        {
            SetupPage();
            SessionManager.ClearReturns();

            try
            {
                RadPersistenceManager1.StorageProviderKey = SessionManager.UserContext.Person.PERSON_ID.ToString();
                RadPersistenceManager1.LoadState();
            }
            catch
            {
            }

            //if (SessionManager.ReturnStatus == null  ||  SessionManager.ReturnStatus != true)
            //if ( SessionManager.ReturnObject == null)
            SearchIncidents();                          // suppress list when invoking page from inbox

            Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");

            if (ucl != null)
            {
                ucl.BindDocumentSelect("EHS", 2, true, true, "");
            }
        }
Esempio n. 5
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
         if (ucl != null)
         {
             ucl.BindDocumentSelect("SYS", 10, true, false, hfDocviewMessage.Value);
         }
     }
 }
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
         if (ucl != null)
         {
             ucl.BindDocumentSelect("EHS", 2, true, true, "");
         }
     }
 }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SQM", 2, true, true, "");
                }

                uclSearchBar.PageTitle.Text = lblCRTitle.Text;
                SetupPage();
                // from quality incident entry page
                if ((bool)SessionManager.ReturnStatus)
                {
                    if (SessionManager.ReturnObject.GetType().ToString().ToUpper().Contains("QI_OCCUR"))
                    {
                        QI_OCCUR qiIssue = (QI_OCCUR)SessionManager.ReturnObject;

                        OnNewClick();
                        costReport.CostReport.COST_REPORT_DESC = qiIssue.INCIDENT.DESCRIPTION;
                        costReport.AddIncident(qiIssue.INCIDENT_ID);
                        uclIncidents.BindQualityIssueList(costReport.IncidentList, false);
                        DisplayReport();
                        BindIncident(qiIssue.INCIDENT_ID);
                        isAutoCreated = true;
                    }
                    SessionManager.ClearReturns();
                }
                else
                {
                    if (costReport == null)
                    {
                        OnListClick();
                    }
                }
            }
            else
            {
                // from incident popop selector
                if ((bool)SessionManager.ReturnStatus)
                {
                    if (SessionManager.ReturnObject.GetType().ToString().ToUpper().Contains("INCIDENT"))
                    {
                        List <INCIDENT> incidentList = (List <INCIDENT>)SessionManager.ReturnObject;
                        costReport.AddIncident(incidentList[0].INCIDENT_ID);
                        uclIncidents.BindQualityIssueList(costReport.IncidentList, false);
                        BindIncident(incidentList[0].INCIDENT_ID);
                    }
                    SessionManager.ClearReturns();
                }
            }
        }
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
         if (ucl != null)
         {
             ucl.BindDocumentSelect("SQM", 2, true, true, "");
         }
     }
     SessionManager.ClearReturns();  // clear any sesion objects from document upload popup
 }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                uclSearchBar.SetButtonsVisible(false, false, false, false, false, false);
                uclSearchBar.PageTitle.Text = lblTitle.Text;
                btnMetricSave.Enabled       = lnkMeasureAdd.Enabled = btnMetricCancel.Enabled = UserContext.CheckAccess("EHS", "311") >= AccessMode.Plant ? true : false;
            }
        }
Esempio n. 10
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                uclSearchBar.SetButtonsVisible(false, false, false, false, false, false);
                uclSearchBar.PageTitle.Text = lblTitle.Text;
                btnMetricSave.Enabled       = lnkMeasureAdd.Enabled = btnMetricCancel.Enabled = UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata);
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                uclIncidentForm.Mode = IncidentMode.Incident;

                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                try
                {
                    if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is INCIDENT)
                    {
                        INCIDENT incident = SessionManager.ReturnObject as INCIDENT;
                        string   context  = SessionManager.ReturnContext;
                        SessionManager.ClearReturns();
                        SessionManager.SetIncidentLocation((decimal)incident.DETECT_PLANT_ID);
                        if (incident.INCIDENT_ID > 0)
                        {
                            // edit existing incident
                            if (context == "a")
                            {
                                uclIncidentForm.BindIncidentAlert(incident.INCIDENT_ID);
                            }
                            else
                            {
                                uclIncidentForm.BindIncident(incident.INCIDENT_ID);
                            }
                        }
                        else
                        {
                            // create new
                            uclIncidentForm.InitNewIncident((decimal)incident.ISSUE_TYPE_ID, (decimal)incident.DETECT_PLANT_ID);
                        }

                        uclIncidentForm.Visible = true;
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 12
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                try
                {
                    if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is INCIDENT)
                    {
                        INCIDENT incident = SessionManager.ReturnObject as INCIDENT;
                        SessionManager.ClearReturns();
                        SessionManager.SetIncidentLocation((decimal)incident.DETECT_PLANT_ID);

                        if (incident.INCIDENT_ID > 0)
                        {
                            // edit existing incident
                            int    step           = 0;
                            string returnOverride = "";
                            if (!string.IsNullOrEmpty(Request.QueryString["s"]))                               // from inbox/calendar assume this is a task assignment. direct to corrective actions page
                            {
                                int.TryParse(Request.QueryString["s"], out step);
                                returnOverride = "/Home/Calendar.aspx";
                            }
                            uclActionForm.BindIncident(incident.INCIDENT_ID, step, returnOverride);
                        }
                        else
                        {
                            // create new
                            uclActionForm.InitNewIncident((decimal)incident.ISSUE_TYPE_ID, incident.ISSUE_TYPE, (decimal)incident.DETECT_PLANT_ID);
                        }

                        uclActionForm.Visible = true;
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 13
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SQM", 2, true, true, "");
                }

                RadComboBoxItem item;

                if (ddlSourceSelect.Items.Count == 5)
                {
                    List <BusinessLocation> supplierLocations = SQMModelMgr.SelectBusinessLocationList(SessionManager.PrimaryCompany().COMPANY_ID, 0, true, true, false);
                    supplierLocations.AddRange(SQMModelMgr.SelectBusinessLocationList(0, 0, true, false, false));
                    foreach (BusinessLocation supp in supplierLocations)
                    {
                        item = new RadComboBoxItem(supp.Plant.PLANT_NAME, supp.Plant.PLANT_ID.ToString());
                        if (supp.Address != null)
                        {
                            item.ToolTip = supp.Address.STREET1 + " " + supp.Address.CITY;
                        }

                        ddlSourceSelect.Items.Add(item);
                    }
                }
                if (ddlUsedSelect.Items.Count == 5)
                {
                    List <BusinessLocation> customerLocations = new List <BusinessLocation>(); // SQMModelMgr.SelectBusinessLocationList(SessionManager.PrimaryCompany().COMPANY_ID, 0, true, true);
                    customerLocations.AddRange(SQMModelMgr.SelectBusinessLocationList(0, 0, false, true, false).OrderBy(l => l.Plant.PLANT_NAME).ToList());
                    foreach (BusinessLocation cust in customerLocations.GroupBy(l => l.Plant.PLANT_ID).Select(l => l.FirstOrDefault()).ToList())
                    {
                        item = new RadComboBoxItem(cust.Plant.PLANT_NAME, cust.Plant.PLANT_ID.ToString());
                        if (cust.Address != null)
                        {
                            item.ToolTip = cust.Address.STREET1 + " " + cust.Address.CITY;
                        }

                        ddlUsedSelect.Items.Add(item);
                    }
                }
            }
        }
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (Page.IsPostBack)
     {
         if (SessionManager.ReturnObject != null && SessionManager.ReturnObject == "DisplayUsers")
         {
             ListUsers();
             SessionManager.ClearReturns();
         }
     }
     else
     {
         Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
         if (ucl != null)
         {
             ucl.BindDocumentSelect("SYS", 10, true, false, hfDocviewMessage.Value);
             //ucl.BindDocumentSelect("EHS", 2, true, false, hfDocviewMessage.Value);
         }
     }
 }
Esempio n. 15
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SQM", 10, true, true, hfDocviewMessage.Value);
                    ucl.BindDocumentSelect("EHS", 10, true, false, hfDocviewMessage.Value);
                }

                SetupPage();
                DisplayCalendar(DateTime.Now);
            }
            else
            {
                ;
            }

            pnlCalendar.Visible = true;
        }
Esempio n. 16
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SQM", 10, true, true, hfDocviewMessage.Value);
                    ucl.BindDocumentSelect("EHS", 10, true, false, hfDocviewMessage.Value);
                }

                if (SessionManager.ReturnObject is TASK_STATUS)
                {
                    TASK_STATUS task = SessionManager.ReturnObject as TASK_STATUS;
                    ReturnURL = SessionManager.ReturnPath;
                    SessionManager.ClearReturns();
                    if (task.TASK_STEP == ((int)SysPriv.action).ToString() || task.TASK_STEP == ((int)SysPriv.notify).ToString())
                    {
                        UpdateSelectedTask(task.TASK_ID);
                    }
                }
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("SYS", 10, true, false, hfDocviewMessage.Value);
                    //ucl.BindDocumentSelect("EHS", 2, true, false, hfDocviewMessage.Value);
                }

                COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);
                uclItemHdr.DisplayCompany(company);
                if (SessionManager.IsEffLocationPrimary())
                {
                    divNavArea.Visible = true;
                }
                else
                {
                    divNavArea.Visible = false;
                }

                if (ddlStatus.Items.Count == 0)
                {
                    List <Settings> status_codes = SQMSettings.Status;
                    ddlStatus.DataSource     = status_codes;
                    ddlStatus.DataTextField  = "short_desc";
                    ddlStatus.DataValueField = "code";
                    ddlStatus.DataBind();
                }

                if (string.IsNullOrEmpty(hfActiveTab.Value))
                {
                    tab_Click("lbCompanyDetail_tab", "");
                }
            }
        }
Esempio n. 18
0
        protected void DisplayNonPostback()
        {
            SetupPage();

            try
            {
                RadPersistenceManager1.LoadState();
            }
            catch
            {
            }

            if (SessionManager.ReturnStatus == null || SessionManager.ReturnStatus != true)
            {
                //if ( SessionManager.ReturnObject == null)
                SearchAudits();                      // suppress list when invoking page from inbox
            }
            Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");

            if (ucl != null)
            {
                ucl.BindDocumentSelect("EHS", 2, true, true, "");
            }
        }
Esempio n. 19
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            bool createAuditAccess = SessionManager.CheckUserPrivilege(SysPriv.config, SysScope.audit);

            if (rbNew.Visible)
            {
                rbNew.Visible = createAuditAccess;
            }


            if (IsPostBack)
            {
                if (!uclAuditScheduleDetail.IsEditContext)
                {
                    RadPersistenceManager1.StorageProviderKey = SessionManager.UserContext.Person.PERSON_ID.ToString();
                    RadPersistenceManager1.SaveState();
                }

                if (SessionManager.ReturnStatus == true)
                {
                    if (SessionManager.ReturnObject is string)
                    {
                        string type = SessionManager.ReturnObject as string;
                        switch (type)
                        {
                        case "DisplayAuditSchedules":
                            UpdateDisplayState(DisplayState.AuditScheduleList);
                            break;

                        case "Notification":
                            uclAuditScheduleDetail.EditAuditScheduleId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditScheduleEdit);
                            rbNew.Visible = false;
                            uclAuditScheduleDetail.EnableReturnButton(true);
                            break;

                        case "Closed":
                            uclAuditScheduleDetail.EditAuditScheduleId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditScheduleNew);
                            rbNew.Visible = false;
                            uclAuditScheduleDetail.EnableReturnButton(false);
                            break;
                        }
                    }
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string)
                {
                    try
                    {
                        // from inbox
                        DisplayNonPostback();
                        SessionManager.ReturnRecordID = Convert.ToDecimal(SessionManager.ReturnObject.ToString());
                        SessionManager.ReturnObject   = "Notification";
                        SessionManager.ReturnStatus   = true;

                        StringBuilder       sbScript = new StringBuilder();
                        ClientScriptManager cs       = Page.ClientScript;

                        sbScript.Append("<script language='JavaScript' type='text/javascript'>\n");
                        sbScript.Append("<!--\n");
                        sbScript.Append(cs.GetPostBackEventReference(this, "PBArg") + ";\n");
                        sbScript.Append("// -->\n");
                        sbScript.Append("</script>\n");

                        cs.RegisterStartupScript(this.GetType(), "AutoPostBackScript", sbScript.ToString());
                    }
                    catch
                    {
                        // not a number, parse as type
                        DisplayNonPostback();
                    }
                }
                else
                {
                    DisplayNonPostback();
                }
            }
        }
Esempio n. 20
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            bool createIncidentAccess = SessionManager.CheckUserPrivilege(SysPriv.originate, SysScope.prevent);              // allow prevaction create for oriinate or config privs

            createIncidentAccess = createIncidentAccess == false?SessionManager.CheckUserPrivilege(SysPriv.config, SysScope.prevent) : createIncidentAccess;

            rbNew.Visible = createIncidentAccess;

            if (IsPostBack)
            {
                RadPersistenceManager1.StorageProviderKey = SessionManager.UserContext.Person.PERSON_ID.ToString();
                RadPersistenceManager1.SaveState();

                if (SessionManager.ReturnStatus == true)
                {
                    if (SessionManager.ReturnObject is string)
                    {
                        string type = SessionManager.ReturnObject as string;
                        switch (type)
                        {
                        case "DisplayIncidents":
                            UpdateDisplayState(DisplayState.IncidentList, 0);
                            break;

                        default:
                            break;
                        }
                    }
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                if (!string.IsNullOrEmpty(Request.QueryString["r"]))                   // incident Record id is supplied from email notification
                {
                    string  targetRec = Request.QueryString["r"];
                    decimal targetRecID;
                    if (decimal.TryParse(targetRec, out targetRecID))
                    {
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                }
                else if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string)
                {
                    // from inbox ?
                    decimal targetRecID;
                    if (decimal.TryParse(SessionManager.ReturnObject.ToString(), out targetRecID))
                    {
                        SessionManager.ClearReturns();
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                }
                else
                {
                    DisplayNonPostback();
                }
            }
        }
Esempio n. 21
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            bool createAuditAccess = SessionManager.CheckUserPrivilege(SysPriv.config, SysScope.audit);

            rbNew.Visible = createAuditAccess;


            if (IsPostBack)
            {
                //if (!uclAuditForm.IsEditContext)
                RadPersistenceManager1.StorageProviderKey = SessionManager.UserContext.Person.PERSON_ID.ToString();
                RadPersistenceManager1.SaveState();

                if (SessionManager.ReturnStatus == true)
                {
                    if (SessionManager.ReturnObject is string)
                    {
                        string type = SessionManager.ReturnObject as string;
                        switch (type)
                        {
                        case "DisplayAudits":
                            UpdateDisplayState(DisplayState.AuditList);
                            break;

                        case "Notification":
                            //UpdateDisplayState(DisplayState.AuditNotificationEdit);
                            //UpdateDisplayState(DisplayState.AuditReportEdit);
                            uclAuditForm.EditAuditId = SessionManager.ReturnRecordID;
                            // need to determine if the Audit is past due and force it into display mode (probelm when coming from Calendar)
                            string auditStatus = EHSAuditMgr.SelectAuditStatus(SessionManager.ReturnRecordID);
                            if (auditStatus == "C")
                            {
                                UpdateDisplayState(DisplayState.AuditNotificationDisplay);
                            }
                            else
                            {
                                UpdateDisplayState(DisplayState.AuditNotificationEdit);
                            }
                            if (isDirected)
                            {
                                rbNew.Visible = false;
                                uclAuditForm.EnableReturnButton(false);
                            }
                            break;

                        case "Closed":
                            uclAuditForm.EditAuditId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditNotificationClosed);
                            if (isDirected)
                            {
                                rbNew.Visible = false;
                                uclAuditForm.EnableReturnButton(false);
                            }
                            break;

                        case "DisplayOnly":
                            uclAuditForm.EditAuditId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditNotificationDisplay);
                            if (isDirected)
                            {
                                rbNew.Visible = false;
                                uclAuditForm.EnableReturnButton(false);
                            }
                            break;
                        }
                    }
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string)
                {
                    try
                    {
                        // from inbox
                        DisplayNonPostback();
                        SessionManager.ReturnRecordID = Convert.ToDecimal(SessionManager.ReturnObject.ToString());
                        SessionManager.ReturnObject   = "Notification";
                        SessionManager.ReturnStatus   = true;
                        isDirected = true;

                        StringBuilder       sbScript = new StringBuilder();
                        ClientScriptManager cs       = Page.ClientScript;

                        sbScript.Append("<script language='JavaScript' type='text/javascript'>\n");
                        sbScript.Append("<!--\n");
                        sbScript.Append(cs.GetPostBackEventReference(this, "PBArg") + ";\n");
                        sbScript.Append("// -->\n");
                        sbScript.Append("</script>\n");

                        cs.RegisterStartupScript(this.GetType(), "AutoPostBackScript", sbScript.ToString());
                    }
                    catch
                    {
                        // not a number, parse as type
                        DisplayNonPostback();
                    }
                }
                else
                {
                    DisplayNonPostback();
                }
            }
            // for now, we will only let 'admin' create audits
            //if (!SessionManager.UserContext.Person.SSO_ID.ToLower().Equals("admin"))
            //	rbNew.Visible = false;
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            bool createIncidentAccess = SessionManager.CheckUserPrivilege(SysPriv.originate, SysScope.incident);

            if (rbNew.Visible)
            {
                rbNew.Visible = createIncidentAccess;
            }

            if (SessionManager.UserContext.Person.PERSON_ID == 1)
            {
                SETTINGS sets = SQMSettings.GetSetting("EHS", "CONVERSION");
                if (sets != null && (sets.VALUE.ToUpper() == "Y" || sets.VALUE.ToUpper() == "TRUE"))
                {
                    btnConversion.Visible = true;
                }
            }


            if (IsPostBack)
            {
                RadPersistenceManager1.StorageProviderKey = SessionManager.UserContext.Person.PERSON_ID.ToString();
                RadPersistenceManager1.SaveState();

                if (SessionManager.ReturnStatus == true)
                {
                    if (SessionManager.ReturnObject is string)
                    {
                        string type = SessionManager.ReturnObject as string;
                        switch (type)
                        {
                        case "DisplayIncidents":
                            UpdateDisplayState(DisplayState.IncidentList, 0);
                            break;

                        default:
                            break;
                        }
                    }
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                if (!string.IsNullOrEmpty(Request.QueryString["r"]))                   // incident Record id is supplied from email notification
                {
                    string  targetRec = Request.QueryString["r"];
                    decimal targetRecID;
                    if (decimal.TryParse(targetRec, out targetRecID))
                    {
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                }
                else if (!string.IsNullOrEmpty(Request.QueryString["a"]))                   // incident Record id is supplied from incident ALERT email notification
                {
                    string  targetRec = Request.QueryString["a"];
                    decimal targetRecID;
                    if (decimal.TryParse(targetRec, out targetRecID))
                    {
                        // Change this from alert mode to edit mode on email url requiest because of client requirement.
                        //UpdateDisplayState(DisplayState.IncidentAlert, targetRecID);
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                }
                else if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string)
                {
                    // from inbox ?
                    decimal targetRecID;
                    if (decimal.TryParse(SessionManager.ReturnObject.ToString(), out targetRecID))
                    {
                        SessionManager.ClearReturns();
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                    else
                    {
                        DisplayNonPostback();
                    }
                }
                else
                {
                    DisplayNonPostback();
                }
            }
        }
Esempio n. 23
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                uclSearchBar.PageTitle.Text = lblProbCaseTitle.Text;
                CaseCtl().isDirected        = false;

                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect(CaseCtl().Context == "EHS" ? CaseCtl().Context : "SQM", 0, true);
                }

                if (ddlPlantSelect.Items.Count < 1)
                {
                    List <PLANT> plantList = SQMModelMgr.SelectPlantList(entities, SQMModelMgr.LookupPrimaryCompany(entities).COMPANY_ID, 0);
                    ddlPlantSelect.Items.Clear();
                    foreach (PLANT plant in plantList)
                    {
                        if (SessionManager.PlantAccess(plant.PLANT_ID))
                        {
                            RadComboBoxItem item = new RadComboBoxItem(plant.PLANT_NAME, plant.PLANT_ID.ToString());
                            item.CssClass = "prompt";
                            item.Checked  = true;
                            ddlPlantSelect.Items.Add(item);
                        }
                    }
                    ddlStatusSelect.SelectedValue = "A";
                }

                // create new case from quality issue
                if ((bool)SessionManager.ReturnStatus)
                {
                    if (SessionManager.ReturnObject is QI_OCCUR)
                    {
                        QI_OCCUR qiIssue = (QI_OCCUR)SessionManager.ReturnObject;
                        CaseCtl().CreateNew("QI", SessionManager.PrimaryCompany().COMPANY_ID, SessionManager.UserContext.Person);
                        CaseCtl().isAutoCreated = true;
                        CaseCtl().problemCase.ProbCase.DESC_LONG = qiIssue.INCIDENT.DESCRIPTION;
                        CaseCtl().problemCase.AddIncident(qiIssue.INCIDENT_ID);
                        uclCaseEdit.BindIncidentList(CaseCtl().problemCase.IncidentList);
                        uclCaseEdit.BindPartIssueItemList(CaseCtl().problemCase.PartIssueItemList);
                    }
                    else if (SessionManager.ReturnObject is TASK_STATUS)
                    {
                        // from inbox
                        CaseCtl().isDirected           = true;
                        uclSearchBar.ReturnButton.Text = lblReturnInbox.Text;
                        TASK_STATUS task = (TASK_STATUS)SessionManager.ReturnObject;
                        uclCaseList_Click(task.RECORD_ID);
                        if (CaseCtl().problemCase.CheckCaseNextStep() >= Convert.ToInt32(task.TASK_STEP))
                        {
                            PageTabClicked("lbTab" + task.TASK_STEP, task.TASK_STEP);
                        }
                        else
                        {
                            PageTabClicked("lbTab0", "0");
                        }
                    }
                    else if (SessionManager.ReturnObject is decimal)
                    {
                        // from console list
                        uclCaseList_Click((decimal)SessionManager.ReturnObject);
                        PageTabClicked("lbTab0", "0");
                    }
                    else if (SessionManager.ReturnObject is INCIDENT)
                    {
                        // Problem case from EHS Incident
                        INCIDENT incident   = (INCIDENT)SessionManager.ReturnObject;
                        decimal  locationId = EHSIncidentMgr.SelectIncidentLocationIdByIncidentId(incident.INCIDENT_ID);
                        CaseCtl().CreateNew("EHS", SessionManager.PrimaryCompany().COMPANY_ID, SessionManager.UserContext.Person);
                        CaseCtl().problemCase.ProbCase.DESC_SHORT    = incident.ISSUE_TYPE;
                        CaseCtl().problemCase.ProbCase.DESC_LONG     = incident.DESCRIPTION;
                        CaseCtl().problemCase.ProbCase.PROBCASE_TYPE = "EHS";
                        CaseCtl().problemCase.AddIncident(incident.INCIDENT_ID);
                        uclCaseEdit.BindIncidentList(CaseCtl().problemCase.IncidentList);
                        if (CaseCtl().problemCase.ProbCase.PROB_DEFINE == null)
                        {
                            CaseCtl().problemCase.CreateProblemDefinition();
                        }
                        CaseCtl().isAutoCreated = true;
                    }
                    else
                    {
                        uclSearchBar_OnSearchClick();
                    }
                }
                else
                {
                    uclSearchBar_OnSearchClick();
                }
            }
            else
            {
                /* add incidents from qi issue popup list */
                if ((bool)SessionManager.ReturnStatus)
                {
                    if (SessionManager.ReturnObject.GetType().ToString().ToUpper().Contains("INCIDENT"))
                    {
                        List <INCIDENT> incidentList = (List <INCIDENT>)SessionManager.ReturnObject;
                        foreach (INCIDENT incident in incidentList)
                        {
                            CaseCtl().problemCase.AddIncident(incident.INCIDENT_ID);
                        }
                        uclCaseEdit.BindIncidentList(CaseCtl().problemCase.IncidentList);
                        uclCaseEdit.BindPartIssueItemList(CaseCtl().problemCase.PartIssueItemList);
                        PageTabClicked("lbTab0", "0");
                    }

                    else if (SessionManager.ReturnObject == "DisplayCases")
                    {
                        uclSearchBar_OnSearchClick();
                        SessionManager.ClearReturns();
                    }
                }
            }
            SessionManager.ClearReturns();

            if (CaseCtl().isAutoCreated)
            {
                CaseCtl().Update();
                SetupPage();
                PageTabClicked("lbTab0", "0");
            }
        }