|
@@ -9,6 +9,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
|
|
|
public class FieldData
|
|
|
{
|
|
|
private SqlHelper dbHelper;
|
|
|
+ private frmReportApp m_Report=new frmReportApp();
|
|
|
//测量文件地址
|
|
|
private string filePath;
|
|
|
public FieldData(string path)
|
|
@@ -16,7 +17,14 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
|
|
|
dbHelper = new SqlHelper("data source='" + path + "\\FIELD_FILES\\Inclusion.db'");
|
|
|
filePath = path + "\\FIELD_FILES\\";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ public FieldData(string path, frmReportApp a_ReportApp)
|
|
|
+ {
|
|
|
+
|
|
|
+ dbHelper = new SqlHelper("data source='" + path + "\\FIELD_FILES\\Inclusion.db'");
|
|
|
+ filePath = path + "\\FIELD_FILES\\";
|
|
|
+ m_Report = a_ReportApp;
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 获取SegmentList
|
|
|
/// </summary>
|
|
@@ -39,26 +47,31 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
|
|
|
DataTable DTE = dbHelper.ExecuteDataTable(sqle, null);
|
|
|
|
|
|
List<Model.Field> Fields = new List<Model.Field>();
|
|
|
- foreach (DataRow dr in DT.Rows)
|
|
|
+
|
|
|
+ DirectoryInfo info = new DirectoryInfo(filePath);
|
|
|
+ int count = info.GetFiles("*.bmp").Length;
|
|
|
+
|
|
|
+ for (int i=0;i< count; i++)
|
|
|
{
|
|
|
- string imagePath = filePath + "Field" + dr["fieldid"].ToString() + ".bmp";
|
|
|
+
|
|
|
+ string imagePath = filePath + "Field" + m_Report.OriginalPoint.Rows[i]["ID"].ToString() + ".bmp";
|
|
|
|
|
|
|
|
|
- Model.Field modelf = new Model.Field() { FieldID = Convert.ToInt32(dr["fieldid"]), FieldPosX = Convert.ToInt32(dr["fieldposx"]), FieldPosY = Convert.ToInt32(dr["fieldposy"]), FieldImage = imagePath };
|
|
|
+ Model.Field modelf = new Model.Field() { FieldID = Convert.ToInt32(m_Report.OriginalPoint.Rows[i]["ID"].ToString()), FieldPosX = Convert.ToInt32(m_Report.OriginalPoint.Rows[i]["FieldX"].ToString()), FieldPosY = Convert.ToInt32(m_Report.OriginalPoint.Rows[i]["FieldY"].ToString()), FieldImage = imagePath };
|
|
|
|
|
|
- DataRow[] drp = DTP.Select("fieldid=" + dr["fieldid"].ToString());
|
|
|
+ DataRow[] drp = DTP.Select("fieldid=" + m_Report.OriginalPoint.Rows[i]["ID"].ToString());
|
|
|
|
|
|
List<Model.Particle> listp = dbHelper.RowsToList<Model.Particle>(drp);
|
|
|
|
|
|
foreach (Model.Particle modelp in listp)
|
|
|
{
|
|
|
//添加FeatureList信息
|
|
|
- DataRow[] drs = DTS.Select("fieldid=" + dr["fieldid"].ToString() + " and particleid=" + modelp.ParticleId.ToString());
|
|
|
+ DataRow[] drs = DTS.Select("fieldid=" + m_Report.OriginalPoint.Rows[i]["ID"].ToString() + " and particleid=" + modelp.ParticleId.ToString());
|
|
|
List<Model.Feature> flist = dbHelper.RowsToList<Model.Feature>(drs);
|
|
|
modelp.FeatureList = flist;
|
|
|
|
|
|
//添加ElementList信息
|
|
|
- DataRow[] dre = DTE.Select("fieldid=" + dr["fieldid"].ToString() + " and XRayId=" + modelp.XrayId.ToString());
|
|
|
+ DataRow[] dre = DTE.Select("fieldid=" + m_Report.OriginalPoint.Rows[i]["ID"].ToString() + " and XRayId=" + modelp.XrayId.ToString());
|
|
|
List<Model.Element> elist = dbHelper.RowsToList<Model.Element>(dre);
|
|
|
modelp.ElementList = elist;
|
|
|
}
|
|
@@ -67,6 +80,36 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
|
|
|
|
|
|
Fields.Add(modelf);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //foreach (DataRow dr in DT.Rows)
|
|
|
+ //{
|
|
|
+ // string imagePath = filePath + "Field" + dr["fieldid"].ToString() + ".bmp";
|
|
|
+
|
|
|
+
|
|
|
+ // Model.Field modelf = new Model.Field() { FieldID = Convert.ToInt32(dr["fieldid"]), FieldPosX = Convert.ToInt32(dr["fieldposx"]), FieldPosY = Convert.ToInt32(dr["fieldposy"]), FieldImage = imagePath };
|
|
|
+
|
|
|
+ // DataRow[] drp = DTP.Select("fieldid=" + dr["fieldid"].ToString());
|
|
|
+
|
|
|
+ // List<Model.Particle> listp = dbHelper.RowsToList<Model.Particle>(drp);
|
|
|
+
|
|
|
+ // foreach (Model.Particle modelp in listp)
|
|
|
+ // {
|
|
|
+ // //添加FeatureList信息
|
|
|
+ // DataRow[] drs = DTS.Select("fieldid=" + dr["fieldid"].ToString() + " and particleid=" + modelp.ParticleId.ToString());
|
|
|
+ // List<Model.Feature> flist = dbHelper.RowsToList<Model.Feature>(drs);
|
|
|
+ // modelp.FeatureList = flist;
|
|
|
+
|
|
|
+ // //添加ElementList信息
|
|
|
+ // DataRow[] dre = DTE.Select("fieldid=" + dr["fieldid"].ToString() + " and XRayId=" + modelp.XrayId.ToString());
|
|
|
+ // List<Model.Element> elist = dbHelper.RowsToList<Model.Element>(dre);
|
|
|
+ // modelp.ElementList = elist;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // modelf.ParticleList = listp;
|
|
|
+
|
|
|
+ // Fields.Add(modelf);
|
|
|
+ //}
|
|
|
|
|
|
return Fields;
|
|
|
|