Exemplo n.º 1
0
        //protected void lnkAddTask_Click(Object sender, EventArgs e)
        //{
        //	//if (OnExceptionListItemClick != null)
        //	//{
        //	//LinkButton lnk = (LinkButton)sender;
        //	//string[] cmd = lnk.CommandArgument.Split(',');
        //	string[] cmd = lnkAddTask.CommandArgument.Split(',');
        //	AddTask(Convert.ToDecimal(cmd[0].ToString()), Convert.ToDecimal(cmd[1].ToString()));
        //	// call sending AuditID, QuestionID
        //	//	OnExceptionListItemClick(Convert.ToDecimal(cmd[0].ToString()), Convert.ToDecimal(cmd[1].ToString()));
        //	//}
        //}

        private void AddTask(decimal auditID, decimal questionID)
        {
            int              recordType    = (int)TaskRecordType.Audit;
            AUDIT            audit         = EHSAuditMgr.SelectAuditById(new PSsqmEntities(), auditID);
            EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(auditID, questionID);

            uclTaskList.TaskWindow(50, auditQuestion.AuditId, auditQuestion.QuestionId, "350", auditQuestion.QuestionText, (decimal)audit.DETECT_PLANT_ID);

            //uclTask.BindTaskAdd(recordType, auditQuestion.AuditId, auditQuestion.QuestionId, "350", "T", auditQuestion.QuestionText, (decimal)audit.DETECT_PLANT_ID, "");
            //string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
Exemplo n.º 2
0
        private void UpdateTaskList(string cmd, decimal recordID, decimal recordSubID)
        {
            // update the status when a task is added
            if (cmd == "added")
            {
                EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(recordID, recordSubID);

                if (auditQuestion != null)
                {
                    auditQuestion.Status = "02";
                    EHSAuditMgr.UpdateAnswer(auditQuestion);
                }
                //SearchAudits();
            }
        }
Exemplo n.º 3
0
        protected void ddlChartTypeChange(object sender, EventArgs e)
        {
            divChart.ViewStateMode = System.Web.UI.ViewStateMode.Disabled;
            //if (ddlChartType.SelectedValue == "" || HSCalcs().ehsCtl.IncidentHst == null || HSCalcs().ehsCtl.IncidentHst.Count == 0)
            if (ddlChartType.SelectedValue == "")
            {
                pnlChartSection.Style.Add("display", "none");
                lnkChartClose.Visible = lnkPrint.Visible = false;
            }
            else
            {
                //PERSPECTIVE_VIEW view = null;
                //divSummaryCharts.Controls.Clear();

                //view = ViewModel.LookupView(entities, "HSIR", "HSIR", 0);

                //if (view != null)
                //{
                //	PERSPECTIVE_VIEW_ITEM vi = view.PERSPECTIVE_VIEW_ITEM.Where(i => i.ITEM_SEQ.ToString() == ddlChartType.SelectedValue).FirstOrDefault();
                //	if (vi != null)
                //	{
                //		GaugeDefinition ggCfg = new GaugeDefinition().Initialize().ConfigureControl(vi, null, "", false, !string.IsNullOrEmpty(hfwidth.Value) ? Convert.ToInt32(hfwidth.Value) - 62 : 0, 0);
                //		ggCfg.Position = null;
                //		HSCalcs().ehsCtl.SetCalcParams(vi.CALCS_METHOD, vi.CALCS_SCOPE, vi.CALCS_STAT, (int)vi.SERIES_ORDER).IncidentSeries((EHSCalcsCtl.SeriesOrder)vi.SERIES_ORDER, SQMBasePage.GetComboBoxCheckedItems(ddlPlantSelect).Select(i => Convert.ToDecimal(i.Value)).ToArray(), new DateTime(1900, 1, 1), SessionManager.UserContext.LocalTime.AddYears(100), HSCalcs().ehsCtl.GetIncidentTopics());
                //		uclChart.CreateControl((SQMChartType)vi.CONTROL_TYPE, ggCfg, HSCalcs().ehsCtl.Results, divSummaryCharts);
                //		pnlChartSection.Style.Add("display", "inline");
                //		lnkChartClose.Visible = lnkPrint.Visible = true;
                //		// return;
                //	}
                //}
                divChart.Controls.Clear();
                switch (ddlChartType.SelectedValue)
                {
                case "charts":
                    decimal protection          = 0;
                    decimal protectionTotal     = 0;
                    decimal surveillance        = 0;
                    decimal surveillanceTotal   = 0;
                    decimal manualresponse      = 0;
                    decimal manualresponseTotal = 0;
                    decimal humanelement        = 0;
                    decimal humanelementTotal   = 0;
                    decimal hazards             = 0;
                    decimal hazardsTotal        = 0;
                    decimal maintenence         = 0;
                    decimal maintenenceTotal    = 0;
                    int     iTopic = 0;
                    decimal answerValue;

                    // get the current year results
                    foreach (EHSAuditData audit in HSCalcs().ehsCtl.AuditHst)
                    {
                        foreach (AUDIT_ANSWER answer in audit.Audit.AUDIT_ANSWER)
                        {
                            try
                            {
                                answerValue = Convert.ToInt16(answer.ANSWER_VALUE);
                            }
                            catch
                            {
                                answerValue = 0;
                            }
                            EHSAuditQuestion question = EHSAuditMgr.SelectAuditQuestion(audit.Audit.AUDIT_ID, answer.AUDIT_QUESTION_ID);
                            iTopic = Convert.ToInt16(question.TopicId);
                            switch (iTopic)
                            {
                            case 3:
                                protection      += answerValue;
                                protectionTotal += 3;
                                break;

                            case 4:
                                surveillance      += answerValue;
                                surveillanceTotal += 3;
                                break;

                            case 5:
                                manualresponse      += answerValue;
                                manualresponseTotal += 3;
                                break;

                            case 6:
                                humanelement      += answerValue;
                                humanelementTotal += 3;
                                break;

                            case 7:
                                hazards      += answerValue;
                                hazardsTotal += 3;
                                break;

                            case 8:
                                maintenence      += answerValue;
                                maintenenceTotal += 3;
                                break;
                            }
                        }
                    }
                    List <GaugeSeries> gaugeSeries = new List <GaugeSeries>();
                    GaugeSeries        g           = new GaugeSeries();
                    g.Name = "Percentage";
                    if (protectionTotal > 0)
                    {
                        answerValue = Math.Round((protection / protectionTotal), 3) * 100;
                    }
                    else
                    {
                        answerValue = 0;
                    }
                    g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Protection"));
                    if (surveillanceTotal > 0)
                    {
                        answerValue = Math.Round((surveillance / surveillanceTotal), 3) * 100;
                    }
                    else
                    {
                        answerValue = 0;
                    }
                    g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Surveillance"));
                    if (manualresponseTotal > 0)
                    {
                        answerValue = Math.Round((manualresponse / manualresponseTotal), 3) * 100;
                    }
                    else
                    {
                        answerValue = 0;
                    }
                    g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Manual Response"));
                    if (humanelementTotal > 0)
                    {
                        answerValue = Math.Round((humanelement / humanelementTotal), 3) * 100;
                    }
                    else
                    {
                        answerValue = 0;
                    }
                    g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Human Element"));
                    if (hazardsTotal > 0)
                    {
                        answerValue = Math.Round((hazards / hazardsTotal), 3) * 100;
                    }
                    else
                    {
                        answerValue = 0;
                    }
                    g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Hazards"));
                    if (maintenenceTotal > 0)
                    {
                        answerValue = Math.Round((maintenence / maintenenceTotal), 3) * 100;
                    }
                    else
                    {
                        answerValue = 0;
                    }
                    g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Maintenence"));
                    gaugeSeries.Add(g);
                    GaugeDefinition gauge = new GaugeDefinition();
                    gauge.ColorPallete = "chartSeriesColor";
                    //gauge.ContainerHeight = 550;
                    //gauge.ContainerWidth = 550;
                    gauge.ControlType    = 70;
                    gauge.DisplayLabel   = true;
                    gauge.DisplayLegend  = true;
                    gauge.DisplayTitle   = true;
                    gauge.DisplayTooltip = true;
                    gauge.Grouping       = 0;
                    gauge.Height         = 550;
                    gauge.Width          = 650;
                    gauge.ItemVisual     = "CENTER";
                    gauge.MinorTics      = false;
                    gauge.Multiplier     = 0;
                    gauge.ScaleMax       = 100;
                    gauge.ScaleMin       = 0;

                    gauge.Title        = "Audit Summary";
                    gauge.DisplayTitle = false;
                    CalcsResult rslt = new CalcsResult();
                    rslt.metricSeries = gaugeSeries;
                    rslt.Status       = 0;
                    rslt.ValidResult  = true;

                    uclChart.CreateControl(SQMChartType.SpiderChart, gauge, rslt, divChart);
                    pnlChartSection.Style.Add("display", "inline");
                    lnkChartClose.Visible  = lnkPrint.Visible = true;
                    divChart.Visible       = true;
                    divDataResults.Visible = false;
                    break;

                case "report":
                    lnkChartClose.Visible  = lnkPrint.Visible = true;
                    divChart.Visible       = false;
                    divDataResults.Visible = true;
                    break;
                }
            }
        }