diff --git a/Web/Charter/CurveData.cs b/Web/Charter/CurveData.cs index c5e8634..ebe0985 100644 --- a/Web/Charter/CurveData.cs +++ b/Web/Charter/CurveData.cs @@ -6,62 +6,54 @@ namespace LeafWeb.Web.Charter [Serializable] public class CurveData { - private readonly String curveID; - private readonly CurveParamSet paramSet1; - private readonly CurveParamSet paramSet2; - private readonly CurveParamSet paramSet3; - private readonly CurveParamSet paramSet4; - - public CurveData() - { - } + private readonly String _curveId; + private readonly CurveParamSet _paramSet1; + private readonly CurveParamSet _paramSet2; + private readonly CurveParamSet _paramSet3; + private readonly CurveParamSet _paramSet4; public CurveData(StreamReader sr, ref String errMsg, ref int lineNbr) { // For each curve in the output file there are four sets of data. - paramSet1 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID); + _paramSet1 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId); if (errMsg.Length > 0) return; - paramSet2 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID); + _paramSet2 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId); if (errMsg.Length > 0) return; - paramSet3 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID); + _paramSet3 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId); if (errMsg.Length > 0) return; - paramSet4 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID); - if (errMsg.Length > 0) - return; - - return; + _paramSet4 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId); } - public String getCurveID() + public String GetCurveId() { - return curveID; + return _curveId; } - public CurveParamSet getParamSet1() + public CurveParamSet GetParamSet1() { - return paramSet1; + return _paramSet1; } - public CurveParamSet getParamSet2() + public CurveParamSet GetParamSet2() { - return paramSet2; + return _paramSet2; } - public CurveParamSet getParamSet3() + public CurveParamSet GetParamSet3() { - return paramSet3; + return _paramSet3; } - public CurveParamSet getParamSet4() + public CurveParamSet GetParamSet4() { - return paramSet4; + return _paramSet4; } } } \ No newline at end of file diff --git a/Web/Charter/CurveParamSet.cs b/Web/Charter/CurveParamSet.cs index 5e09f3c..22bb655 100644 --- a/Web/Charter/CurveParamSet.cs +++ b/Web/Charter/CurveParamSet.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using System.IO; using System.Text; @@ -8,43 +8,42 @@ namespace LeafWeb.Web.Charter [Serializable] public class CurveParamSet { - private readonly ArrayList anetMeasChloro1Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=1 - private readonly ArrayList anetMeasChloro2Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=2 - private readonly ArrayList anetMeasChloro3Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=3 - private readonly ArrayList anetMeasInter1Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=1 - private readonly ArrayList anetMeasInter2Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=2 - private readonly ArrayList anetMeasInter3Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=3 - private readonly ArrayList acChloroData; // y=Ac column, x=CO2cc column - private readonly ArrayList ajChloroData; // y=Aj column, x=CO2cj column - private readonly ArrayList atChloroData; // y=At column, x=CO2ct column - private readonly ArrayList acInterData; // y=Ac column, x=CO2i column - private readonly ArrayList ajInterData; // y=Aj column, x=CO2i column - private readonly ArrayList atInterData; // y=At column, x=CO2i column + private readonly List _anetMeasChloro1Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=1 + private readonly List _anetMeasChloro2Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=2 + private readonly List _anetMeasChloro3Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=3 + private readonly List _anetMeasInter1Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=1 + private readonly List _anetMeasInter2Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=2 + private readonly List _anetMeasInter3Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=3 + private readonly List _acChloroData; // y=Ac column, x=CO2cc column + private readonly List _ajChloroData; // y=Aj column, x=CO2cj column + private readonly List _atChloroData; // y=At column, x=CO2ct column + private readonly List _acInterData; // y=Ac column, x=CO2i column + private readonly List _ajInterData; // y=Aj column, x=CO2i column + private readonly List _atInterData; // y=At column, x=CO2i column public CurveParamSet() { } - public CurveParamSet(StreamReader sr, ref String errMsg, ref int lineNbr, ref String curveID) + public CurveParamSet(StreamReader sr, ref String errMsg, ref int lineNbr, ref String curveId) { - bool curveIDSet = false, doneWithAnet = false; - String line, firstField; + bool curveIdSet = false, doneWithAnet = false; + String line; var errorMsg = new StringBuilder(""); - ArrayList phrases; - XYPoint xyPoint1, xyPoint2; - int pointLimitType; - anetMeasChloro1Data = new ArrayList(); - anetMeasChloro2Data = new ArrayList(); - anetMeasChloro3Data = new ArrayList(); - anetMeasInter1Data = new ArrayList(); - anetMeasInter2Data = new ArrayList(); - anetMeasInter3Data = new ArrayList(); - acChloroData = new ArrayList(); - ajChloroData = new ArrayList(); - atChloroData = new ArrayList(); - acInterData = new ArrayList(); - ajInterData = new ArrayList(); - atInterData = new ArrayList(); + List phrases; + XyPoint xyPoint1; + _anetMeasChloro1Data = new List(); + _anetMeasChloro2Data = new List(); + _anetMeasChloro3Data = new List(); + _anetMeasInter1Data = new List(); + _anetMeasInter2Data = new List(); + _anetMeasInter3Data = new List(); + _acChloroData = new List(); + _ajChloroData = new List(); + _atChloroData = new List(); + _acInterData = new List(); + _ajInterData = new List(); + _atInterData = new List(); while (!doneWithAnet) { @@ -58,9 +57,9 @@ namespace LeafWeb.Web.Charter return; } - phrases = splitCSVLine(line); + phrases = SplitCsvLine(line); - firstField = (String) phrases[0]; + String firstField = phrases[0]; if (firstField.Equals("CO2i")) { doneWithAnet = true; @@ -84,27 +83,27 @@ namespace LeafWeb.Web.Charter // 12 weitedrms // 13 PointLimitType - if (!curveIDSet) + if (!curveIdSet) { - curveID = firstField; - curveIDSet = true; + curveId = firstField; + curveIdSet = true; } - xyPoint1 = new XYPoint((String) phrases[9], (String) phrases[10]); // AnetMeas(y), PCO2c(x) - xyPoint2 = new XYPoint((String) phrases[8], (String) phrases[10]); // AnetMeas(y), PCO2i(x) - pointLimitType = Int32.Parse((String) phrases[13]); + xyPoint1 = new XyPoint(phrases[9], phrases[10]); // AnetMeas(y), PCO2c(x) + var xyPoint2 = new XyPoint(phrases[8], phrases[10]); + var pointLimitType = Int32.Parse(phrases[13]); switch (pointLimitType) { case 1: - anetMeasChloro1Data.Add(xyPoint1); - anetMeasInter1Data.Add(xyPoint2); + _anetMeasChloro1Data.Add(xyPoint1); + _anetMeasInter1Data.Add(xyPoint2); break; case 2: - anetMeasChloro2Data.Add(xyPoint1); - anetMeasInter2Data.Add(xyPoint2); + _anetMeasChloro2Data.Add(xyPoint1); + _anetMeasInter2Data.Add(xyPoint2); break; case 3: - anetMeasChloro3Data.Add(xyPoint1); - anetMeasInter3Data.Add(xyPoint2); + _anetMeasChloro3Data.Add(xyPoint1); + _anetMeasInter3Data.Add(xyPoint2); break; } } @@ -140,30 +139,28 @@ namespace LeafWeb.Web.Charter moreData = false; else { - phrases = splitCSVLine(line); - xyPoint1 = new XYPoint((String) phrases[1], (String) phrases[2]); // Ac(y),CO2cc(x) - if (xyPoint1.yIsInRange(-20.0, 50.0)) - acChloroData.Add(xyPoint1); - xyPoint1 = new XYPoint((String) phrases[3], (String) phrases[4]); // Aj(y),CO2cj(x) - if (xyPoint1.yIsInRange(-20.0, 50.0)) - ajChloroData.Add(xyPoint1); - xyPoint1 = new XYPoint((String) phrases[5], (String) phrases[6]); // At(y),CO2ct(x) - if (xyPoint1.yIsInRange(-20.0, 50.0)) - atChloroData.Add(xyPoint1); + phrases = SplitCsvLine(line); + xyPoint1 = new XyPoint(phrases[1],phrases[2]); // Ac(y),CO2cc(x) + if (xyPoint1.YIsInRange(-20.0, 50.0)) + _acChloroData.Add(xyPoint1); + xyPoint1 = new XyPoint(phrases[3], phrases[4]); // Aj(y),CO2cj(x) + if (xyPoint1.YIsInRange(-20.0, 50.0)) + _ajChloroData.Add(xyPoint1); + xyPoint1 = new XyPoint(phrases[5], phrases[6]); // At(y),CO2ct(x) + if (xyPoint1.YIsInRange(-20.0, 50.0)) + _atChloroData.Add(xyPoint1); - xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[2]); // Ac(y),CO2i(x) - if (xyPoint1.yIsInRange(-20.0, 50.0)) - acInterData.Add(xyPoint1); - xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[4]); // Aj(y),CO2i(x) - if (xyPoint1.yIsInRange(-20.0, 50.0)) - ajInterData.Add(xyPoint1); - xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[6]); // At(y),CO2i(x) - if (xyPoint1.yIsInRange(-20.0, 50.0)) - atInterData.Add(xyPoint1); + xyPoint1 = new XyPoint(phrases[0], phrases[2]); // Ac(y),CO2i(x) + if (xyPoint1.YIsInRange(-20.0, 50.0)) + _acInterData.Add(xyPoint1); + xyPoint1 = new XyPoint(phrases[0], phrases[4]); // Aj(y),CO2i(x) + if (xyPoint1.YIsInRange(-20.0, 50.0)) + _ajInterData.Add(xyPoint1); + xyPoint1 = new XyPoint(phrases[0], phrases[6]); // At(y),CO2i(x) + if (xyPoint1.YIsInRange(-20.0, 50.0)) + _atInterData.Add(xyPoint1); } } - - return; } /// @@ -174,75 +171,68 @@ namespace LeafWeb.Web.Charter /// /// /// - private ArrayList splitCSVLine(String line) + private static List SplitCsvLine(String line) { int i; - char[] separator; - separator = new char[3]; - separator[0] = ','; - separator[1] = ' '; - separator[2] = '\t'; + var separator = new [] {',', ' ', '\t'}; var phrases = line.Split(separator); - String phrase; //int lastNonBlank = -1; - var retPhrases = new ArrayList(); + var retPhrases = new List(); for (i = 0; i < phrases.Length; i++) { - phrase = phrases[i].Trim(); + var phrase = phrases[i].Trim(); if (phrase.Length > 0) // lastNonBlank = i; retPhrases.Add(phrase); } - //int firstBlankToRemove = lastNonBlank + 1; - //if( firstBlankToRemove <= phrases.Length - 1 ) - // retPhrases.RemoveRange(firstBlankToRemove, phrases.Length - firstBlankToRemove); - return retPhrases; } - public ArrayList getAnetMeasData() + public List> GetAnetMeasData() { - var list = new ArrayList(); - list.Add(anetMeasChloro1Data); - list.Add(anetMeasChloro2Data); - list.Add(anetMeasChloro3Data); - list.Add(anetMeasInter1Data); - list.Add(anetMeasInter2Data); - list.Add(anetMeasInter3Data); + var list = new List> + { + _anetMeasChloro1Data, + _anetMeasChloro2Data, + _anetMeasChloro3Data, + _anetMeasInter1Data, + _anetMeasInter2Data, + _anetMeasInter3Data + }; return list; } - public ArrayList getAcChloroData() + public List GetAcChloroData() { - return acChloroData; + return _acChloroData; } - public ArrayList getAjChloroData() + public List GetAjChloroData() { - return ajChloroData; + return _ajChloroData; } - public ArrayList getAtChloroData() + public List GetAtChloroData() { - return atChloroData; + return _atChloroData; } - public ArrayList getAcInterData() + public List GetAcInterData() { - return acInterData; + return _acInterData; } - public ArrayList getAjInterData() + public List GetAjInterData() { - return ajInterData; + return _ajInterData; } - public ArrayList getAtInterData() + public List GetAtInterData() { - return atInterData; + return _atInterData; } } } \ No newline at end of file diff --git a/Web/Charter/LeafWebCharter.ascx b/Web/Charter/LeafWebCharter.ascx index 933ece1..52aea7a 100644 --- a/Web/Charter/LeafWebCharter.ascx +++ b/Web/Charter/LeafWebCharter.ascx @@ -5,86 +5,7 @@

Charting the Output from LeafWeb Jobs

- - -

- Choose a LeafWeb job: - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
Job number: - -
Submitted by: - -
Job name: - -
Date job finished: - -
-

- -

- Please choose one of the curves to chart.
- - - -
-

diff --git a/Web/Charter/LeafWebCharter.ascx.cs b/Web/Charter/LeafWebCharter.ascx.cs index b780c3a..c45b7c3 100644 --- a/Web/Charter/LeafWebCharter.ascx.cs +++ b/Web/Charter/LeafWebCharter.ascx.cs @@ -1,243 +1,20 @@ using System; -using System.Collections; -using System.Configuration; +using System.Collections.Generic; using System.Data; -using System.Data.SqlClient; using System.Drawing; using System.IO; using System.Web.UI; -using System.Web.UI.WebControls; +using System.Web.UI.DataVisualization.Charting; namespace LeafWeb.Web.Charter { + public partial class LeafWebCharter : UserControl { - private static String hostname = "http://leafweb.ornl.gov"; - //static String hostname = "http://bjerkevpc/leaf"; - - protected void Page_Load(object sender, EventArgs e) - { - //WriteTrace("Got to Page_Load"); - SPFolderCollection subFolders = null; - - if (! IsPostBack) - { - try - { - var siteCollection = new SPSite(hostname); - // WriteTrace("Got siteCollection"); - if (siteCollection == null) - { - WriteTrace("siteCollection is null"); - ErrorLBL.Text = "siteCollection is null"; - ErrorLBL.Visible = true; - return; - } - SPWeb webSite = siteCollection.OpenWeb(); - //WriteTrace("Got webSite"); - if (webSite == null) - { - WriteTrace("webSite is null"); - ErrorLBL.Text = "webSite is null"; - ErrorLBL.Visible = true; - return; - } - SPFolder lofFolder = webSite.GetFolder("LeafOutputFiles"); - //WriteTrace("Got lofFolder"); - if (lofFolder == null) - { - WriteTrace("lofFolder is null"); - ErrorLBL.Text = "lofFolder is null"; - ErrorLBL.Visible = true; - return; - } - subFolders = lofFolder.SubFolders; - //WriteTrace("Got subFolders"); - if (subFolders == null) - { - WriteTrace("subFolders is null"); - ErrorLBL.Text = "subFolders is null"; - ErrorLBL.Visible = true; - return; - } - } - catch (Exception exc) - { - ErrorLBL.Text = "Error locating folder: " + exc.Message; - ErrorLBL.Visible = true; - return; - } - //WriteTrace("# subfoldrs = " + subFolders.Count); - - String folderName, identifier, submittedBy; - DateTime dateSubmitted; - int intName; - String propertyKey; - Object propertyValue; - String dateTimeCreated; - - var dt = new DataTable(); - dt.Columns.Add(new DataColumn("name")); - dt.Columns.Add(new DataColumn("submittedBy")); - dt.Columns.Add(new DataColumn("identifier")); - dt.Columns.Add(new DataColumn("dateSubmitted")); - var dcIntName = new DataColumn("intName"); - dcIntName.DataType = Type.GetType("System.Int32"); - dt.Columns.Add(dcIntName); - //WriteTrace("DataTable initialized"); - DataRow dr; - object obj; - - try - { - foreach (SPFolder f in subFolders) - { - folderName = f.Name; - //WriteTrace("folder name = " + folderName); - try - { - intName = Int32.Parse(folderName); - } - catch (Exception exc) - { - //WriteTrace("That is not a job folder"); - continue; - } - - dr = dt.NewRow(); - dr["name"] = folderName; - dr["intName"] = intName; - - /*System.Collections.Hashtable pc = f.Properties; - IDictionaryEnumerator myEnumerator = pc.GetEnumerator(); - while (myEnumerator.MoveNext()) - { - propertyKey = (String) myEnumerator.Key; - propertyValue = myEnumerator.Value; - }*/ - - identifier = (String) f.Properties["Identifier"]; - submittedBy = (String) f.Properties["Submitted by"]; - //WriteTrace("identifier=" + identifier + ", submitted by=" + submittedBy); - dateTimeCreated = ""; - obj = f.Properties["vti_timecreated"]; - if (obj != null) - { - dateSubmitted = (DateTime) obj; - dateSubmitted = dateSubmitted.AddHours(-5); - dateTimeCreated = dateSubmitted.ToShortDateString() + - " " + dateSubmitted.ToShortTimeString(); - } - //WriteTrace("date=" + dateTimeCreated); - - dr["submittedBy"] = submittedBy; - dr["identifier"] = identifier; - dr["dateSubmitted"] = dateTimeCreated; - dt.Rows.Add(dr); - } - } - catch (Exception exc1) - { - WriteTrace("error browsing folder: " + exc1.Message); - ErrorLBL.Text = "Error browsing folder: " + encodeSqlQuotes(exc1.Message); - ErrorLBL.Visible = true; - return; - } - - // The table just created is not sorted. It can be sorted on the intName - // column by referencing its DefaultView. - - try - { - var dsSorted = new DataSet(); - dt.DefaultView.Sort = "intName ASC"; - - // Add sorted table to dataset, then bind to control. - // NOTE the use of ToTable to produce a datatable from our sorted view. - dsSorted.Tables.Add(dt.DefaultView.ToTable()); - //WriteTrace("dsSorted is ready"); - JobGV.DataSource = dsSorted; - JobGV.DataBind(); - //WriteTrace("GridView is Bound"); - - ChooseJobErrrorLBL.Visible = false; - //WriteTrace("ChooseJobErrrorLBL control made visible"); - CurveChoosePNL.Visible = false; - //WriteTrace("CurveChoosePNL control made visible"); - ChartPNL.Visible = false; - //WriteTrace("ChartPNL control made visible"); - } - catch (Exception exc2) - { - WriteTrace("Error: " + exc2.Message); - } - } - } - - protected void ChooseJob(object sender, EventArgs e) - { - Session["LeafChartData"] = null; - var lb = (LinkButton) sender; - var jobID = lb.CommandArgument; - - var siteCollection = new SPSite(hostname); - SPWeb webSite = siteCollection.OpenWeb(); - SPFolder lofFolder = webSite.GetFolder("LeafOutputFiles"); - SPFolder jobFolder = lofFolder.SubFolders[jobID]; - - SPFileCollection fileSet = jobFolder.Files; - var jobName = ""; - var submittedBy = ""; - jobName = (String) jobFolder.Properties["Identifier"]; - submittedBy = (String) jobFolder.Properties["Submitted by"]; - var dateTimeCreated = ""; - object obj = jobFolder.Properties["vti_timecreated"]; - if (obj != null) - { - var dateSubmitted = (DateTime) obj; - dateSubmitted = dateSubmitted.AddHours(-5); - dateTimeCreated = dateSubmitted.ToShortDateString() + - " " + dateSubmitted.ToShortTimeString(); - } - - var foundFile = false; - if (fileSet != null) - { - foreach (SPFile aFile in fileSet) - { - if (aFile.Name.Contains("cntrlcomparison")) - { - var sr = new StreamReader(aFile.OpenBinaryStream()); - var errorMessage = ""; - ReadFile(sr, ref errorMessage); - sr.Close(); - foundFile = true; - break; - } - } - } - - if (!foundFile) - { - ChooseJobErrrorLBL.Text = "That folder does not contain a file called cntrlcomparison."; - ChooseJobErrrorLBL.Visible = true; - return; - } - - CurveChoosePNL.Visible = true; - JobChoosePNL.Visible = false; - - JobNumberLBL.Text = jobID; - SubmittedByLBL.Text = submittedBy; - JobNameLBL.Text = jobName; - JobDoneDateLBL.Text = dateTimeCreated; - } - - protected void ReadFile(StreamReader sr, ref String errMsg) { var pisOut = new PiscalOutput(); - if (!pisOut.readFromStream(sr, ref errMsg)) + if (!pisOut.ReadFromStream(sr, ref errMsg)) { ErrorLBL.Text = errMsg; ErrorLBL.Visible = true; @@ -252,256 +29,205 @@ namespace LeafWeb.Web.Charter var curveDT = new DataTable(); curveDT.Columns.Add(new DataColumn("curveID")); - DataRow dr; - CurveData aCurve; - var curveData = pisOut.getCurveData(); + var curveData = pisOut.GetCurveData(); for (var i = 0; i < curveData.Count; i++) { - aCurve = (CurveData) curveData[i]; - dr = curveDT.NewRow(); - dr["curveID"] = aCurve.getCurveID(); + var aCurve = curveData[i]; + var dr = curveDT.NewRow(); + dr["curveID"] = aCurve.GetCurveId(); curveDT.Rows.Add(dr); } - CurveDDL.DataSource = curveDT; - CurveDDL.DataTextField = "curveID"; - CurveDDL.DataValueField = "curveID"; - CurveDDL.DataBind(); + //CurveDDL.DataSource = curveDT; + //CurveDDL.DataTextField = "curveID"; + //CurveDDL.DataValueField = "curveID"; + //CurveDDL.DataBind(); } - protected void ProduceChartBTN_Click(object sender, EventArgs e) + public void ProduceChartBTN_Click(PiscalOutput pisOut) { - ChartPNL.Visible = true; - - var pisOut = (PiscalOutput) Session["LeafChartData"]; - // If the session has timed out, use the selected index from the GridView // to determine which job to chart. - if (pisOut == null) - { - var selectedIndex = JobGV.SelectedIndex; - var gvr = JobGV.Rows[selectedIndex]; - var nameLB = (LinkButton) gvr.FindControl("NameLB"); - var jobID = nameLB.Text; + // if (aFile.Name.Contains("cntrlcomparison")) + // { + // var sr = new StreamReader(aFile.OpenBinaryStream()); + // var errorMessage = ""; + // ReadFile(sr, ref errorMessage); + // sr.Close(); + // break; + // } - var siteCollection = new SPSite(hostname); - SPWeb webSite = siteCollection.OpenWeb(); - SPFolder lofFolder = webSite.GetFolder("LeafOutputFiles"); - SPFolder jobFolder = lofFolder.SubFolders[jobID]; + var curveData = pisOut.GetCurveData(); + var curve = curveData[1]; + var curveId = curve.GetCurveId(); - SPFileCollection fileSet = jobFolder.Files; + var paramSet1 = curve.GetParamSet1(); + var paramSet2 = curve.GetParamSet2(); + var paramSet3 = curve.GetParamSet3(); + var paramSet4 = curve.GetParamSet4(); - if (fileSet != null) - { - foreach (SPFile aFile in fileSet) - { - if (aFile.Name.Contains("cntrlcomparison")) - { - var sr = new StreamReader(aFile.OpenBinaryStream()); - var errorMessage = ""; - ReadFile(sr, ref errorMessage); - sr.Close(); - break; - } - } - } - pisOut = (PiscalOutput) Session["LeafChartData"]; - } + var paramSet1Anet = paramSet1.GetAnetMeasData(); + var paramSet2Anet = paramSet2.GetAnetMeasData(); + var paramSet3Anet = paramSet3.GetAnetMeasData(); + var paramSet4Anet = paramSet4.GetAnetMeasData(); - var curveData = pisOut.getCurveData(); - var curve = (CurveData) curveData[CurveDDL.SelectedIndex]; - var curveID = curve.getCurveID(); + var anetMeasChloro1PS1Data = paramSet1Anet[0]; + var anetMeasChloro2PS1Data = paramSet1Anet[1]; + var anetMeasChloro3PS1Data = paramSet1Anet[2]; + var anetMeasChloro1PS2Data = paramSet2Anet[0]; + var anetMeasChloro2PS2Data = paramSet2Anet[1]; + var anetMeasChloro3PS2Data = paramSet2Anet[2]; + var anetMeasChloro1PS3Data = paramSet3Anet[0]; + var anetMeasChloro2PS3Data = paramSet3Anet[1]; + var anetMeasChloro3PS3Data = paramSet3Anet[2]; + var anetMeasChloro1PS4Data = paramSet4Anet[0]; + var anetMeasChloro2PS4Data = paramSet4Anet[1]; + var anetMeasChloro3PS4Data = paramSet4Anet[2]; - CurveParamSet paramSet1 = null; - CurveParamSet paramSet2 = null; - CurveParamSet paramSet3 = null; - CurveParamSet paramSet4 = null; - paramSet1 = curve.getParamSet1(); - paramSet2 = curve.getParamSet2(); - paramSet3 = curve.getParamSet3(); - paramSet4 = curve.getParamSet4(); - - var paramSet1Anet = paramSet1.getAnetMeasData(); - var paramSet2Anet = paramSet2.getAnetMeasData(); - var paramSet3Anet = paramSet3.getAnetMeasData(); - var paramSet4Anet = paramSet4.getAnetMeasData(); - - var anetMeasChloro1PS1Data = (ArrayList) paramSet1Anet[0]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasChloro2PS1Data = (ArrayList) paramSet1Anet[1]; //.getAnetMeasData(2); - var anetMeasChloro3PS1Data = (ArrayList) paramSet1Anet[2]; //.getAnetMeasData(3); - var anetMeasChloro1PS2Data = (ArrayList) paramSet2Anet[0]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasChloro2PS2Data = (ArrayList) paramSet2Anet[1]; //.getAnetMeasData(2); - var anetMeasChloro3PS2Data = (ArrayList) paramSet2Anet[2]; //.getAnetMeasData(3); - var anetMeasChloro1PS3Data = (ArrayList) paramSet3Anet[0]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasChloro2PS3Data = (ArrayList) paramSet3Anet[1]; //.getAnetMeasData(2); - var anetMeasChloro3PS3Data = (ArrayList) paramSet3Anet[2]; //.getAnetMeasData(3); - var anetMeasChloro1PS4Data = (ArrayList) paramSet4Anet[0]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasChloro2PS4Data = (ArrayList) paramSet4Anet[1]; //.getAnetMeasData(2); - var anetMeasChloro3PS4Data = (ArrayList) paramSet4Anet[2]; //.getAnetMeasData(3); - - var anetMeasInter1PS1Data = (ArrayList) paramSet1Anet[3]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasInter2PS1Data = (ArrayList) paramSet1Anet[4]; //.getAnetMeasData(2); - var anetMeasInter3PS1Data = (ArrayList) paramSet1Anet[5]; //.getAnetMeasData(3); - var anetMeasInter1PS2Data = (ArrayList) paramSet2Anet[3]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasInter2PS2Data = (ArrayList) paramSet2Anet[4]; //.getAnetMeasData(2); - var anetMeasInter3PS2Data = (ArrayList) paramSet2Anet[5]; //.getAnetMeasData(3); - var anetMeasInter1PS3Data = (ArrayList) paramSet3Anet[3]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasInter2PS3Data = (ArrayList) paramSet3Anet[4]; //.getAnetMeasData(2); - var anetMeasInter3PS3Data = (ArrayList) paramSet3Anet[5]; //.getAnetMeasData(3); - var anetMeasInter1PS4Data = (ArrayList) paramSet4Anet[3]; - //.getAnetMeasData(1); // These are arrays of XYPoint objects - var anetMeasInter2PS4Data = (ArrayList) paramSet4Anet[4]; //.getAnetMeasData(2); - var anetMeasInter3PS4Data = (ArrayList) paramSet4Anet[5]; //.getAnetMeasData(3); - - XYPoint xy; - int i; - double maxX1 = 0.0, - maxX2 = 0.0, - maxX3 = 0.0, - maxX4 = 0.0, - maxX5 = 0.0, - maxX6 = 0.0, - maxX7 = 0.0, - maxX8 = 0.0; + var anetMeasInter1PS1Data = paramSet1Anet[3]; + var anetMeasInter2PS1Data = paramSet1Anet[4]; + var anetMeasInter3PS1Data = paramSet1Anet[5]; + var anetMeasInter1PS2Data = paramSet2Anet[3]; + var anetMeasInter2PS2Data = paramSet2Anet[4]; + var anetMeasInter3PS2Data = paramSet2Anet[5]; + var anetMeasInter1PS3Data = paramSet3Anet[3]; + var anetMeasInter2PS3Data = paramSet3Anet[4]; + var anetMeasInter3PS3Data = paramSet3Anet[5]; + var anetMeasInter1PS4Data = paramSet4Anet[3]; + var anetMeasInter2PS4Data = paramSet4Anet[4]; + var anetMeasInter3PS4Data = paramSet4Anet[5]; // Set the points for the symbol series for paramater set 1, chloroplastic - setAnetMeasPoints(anetMeasChloro1PS1Data, ChartChloro1.Series["Rubisco-limited"], ref maxX1); - setAnetMeasPoints(anetMeasChloro2PS1Data, ChartChloro1.Series["RuBP regeneration-limited"], ref maxX1); + setAnetMeasPoints(anetMeasChloro1PS1Data, ChartChloro1.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasChloro2PS1Data, ChartChloro1.Series["RuBP regeneration-limited"]); var tpuSeries = newTPUSeries(anetMeasChloro3PS1Data); - setAnetMeasPoints(anetMeasChloro3PS1Data, tpuSeries, ref maxX1); + setAnetMeasPoints(anetMeasChloro3PS1Data, tpuSeries); ChartChloro1.Series.Add(tpuSeries); // Set the points for the symbol series for paramater set 2, chloroplastic - setAnetMeasPoints(anetMeasChloro1PS2Data, ChartChloro2.Series["Rubisco-limited"], ref maxX2); - setAnetMeasPoints(anetMeasChloro2PS2Data, ChartChloro2.Series["RuBP regeneration-limited"], ref maxX2); + setAnetMeasPoints(anetMeasChloro1PS2Data, ChartChloro2.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasChloro2PS2Data, ChartChloro2.Series["RuBP regeneration-limited"]); tpuSeries = newTPUSeries(anetMeasChloro3PS2Data); - setAnetMeasPoints(anetMeasChloro3PS2Data, tpuSeries, ref maxX2); + setAnetMeasPoints(anetMeasChloro3PS2Data, tpuSeries); ChartChloro2.Series.Add(tpuSeries); // Set the points for the symbol series for paramater set 3, chloroplastic - setAnetMeasPoints(anetMeasChloro1PS3Data, ChartChloro3.Series["Rubisco-limited"], ref maxX3); - setAnetMeasPoints(anetMeasChloro2PS3Data, ChartChloro3.Series["RuBP regeneration-limited"], ref maxX3); + setAnetMeasPoints(anetMeasChloro1PS3Data, ChartChloro3.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasChloro2PS3Data, ChartChloro3.Series["RuBP regeneration-limited"]); tpuSeries = newTPUSeries(anetMeasChloro3PS3Data); - setAnetMeasPoints(anetMeasChloro3PS3Data, tpuSeries, ref maxX3); + setAnetMeasPoints(anetMeasChloro3PS3Data, tpuSeries); ChartChloro3.Series.Add(tpuSeries); // Set the points for the symbol series for paramater set 4, chloroplastic - setAnetMeasPoints(anetMeasChloro1PS4Data, ChartChloro4.Series["Rubisco-limited"], ref maxX4); - setAnetMeasPoints(anetMeasChloro2PS4Data, ChartChloro4.Series["RuBP regeneration-limited"], ref maxX4); + setAnetMeasPoints(anetMeasChloro1PS4Data, ChartChloro4.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasChloro2PS4Data, ChartChloro4.Series["RuBP regeneration-limited"]); tpuSeries = newTPUSeries(anetMeasChloro3PS4Data); - setAnetMeasPoints(anetMeasChloro3PS4Data, tpuSeries, ref maxX4); + setAnetMeasPoints(anetMeasChloro3PS4Data, tpuSeries); ChartChloro4.Series.Add(tpuSeries); // Set the points for the symbol series for paramater set 1, intercellular - setAnetMeasPoints(anetMeasInter1PS1Data, ChartInter1.Series["Rubisco-limited"], ref maxX5); - setAnetMeasPoints(anetMeasInter2PS1Data, ChartInter1.Series["RuBP regeneration-limited"], ref maxX5); + setAnetMeasPoints(anetMeasInter1PS1Data, ChartInter1.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasInter2PS1Data, ChartInter1.Series["RuBP regeneration-limited"]); tpuSeries = newTPUSeries(anetMeasInter3PS1Data); - setAnetMeasPoints(anetMeasInter3PS1Data, tpuSeries, ref maxX5); + setAnetMeasPoints(anetMeasInter3PS1Data, tpuSeries); ChartInter1.Series.Add(tpuSeries); // Set the points for the symbol series for paramater set 2, intercellular - setAnetMeasPoints(anetMeasInter1PS2Data, ChartInter2.Series["Rubisco-limited"], ref maxX6); - setAnetMeasPoints(anetMeasInter2PS2Data, ChartInter2.Series["RuBP regeneration-limited"], ref maxX6); + setAnetMeasPoints(anetMeasInter1PS2Data, ChartInter2.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasInter2PS2Data, ChartInter2.Series["RuBP regeneration-limited"]); tpuSeries = newTPUSeries(anetMeasInter3PS2Data); - setAnetMeasPoints(anetMeasInter3PS2Data, tpuSeries, ref maxX6); + setAnetMeasPoints(anetMeasInter3PS2Data, tpuSeries); ChartInter2.Series.Add(tpuSeries); // Set the points for the symbol series for paramater set 3, intercellular - setAnetMeasPoints(anetMeasInter1PS3Data, ChartInter3.Series["Rubisco-limited"], ref maxX7); - setAnetMeasPoints(anetMeasInter2PS3Data, ChartInter3.Series["RuBP regeneration-limited"], ref maxX7); + setAnetMeasPoints(anetMeasInter1PS3Data, ChartInter3.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasInter2PS3Data, ChartInter3.Series["RuBP regeneration-limited"]); tpuSeries = newTPUSeries(anetMeasInter3PS3Data); - setAnetMeasPoints(anetMeasInter3PS3Data, tpuSeries, ref maxX7); + setAnetMeasPoints(anetMeasInter3PS3Data, tpuSeries); ChartInter3.Series.Add(tpuSeries); // Set the points for the symbol series for paramater set 4, intercellular - setAnetMeasPoints(anetMeasInter1PS4Data, ChartInter4.Series["Rubisco-limited"], ref maxX8); - setAnetMeasPoints(anetMeasInter2PS4Data, ChartInter4.Series["RuBP regeneration-limited"], ref maxX8); + setAnetMeasPoints(anetMeasInter1PS4Data, ChartInter4.Series["Rubisco-limited"]); + setAnetMeasPoints(anetMeasInter2PS4Data, ChartInter4.Series["RuBP regeneration-limited"]); tpuSeries = newTPUSeries(anetMeasInter3PS4Data); - setAnetMeasPoints(anetMeasInter3PS4Data, tpuSeries, ref maxX8); + setAnetMeasPoints(anetMeasInter3PS4Data, tpuSeries); ChartInter4.Series.Add(tpuSeries); - var acChloroListPS1 = paramSet1.getAcChloroData(); - var ajChloroListPS1 = paramSet1.getAjChloroData(); - var atChloroListPS1 = paramSet1.getAtChloroData(); - var acChloroListPS2 = paramSet2.getAcChloroData(); - var ajChloroListPS2 = paramSet2.getAjChloroData(); - var atChloroListPS2 = paramSet2.getAtChloroData(); - var acChloroListPS3 = paramSet3.getAcChloroData(); - var ajChloroListPS3 = paramSet3.getAjChloroData(); - var atChloroListPS3 = paramSet3.getAtChloroData(); - var acChloroListPS4 = paramSet4.getAcChloroData(); - var ajChloroListPS4 = paramSet4.getAjChloroData(); - var atChloroListPS4 = paramSet4.getAtChloroData(); + var acChloroListPS1 = paramSet1.GetAcChloroData(); + var ajChloroListPS1 = paramSet1.GetAjChloroData(); + var atChloroListPS1 = paramSet1.GetAtChloroData(); + var acChloroListPS2 = paramSet2.GetAcChloroData(); + var ajChloroListPS2 = paramSet2.GetAjChloroData(); + var atChloroListPS2 = paramSet2.GetAtChloroData(); + var acChloroListPS3 = paramSet3.GetAcChloroData(); + var ajChloroListPS3 = paramSet3.GetAjChloroData(); + var atChloroListPS3 = paramSet3.GetAtChloroData(); + var acChloroListPS4 = paramSet4.GetAcChloroData(); + var ajChloroListPS4 = paramSet4.GetAjChloroData(); + var atChloroListPS4 = paramSet4.GetAtChloroData(); - var acInterListPS1 = paramSet1.getAcInterData(); - var ajInterListPS1 = paramSet1.getAjInterData(); - var atInterListPS1 = paramSet1.getAtInterData(); - var acInterListPS2 = paramSet2.getAcInterData(); - var ajInterListPS2 = paramSet2.getAjInterData(); - var atInterListPS2 = paramSet2.getAtInterData(); - var acInterListPS3 = paramSet3.getAcInterData(); - var ajInterListPS3 = paramSet3.getAjInterData(); - var atInterListPS3 = paramSet3.getAtInterData(); - var acInterListPS4 = paramSet4.getAcInterData(); - var ajInterListPS4 = paramSet4.getAjInterData(); - var atInterListPS4 = paramSet4.getAtInterData(); + var acInterListPS1 = paramSet1.GetAcInterData(); + var ajInterListPS1 = paramSet1.GetAjInterData(); + var atInterListPS1 = paramSet1.GetAtInterData(); + var acInterListPS2 = paramSet2.GetAcInterData(); + var ajInterListPS2 = paramSet2.GetAjInterData(); + var atInterListPS2 = paramSet2.GetAtInterData(); + var acInterListPS3 = paramSet3.GetAcInterData(); + var ajInterListPS3 = paramSet3.GetAjInterData(); + var atInterListPS3 = paramSet3.GetAtInterData(); + var acInterListPS4 = paramSet4.GetAcInterData(); + var ajInterListPS4 = paramSet4.GetAjInterData(); + var atInterListPS4 = paramSet4.GetAtInterData(); // Set the points on the asymptote curve for parameter set 1, chloroplast - setAsymptotePoints(acChloroListPS1, ChartChloro1.Series["acCurve"], ref maxX1); - setAsymptotePoints(ajChloroListPS1, ChartChloro1.Series["ajCurve"], ref maxX1); - setAsymptotePoints(atChloroListPS1, ChartChloro1.Series["atCurve"], ref maxX1); + setAsymptotePoints(acChloroListPS1, ChartChloro1.Series["acCurve"]); + setAsymptotePoints(ajChloroListPS1, ChartChloro1.Series["ajCurve"]); + setAsymptotePoints(atChloroListPS1, ChartChloro1.Series["atCurve"]); // Set the points on the asymptote curve for parameter set 2, chloroplast - setAsymptotePoints(acChloroListPS2, ChartChloro2.Series["acCurve"], ref maxX2); - setAsymptotePoints(ajChloroListPS2, ChartChloro2.Series["ajCurve"], ref maxX2); - setAsymptotePoints(atChloroListPS2, ChartChloro2.Series["atCurve"], ref maxX2); + setAsymptotePoints(acChloroListPS2, ChartChloro2.Series["acCurve"]); + setAsymptotePoints(ajChloroListPS2, ChartChloro2.Series["ajCurve"]); + setAsymptotePoints(atChloroListPS2, ChartChloro2.Series["atCurve"]); // Set the points on the asymptote curve for parameter set 3, chloroplast - setAsymptotePoints(acChloroListPS3, ChartChloro3.Series["acCurve"], ref maxX3); - setAsymptotePoints(ajChloroListPS3, ChartChloro3.Series["ajCurve"], ref maxX3); - setAsymptotePoints(atChloroListPS3, ChartChloro3.Series["atCurve"], ref maxX3); + setAsymptotePoints(acChloroListPS3, ChartChloro3.Series["acCurve"]); + setAsymptotePoints(ajChloroListPS3, ChartChloro3.Series["ajCurve"]); + setAsymptotePoints(atChloroListPS3, ChartChloro3.Series["atCurve"]); // Set the points on the asymptote curve for parameter set 4, chloroplast - setAsymptotePoints(acChloroListPS4, ChartChloro4.Series["acCurve"], ref maxX4); - setAsymptotePoints(ajChloroListPS4, ChartChloro4.Series["ajCurve"], ref maxX4); - setAsymptotePoints(atChloroListPS4, ChartChloro4.Series["atCurve"], ref maxX4); + setAsymptotePoints(acChloroListPS4, ChartChloro4.Series["acCurve"]); + setAsymptotePoints(ajChloroListPS4, ChartChloro4.Series["ajCurve"]); + setAsymptotePoints(atChloroListPS4, ChartChloro4.Series["atCurve"]); // Set the points on the asymptote curve for parameter set 1, intercellular - setAsymptotePoints(acInterListPS1, ChartInter1.Series["acCurve"], ref maxX5); - setAsymptotePoints(ajInterListPS1, ChartInter1.Series["ajCurve"], ref maxX5); - setAsymptotePoints(atInterListPS1, ChartInter1.Series["atCurve"], ref maxX5); + setAsymptotePoints(acInterListPS1, ChartInter1.Series["acCurve"]); + setAsymptotePoints(ajInterListPS1, ChartInter1.Series["ajCurve"]); + setAsymptotePoints(atInterListPS1, ChartInter1.Series["atCurve"]); // Set the points on the asymptote curve for parameter set 2, intercellular - setAsymptotePoints(acInterListPS2, ChartInter2.Series["acCurve"], ref maxX6); - setAsymptotePoints(ajInterListPS2, ChartInter2.Series["ajCurve"], ref maxX6); - setAsymptotePoints(atInterListPS2, ChartInter2.Series["atCurve"], ref maxX6); + setAsymptotePoints(acInterListPS2, ChartInter2.Series["acCurve"]); + setAsymptotePoints(ajInterListPS2, ChartInter2.Series["ajCurve"]); + setAsymptotePoints(atInterListPS2, ChartInter2.Series["atCurve"]); // Set the points on the asymptote curve for parameter set 3, intercellular - setAsymptotePoints(acInterListPS3, ChartInter3.Series["acCurve"], ref maxX7); - setAsymptotePoints(ajInterListPS3, ChartInter3.Series["ajCurve"], ref maxX7); - setAsymptotePoints(atInterListPS3, ChartInter3.Series["atCurve"], ref maxX7); + setAsymptotePoints(acInterListPS3, ChartInter3.Series["acCurve"]); + setAsymptotePoints(ajInterListPS3, ChartInter3.Series["ajCurve"]); + setAsymptotePoints(atInterListPS3, ChartInter3.Series["atCurve"]); // Set the points on the asymptote curve for parameter set 4, intercellular - setAsymptotePoints(acInterListPS4, ChartInter4.Series["acCurve"], ref maxX8); - setAsymptotePoints(ajInterListPS4, ChartInter4.Series["ajCurve"], ref maxX8); - setAsymptotePoints(atInterListPS4, ChartInter4.Series["atCurve"], ref maxX8); + setAsymptotePoints(acInterListPS4, ChartInter4.Series["acCurve"]); + setAsymptotePoints(ajInterListPS4, ChartInter4.Series["ajCurve"]); + setAsymptotePoints(atInterListPS4, ChartInter4.Series["atCurve"]); // Now, set the minimum and maximum values for the X-axis. The // Y-axis seems to be doing OK in auto mode. @@ -514,25 +240,25 @@ namespace LeafWeb.Web.Charter var axisFont = new Font("Times New Roman", 12, FontStyle.Bold); var titleFont = new Font("Times New Roman", 12, FontStyle.Bold); - var titlePS1 = new Title("LeafWeb curveID = " + curveID + + var titlePS1 = new Title("LeafWeb curveID = " + curveId + "\nInternal conductance fixed, compensation point and M-M constants fixed"); titlePS1.Font = titleFont; ChartChloro1.Titles.Add(titlePS1); ChartInter1.Titles.Add(titlePS1); - var titlePS2 = new Title("LeafWeb curveID = " + curveID + + var titlePS2 = new Title("LeafWeb curveID = " + curveId + "\nInternal conductance fixed, compensation point and M-M constants estimated"); titlePS2.Font = titleFont; ChartChloro2.Titles.Add(titlePS2); ChartInter2.Titles.Add(titlePS2); - var titlePS3 = new Title("LeafWeb curveID = " + curveID + + var titlePS3 = new Title("LeafWeb curveID = " + curveId + "\nInternal conductance estimated, compensation point and M-M constants fixed"); titlePS3.Font = titleFont; ChartChloro3.Titles.Add(titlePS3); ChartInter3.Titles.Add(titlePS3); - var titlePS4 = new Title("LeafWeb curveID = " + curveID + + var titlePS4 = new Title("LeafWeb curveID = " + curveId + "\nInternal conductance estimated, compensation point and M-M constants estimated"); titlePS4.Font = titleFont; ChartChloro4.Titles.Add(titlePS4); @@ -557,7 +283,7 @@ namespace LeafWeb.Web.Charter ChartInter4.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont; } - private Series newTPUSeries(ArrayList data) + private Series newTPUSeries(IReadOnlyCollection data) { var seriesName = "TPU-limited"; if (data.Count == 0) @@ -577,106 +303,25 @@ namespace LeafWeb.Web.Charter return series3; } - private void setAnetMeasPoints(ArrayList data, Series series, ref double xMax) + private void setAnetMeasPoints(List data, Series series) { // Set the points for the series from the ArrayList - - XYPoint xy; - int i; - - for (i = 0; i < data.Count; i++) + foreach (var xy in data) { - xy = (XYPoint) data[i]; - series.Points.AddXY(xy.getX(), xy.getY()); - if (xy.getX() > xMax) - xMax = xy.getX(); + series.Points.AddXY(xy.X, xy.Y); } } - private void setAsymptotePoints(ArrayList data, Series series, ref double xMax) + private void setAsymptotePoints(List data, Series series) { // Set the points for the series from the ArrayList - - XYPoint xy; - int i; - - for (i = 0; i < data.Count; i++) + foreach (var xy in data) { - xy = (XYPoint) data[i]; - if ((xy.getX() != -9999) && (xy.getY() != -9999)) + if ((xy.X != -9999) && (xy.Y != -9999)) { - series.Points.AddXY(xy.getX(), xy.getY()); - if (xy.getX() > xMax) - xMax = xy.getX(); + series.Points.AddXY(xy.X, xy.Y); } } } - - protected void BackToJobList(object sender, EventArgs e) - { - JobChoosePNL.Visible = true; - ChooseJobErrrorLBL.Visible = false; - CurveChoosePNL.Visible = false; - ChartPNL.Visible = false; - } - - private void WriteTrace(String str) - { - var conn = getDbConn(); - if (conn != null) - { - var sqlString = "insert into LogEntry (text,logdate) values('" + str + "',getdate())"; - var cmd = new SqlCommand(sqlString, conn); - - try - { - cmd.ExecuteNonQuery(); - } - catch (Exception ex2) - { - conn.Close(); - return; - } - - conn.Close(); - } - } - - public static SqlConnection getDbConn() - { - // Determine what environment we are in - var reader = new AppSettingsReader(); - var environment = reader.GetValue("UserRealm", Type.GetType("System.String")).ToString(); - - // Set the datasource based on the environment - string dataSource; - if (environment == "PROD") - dataSource = "mssql.ornl.gov"; - else if (environment == "QA") - dataSource = "qamssql.ornl.gov"; - else - dataSource = "devmssql.ornl.gov"; - - // Build the connection string - var connString = "Data Source=" + dataSource + ";Initial Catalog=aci;User ID=xpl;Password=xxxxxxxx;"; - - SqlConnection conn = null; - try - { - conn = new SqlConnection(connString); - conn.Open(); - } - catch (Exception e) - { - var error = e.Message; - return null; - } - return conn; - } - - public String encodeSqlQuotes(String str) - { - return str.Replace("'", "''"); - } } } \ No newline at end of file diff --git a/Web/Charter/LeafWebCharter.ascx.designer.cs b/Web/Charter/LeafWebCharter.ascx.designer.cs index 689edb3..beb0acd 100644 --- a/Web/Charter/LeafWebCharter.ascx.designer.cs +++ b/Web/Charter/LeafWebCharter.ascx.designer.cs @@ -21,105 +21,6 @@ namespace LeafWeb.Web.Charter { /// protected global::System.Web.UI.WebControls.Label ErrorLBL; - /// - /// JobChoosePNL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel JobChoosePNL; - - /// - /// ChooseJobErrrorLBL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label ChooseJobErrrorLBL; - - /// - /// JobGV control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.GridView JobGV; - - /// - /// CurveChoosePNL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel CurveChoosePNL; - - /// - /// JobNumberLBL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label JobNumberLBL; - - /// - /// SubmittedByLBL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label SubmittedByLBL; - - /// - /// JobNameLBL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label JobNameLBL; - - /// - /// JobDoneDateLBL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label JobDoneDateLBL; - - /// - /// BackToJobListBTN control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button BackToJobListBTN; - - /// - /// CurveDDL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList CurveDDL; - - /// - /// ProduceChartBTN control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button ProduceChartBTN; - /// /// ChartPNL control. /// diff --git a/Web/Charter/PiscalOutput.cs b/Web/Charter/PiscalOutput.cs index 9e05415..cfc1afe 100644 --- a/Web/Charter/PiscalOutput.cs +++ b/Web/Charter/PiscalOutput.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using System.IO; namespace LeafWeb.Web.Charter @@ -7,22 +7,17 @@ namespace LeafWeb.Web.Charter [Serializable] public class PiscalOutput { - private int nbrCurves; // This is the number of input files that were processed. - private readonly ArrayList curveData; // Each element will be a PiscalCurve element that contains + private readonly List _curveData; // Each element will be a PiscalCurve element that contains // all of the output data for one curve. public PiscalOutput() { - nbrCurves = 0; - curveData = new ArrayList(); + _curveData = new List(); } - public bool readFromStream(StreamReader sr, ref String errorMsg) + public bool ReadFromStream(StreamReader sr, ref String errorMsg) { - CurveData curve; - // Skip the first two lines. - sr.ReadLine(); sr.ReadLine(); var lineNbr = 2; @@ -34,45 +29,20 @@ namespace LeafWeb.Web.Charter var more = true; while (more) { - curve = new CurveData(sr, ref errorMsg, ref lineNbr); + var curve = new CurveData(sr, ref errorMsg, ref lineNbr); if (errorMsg.Length > 0) return false; - curveData.Add(curve); + _curveData.Add(curve); if (sr.EndOfStream) more = false; } return true; } - public bool readFromDataFile(Stream fileStream, ref String errorMsg) + public List GetCurveData() { - StreamReader sr; - - if (fileStream == null) - { - errorMsg = "Please choose a data file first"; - return false; - } - - try - { - sr = new StreamReader(fileStream); - } - catch (Exception openExc) - { - errorMsg = "Error opening file: " + openExc.Message; - return false; - } - - readFromStream(sr, ref errorMsg); - sr.Close(); - return true; - } - - public ArrayList getCurveData() - { - return curveData; + return _curveData; } } } \ No newline at end of file diff --git a/Web/Charter/XYPoint.cs b/Web/Charter/XYPoint.cs index ac26c51..00e4932 100644 --- a/Web/Charter/XYPoint.cs +++ b/Web/Charter/XYPoint.cs @@ -3,49 +3,21 @@ namespace LeafWeb.Web.Charter { [Serializable] - public class XYPoint + public class XyPoint { - private double x; - private double y; - - public XYPoint(double x1, double y1) + public XyPoint(String x, String y) { - x = x1; - y = y1; + X = Double.Parse(x); + Y = Double.Parse(y); } - public XYPoint(String x1, String y1) - { - x = Double.Parse(x1); - y = Double.Parse(y1); - } + public double X { get; private set; } - public double getX() - { - return x; - } + public double Y { get; private set; } - public void setX(double x1) + public bool YIsInRange(double lowEnd, double highEnd) { - x = x1; - } - - public double getY() - { - return y; - } - - public void setY(double y1) - { - y = y1; - } - - public bool yIsInRange(double lowEnd, double highEnd) - { - if ((y >= lowEnd) && (y <= highEnd)) - return true; - else - return false; + return (Y >= lowEnd) && (Y <= highEnd); } } } \ No newline at end of file