private List <vCurrentAndAccepted> BindCurrentAcceptedValuesssssss(String variable, PredictedObservedDetail currPODetails)
        {
            List <vCurrentAndAccepted> POCurrentValuesList;

            //some of the older records may not have this yet.  So find it the old way.
            if ((currPODetails.AcceptedPredictedObservedDetailsID == null) || (currPODetails.AcceptedPredictedObservedDetailsID <= 0))
            {
                //Retrieve the curresponding (parent) ApsimFile for this PredictedObservedDetail
                ApsimFile apsimFile = ApsimFilesDS.GetByID(currPODetails.ApsimFilesID);

                //get the Pull Request Id for the lastest released pull request that is not the current one
                int acceptPullRequestId = ApsimFilesDS.GetLatestMergedPullRequestId(apsimFile.PullRequestId);

                //get the PredictedObservedDetail.ID for the records that match our current record 'matching' criteria
                currPODetails.AcceptedPredictedObservedDetailsID = PredictedObservedDS.GetIDByMatchingDetails(acceptPullRequestId, apsimFile.FileName, currPODetails.TableName,
                                                                                                              currPODetails.PredictedTableName, currPODetails.ObservedTableName, currPODetails.FieldNameUsedForMatch);
            }


            POCurrentValuesList = PredictedObservedDS.GetCurrentAcceptedValuesWithNulls(variable, currPODetails.ID, (int)currPODetails.AcceptedPredictedObservedDetailsID);
            //POCurrentValuesList = PredictedObservedDS.GetCurrentAcceptedValues(variable, currPODetails.ID, (int)currPODetails.AcceptedPredictedObservedDetailsID);
            //get the data to be displayed in the chart and grid
            //POValuesList = PredictedObservedDS.GetCurrentAcceptedValues(variable, currPODetails.ID, (int)currPODetails.AcceptedPredictedObservedDetailsID);

            //POValuesDT = Genfuncs.ToDataTable(POCurrentValuesList);

            return(POCurrentValuesList);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int predictedObservedId = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["PO_Id"]))
                {
                    predictedObservedId = int.Parse(Request.QueryString["PO_Id"]);
                }

                if (predictedObservedId > 0)
                {
                    hfPredictedObservedID.Value = predictedObservedId.ToString();
                    PredictedObservedDetail currPODetails = PredictedObservedDS.GetByPredictedObservedID(predictedObservedId);
                    ApsimFile apsim = ApsimFilesDS.GetByID(currPODetails.ApsimFilesID);
                    hfPullRequestID.Value = apsim.PullRequestId.ToString();

                    lblPullRequest.Text = "Pull Request: " + apsim.PullRequestId.ToString();
                    lblApsimFile.Text   = "Apsim File: " + apsim.FileName;
                    lblPOTableName.Text = "Table: " + currPODetails.TableName + " (PO Id: " + currPODetails.ID.ToString() + ")";

                    //now bind the data
                    RetrieveDataAndBindCharts(currPODetails);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int    predictedObservedId = 0;
                string variable            = string.Empty;
                if (!string.IsNullOrEmpty(Request.QueryString["PO_Id"]))
                {
                    predictedObservedId = int.Parse(Request.QueryString["PO_Id"]);
                }

                if (predictedObservedId > 0)
                {
                    hfPredictedObservedID.Value = predictedObservedId.ToString();
                    PredictedObservedDetail currPODetails = PredictedObservedDS.GetByPredictedObservedID(predictedObservedId);
                    ApsimFile apsim = ApsimFilesDS.GetByID(currPODetails.ApsimFilesID);
                    hfPullRequestID.Value = apsim.PullRequestId.ToString();

                    Session["POTestsDT"] = null;
                    BindCurrentAcceptedTestsDataTable();

                    lblPullRequest.Text = "Pull Request: " + apsim.PullRequestId.ToString();
                    lblApsimFile.Text   = "Apsim File: " + apsim.FileName;
                    lblPOTableName.Text = "Table: " + currPODetails.TableName + " (PO Id: " + currPODetails.ID.ToString() + ")";

                    if (!string.IsNullOrEmpty(Request.QueryString["Variable"]))
                    {
                        //LoadTimer.Enabled = false;
                        variable = Request.QueryString["Variable"].ToString();
                        BindPredictedObservedVariables(currPODetails.ID);
                        ddlVariables.SelectedValue = variable;

                        ClientScript.RegisterStartupScript(this.GetType(), "ScrollScript", "scrollToDiv();", true);
                    }
                    else
                    {
                        BindPredictedObservedVariables(currPODetails.ID);
                    }

                    //if (gvPOTests.Rows.Count > 0)
                    //{
                    //    //NOTE:  This is registered using the ClientScript (not ScriptManager), with different parameters, as this grid is NOT in an update panel
                    //    ClientScript.RegisterStartupScript(this.GetType(), "CreateGridHeader", "<script>CreateGridHeader('GridDataDiv_POTests', 'ContentPlaceHolder1_gvPOTests', 'GridHeaderDiv_POTests');</script>");
                    //}
                }
            }
            //if (gvPOValues.Rows.Count > 0)
            //{
            //    //NOTE:  This is registered using the ScriptManager (not ClientScript), with different parameters, as this grid is nested in an update panel
            //    ScriptManager.RegisterStartupScript(this, GetType(), "CreateGridHeader_POValues", "CreateGridHeader('GridDataDiv_POValues', 'ContentPlaceHolder1_gvPOValues', 'GridHeaderDiv_POValues');", true);
            //}
        }
Example #4
0
        private void RetrieveDataAndBindCharts(PredictedObservedDetail currPODetails)
        {
            //some of the older records may not have this yet.  So find it the old way.
            if ((currPODetails.AcceptedPredictedObservedDetailsID == null) || (currPODetails.AcceptedPredictedObservedDetailsID <= 0))
            {
                //Retrieve the curresponding (parent) ApsimFile for this PredictedObservedDetail
                ApsimFile apsimFile = ApsimFilesDS.GetByID(currPODetails.ApsimFilesID);

                //get the Pull Request Id for the lastest released pull request that is not the current one
                int acceptPullRequestId = ApsimFilesDS.GetLatestMergedPullRequestId(apsimFile.PullRequestId);

                //get the PredictedObservedDetail.ID for the records that match our current record 'matching' criteria
                currPODetails.AcceptedPredictedObservedDetailsID = PredictedObservedDS.GetIDByMatchingDetails(acceptPullRequestId, apsimFile.FileName, currPODetails.TableName,
                                                                                                              currPODetails.PredictedTableName, currPODetails.ObservedTableName, currPODetails.FieldNameUsedForMatch);
            }

            List <vSimulationPredictedObserved> POCurrentValuesList = PredictedObservedDS.GetCurrentAcceptedSimulationValues(currPODetails.ID, (int)currPODetails.AcceptedPredictedObservedDetailsID);
            string             holdVariable       = string.Empty;
            string             holdSimulationName = string.Empty;
            string             tooltip            = string.Empty;
            string             textAnnotation     = string.Empty;
            List <PODataPoint> acceptedData       = new List <PODataPoint>();
            List <PODataPoint> currentData        = new List <PODataPoint>();
            double             maxXYValue         = 0;
            bool newchart = false;
            int  chartNo  = 0;

            foreach (vSimulationPredictedObserved item in POCurrentValuesList)
            {
                if (holdVariable == string.Empty)
                {
                    holdVariable       = item.ValueName;
                    holdSimulationName = item.SimulationName;
                    tooltip            = String.Format("{0} - {1}", item.SimulationName, item.ValueName);
                }

                newchart = false;
                //if (item.SimulationName != holdSimulationName) { newchart = true; }
                if (item.ValueName != holdVariable)
                {
                    newchart = true;
                }

                if (newchart == true)
                {
                    //create the chart
                    if ((currentData.Count > 0) || (currentData.Count > 0))
                    {
                        chartNo       += 1;
                        textAnnotation = GetPredictedObservedTests(currPODetails.ID, holdVariable);
                        BindCurrentAcceptedChart(chartNo, holdVariable, currPODetails.ID, tooltip, currentData.ToArray(), acceptedData.ToArray(), maxXYValue, textAnnotation);
                    }
                    //reset the variables
                    acceptedData.Clear();
                    currentData.Clear();
                    maxXYValue         = 0;
                    holdVariable       = item.ValueName;
                    holdSimulationName = item.SimulationName;
                }

                if ((item.AcceptedObservedValue != null) && (item.AcceptedPredictedValue != null))
                {
                    acceptedData.Add(new PODataPoint()
                    {
                        X = (double)item.AcceptedObservedValue,
                        Y = (double)item.AcceptedPredictedValue,
                        SimulationName = item.SimulationName
                    });
                    if ((double)item.AcceptedObservedValue > maxXYValue)
                    {
                        maxXYValue = (double)item.AcceptedObservedValue;
                    }
                    if ((double)item.AcceptedPredictedValue > maxXYValue)
                    {
                        maxXYValue = (double)item.AcceptedPredictedValue;
                    }
                }

                if ((item.CurrentObservedValue != null) && (item.CurrentPredictedValue != null))
                {
                    currentData.Add(new PODataPoint()
                    {
                        X = (double)item.CurrentObservedValue,
                        Y = (double)item.CurrentPredictedValue,
                        SimulationName = item.SimulationName
                    });
                    if ((double)item.CurrentObservedValue > maxXYValue)
                    {
                        maxXYValue = (double)item.CurrentObservedValue;
                    }
                    if ((double)item.CurrentPredictedValue > maxXYValue)
                    {
                        maxXYValue = (double)item.CurrentPredictedValue;
                    }
                }
            }
            if ((currentData.Count > 0) || (acceptedData.Count > 0))
            {
                chartNo       += 1;
                textAnnotation = GetPredictedObservedTests(currPODetails.ID, holdVariable);
                BindCurrentAcceptedChart(chartNo, holdVariable, currPODetails.ID, tooltip, currentData.ToArray(), acceptedData.ToArray(), maxXYValue, textAnnotation);
            }
        }