Пример #1
0
        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);
        }
Пример #2
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);
            }
        }