Refactor Charter code

This commit is contained in:
2015-11-21 23:10:52 -05:00
parent 5aaed082c9
commit 50304be0c9
7 changed files with 264 additions and 873 deletions
+19 -27
View File
@@ -6,62 +6,54 @@ namespace LeafWeb.Web.Charter
[Serializable] [Serializable]
public class CurveData public class CurveData
{ {
private readonly String curveID; private readonly String _curveId;
private readonly CurveParamSet paramSet1; private readonly CurveParamSet _paramSet1;
private readonly CurveParamSet paramSet2; private readonly CurveParamSet _paramSet2;
private readonly CurveParamSet paramSet3; private readonly CurveParamSet _paramSet3;
private readonly CurveParamSet paramSet4; private readonly CurveParamSet _paramSet4;
public CurveData()
{
}
public CurveData(StreamReader sr, ref String errMsg, ref int lineNbr) public CurveData(StreamReader sr, ref String errMsg, ref int lineNbr)
{ {
// For each curve in the output file there are four sets of data. // 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) if (errMsg.Length > 0)
return; 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) if (errMsg.Length > 0)
return; 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) if (errMsg.Length > 0)
return; return;
paramSet4 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID); _paramSet4 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId);
if (errMsg.Length > 0)
return;
return;
} }
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;
} }
} }
} }
+89 -99
View File
@@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
@@ -8,43 +8,42 @@ namespace LeafWeb.Web.Charter
[Serializable] [Serializable]
public class CurveParamSet public class CurveParamSet
{ {
private readonly ArrayList anetMeasChloro1Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=1 private readonly List<XyPoint> _anetMeasChloro1Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=1
private readonly ArrayList anetMeasChloro2Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=2 private readonly List<XyPoint> _anetMeasChloro2Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=2
private readonly ArrayList anetMeasChloro3Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=3 private readonly List<XyPoint> _anetMeasChloro3Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=3
private readonly ArrayList anetMeasInter1Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=1 private readonly List<XyPoint> _anetMeasInter1Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=1
private readonly ArrayList anetMeasInter2Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=2 private readonly List<XyPoint> _anetMeasInter2Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=2
private readonly ArrayList anetMeasInter3Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=3 private readonly List<XyPoint> _anetMeasInter3Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=3
private readonly ArrayList acChloroData; // y=Ac column, x=CO2cc column private readonly List<XyPoint> _acChloroData; // y=Ac column, x=CO2cc column
private readonly ArrayList ajChloroData; // y=Aj column, x=CO2cj column private readonly List<XyPoint> _ajChloroData; // y=Aj column, x=CO2cj column
private readonly ArrayList atChloroData; // y=At column, x=CO2ct column private readonly List<XyPoint> _atChloroData; // y=At column, x=CO2ct column
private readonly ArrayList acInterData; // y=Ac column, x=CO2i column private readonly List<XyPoint> _acInterData; // y=Ac column, x=CO2i column
private readonly ArrayList ajInterData; // y=Aj column, x=CO2i column private readonly List<XyPoint> _ajInterData; // y=Aj column, x=CO2i column
private readonly ArrayList atInterData; // y=At column, x=CO2i column private readonly List<XyPoint> _atInterData; // y=At column, x=CO2i column
public CurveParamSet() 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; bool curveIdSet = false, doneWithAnet = false;
String line, firstField; String line;
var errorMsg = new StringBuilder(""); var errorMsg = new StringBuilder("");
ArrayList phrases; List<string> phrases;
XYPoint xyPoint1, xyPoint2; XyPoint xyPoint1;
int pointLimitType; _anetMeasChloro1Data = new List<XyPoint>();
anetMeasChloro1Data = new ArrayList(); _anetMeasChloro2Data = new List<XyPoint>();
anetMeasChloro2Data = new ArrayList(); _anetMeasChloro3Data = new List<XyPoint>();
anetMeasChloro3Data = new ArrayList(); _anetMeasInter1Data = new List<XyPoint>();
anetMeasInter1Data = new ArrayList(); _anetMeasInter2Data = new List<XyPoint>();
anetMeasInter2Data = new ArrayList(); _anetMeasInter3Data = new List<XyPoint>();
anetMeasInter3Data = new ArrayList(); _acChloroData = new List<XyPoint>();
acChloroData = new ArrayList(); _ajChloroData = new List<XyPoint>();
ajChloroData = new ArrayList(); _atChloroData = new List<XyPoint>();
atChloroData = new ArrayList(); _acInterData = new List<XyPoint>();
acInterData = new ArrayList(); _ajInterData = new List<XyPoint>();
ajInterData = new ArrayList(); _atInterData = new List<XyPoint>();
atInterData = new ArrayList();
while (!doneWithAnet) while (!doneWithAnet)
{ {
@@ -58,9 +57,9 @@ namespace LeafWeb.Web.Charter
return; return;
} }
phrases = splitCSVLine(line); phrases = SplitCsvLine(line);
firstField = (String) phrases[0]; String firstField = phrases[0];
if (firstField.Equals("CO2i")) if (firstField.Equals("CO2i"))
{ {
doneWithAnet = true; doneWithAnet = true;
@@ -84,27 +83,27 @@ namespace LeafWeb.Web.Charter
// 12 weitedrms // 12 weitedrms
// 13 PointLimitType // 13 PointLimitType
if (!curveIDSet) if (!curveIdSet)
{ {
curveID = firstField; curveId = firstField;
curveIDSet = true; curveIdSet = true;
} }
xyPoint1 = new XYPoint((String) phrases[9], (String) phrases[10]); // AnetMeas(y), PCO2c(x) xyPoint1 = new XyPoint(phrases[9], phrases[10]); // AnetMeas(y), PCO2c(x)
xyPoint2 = new XYPoint((String) phrases[8], (String) phrases[10]); // AnetMeas(y), PCO2i(x) var xyPoint2 = new XyPoint(phrases[8], phrases[10]);
pointLimitType = Int32.Parse((String) phrases[13]); var pointLimitType = Int32.Parse(phrases[13]);
switch (pointLimitType) switch (pointLimitType)
{ {
case 1: case 1:
anetMeasChloro1Data.Add(xyPoint1); _anetMeasChloro1Data.Add(xyPoint1);
anetMeasInter1Data.Add(xyPoint2); _anetMeasInter1Data.Add(xyPoint2);
break; break;
case 2: case 2:
anetMeasChloro2Data.Add(xyPoint1); _anetMeasChloro2Data.Add(xyPoint1);
anetMeasInter2Data.Add(xyPoint2); _anetMeasInter2Data.Add(xyPoint2);
break; break;
case 3: case 3:
anetMeasChloro3Data.Add(xyPoint1); _anetMeasChloro3Data.Add(xyPoint1);
anetMeasInter3Data.Add(xyPoint2); _anetMeasInter3Data.Add(xyPoint2);
break; break;
} }
} }
@@ -140,30 +139,28 @@ namespace LeafWeb.Web.Charter
moreData = false; moreData = false;
else else
{ {
phrases = splitCSVLine(line); phrases = SplitCsvLine(line);
xyPoint1 = new XYPoint((String) phrases[1], (String) phrases[2]); // Ac(y),CO2cc(x) xyPoint1 = new XyPoint(phrases[1],phrases[2]); // Ac(y),CO2cc(x)
if (xyPoint1.yIsInRange(-20.0, 50.0)) if (xyPoint1.YIsInRange(-20.0, 50.0))
acChloroData.Add(xyPoint1); _acChloroData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[3], (String) phrases[4]); // Aj(y),CO2cj(x) xyPoint1 = new XyPoint(phrases[3], phrases[4]); // Aj(y),CO2cj(x)
if (xyPoint1.yIsInRange(-20.0, 50.0)) if (xyPoint1.YIsInRange(-20.0, 50.0))
ajChloroData.Add(xyPoint1); _ajChloroData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[5], (String) phrases[6]); // At(y),CO2ct(x) xyPoint1 = new XyPoint(phrases[5], phrases[6]); // At(y),CO2ct(x)
if (xyPoint1.yIsInRange(-20.0, 50.0)) if (xyPoint1.YIsInRange(-20.0, 50.0))
atChloroData.Add(xyPoint1); _atChloroData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[2]); // Ac(y),CO2i(x) xyPoint1 = new XyPoint(phrases[0], phrases[2]); // Ac(y),CO2i(x)
if (xyPoint1.yIsInRange(-20.0, 50.0)) if (xyPoint1.YIsInRange(-20.0, 50.0))
acInterData.Add(xyPoint1); _acInterData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[4]); // Aj(y),CO2i(x) xyPoint1 = new XyPoint(phrases[0], phrases[4]); // Aj(y),CO2i(x)
if (xyPoint1.yIsInRange(-20.0, 50.0)) if (xyPoint1.YIsInRange(-20.0, 50.0))
ajInterData.Add(xyPoint1); _ajInterData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[6]); // At(y),CO2i(x) xyPoint1 = new XyPoint(phrases[0], phrases[6]); // At(y),CO2i(x)
if (xyPoint1.yIsInRange(-20.0, 50.0)) if (xyPoint1.YIsInRange(-20.0, 50.0))
atInterData.Add(xyPoint1); _atInterData.Add(xyPoint1);
} }
} }
return;
} }
/// <summary> /// <summary>
@@ -174,75 +171,68 @@ namespace LeafWeb.Web.Charter
/// </summary> /// </summary>
/// <param name="line"></param> /// <param name="line"></param>
/// <returns></returns> /// <returns></returns>
private ArrayList splitCSVLine(String line) private static List<string> SplitCsvLine(String line)
{ {
int i; int i;
char[] separator; var separator = new [] {',', ' ', '\t'};
separator = new char[3];
separator[0] = ',';
separator[1] = ' ';
separator[2] = '\t';
var phrases = line.Split(separator); var phrases = line.Split(separator);
String phrase;
//int lastNonBlank = -1; //int lastNonBlank = -1;
var retPhrases = new ArrayList(); var retPhrases = new List<string>();
for (i = 0; i < phrases.Length; i++) for (i = 0; i < phrases.Length; i++)
{ {
phrase = phrases[i].Trim(); var phrase = phrases[i].Trim();
if (phrase.Length > 0) if (phrase.Length > 0)
// lastNonBlank = i; // lastNonBlank = i;
retPhrases.Add(phrase); retPhrases.Add(phrase);
} }
//int firstBlankToRemove = lastNonBlank + 1;
//if( firstBlankToRemove <= phrases.Length - 1 )
// retPhrases.RemoveRange(firstBlankToRemove, phrases.Length - firstBlankToRemove);
return retPhrases; return retPhrases;
} }
public ArrayList getAnetMeasData() public List<List<XyPoint>> GetAnetMeasData()
{ {
var list = new ArrayList(); var list = new List<List<XyPoint>>
list.Add(anetMeasChloro1Data); {
list.Add(anetMeasChloro2Data); _anetMeasChloro1Data,
list.Add(anetMeasChloro3Data); _anetMeasChloro2Data,
list.Add(anetMeasInter1Data); _anetMeasChloro3Data,
list.Add(anetMeasInter2Data); _anetMeasInter1Data,
list.Add(anetMeasInter3Data); _anetMeasInter2Data,
_anetMeasInter3Data
};
return list; return list;
} }
public ArrayList getAcChloroData() public List<XyPoint> GetAcChloroData()
{ {
return acChloroData; return _acChloroData;
} }
public ArrayList getAjChloroData() public List<XyPoint> GetAjChloroData()
{ {
return ajChloroData; return _ajChloroData;
} }
public ArrayList getAtChloroData() public List<XyPoint> GetAtChloroData()
{ {
return atChloroData; return _atChloroData;
} }
public ArrayList getAcInterData() public List<XyPoint> GetAcInterData()
{ {
return acInterData; return _acInterData;
} }
public ArrayList getAjInterData() public List<XyPoint> GetAjInterData()
{ {
return ajInterData; return _ajInterData;
} }
public ArrayList getAtInterData() public List<XyPoint> GetAtInterData()
{ {
return atInterData; return _atInterData;
} }
} }
} }
-79
View File
@@ -5,86 +5,7 @@
<asp:Label ID="ErrorLBL" runat="server" Text="" ForeColor="Red" Font-Bold="true"></asp:Label> <asp:Label ID="ErrorLBL" runat="server" Text="" ForeColor="Red" Font-Bold="true"></asp:Label>
<br /> <br />
<h1>Charting the Output from LeafWeb Jobs</h1> <h1>Charting the Output from LeafWeb Jobs</h1>
<asp:Panel ID="JobChoosePNL" runat="server">
<asp:Label ID="ChooseJobErrrorLBL" runat="server" Text="" ForeColor="Red" Font-Bold="true"></asp:Label>
<br /><br />
Choose a LeafWeb job:
<asp:GridView ID="JobGV" runat="server" AutoGenerateColumns = "False"
Font-Size="Small" Width="500px" BorderStyle="Groove"
BorderWidth="10px" GridLines="Both" AlternatingRowStyle-BackColor="LightGray"
BorderColor="Transparent" >
<HeaderStyle Font-Size="Medium" BackColor="LightGray" />
<Columns>
<asp:CommandField />
<asp:TemplateField HeaderText="Name" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:LinkButton ID="NameLB" runat="server" Text='<%# Eval("name") %>'
CommandArgument='<%# Eval("name") %>'
OnClick="ChooseJob" >
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Submitted by" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label ID="SubmittedByLBL" runat="server"
Text='<%# Eval("submittedBy") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Identifier" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label ID="IdentifierLBL" runat="server"
Text='<%# Eval("identifier") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date finished" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label ID="DateSubmittedLBL" runat="server"
Text='<%# Eval("dateSubmitted") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="LightGray" />
</asp:GridView>
</asp:Panel>
<asp:Panel ID="CurveChoosePNL" runat="server">
<table>
<tr>
<td><b>Job number:</b></td>
<td>
<asp:Label ID="JobNumberLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td><b>Submitted by:</b></td>
<td>
<asp:Label ID="SubmittedByLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td><b>Job name:</b></td>
<td>
<asp:Label ID="JobNameLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td><b>Date job finished:</b></td>
<td>
<asp:Label ID="JobDoneDateLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
<br /><br />
<asp:Button ID="BackToJobListBTN" runat="server" Text="Back to job list"
OnClick="BackToJobList" />
<br /><br />
Please choose one of the curves to chart.<br />
<asp:DropDownList ID="CurveDDL" runat="server">
</asp:DropDownList>
<asp:Button ID="ProduceChartBTN" runat="server" Text="Produce Chart"
onclick="ProduceChartBTN_Click" />
</asp:Panel>
<br /><br />
<asp:Panel ID="ChartPNL" runat="server"> <asp:Panel ID="ChartPNL" runat="server">
<asp:Chart ID="ChartChloro1" runat="server" Width="700" Height="500" > <asp:Chart ID="ChartChloro1" runat="server" Width="700" Height="500" >
+140 -495
View File
@@ -1,243 +1,20 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using System.Configuration;
using System.Data; using System.Data;
using System.Data.SqlClient;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.DataVisualization.Charting;
namespace LeafWeb.Web.Charter namespace LeafWeb.Web.Charter
{ {
public partial class LeafWebCharter : UserControl 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) protected void ReadFile(StreamReader sr, ref String errMsg)
{ {
var pisOut = new PiscalOutput(); var pisOut = new PiscalOutput();
if (!pisOut.readFromStream(sr, ref errMsg)) if (!pisOut.ReadFromStream(sr, ref errMsg))
{ {
ErrorLBL.Text = errMsg; ErrorLBL.Text = errMsg;
ErrorLBL.Visible = true; ErrorLBL.Visible = true;
@@ -252,256 +29,205 @@ namespace LeafWeb.Web.Charter
var curveDT = new DataTable(); var curveDT = new DataTable();
curveDT.Columns.Add(new DataColumn("curveID")); 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++) for (var i = 0; i < curveData.Count; i++)
{ {
aCurve = (CurveData) curveData[i]; var aCurve = curveData[i];
dr = curveDT.NewRow(); var dr = curveDT.NewRow();
dr["curveID"] = aCurve.getCurveID(); dr["curveID"] = aCurve.GetCurveId();
curveDT.Rows.Add(dr); curveDT.Rows.Add(dr);
} }
CurveDDL.DataSource = curveDT; //CurveDDL.DataSource = curveDT;
CurveDDL.DataTextField = "curveID"; //CurveDDL.DataTextField = "curveID";
CurveDDL.DataValueField = "curveID"; //CurveDDL.DataValueField = "curveID";
CurveDDL.DataBind(); //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 // If the session has timed out, use the selected index from the GridView
// to determine which job to chart. // to determine which job to chart.
if (pisOut == null) // if (aFile.Name.Contains("cntrlcomparison"))
{ // {
var selectedIndex = JobGV.SelectedIndex; // var sr = new StreamReader(aFile.OpenBinaryStream());
var gvr = JobGV.Rows[selectedIndex]; // var errorMessage = "";
var nameLB = (LinkButton) gvr.FindControl("NameLB"); // ReadFile(sr, ref errorMessage);
var jobID = nameLB.Text; // sr.Close();
// break;
// }
var siteCollection = new SPSite(hostname); var curveData = pisOut.GetCurveData();
SPWeb webSite = siteCollection.OpenWeb(); var curve = curveData[1];
SPFolder lofFolder = webSite.GetFolder("LeafOutputFiles"); var curveId = curve.GetCurveId();
SPFolder jobFolder = lofFolder.SubFolders[jobID];
SPFileCollection fileSet = jobFolder.Files; var paramSet1 = curve.GetParamSet1();
var paramSet2 = curve.GetParamSet2();
var paramSet3 = curve.GetParamSet3();
var paramSet4 = curve.GetParamSet4();
if (fileSet != null) var paramSet1Anet = paramSet1.GetAnetMeasData();
{ var paramSet2Anet = paramSet2.GetAnetMeasData();
foreach (SPFile aFile in fileSet) var paramSet3Anet = paramSet3.GetAnetMeasData();
{ var paramSet4Anet = paramSet4.GetAnetMeasData();
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 curveData = pisOut.getCurveData(); var anetMeasChloro1PS1Data = paramSet1Anet[0];
var curve = (CurveData) curveData[CurveDDL.SelectedIndex]; var anetMeasChloro2PS1Data = paramSet1Anet[1];
var curveID = curve.getCurveID(); 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; var anetMeasInter1PS1Data = paramSet1Anet[3];
CurveParamSet paramSet2 = null; var anetMeasInter2PS1Data = paramSet1Anet[4];
CurveParamSet paramSet3 = null; var anetMeasInter3PS1Data = paramSet1Anet[5];
CurveParamSet paramSet4 = null; var anetMeasInter1PS2Data = paramSet2Anet[3];
paramSet1 = curve.getParamSet1(); var anetMeasInter2PS2Data = paramSet2Anet[4];
paramSet2 = curve.getParamSet2(); var anetMeasInter3PS2Data = paramSet2Anet[5];
paramSet3 = curve.getParamSet3(); var anetMeasInter1PS3Data = paramSet3Anet[3];
paramSet4 = curve.getParamSet4(); var anetMeasInter2PS3Data = paramSet3Anet[4];
var anetMeasInter3PS3Data = paramSet3Anet[5];
var paramSet1Anet = paramSet1.getAnetMeasData(); var anetMeasInter1PS4Data = paramSet4Anet[3];
var paramSet2Anet = paramSet2.getAnetMeasData(); var anetMeasInter2PS4Data = paramSet4Anet[4];
var paramSet3Anet = paramSet3.getAnetMeasData(); var anetMeasInter3PS4Data = paramSet4Anet[5];
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;
// Set the points for the symbol series for paramater set 1, chloroplastic // Set the points for the symbol series for paramater set 1, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS1Data, ChartChloro1.Series["Rubisco-limited"], ref maxX1); setAnetMeasPoints(anetMeasChloro1PS1Data, ChartChloro1.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasChloro2PS1Data, ChartChloro1.Series["RuBP regeneration-limited"], ref maxX1); setAnetMeasPoints(anetMeasChloro2PS1Data, ChartChloro1.Series["RuBP regeneration-limited"]);
var tpuSeries = newTPUSeries(anetMeasChloro3PS1Data); var tpuSeries = newTPUSeries(anetMeasChloro3PS1Data);
setAnetMeasPoints(anetMeasChloro3PS1Data, tpuSeries, ref maxX1); setAnetMeasPoints(anetMeasChloro3PS1Data, tpuSeries);
ChartChloro1.Series.Add(tpuSeries); ChartChloro1.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 2, chloroplastic // Set the points for the symbol series for paramater set 2, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS2Data, ChartChloro2.Series["Rubisco-limited"], ref maxX2); setAnetMeasPoints(anetMeasChloro1PS2Data, ChartChloro2.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasChloro2PS2Data, ChartChloro2.Series["RuBP regeneration-limited"], ref maxX2); setAnetMeasPoints(anetMeasChloro2PS2Data, ChartChloro2.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasChloro3PS2Data); tpuSeries = newTPUSeries(anetMeasChloro3PS2Data);
setAnetMeasPoints(anetMeasChloro3PS2Data, tpuSeries, ref maxX2); setAnetMeasPoints(anetMeasChloro3PS2Data, tpuSeries);
ChartChloro2.Series.Add(tpuSeries); ChartChloro2.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 3, chloroplastic // Set the points for the symbol series for paramater set 3, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS3Data, ChartChloro3.Series["Rubisco-limited"], ref maxX3); setAnetMeasPoints(anetMeasChloro1PS3Data, ChartChloro3.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasChloro2PS3Data, ChartChloro3.Series["RuBP regeneration-limited"], ref maxX3); setAnetMeasPoints(anetMeasChloro2PS3Data, ChartChloro3.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasChloro3PS3Data); tpuSeries = newTPUSeries(anetMeasChloro3PS3Data);
setAnetMeasPoints(anetMeasChloro3PS3Data, tpuSeries, ref maxX3); setAnetMeasPoints(anetMeasChloro3PS3Data, tpuSeries);
ChartChloro3.Series.Add(tpuSeries); ChartChloro3.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 4, chloroplastic // Set the points for the symbol series for paramater set 4, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS4Data, ChartChloro4.Series["Rubisco-limited"], ref maxX4); setAnetMeasPoints(anetMeasChloro1PS4Data, ChartChloro4.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasChloro2PS4Data, ChartChloro4.Series["RuBP regeneration-limited"], ref maxX4); setAnetMeasPoints(anetMeasChloro2PS4Data, ChartChloro4.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasChloro3PS4Data); tpuSeries = newTPUSeries(anetMeasChloro3PS4Data);
setAnetMeasPoints(anetMeasChloro3PS4Data, tpuSeries, ref maxX4); setAnetMeasPoints(anetMeasChloro3PS4Data, tpuSeries);
ChartChloro4.Series.Add(tpuSeries); ChartChloro4.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 1, intercellular // Set the points for the symbol series for paramater set 1, intercellular
setAnetMeasPoints(anetMeasInter1PS1Data, ChartInter1.Series["Rubisco-limited"], ref maxX5); setAnetMeasPoints(anetMeasInter1PS1Data, ChartInter1.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasInter2PS1Data, ChartInter1.Series["RuBP regeneration-limited"], ref maxX5); setAnetMeasPoints(anetMeasInter2PS1Data, ChartInter1.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasInter3PS1Data); tpuSeries = newTPUSeries(anetMeasInter3PS1Data);
setAnetMeasPoints(anetMeasInter3PS1Data, tpuSeries, ref maxX5); setAnetMeasPoints(anetMeasInter3PS1Data, tpuSeries);
ChartInter1.Series.Add(tpuSeries); ChartInter1.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 2, intercellular // Set the points for the symbol series for paramater set 2, intercellular
setAnetMeasPoints(anetMeasInter1PS2Data, ChartInter2.Series["Rubisco-limited"], ref maxX6); setAnetMeasPoints(anetMeasInter1PS2Data, ChartInter2.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasInter2PS2Data, ChartInter2.Series["RuBP regeneration-limited"], ref maxX6); setAnetMeasPoints(anetMeasInter2PS2Data, ChartInter2.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasInter3PS2Data); tpuSeries = newTPUSeries(anetMeasInter3PS2Data);
setAnetMeasPoints(anetMeasInter3PS2Data, tpuSeries, ref maxX6); setAnetMeasPoints(anetMeasInter3PS2Data, tpuSeries);
ChartInter2.Series.Add(tpuSeries); ChartInter2.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 3, intercellular // Set the points for the symbol series for paramater set 3, intercellular
setAnetMeasPoints(anetMeasInter1PS3Data, ChartInter3.Series["Rubisco-limited"], ref maxX7); setAnetMeasPoints(anetMeasInter1PS3Data, ChartInter3.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasInter2PS3Data, ChartInter3.Series["RuBP regeneration-limited"], ref maxX7); setAnetMeasPoints(anetMeasInter2PS3Data, ChartInter3.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasInter3PS3Data); tpuSeries = newTPUSeries(anetMeasInter3PS3Data);
setAnetMeasPoints(anetMeasInter3PS3Data, tpuSeries, ref maxX7); setAnetMeasPoints(anetMeasInter3PS3Data, tpuSeries);
ChartInter3.Series.Add(tpuSeries); ChartInter3.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 4, intercellular // Set the points for the symbol series for paramater set 4, intercellular
setAnetMeasPoints(anetMeasInter1PS4Data, ChartInter4.Series["Rubisco-limited"], ref maxX8); setAnetMeasPoints(anetMeasInter1PS4Data, ChartInter4.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasInter2PS4Data, ChartInter4.Series["RuBP regeneration-limited"], ref maxX8); setAnetMeasPoints(anetMeasInter2PS4Data, ChartInter4.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasInter3PS4Data); tpuSeries = newTPUSeries(anetMeasInter3PS4Data);
setAnetMeasPoints(anetMeasInter3PS4Data, tpuSeries, ref maxX8); setAnetMeasPoints(anetMeasInter3PS4Data, tpuSeries);
ChartInter4.Series.Add(tpuSeries); ChartInter4.Series.Add(tpuSeries);
var acChloroListPS1 = paramSet1.getAcChloroData(); var acChloroListPS1 = paramSet1.GetAcChloroData();
var ajChloroListPS1 = paramSet1.getAjChloroData(); var ajChloroListPS1 = paramSet1.GetAjChloroData();
var atChloroListPS1 = paramSet1.getAtChloroData(); var atChloroListPS1 = paramSet1.GetAtChloroData();
var acChloroListPS2 = paramSet2.getAcChloroData(); var acChloroListPS2 = paramSet2.GetAcChloroData();
var ajChloroListPS2 = paramSet2.getAjChloroData(); var ajChloroListPS2 = paramSet2.GetAjChloroData();
var atChloroListPS2 = paramSet2.getAtChloroData(); var atChloroListPS2 = paramSet2.GetAtChloroData();
var acChloroListPS3 = paramSet3.getAcChloroData(); var acChloroListPS3 = paramSet3.GetAcChloroData();
var ajChloroListPS3 = paramSet3.getAjChloroData(); var ajChloroListPS3 = paramSet3.GetAjChloroData();
var atChloroListPS3 = paramSet3.getAtChloroData(); var atChloroListPS3 = paramSet3.GetAtChloroData();
var acChloroListPS4 = paramSet4.getAcChloroData(); var acChloroListPS4 = paramSet4.GetAcChloroData();
var ajChloroListPS4 = paramSet4.getAjChloroData(); var ajChloroListPS4 = paramSet4.GetAjChloroData();
var atChloroListPS4 = paramSet4.getAtChloroData(); var atChloroListPS4 = paramSet4.GetAtChloroData();
var acInterListPS1 = paramSet1.getAcInterData(); var acInterListPS1 = paramSet1.GetAcInterData();
var ajInterListPS1 = paramSet1.getAjInterData(); var ajInterListPS1 = paramSet1.GetAjInterData();
var atInterListPS1 = paramSet1.getAtInterData(); var atInterListPS1 = paramSet1.GetAtInterData();
var acInterListPS2 = paramSet2.getAcInterData(); var acInterListPS2 = paramSet2.GetAcInterData();
var ajInterListPS2 = paramSet2.getAjInterData(); var ajInterListPS2 = paramSet2.GetAjInterData();
var atInterListPS2 = paramSet2.getAtInterData(); var atInterListPS2 = paramSet2.GetAtInterData();
var acInterListPS3 = paramSet3.getAcInterData(); var acInterListPS3 = paramSet3.GetAcInterData();
var ajInterListPS3 = paramSet3.getAjInterData(); var ajInterListPS3 = paramSet3.GetAjInterData();
var atInterListPS3 = paramSet3.getAtInterData(); var atInterListPS3 = paramSet3.GetAtInterData();
var acInterListPS4 = paramSet4.getAcInterData(); var acInterListPS4 = paramSet4.GetAcInterData();
var ajInterListPS4 = paramSet4.getAjInterData(); var ajInterListPS4 = paramSet4.GetAjInterData();
var atInterListPS4 = paramSet4.getAtInterData(); var atInterListPS4 = paramSet4.GetAtInterData();
// Set the points on the asymptote curve for parameter set 1, chloroplast // Set the points on the asymptote curve for parameter set 1, chloroplast
setAsymptotePoints(acChloroListPS1, ChartChloro1.Series["acCurve"], ref maxX1); setAsymptotePoints(acChloroListPS1, ChartChloro1.Series["acCurve"]);
setAsymptotePoints(ajChloroListPS1, ChartChloro1.Series["ajCurve"], ref maxX1); setAsymptotePoints(ajChloroListPS1, ChartChloro1.Series["ajCurve"]);
setAsymptotePoints(atChloroListPS1, ChartChloro1.Series["atCurve"], ref maxX1); setAsymptotePoints(atChloroListPS1, ChartChloro1.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 2, chloroplast // Set the points on the asymptote curve for parameter set 2, chloroplast
setAsymptotePoints(acChloroListPS2, ChartChloro2.Series["acCurve"], ref maxX2); setAsymptotePoints(acChloroListPS2, ChartChloro2.Series["acCurve"]);
setAsymptotePoints(ajChloroListPS2, ChartChloro2.Series["ajCurve"], ref maxX2); setAsymptotePoints(ajChloroListPS2, ChartChloro2.Series["ajCurve"]);
setAsymptotePoints(atChloroListPS2, ChartChloro2.Series["atCurve"], ref maxX2); setAsymptotePoints(atChloroListPS2, ChartChloro2.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 3, chloroplast // Set the points on the asymptote curve for parameter set 3, chloroplast
setAsymptotePoints(acChloroListPS3, ChartChloro3.Series["acCurve"], ref maxX3); setAsymptotePoints(acChloroListPS3, ChartChloro3.Series["acCurve"]);
setAsymptotePoints(ajChloroListPS3, ChartChloro3.Series["ajCurve"], ref maxX3); setAsymptotePoints(ajChloroListPS3, ChartChloro3.Series["ajCurve"]);
setAsymptotePoints(atChloroListPS3, ChartChloro3.Series["atCurve"], ref maxX3); setAsymptotePoints(atChloroListPS3, ChartChloro3.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 4, chloroplast // Set the points on the asymptote curve for parameter set 4, chloroplast
setAsymptotePoints(acChloroListPS4, ChartChloro4.Series["acCurve"], ref maxX4); setAsymptotePoints(acChloroListPS4, ChartChloro4.Series["acCurve"]);
setAsymptotePoints(ajChloroListPS4, ChartChloro4.Series["ajCurve"], ref maxX4); setAsymptotePoints(ajChloroListPS4, ChartChloro4.Series["ajCurve"]);
setAsymptotePoints(atChloroListPS4, ChartChloro4.Series["atCurve"], ref maxX4); setAsymptotePoints(atChloroListPS4, ChartChloro4.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 1, intercellular // Set the points on the asymptote curve for parameter set 1, intercellular
setAsymptotePoints(acInterListPS1, ChartInter1.Series["acCurve"], ref maxX5); setAsymptotePoints(acInterListPS1, ChartInter1.Series["acCurve"]);
setAsymptotePoints(ajInterListPS1, ChartInter1.Series["ajCurve"], ref maxX5); setAsymptotePoints(ajInterListPS1, ChartInter1.Series["ajCurve"]);
setAsymptotePoints(atInterListPS1, ChartInter1.Series["atCurve"], ref maxX5); setAsymptotePoints(atInterListPS1, ChartInter1.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 2, intercellular // Set the points on the asymptote curve for parameter set 2, intercellular
setAsymptotePoints(acInterListPS2, ChartInter2.Series["acCurve"], ref maxX6); setAsymptotePoints(acInterListPS2, ChartInter2.Series["acCurve"]);
setAsymptotePoints(ajInterListPS2, ChartInter2.Series["ajCurve"], ref maxX6); setAsymptotePoints(ajInterListPS2, ChartInter2.Series["ajCurve"]);
setAsymptotePoints(atInterListPS2, ChartInter2.Series["atCurve"], ref maxX6); setAsymptotePoints(atInterListPS2, ChartInter2.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 3, intercellular // Set the points on the asymptote curve for parameter set 3, intercellular
setAsymptotePoints(acInterListPS3, ChartInter3.Series["acCurve"], ref maxX7); setAsymptotePoints(acInterListPS3, ChartInter3.Series["acCurve"]);
setAsymptotePoints(ajInterListPS3, ChartInter3.Series["ajCurve"], ref maxX7); setAsymptotePoints(ajInterListPS3, ChartInter3.Series["ajCurve"]);
setAsymptotePoints(atInterListPS3, ChartInter3.Series["atCurve"], ref maxX7); setAsymptotePoints(atInterListPS3, ChartInter3.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 4, intercellular // Set the points on the asymptote curve for parameter set 4, intercellular
setAsymptotePoints(acInterListPS4, ChartInter4.Series["acCurve"], ref maxX8); setAsymptotePoints(acInterListPS4, ChartInter4.Series["acCurve"]);
setAsymptotePoints(ajInterListPS4, ChartInter4.Series["ajCurve"], ref maxX8); setAsymptotePoints(ajInterListPS4, ChartInter4.Series["ajCurve"]);
setAsymptotePoints(atInterListPS4, ChartInter4.Series["atCurve"], ref maxX8); setAsymptotePoints(atInterListPS4, ChartInter4.Series["atCurve"]);
// Now, set the minimum and maximum values for the X-axis. The // Now, set the minimum and maximum values for the X-axis. The
// Y-axis seems to be doing OK in auto mode. // 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 axisFont = new Font("Times New Roman", 12, FontStyle.Bold);
var titleFont = 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"); "\nInternal conductance fixed, compensation point and M-M constants fixed");
titlePS1.Font = titleFont; titlePS1.Font = titleFont;
ChartChloro1.Titles.Add(titlePS1); ChartChloro1.Titles.Add(titlePS1);
ChartInter1.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"); "\nInternal conductance fixed, compensation point and M-M constants estimated");
titlePS2.Font = titleFont; titlePS2.Font = titleFont;
ChartChloro2.Titles.Add(titlePS2); ChartChloro2.Titles.Add(titlePS2);
ChartInter2.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"); "\nInternal conductance estimated, compensation point and M-M constants fixed");
titlePS3.Font = titleFont; titlePS3.Font = titleFont;
ChartChloro3.Titles.Add(titlePS3); ChartChloro3.Titles.Add(titlePS3);
ChartInter3.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"); "\nInternal conductance estimated, compensation point and M-M constants estimated");
titlePS4.Font = titleFont; titlePS4.Font = titleFont;
ChartChloro4.Titles.Add(titlePS4); ChartChloro4.Titles.Add(titlePS4);
@@ -557,7 +283,7 @@ namespace LeafWeb.Web.Charter
ChartInter4.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont; ChartInter4.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
} }
private Series newTPUSeries(ArrayList data) private Series newTPUSeries(IReadOnlyCollection<XyPoint> data)
{ {
var seriesName = "TPU-limited"; var seriesName = "TPU-limited";
if (data.Count == 0) if (data.Count == 0)
@@ -577,106 +303,25 @@ namespace LeafWeb.Web.Charter
return series3; return series3;
} }
private void setAnetMeasPoints(ArrayList data, Series series, ref double xMax) private void setAnetMeasPoints(List<XyPoint> data, Series series)
{ {
// Set the points for the series from the ArrayList // Set the points for the series from the ArrayList
foreach (var xy in data)
XYPoint xy;
int i;
for (i = 0; i < data.Count; i++)
{ {
xy = (XYPoint) data[i]; series.Points.AddXY(xy.X, xy.Y);
series.Points.AddXY(xy.getX(), xy.getY());
if (xy.getX() > xMax)
xMax = xy.getX();
} }
} }
private void setAsymptotePoints(ArrayList data, Series series, ref double xMax) private void setAsymptotePoints(List<XyPoint> data, Series series)
{ {
// Set the points for the series from the ArrayList // Set the points for the series from the ArrayList
foreach (var xy in data)
XYPoint xy;
int i;
for (i = 0; i < data.Count; i++)
{ {
xy = (XYPoint) data[i]; if ((xy.X != -9999) && (xy.Y != -9999))
if ((xy.getX() != -9999) && (xy.getY() != -9999))
{ {
series.Points.AddXY(xy.getX(), xy.getY()); series.Points.AddXY(xy.X, xy.Y);
if (xy.getX() > xMax)
xMax = xy.getX();
} }
} }
} }
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("'", "''");
}
} }
} }
-99
View File
@@ -21,105 +21,6 @@ namespace LeafWeb.Web.Charter {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Label ErrorLBL; protected global::System.Web.UI.WebControls.Label ErrorLBL;
/// <summary>
/// JobChoosePNL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel JobChoosePNL;
/// <summary>
/// ChooseJobErrrorLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label ChooseJobErrrorLBL;
/// <summary>
/// JobGV control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView JobGV;
/// <summary>
/// CurveChoosePNL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel CurveChoosePNL;
/// <summary>
/// JobNumberLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label JobNumberLBL;
/// <summary>
/// SubmittedByLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label SubmittedByLBL;
/// <summary>
/// JobNameLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label JobNameLBL;
/// <summary>
/// JobDoneDateLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label JobDoneDateLBL;
/// <summary>
/// BackToJobListBTN control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button BackToJobListBTN;
/// <summary>
/// CurveDDL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList CurveDDL;
/// <summary>
/// ProduceChartBTN control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button ProduceChartBTN;
/// <summary> /// <summary>
/// ChartPNL control. /// ChartPNL control.
/// </summary> /// </summary>
+8 -38
View File
@@ -1,5 +1,5 @@
using System; using System;
using System.Collections; using System.Collections.Generic;
using System.IO; using System.IO;
namespace LeafWeb.Web.Charter namespace LeafWeb.Web.Charter
@@ -7,22 +7,17 @@ namespace LeafWeb.Web.Charter
[Serializable] [Serializable]
public class PiscalOutput public class PiscalOutput
{ {
private int nbrCurves; // This is the number of input files that were processed. private readonly List<CurveData> _curveData; // Each element will be a PiscalCurve element that contains
private readonly ArrayList curveData; // Each element will be a PiscalCurve element that contains
// all of the output data for one curve. // all of the output data for one curve.
public PiscalOutput() public PiscalOutput()
{ {
nbrCurves = 0; _curveData = new List<CurveData>();
curveData = new ArrayList();
} }
public bool readFromStream(StreamReader sr, ref String errorMsg) public bool ReadFromStream(StreamReader sr, ref String errorMsg)
{ {
CurveData curve;
// Skip the first two lines. // Skip the first two lines.
sr.ReadLine(); sr.ReadLine();
sr.ReadLine(); sr.ReadLine();
var lineNbr = 2; var lineNbr = 2;
@@ -34,45 +29,20 @@ namespace LeafWeb.Web.Charter
var more = true; var more = true;
while (more) while (more)
{ {
curve = new CurveData(sr, ref errorMsg, ref lineNbr); var curve = new CurveData(sr, ref errorMsg, ref lineNbr);
if (errorMsg.Length > 0) if (errorMsg.Length > 0)
return false; return false;
curveData.Add(curve); _curveData.Add(curve);
if (sr.EndOfStream) if (sr.EndOfStream)
more = false; more = false;
} }
return true; return true;
} }
public bool readFromDataFile(Stream fileStream, ref String errorMsg) public List<CurveData> GetCurveData()
{ {
StreamReader sr; return _curveData;
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;
} }
} }
} }
+8 -36
View File
@@ -3,49 +3,21 @@
namespace LeafWeb.Web.Charter namespace LeafWeb.Web.Charter
{ {
[Serializable] [Serializable]
public class XYPoint public class XyPoint
{ {
private double x; public XyPoint(String x, String y)
private double y;
public XYPoint(double x1, double y1)
{ {
x = x1; X = Double.Parse(x);
y = y1; Y = Double.Parse(y);
} }
public XYPoint(String x1, String y1) public double X { get; private set; }
{
x = Double.Parse(x1);
y = Double.Parse(y1);
}
public double getX() public double Y { get; private set; }
{
return x;
}
public void setX(double x1) public bool YIsInRange(double lowEnd, double highEnd)
{ {
x = x1; return (Y >= lowEnd) && (Y <= highEnd);
}
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;
} }
} }
} }