示例#1
0
 protected void dsScoreCardDashboard_Deleting(object sender, LinqDataSourceDeleteEventArgs e)
 {
     if (MyDashboardMode)
     {
         MetricTrac.Bll.ScoreCardDashboard d = (MetricTrac.Bll.ScoreCardDashboard)e.OriginalObject;
         d.InstanceId = MetricTrac.Bll.LinqMicajahDataContext.InstanceId;
         d.UserId     = (Guid)MetricTrac.Bll.LinqMicajahDataContext.LogedUserId;
     }
 }
示例#2
0
        protected void Page_Prerender(object sender, EventArgs e)
        {
            Guid   ScoreCardID       = new Guid(ddlScoreCard.SelectedValue);
            string ScoreCardMetricID = rcbMetricOrg.SelectedValue;

            if (!IsPostBack && mfScoreCardDashboard.DataItem != null)
            {
                MetricTrac.Bll.ScoreCardDashboard d = (MetricTrac.Bll.ScoreCardDashboard)mfScoreCardDashboard.DataItem;
                var scm = MetricTrac.Bll.ScoreCardMetric.Get(d.ScoreCardMetricID);
                ScoreCardMetricID = d.ScoreCardMetricID.ToString();
                ScoreCardID       = scm.ScoreCardID;
            }

            var mo = MetricTrac.Bll.ScoreCardMetric.ListUnusedDashboard(ScoreCardID, ScoreCardDashboardID == Guid.Empty ? null : (Guid?)ScoreCardDashboardID);

            rcbMetricOrg.DataSource = mo;
            rcbMetricOrg.DataBind();
            if (mo.Count < 1)
            {
                rcbMetricOrg.EmptyMessage = "This Score Card has not more Metric, Please select another Score Card";
            }

            for (int i = 0; i < mo.Count(); i++)
            {
                Telerik.Web.UI.RadComboBoxItem        it = rcbMetricOrg.Items[i];
                MetricTrac.Bll.ScoreCardMetric.Extend d  = mo[i];
                string t = d.MetricName + " / " + d.OrgLocationName;
                it.Text = t;
            }

            foreach (Telerik.Web.UI.RadComboBoxItem i in rcbMetricOrg.Items)
            {
                i.Selected = i.Value == ScoreCardMetricID;
            }

            foreach (ListItem i in ddlScoreCard.Items)
            {
                i.Selected = i.Value == ScoreCardID.ToString();
            }

            Telerik.Web.UI.RadAjaxManager ram = Telerik.Web.UI.RadAjaxManager.GetCurrent(this);
            ram.UpdatePanelsRenderMode = UpdatePanelRenderMode.Inline;
            ram.AjaxSettings.AddAjaxSetting(mfScoreCardDashboard.FindControl("ddlScoreCard"), mfScoreCardDashboard.FindControl("rapDashboard"), (Telerik.Web.UI.RadAjaxLoadingPanel)mfScoreCardDashboard.FindControl("ralpDashboard"));
        }
示例#3
0
        void InitDiagrams()
        {
            if (ScoreCardMetricID == null)
            {
                string s = Request.QueryString["ScoreCardMetricID"];
                if (!string.IsNullOrEmpty(s))
                {
                    try
                    {
                        ScoreCardMetricID = new Guid(s);
                    }
                    catch { }
                }
            }

            phCurrent.Visible      = false;
            phPrevious.Visible     = false;
            phChange.Visible       = false;
            dataValueChart.Visible = false;

            if (ScoreCardMetricID != null)
            {
                var m = MetricTrac.Bll.ScoreCardMetric.Get((Guid)ScoreCardMetricID);
                MetricTrac.Bll.ScoreCardDashboard d = null;
                if (DasboardID != null)
                {
                    d = MetricTrac.Bll.ScoreCardDashboard.Get((Guid)DasboardID);
                }
                if (m != null)
                {
                    double MaxValue = 0;
                    if (m.CurrentValue != null)
                    {
                        MaxValue = (double)m.CurrentValue;
                    }
                    if (m.PreviousValue != null && m.PreviousValue > MaxValue)
                    {
                        MaxValue = (double)m.PreviousValue;
                    }
                    if (d != null && d.MaxValue != null && (double)((decimal)d.MaxValue) > MaxValue)
                    {
                        MaxValue = (double)d.MaxValue;
                    }

                    double MinValue = 0;
                    if (d != null && d.MinValue != null)
                    {
                        MinValue = (double)d.MinValue;
                    }
                    if (m.CurrentValue != null && m.CurrentValue < MinValue)
                    {
                        MinValue = (double)m.CurrentValue;
                    }
                    if (m.PreviousValue != null && m.PreviousValue < MinValue)
                    {
                        MinValue = (double)m.PreviousValue;
                    }

                    double?Breakpoint1Value = d == null || d.Breakpoint1Value == null ? (double?)null : (double)((decimal)(d.Breakpoint1Value));
                    double?Breakpoint2Value = d == null || d.Breakpoint2Value == null ? (double?)null : (double)((decimal)(d.Breakpoint2Value));

                    if (m.CurrentValue != null)
                    {
                        InitGauge(dgwcCurrent, (double)m.CurrentValue, MinValue, MaxValue, Breakpoint1Value, Breakpoint2Value, MaxValue * 1.1);
                        //, (double?)m.MinValue, (double?)m.MaxValue, true, MaxValue);
                        lbCurrent.Text = m.CurrentValueStr;
                    }

                    if (m.PreviousValue != null)
                    {
                        InitGauge(dgwcPrevious, (double)m.PreviousValue, MinValue, MaxValue, Breakpoint1Value, Breakpoint2Value, MaxValue * 1.1);
                        lbPrevious.Text = m.PreviousValueStr;
                    }

                    if (m.ChangeValue != null)
                    {
                        InitGauge(dgwcChange, (double)m.ChangeValue, -100, 100, null, null, 100);
                        lbChange.Text = m.ChangeValueStr;
                    }

                    dataValueChart.Visible           = true;
                    dataValueChart.ScoreCardMetricID = m.ScoreCardMetricID;
                    dataValueChart.DasboardID        = DasboardID;
                    //dataValueChart.OrgLocationID = m.OrgLocationID;
                }
            }
        }
示例#4
0
        protected void Page_Prerender(object sender, EventArgs e)
        {
            var mo = MetricTrac.Bll.MetricValue.List(6, DateBegin, ScoreCardMetricID, MetricTrac.PerformanceIndicatorCalc.CalcStringFormula);

            if (mo == null)
            {
                return;
            }
            Telerik.Charting.ChartSeries l = rcMetricOrgLocation.Series[3];
            lbTitle.Text = mo.Name + "<br>" + mo.OrgLocationFullName;

            double?MaxValue = null;
            double?MinValue = null;

            for (int NumVal = 0; NumVal < mo.MetricValues.Count; NumVal++)
            {
                var v = mo.MetricValues[NumVal];
                Telerik.Charting.ChartSeriesItem it;
                if (v == null || v.DValue == null)
                {
                    it               = new Telerik.Charting.ChartSeriesItem(0);
                    it.Empty         = true;
                    it.Label.Visible = false;
                }
                else
                {
                    double val = (double)v.DValue;
                    if (MaxValue == null || MaxValue < val)
                    {
                        MaxValue = val;
                    }
                    if (MinValue == null || MinValue > val)
                    {
                        MinValue = val;
                    }
                    string ItemLabel = ((double)v.DValue).ToString("N" + mo.NODecPlaces);
                    it = new Telerik.Charting.ChartSeriesItem(val, ItemLabel);
                }

                it.XValue = NumVal;
                rcMetricOrgLocation.PlotArea.XAxis.Items[NumVal].TextBlock.Text = v.Period;
                l.Items.Add(it);
            }

            if (mo.UnitOfMeasureID != null)
            {
                string name = MetricTrac.Bll.Mc_UnitsOfMeasure.GetSingularAbbreviation((Guid)mo.UnitOfMeasureID);
                if (!string.IsNullOrEmpty(name))
                {
                    rcMetricOrgLocation.PlotArea.Appearance.Dimensions.Margins.Top   = 15;
                    rcMetricOrgLocation.PlotArea.Appearance.Dimensions.Margins.Right = 7;
                    rcMetricOrgLocation.PlotArea.YAxis.AxisLabel.TextBlock.Text      = name;
                    rcMetricOrgLocation.PlotArea.YAxis.AxisLabel.Visible             = true;
                }
            }

            MetricTrac.Bll.ScoreCardDashboard d = null;
            if (DasboardID != null)
            {
                d = MetricTrac.Bll.ScoreCardDashboard.Get((Guid)DasboardID);
            }
            if (d == null)
            {
                d = new MetricTrac.Bll.ScoreCardDashboard();
            }

            if (d.MaxValue != null)
            {
                double max = (double)(decimal)d.MaxValue;
                if (MaxValue != null && max < MaxValue)
                {
                    max = (double)MaxValue;
                }
                rcMetricOrgLocation.PlotArea.YAxis.AutoScale = false;
                rcMetricOrgLocation.PlotArea.YAxis.MaxValue  = max;

                double min = 0;
                if (d.MinValue != null)
                {
                    min = (double)d.MinValue;
                }
                if (MinValue != null && min > MinValue)
                {
                    min = (double)MinValue;
                }
                rcMetricOrgLocation.PlotArea.YAxis.MinValue = min;

                double Step = ((double)d.MaxValue - min) / 10;
                double Pow  = Math.Pow(10, ((int)(Math.Log10(Step))));
                double Base = (int)(Step / Pow);
                if (Base < 2)
                {
                    Step = Pow;
                }
                else if (Base < 5)
                {
                    Step = 2 * Pow;
                }
                else
                {
                    Step = 10 * Pow;
                }
                rcMetricOrgLocation.PlotArea.YAxis.Step = Step;
            }
            InitHorizontLine(d.BaselineValue, d.BaselineValueLabel, 0, mo.MetricValues.Count);
            InitHorizontLine(d.Breakpoint1Value, d.Breakpoint1ValueLabel, 1, mo.MetricValues.Count);
            InitHorizontLine(d.Breakpoint2Value, d.Breakpoint2ValueLabel, 2, mo.MetricValues.Count);
        }