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); }
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); } } }
private void BindSimulationFiles(int pullRequestId) { List <vSimFile> simFileList = ApsimFilesDS.GetSimFilesByPullRequestID(pullRequestId); gvSimFiles.DataSource = simFileList; gvSimFiles.DataBind(); //Can we //BindPredictedObservedVariables() }
//this will provide data for both Pull request drop down controls private void BindPullRequestLists() { List <vApsimFile> apsimFileList = ApsimFilesDS.GetPullRequestsWithStatus(); gvApsimFiles1.DataSource = apsimFileList; gvApsimFiles1.DataBind(); gvApsimFiles2.DataSource = apsimFileList; gvApsimFiles2.DataBind(); }
private void BindApsimFileNames() { List <vVariable> fileNameList = ApsimFilesDS.GetDistinctApsimFileNames(); vVariable selectItem = new vVariable(); selectItem.Name = "Select a File"; selectItem.Value = "0"; fileNameList.Insert(0, selectItem); ddlApsimFile.DataSource = fileNameList; ddlApsimFile.DataBind(); }
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); //} }
private void BindSimFilesGrid(int pullRequestId, DateTime runDate, int acceptPullRequestId, int PercentPassed) { //how many files are in the accepted Pull Request Set //what happens if they do not match lblMissing.Text = string.Empty; hfPullRequestId.Value = pullRequestId.ToString(); if (acceptPullRequestId > 0) { List <string> missingTables = ApsimFilesDS.GetMissingTables(pullRequestId, acceptPullRequestId); if (missingTables != null && missingTables.Count > 0) { lblMissing.Text = "Missing FileName.TableName(s): " + string.Join(",", missingTables) + "."; } List <string> newTables = ApsimFilesDS.GetNewTables(pullRequestId, acceptPullRequestId); if (newTables != null && newTables.Count > 0) { StringBuilder message = new StringBuilder(); message.AppendLine("New predicted/observed tables have been added by this pull request:"); message.AppendLine(string.Join(",", newTables)); lblNewFiles.Text = message.ToString(); } } lblPullRequestId.Text = "Simulation Files for Pull Request Id: " + pullRequestId.ToString(); if (PercentPassed == 100) { //btnDifferences.Visible = false; btnTestsCharts.Visible = true; btnTestsGrids.Visible = true; } else { //btnDifferences.Visible = true; //btnDifferences.Text = "Pull Request " + pullRequestId.ToString() + " Tests - Differences "; btnTestsCharts.Visible = true; btnTestsCharts.Text = "Pull Request " + pullRequestId.ToString() + " Tests - Graphical Results"; btnTestsGrids.Visible = true; btnTestsGrids.Text = "Pull Request " + pullRequestId.ToString() + " Tests - Tabulated Results"; } SimFilesList = ApsimFilesDS.GetSimFilesByPullRequestIDandDate(pullRequestId, runDate); SimFilesDT = Genfuncs.ToDataTable(SimFilesList); Session["SimFilesDT"] = SimFilesDT; gvSimFiles.DataSource = SimFilesDT; gvSimFiles.DataBind(); //ClientScript.RegisterStartupScript(this.GetType(), "CreateGridHeader", "<script>CreateGridHeader('GridDataDiv_SimFiles', 'ContentPlaceHolder1_gvSimFiles', 'GridHeaderDiv_SimFiles');</script>"); }
private void BindApsimFilesGrid() { ApsimFileList = ApsimFilesDS.GetPullRequestsWithStatus(); ApsimFileDT = Genfuncs.ToDataTable(ApsimFileList); Session["ApsimFileDT"] = ApsimFileDT; gvApsimFiles.DataSource = ApsimFileDT; gvApsimFiles.DataBind(); AcceptStatsLog acceptedPR = AcceptStatsLogDS.GetLatestAcceptedStatsLog(); if (acceptedPR != null) { lblAcceptedDetails.Text = string.Format("Current Accepted Stats are for Pull Request Id {0}, submitted by {1}, accepted on {2}.", acceptedPR.PullRequestId, acceptedPR.SubmitPerson, acceptedPR.LogAcceptDate.ToString("dd-MMM-yyyy HH:MM tt")); hfAcceptedFileCount.Value = acceptedPR.FileCount.ToString(); } }
private void BindSimFilesGrid(int pullRequestId) { lblMissing.Text = string.Empty; hfPullRequestId.Value = pullRequestId.ToString(); lblPullRequestId.Text = "Simulation Files for Pull Request Id: " + pullRequestId.ToString(); //btnDifferences.Visible = true; //btnDifferences.Text = "Pull Request " + pullRequestId.ToString() + " Tests - Differences " ; btnTestsCharts.Visible = true; btnTestsCharts.Text = "Pull Request " + pullRequestId.ToString() + " Tests - Graphical Results"; btnTestsGrids.Visible = true; btnTestsGrids.Text = "Pull Request " + pullRequestId.ToString() + " Tests - Tabulated Results"; SimFilesList = ApsimFilesDS.GetSimFilesByPullRequestID(pullRequestId); SimFilesDT = Genfuncs.ToDataTable(SimFilesList); Session["SimFilesDT"] = SimFilesDT; gvSimFiles.DataSource = SimFilesDT; gvSimFiles.DataBind(); //ClientScript.RegisterStartupScript(this.GetType(), "CreateGridHeader", "<script>CreateGridHeader('GridDataDiv_SimFiles', 'ContentPlaceHolder1_gvSimFiles', 'GridHeaderDiv_SimFiles');</script>"); }
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); } }