diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
new file mode 100644
index 0000000..bc6c685
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
@@ -0,0 +1,87 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DetectionServiceImpl : DetectionService
+ {
+ public int add(int deviceId, DateTime logTime,String frequency)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection (DEVICE_ID,LOG_TIME,FREQUENCY)" +
+ "values(@DEVICE_ID,@LOG_TIME,@FREQUENCY)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 255).Value = frequency;
+ cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(int deviceId)
+ {
+ List detectionDtoList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetection : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT DEVICE_ID,LOG_TIME,FREQUENCY FROM r_detection where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionDto detectionDto = new DetectionDto();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionDto.DeviceId = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionDto.LogTime = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) detectionDto.Frequency = aReader.GetString(2);
+
+ detectionDtoList.Add(detectionDto);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionDtoList = null;
+ }
+ return detectionDtoList;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
new file mode 100644
index 0000000..bc6c685
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
@@ -0,0 +1,87 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DetectionServiceImpl : DetectionService
+ {
+ public int add(int deviceId, DateTime logTime,String frequency)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection (DEVICE_ID,LOG_TIME,FREQUENCY)" +
+ "values(@DEVICE_ID,@LOG_TIME,@FREQUENCY)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 255).Value = frequency;
+ cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(int deviceId)
+ {
+ List detectionDtoList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetection : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT DEVICE_ID,LOG_TIME,FREQUENCY FROM r_detection where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionDto detectionDto = new DetectionDto();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionDto.DeviceId = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionDto.LogTime = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) detectionDto.Frequency = aReader.GetString(2);
+
+ detectionDtoList.Add(detectionDto);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionDtoList = null;
+ }
+ return detectionDtoList;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
new file mode 100644
index 0000000..8d3fc42
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
@@ -0,0 +1,200 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DeviceServiceImpl:DeviceService
+ {
+ public int add(string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+ //DetectionItemService detectionItemService = new DetectionItemServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_device (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,REG_TIME,CUSTOMER_NAME,CUSTOMER_DEV,STATUSID,CHANNEL,ACTIVE)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@REG_TIME,@CUSTOMER_NAME,@CUSTOMER_DEV,@STATUSID,@CHANNEL,@ACTIVE)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@REG_TIME", MySqlDbType.Date, 0).Value = DateTime.Now;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@STATUSID", MySqlDbType.String, 20).Value = 1;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+ cmd.Parameters.Add("@ACTIVE", MySqlDbType.Int64, 0).Value = 0;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int update(int id, string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,CUSTOMER_NAME,CUSTOMER_DEV,CHANNEL)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@CUSTOMER_NAME,@CUSTOMER_DEV,@CHANNEL) WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int delete(int id)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET ACTIVE = 1 WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(string devName, string devCode, string devModel,
+ string suctomerDev, string customerName, string statusId)
+ {
+
+ List deviceDtoList = new List();
+ DictService dictService = new DictServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_device where active = " + 0;
+
+ if (devName != "" && devName != null)
+ sQry += " and DEV_NAME like '%" + devName + "%'";
+ if (devCode != "" && devCode != null)
+ sQry += " and DEV_CODE like '%" + devCode + "%'";
+ if (devModel != "" && devModel != null)
+ sQry += " and DEV_MODEL like '%" + devModel + "%'";
+ if(suctomerDev!=""&&suctomerDev!=null)
+ sQry+= " and CUSTOMER_DEV like '%"+ suctomerDev + "%'";
+ if (customerName != "" && customerName != null)
+ sQry += " and CUSTOMER_NAME like '%" + customerName + "%'";
+ if (statusId != "" && statusId != null)
+ sQry += "and STATUSID = " + statusId;
+
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DeviceDto deviceDto = new DeviceDto();
+
+ if (!aReader.IsDBNull(0)) deviceDto.Id = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2);
+ if (!aReader.IsDBNull(3))
+ {
+ deviceDto.DevTypeId = aReader.GetString(3);
+ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3));
+ }
+ if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4);
+ if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(5);
+ if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(6);
+ if (!aReader.IsDBNull(7))
+ {
+ deviceDto.StatusId = aReader.GetString(7);
+ deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7));
+ }
+ if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8);
+
+ deviceDtoList.Add(deviceDto);
+ }
+
+ aCommand.Dispose();
+
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message);
+ deviceDtoList = null;
+ }
+
+ return deviceDtoList;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
new file mode 100644
index 0000000..bc6c685
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
@@ -0,0 +1,87 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DetectionServiceImpl : DetectionService
+ {
+ public int add(int deviceId, DateTime logTime,String frequency)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection (DEVICE_ID,LOG_TIME,FREQUENCY)" +
+ "values(@DEVICE_ID,@LOG_TIME,@FREQUENCY)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 255).Value = frequency;
+ cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(int deviceId)
+ {
+ List detectionDtoList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetection : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT DEVICE_ID,LOG_TIME,FREQUENCY FROM r_detection where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionDto detectionDto = new DetectionDto();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionDto.DeviceId = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionDto.LogTime = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) detectionDto.Frequency = aReader.GetString(2);
+
+ detectionDtoList.Add(detectionDto);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionDtoList = null;
+ }
+ return detectionDtoList;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
new file mode 100644
index 0000000..8d3fc42
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
@@ -0,0 +1,200 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DeviceServiceImpl:DeviceService
+ {
+ public int add(string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+ //DetectionItemService detectionItemService = new DetectionItemServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_device (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,REG_TIME,CUSTOMER_NAME,CUSTOMER_DEV,STATUSID,CHANNEL,ACTIVE)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@REG_TIME,@CUSTOMER_NAME,@CUSTOMER_DEV,@STATUSID,@CHANNEL,@ACTIVE)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@REG_TIME", MySqlDbType.Date, 0).Value = DateTime.Now;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@STATUSID", MySqlDbType.String, 20).Value = 1;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+ cmd.Parameters.Add("@ACTIVE", MySqlDbType.Int64, 0).Value = 0;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int update(int id, string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,CUSTOMER_NAME,CUSTOMER_DEV,CHANNEL)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@CUSTOMER_NAME,@CUSTOMER_DEV,@CHANNEL) WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int delete(int id)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET ACTIVE = 1 WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(string devName, string devCode, string devModel,
+ string suctomerDev, string customerName, string statusId)
+ {
+
+ List deviceDtoList = new List();
+ DictService dictService = new DictServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_device where active = " + 0;
+
+ if (devName != "" && devName != null)
+ sQry += " and DEV_NAME like '%" + devName + "%'";
+ if (devCode != "" && devCode != null)
+ sQry += " and DEV_CODE like '%" + devCode + "%'";
+ if (devModel != "" && devModel != null)
+ sQry += " and DEV_MODEL like '%" + devModel + "%'";
+ if(suctomerDev!=""&&suctomerDev!=null)
+ sQry+= " and CUSTOMER_DEV like '%"+ suctomerDev + "%'";
+ if (customerName != "" && customerName != null)
+ sQry += " and CUSTOMER_NAME like '%" + customerName + "%'";
+ if (statusId != "" && statusId != null)
+ sQry += "and STATUSID = " + statusId;
+
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DeviceDto deviceDto = new DeviceDto();
+
+ if (!aReader.IsDBNull(0)) deviceDto.Id = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2);
+ if (!aReader.IsDBNull(3))
+ {
+ deviceDto.DevTypeId = aReader.GetString(3);
+ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3));
+ }
+ if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4);
+ if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(5);
+ if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(6);
+ if (!aReader.IsDBNull(7))
+ {
+ deviceDto.StatusId = aReader.GetString(7);
+ deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7));
+ }
+ if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8);
+
+ deviceDtoList.Add(deviceDto);
+ }
+
+ aCommand.Dispose();
+
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message);
+ deviceDtoList = null;
+ }
+
+ return deviceDtoList;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
new file mode 100644
index 0000000..04f5244
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
@@ -0,0 +1,85 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DictServiceImpl:DictService
+ {
+ public String getNameByCode(string codeType,string code)
+ {
+ String name = "";
+ try
+ {
+ string sql = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '"
+ + codeType + "') and code = " + code;
+
+ MySqlCommand cmd = new MySqlCommand(sql, DbConnectService.mySqlConnect);
+
+ MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default);
+
+ if (aReader != null)
+ {
+ if (aReader.Read())
+ {
+ //判断门的状态
+ if (!aReader.IsDBNull(0))
+ {
+ name = aReader.GetString(0);
+ }
+ }
+ }
+
+ cmd.Dispose();
+ return name;
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message);
+ name = "";
+ }
+ return name;
+ }
+
+ public List getTypeListByCodeType(string codeType)
+ {
+ List nameList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')";
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ if (!aReader.IsDBNull(0))
+ nameList.Add(aReader.GetString(0));
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message);
+ nameList = null;
+ }
+
+ return nameList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
new file mode 100644
index 0000000..bc6c685
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
@@ -0,0 +1,87 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DetectionServiceImpl : DetectionService
+ {
+ public int add(int deviceId, DateTime logTime,String frequency)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection (DEVICE_ID,LOG_TIME,FREQUENCY)" +
+ "values(@DEVICE_ID,@LOG_TIME,@FREQUENCY)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 255).Value = frequency;
+ cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(int deviceId)
+ {
+ List detectionDtoList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetection : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT DEVICE_ID,LOG_TIME,FREQUENCY FROM r_detection where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionDto detectionDto = new DetectionDto();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionDto.DeviceId = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionDto.LogTime = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) detectionDto.Frequency = aReader.GetString(2);
+
+ detectionDtoList.Add(detectionDto);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionDtoList = null;
+ }
+ return detectionDtoList;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
new file mode 100644
index 0000000..8d3fc42
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
@@ -0,0 +1,200 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DeviceServiceImpl:DeviceService
+ {
+ public int add(string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+ //DetectionItemService detectionItemService = new DetectionItemServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_device (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,REG_TIME,CUSTOMER_NAME,CUSTOMER_DEV,STATUSID,CHANNEL,ACTIVE)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@REG_TIME,@CUSTOMER_NAME,@CUSTOMER_DEV,@STATUSID,@CHANNEL,@ACTIVE)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@REG_TIME", MySqlDbType.Date, 0).Value = DateTime.Now;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@STATUSID", MySqlDbType.String, 20).Value = 1;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+ cmd.Parameters.Add("@ACTIVE", MySqlDbType.Int64, 0).Value = 0;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int update(int id, string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,CUSTOMER_NAME,CUSTOMER_DEV,CHANNEL)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@CUSTOMER_NAME,@CUSTOMER_DEV,@CHANNEL) WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int delete(int id)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET ACTIVE = 1 WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(string devName, string devCode, string devModel,
+ string suctomerDev, string customerName, string statusId)
+ {
+
+ List deviceDtoList = new List();
+ DictService dictService = new DictServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_device where active = " + 0;
+
+ if (devName != "" && devName != null)
+ sQry += " and DEV_NAME like '%" + devName + "%'";
+ if (devCode != "" && devCode != null)
+ sQry += " and DEV_CODE like '%" + devCode + "%'";
+ if (devModel != "" && devModel != null)
+ sQry += " and DEV_MODEL like '%" + devModel + "%'";
+ if(suctomerDev!=""&&suctomerDev!=null)
+ sQry+= " and CUSTOMER_DEV like '%"+ suctomerDev + "%'";
+ if (customerName != "" && customerName != null)
+ sQry += " and CUSTOMER_NAME like '%" + customerName + "%'";
+ if (statusId != "" && statusId != null)
+ sQry += "and STATUSID = " + statusId;
+
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DeviceDto deviceDto = new DeviceDto();
+
+ if (!aReader.IsDBNull(0)) deviceDto.Id = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2);
+ if (!aReader.IsDBNull(3))
+ {
+ deviceDto.DevTypeId = aReader.GetString(3);
+ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3));
+ }
+ if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4);
+ if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(5);
+ if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(6);
+ if (!aReader.IsDBNull(7))
+ {
+ deviceDto.StatusId = aReader.GetString(7);
+ deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7));
+ }
+ if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8);
+
+ deviceDtoList.Add(deviceDto);
+ }
+
+ aCommand.Dispose();
+
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message);
+ deviceDtoList = null;
+ }
+
+ return deviceDtoList;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
new file mode 100644
index 0000000..04f5244
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
@@ -0,0 +1,85 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DictServiceImpl:DictService
+ {
+ public String getNameByCode(string codeType,string code)
+ {
+ String name = "";
+ try
+ {
+ string sql = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '"
+ + codeType + "') and code = " + code;
+
+ MySqlCommand cmd = new MySqlCommand(sql, DbConnectService.mySqlConnect);
+
+ MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default);
+
+ if (aReader != null)
+ {
+ if (aReader.Read())
+ {
+ //判断门的状态
+ if (!aReader.IsDBNull(0))
+ {
+ name = aReader.GetString(0);
+ }
+ }
+ }
+
+ cmd.Dispose();
+ return name;
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message);
+ name = "";
+ }
+ return name;
+ }
+
+ public List getTypeListByCodeType(string codeType)
+ {
+ List nameList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')";
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ if (!aReader.IsDBNull(0))
+ nameList.Add(aReader.GetString(0));
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message);
+ nameList = null;
+ }
+
+ return nameList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
new file mode 100644
index 0000000..4f1ec53
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
@@ -0,0 +1,236 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class BaseStateDto
+ {
+ //基本信息
+ BaseInfo baseInfo;
+
+ //时间信息
+ BaseTime baseTime;
+
+ //位置信息
+ BasePosition basePosition;
+
+ internal BaseInfo BaseInfo
+ {
+ get
+ {
+ return baseInfo;
+ }
+
+ set
+ {
+ baseInfo = value;
+ }
+ }
+
+ internal BaseTime BaseTime
+ {
+ get
+ {
+ return baseTime;
+ }
+
+ set
+ {
+ baseTime = value;
+ }
+ }
+
+ internal BasePosition BasePosition
+ {
+ get
+ {
+ return basePosition;
+ }
+
+ set
+ {
+ basePosition = value;
+ }
+ }
+
+ }
+ ///
+ /// 基本信息
+ ///
+ class BaseInfo
+ {
+ //原子钟
+ String atomicClocksStatus;
+
+ //接收机状态
+ String receiverStatus;
+
+ public string AtomicClocksStatus
+ {
+ get
+ {
+ return atomicClocksStatus;
+ }
+
+ set
+ {
+ atomicClocksStatus = value;
+ }
+ }
+
+ public string ReceiverStatus
+ {
+ get
+ {
+ return receiverStatus;
+ }
+
+ set
+ {
+ receiverStatus = value;
+ }
+ }
+ }
+ ///
+ /// 时间信息
+ ///
+ class BaseTime
+ {
+ //日期
+ String date;
+
+ //时间
+ String time;
+
+ //mjd
+ String mjd;
+
+ public string Date
+ {
+ get
+ {
+ return date;
+ }
+
+ set
+ {
+ date = value;
+ }
+ }
+
+ public string Time
+ {
+ get
+ {
+ return time;
+ }
+
+ set
+ {
+ time = value;
+ }
+ }
+
+ public string Mjd
+ {
+ get
+ {
+ return mjd;
+ }
+
+ set
+ {
+ mjd = value;
+ }
+ }
+ }
+
+ ///
+ /// 位置信息
+ ///
+ class BasePosition
+ {
+ //经度
+ String lng;
+
+ //纬度
+ String lat;
+
+ //x
+ String x;
+
+ //y
+ String y;
+
+ //z
+ String z;
+
+ public string Lng
+ {
+ get
+ {
+ return lng;
+ }
+
+ set
+ {
+ lng = value;
+ }
+ }
+
+ public string Lat
+ {
+ get
+ {
+ return lat;
+ }
+
+ set
+ {
+ lat = value;
+ }
+ }
+
+ public string X
+ {
+ get
+ {
+ return x;
+ }
+
+ set
+ {
+ x = value;
+ }
+ }
+
+ public string Y
+ {
+ get
+ {
+ return y;
+ }
+
+ set
+ {
+ y = value;
+ }
+ }
+
+ public string Z
+ {
+ get
+ {
+ return z;
+ }
+
+ set
+ {
+ z = value;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
new file mode 100644
index 0000000..bc6c685
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
@@ -0,0 +1,87 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DetectionServiceImpl : DetectionService
+ {
+ public int add(int deviceId, DateTime logTime,String frequency)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection (DEVICE_ID,LOG_TIME,FREQUENCY)" +
+ "values(@DEVICE_ID,@LOG_TIME,@FREQUENCY)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 255).Value = frequency;
+ cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(int deviceId)
+ {
+ List detectionDtoList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetection : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT DEVICE_ID,LOG_TIME,FREQUENCY FROM r_detection where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionDto detectionDto = new DetectionDto();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionDto.DeviceId = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionDto.LogTime = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) detectionDto.Frequency = aReader.GetString(2);
+
+ detectionDtoList.Add(detectionDto);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionDtoList = null;
+ }
+ return detectionDtoList;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
new file mode 100644
index 0000000..8d3fc42
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
@@ -0,0 +1,200 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DeviceServiceImpl:DeviceService
+ {
+ public int add(string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+ //DetectionItemService detectionItemService = new DetectionItemServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_device (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,REG_TIME,CUSTOMER_NAME,CUSTOMER_DEV,STATUSID,CHANNEL,ACTIVE)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@REG_TIME,@CUSTOMER_NAME,@CUSTOMER_DEV,@STATUSID,@CHANNEL,@ACTIVE)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@REG_TIME", MySqlDbType.Date, 0).Value = DateTime.Now;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@STATUSID", MySqlDbType.String, 20).Value = 1;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+ cmd.Parameters.Add("@ACTIVE", MySqlDbType.Int64, 0).Value = 0;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int update(int id, string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,CUSTOMER_NAME,CUSTOMER_DEV,CHANNEL)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@CUSTOMER_NAME,@CUSTOMER_DEV,@CHANNEL) WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int delete(int id)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET ACTIVE = 1 WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(string devName, string devCode, string devModel,
+ string suctomerDev, string customerName, string statusId)
+ {
+
+ List deviceDtoList = new List();
+ DictService dictService = new DictServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_device where active = " + 0;
+
+ if (devName != "" && devName != null)
+ sQry += " and DEV_NAME like '%" + devName + "%'";
+ if (devCode != "" && devCode != null)
+ sQry += " and DEV_CODE like '%" + devCode + "%'";
+ if (devModel != "" && devModel != null)
+ sQry += " and DEV_MODEL like '%" + devModel + "%'";
+ if(suctomerDev!=""&&suctomerDev!=null)
+ sQry+= " and CUSTOMER_DEV like '%"+ suctomerDev + "%'";
+ if (customerName != "" && customerName != null)
+ sQry += " and CUSTOMER_NAME like '%" + customerName + "%'";
+ if (statusId != "" && statusId != null)
+ sQry += "and STATUSID = " + statusId;
+
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DeviceDto deviceDto = new DeviceDto();
+
+ if (!aReader.IsDBNull(0)) deviceDto.Id = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2);
+ if (!aReader.IsDBNull(3))
+ {
+ deviceDto.DevTypeId = aReader.GetString(3);
+ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3));
+ }
+ if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4);
+ if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(5);
+ if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(6);
+ if (!aReader.IsDBNull(7))
+ {
+ deviceDto.StatusId = aReader.GetString(7);
+ deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7));
+ }
+ if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8);
+
+ deviceDtoList.Add(deviceDto);
+ }
+
+ aCommand.Dispose();
+
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message);
+ deviceDtoList = null;
+ }
+
+ return deviceDtoList;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
new file mode 100644
index 0000000..04f5244
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
@@ -0,0 +1,85 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DictServiceImpl:DictService
+ {
+ public String getNameByCode(string codeType,string code)
+ {
+ String name = "";
+ try
+ {
+ string sql = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '"
+ + codeType + "') and code = " + code;
+
+ MySqlCommand cmd = new MySqlCommand(sql, DbConnectService.mySqlConnect);
+
+ MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default);
+
+ if (aReader != null)
+ {
+ if (aReader.Read())
+ {
+ //判断门的状态
+ if (!aReader.IsDBNull(0))
+ {
+ name = aReader.GetString(0);
+ }
+ }
+ }
+
+ cmd.Dispose();
+ return name;
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message);
+ name = "";
+ }
+ return name;
+ }
+
+ public List getTypeListByCodeType(string codeType)
+ {
+ List nameList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')";
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ if (!aReader.IsDBNull(0))
+ nameList.Add(aReader.GetString(0));
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message);
+ nameList = null;
+ }
+
+ return nameList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
new file mode 100644
index 0000000..4f1ec53
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
@@ -0,0 +1,236 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class BaseStateDto
+ {
+ //基本信息
+ BaseInfo baseInfo;
+
+ //时间信息
+ BaseTime baseTime;
+
+ //位置信息
+ BasePosition basePosition;
+
+ internal BaseInfo BaseInfo
+ {
+ get
+ {
+ return baseInfo;
+ }
+
+ set
+ {
+ baseInfo = value;
+ }
+ }
+
+ internal BaseTime BaseTime
+ {
+ get
+ {
+ return baseTime;
+ }
+
+ set
+ {
+ baseTime = value;
+ }
+ }
+
+ internal BasePosition BasePosition
+ {
+ get
+ {
+ return basePosition;
+ }
+
+ set
+ {
+ basePosition = value;
+ }
+ }
+
+ }
+ ///
+ /// 基本信息
+ ///
+ class BaseInfo
+ {
+ //原子钟
+ String atomicClocksStatus;
+
+ //接收机状态
+ String receiverStatus;
+
+ public string AtomicClocksStatus
+ {
+ get
+ {
+ return atomicClocksStatus;
+ }
+
+ set
+ {
+ atomicClocksStatus = value;
+ }
+ }
+
+ public string ReceiverStatus
+ {
+ get
+ {
+ return receiverStatus;
+ }
+
+ set
+ {
+ receiverStatus = value;
+ }
+ }
+ }
+ ///
+ /// 时间信息
+ ///
+ class BaseTime
+ {
+ //日期
+ String date;
+
+ //时间
+ String time;
+
+ //mjd
+ String mjd;
+
+ public string Date
+ {
+ get
+ {
+ return date;
+ }
+
+ set
+ {
+ date = value;
+ }
+ }
+
+ public string Time
+ {
+ get
+ {
+ return time;
+ }
+
+ set
+ {
+ time = value;
+ }
+ }
+
+ public string Mjd
+ {
+ get
+ {
+ return mjd;
+ }
+
+ set
+ {
+ mjd = value;
+ }
+ }
+ }
+
+ ///
+ /// 位置信息
+ ///
+ class BasePosition
+ {
+ //经度
+ String lng;
+
+ //纬度
+ String lat;
+
+ //x
+ String x;
+
+ //y
+ String y;
+
+ //z
+ String z;
+
+ public string Lng
+ {
+ get
+ {
+ return lng;
+ }
+
+ set
+ {
+ lng = value;
+ }
+ }
+
+ public string Lat
+ {
+ get
+ {
+ return lat;
+ }
+
+ set
+ {
+ lat = value;
+ }
+ }
+
+ public string X
+ {
+ get
+ {
+ return x;
+ }
+
+ set
+ {
+ x = value;
+ }
+ }
+
+ public string Y
+ {
+ get
+ {
+ return y;
+ }
+
+ set
+ {
+ y = value;
+ }
+ }
+
+ public string Z
+ {
+ get
+ {
+ return z;
+ }
+
+ set
+ {
+ z = value;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs b/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs
new file mode 100644
index 0000000..25e25d2
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs
@@ -0,0 +1,14 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface BaseInfoService
+ {
+ BaseStateDto getBaseStateDto();
+
+ }
+}
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
new file mode 100644
index 0000000..bc6c685
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
@@ -0,0 +1,87 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DetectionServiceImpl : DetectionService
+ {
+ public int add(int deviceId, DateTime logTime,String frequency)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection (DEVICE_ID,LOG_TIME,FREQUENCY)" +
+ "values(@DEVICE_ID,@LOG_TIME,@FREQUENCY)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 255).Value = frequency;
+ cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(int deviceId)
+ {
+ List detectionDtoList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetection : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT DEVICE_ID,LOG_TIME,FREQUENCY FROM r_detection where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionDto detectionDto = new DetectionDto();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionDto.DeviceId = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionDto.LogTime = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) detectionDto.Frequency = aReader.GetString(2);
+
+ detectionDtoList.Add(detectionDto);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionDtoList = null;
+ }
+ return detectionDtoList;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
new file mode 100644
index 0000000..8d3fc42
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
@@ -0,0 +1,200 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DeviceServiceImpl:DeviceService
+ {
+ public int add(string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+ //DetectionItemService detectionItemService = new DetectionItemServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_device (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,REG_TIME,CUSTOMER_NAME,CUSTOMER_DEV,STATUSID,CHANNEL,ACTIVE)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@REG_TIME,@CUSTOMER_NAME,@CUSTOMER_DEV,@STATUSID,@CHANNEL,@ACTIVE)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@REG_TIME", MySqlDbType.Date, 0).Value = DateTime.Now;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@STATUSID", MySqlDbType.String, 20).Value = 1;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+ cmd.Parameters.Add("@ACTIVE", MySqlDbType.Int64, 0).Value = 0;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int update(int id, string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,CUSTOMER_NAME,CUSTOMER_DEV,CHANNEL)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@CUSTOMER_NAME,@CUSTOMER_DEV,@CHANNEL) WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int delete(int id)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET ACTIVE = 1 WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(string devName, string devCode, string devModel,
+ string suctomerDev, string customerName, string statusId)
+ {
+
+ List deviceDtoList = new List();
+ DictService dictService = new DictServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_device where active = " + 0;
+
+ if (devName != "" && devName != null)
+ sQry += " and DEV_NAME like '%" + devName + "%'";
+ if (devCode != "" && devCode != null)
+ sQry += " and DEV_CODE like '%" + devCode + "%'";
+ if (devModel != "" && devModel != null)
+ sQry += " and DEV_MODEL like '%" + devModel + "%'";
+ if(suctomerDev!=""&&suctomerDev!=null)
+ sQry+= " and CUSTOMER_DEV like '%"+ suctomerDev + "%'";
+ if (customerName != "" && customerName != null)
+ sQry += " and CUSTOMER_NAME like '%" + customerName + "%'";
+ if (statusId != "" && statusId != null)
+ sQry += "and STATUSID = " + statusId;
+
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DeviceDto deviceDto = new DeviceDto();
+
+ if (!aReader.IsDBNull(0)) deviceDto.Id = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2);
+ if (!aReader.IsDBNull(3))
+ {
+ deviceDto.DevTypeId = aReader.GetString(3);
+ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3));
+ }
+ if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4);
+ if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(5);
+ if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(6);
+ if (!aReader.IsDBNull(7))
+ {
+ deviceDto.StatusId = aReader.GetString(7);
+ deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7));
+ }
+ if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8);
+
+ deviceDtoList.Add(deviceDto);
+ }
+
+ aCommand.Dispose();
+
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message);
+ deviceDtoList = null;
+ }
+
+ return deviceDtoList;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
new file mode 100644
index 0000000..04f5244
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
@@ -0,0 +1,85 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DictServiceImpl:DictService
+ {
+ public String getNameByCode(string codeType,string code)
+ {
+ String name = "";
+ try
+ {
+ string sql = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '"
+ + codeType + "') and code = " + code;
+
+ MySqlCommand cmd = new MySqlCommand(sql, DbConnectService.mySqlConnect);
+
+ MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default);
+
+ if (aReader != null)
+ {
+ if (aReader.Read())
+ {
+ //判断门的状态
+ if (!aReader.IsDBNull(0))
+ {
+ name = aReader.GetString(0);
+ }
+ }
+ }
+
+ cmd.Dispose();
+ return name;
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message);
+ name = "";
+ }
+ return name;
+ }
+
+ public List getTypeListByCodeType(string codeType)
+ {
+ List nameList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')";
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ if (!aReader.IsDBNull(0))
+ nameList.Add(aReader.GetString(0));
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message);
+ nameList = null;
+ }
+
+ return nameList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
new file mode 100644
index 0000000..4f1ec53
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
@@ -0,0 +1,236 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class BaseStateDto
+ {
+ //基本信息
+ BaseInfo baseInfo;
+
+ //时间信息
+ BaseTime baseTime;
+
+ //位置信息
+ BasePosition basePosition;
+
+ internal BaseInfo BaseInfo
+ {
+ get
+ {
+ return baseInfo;
+ }
+
+ set
+ {
+ baseInfo = value;
+ }
+ }
+
+ internal BaseTime BaseTime
+ {
+ get
+ {
+ return baseTime;
+ }
+
+ set
+ {
+ baseTime = value;
+ }
+ }
+
+ internal BasePosition BasePosition
+ {
+ get
+ {
+ return basePosition;
+ }
+
+ set
+ {
+ basePosition = value;
+ }
+ }
+
+ }
+ ///
+ /// 基本信息
+ ///
+ class BaseInfo
+ {
+ //原子钟
+ String atomicClocksStatus;
+
+ //接收机状态
+ String receiverStatus;
+
+ public string AtomicClocksStatus
+ {
+ get
+ {
+ return atomicClocksStatus;
+ }
+
+ set
+ {
+ atomicClocksStatus = value;
+ }
+ }
+
+ public string ReceiverStatus
+ {
+ get
+ {
+ return receiverStatus;
+ }
+
+ set
+ {
+ receiverStatus = value;
+ }
+ }
+ }
+ ///
+ /// 时间信息
+ ///
+ class BaseTime
+ {
+ //日期
+ String date;
+
+ //时间
+ String time;
+
+ //mjd
+ String mjd;
+
+ public string Date
+ {
+ get
+ {
+ return date;
+ }
+
+ set
+ {
+ date = value;
+ }
+ }
+
+ public string Time
+ {
+ get
+ {
+ return time;
+ }
+
+ set
+ {
+ time = value;
+ }
+ }
+
+ public string Mjd
+ {
+ get
+ {
+ return mjd;
+ }
+
+ set
+ {
+ mjd = value;
+ }
+ }
+ }
+
+ ///
+ /// 位置信息
+ ///
+ class BasePosition
+ {
+ //经度
+ String lng;
+
+ //纬度
+ String lat;
+
+ //x
+ String x;
+
+ //y
+ String y;
+
+ //z
+ String z;
+
+ public string Lng
+ {
+ get
+ {
+ return lng;
+ }
+
+ set
+ {
+ lng = value;
+ }
+ }
+
+ public string Lat
+ {
+ get
+ {
+ return lat;
+ }
+
+ set
+ {
+ lat = value;
+ }
+ }
+
+ public string X
+ {
+ get
+ {
+ return x;
+ }
+
+ set
+ {
+ x = value;
+ }
+ }
+
+ public string Y
+ {
+ get
+ {
+ return y;
+ }
+
+ set
+ {
+ y = value;
+ }
+ }
+
+ public string Z
+ {
+ get
+ {
+ return z;
+ }
+
+ set
+ {
+ z = value;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs b/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs
new file mode 100644
index 0000000..25e25d2
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs
@@ -0,0 +1,14 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface BaseInfoService
+ {
+ BaseStateDto getBaseStateDto();
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/BaseInfoServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/BaseInfoServiceImpl.cs
new file mode 100644
index 0000000..9f8a7de
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/BaseInfoServiceImpl.cs
@@ -0,0 +1,31 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
+{
+ class BaseInfoServiceImpl
+ {
+ public BaseStateDto getBaseStateDto()
+ {
+ BaseStateDto baseStateDto = new BaseStateDto();
+
+ try
+ {
+
+ }
+ catch(Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, " getBaseStateDto: " + ex.Message);
+ baseStateDto = null;
+ }
+
+ return baseStateDto;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config
index 356e71e..bbb88a7 100644
--- a/RbFreqStandMeasure/App.config
+++ b/RbFreqStandMeasure/App.config
@@ -5,7 +5,7 @@
-
+
diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
new file mode 100644
index 0000000..19ec91c
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs
@@ -0,0 +1,64 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase
+{
+ public class DbConnectService
+ {
+ public static MySqlConnection mySqlConnect = null;
+ private static String server = ConfigHelper.GetAppConfig("server");
+ private static String databasePort = ConfigHelper.GetAppConfig("databasePort");
+ private static String databaseUser = ConfigHelper.GetAppConfig("databaseUser");
+ private static String databaseName = ConfigHelper.GetAppConfig("databaseName");
+ private static String databasePassword = ConfigHelper.GetAppConfig("databasePassword");
+
+ public static int openDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ string sConnection = "server=" + server
+ + ";port=" + databasePort
+ + ";user=" + databaseUser
+ + ";database=" + databaseName
+ + ";password=" + databasePassword
+ + ";Charset=utf8"
+ + ";Allow User Variables=True";
+ mySqlConnect = new MySqlConnection(sConnection);
+ mySqlConnect.Open();
+ iRetval = 0;
+ }
+ catch (Exception ex)
+ {
+ iRetval = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "openDB : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public static int closeDb()
+ {
+ int iRetval = -1;
+ try
+ {
+ mySqlConnect.Close();
+ }
+ catch (MySqlException exSql)
+ {
+ iRetval = exSql.ErrorCode;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "closeDB : " + ex.Message);
+ }
+
+ return iRetval;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
new file mode 100644
index 0000000..fc4fe82
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DetectionDto.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DetectionDto
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ String logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
new file mode 100644
index 0000000..06d0598
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Dto/DeviceDto.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto
+{
+ class DeviceDto
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+ //设备类型
+ private String devTypeName;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private String regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //设备状态名称
+ private String statusName;
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public string RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeName
+ {
+ get
+ {
+ return devTypeName;
+ }
+
+ set
+ {
+ devTypeName = value;
+ }
+ }
+
+ public string StatusName
+ {
+ get
+ {
+ return statusName;
+ }
+
+ set
+ {
+ statusName = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Detection.cs b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
new file mode 100644
index 0000000..5e7b45a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Detection.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 检测值
+ ///
+ public class Detection
+ {
+ int id;
+
+ //设备ID
+ int deviceId;
+
+ //记录时间
+ DateTime logTime;
+ //频率
+ String frequency;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public string Frequency
+ {
+ get
+ {
+ return frequency;
+ }
+
+ set
+ {
+ frequency = value;
+ }
+ }
+
+ public DateTime LogTime
+ {
+ get
+ {
+ return logTime;
+ }
+
+ set
+ {
+ logTime = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
new file mode 100644
index 0000000..f101b94
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/DetectionItem.cs
@@ -0,0 +1,152 @@
+
+using System;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class DetectionItem
+ {
+ private int id;
+
+ //设备ID
+ private int deviceId;
+
+ //开始时间
+ private DateTime startTime;
+
+ //结束时间
+ private DateTime endTime;
+
+ //频率稳定度
+ private int stability;
+
+ //频率准确度
+ private int accuracy;
+
+ //开机特性
+ private int bootFeature;
+
+ //日老化率
+ private int ageRate;
+
+ //频率稳定度
+ private String interval;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int DeviceId
+ {
+ get
+ {
+ return deviceId;
+ }
+
+ set
+ {
+ deviceId = value;
+ }
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return startTime;
+ }
+
+ set
+ {
+ startTime = value;
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return endTime;
+ }
+
+ set
+ {
+ endTime = value;
+ }
+ }
+
+ public int Stability
+ {
+ get
+ {
+ return stability;
+ }
+
+ set
+ {
+ stability = value;
+ }
+ }
+
+ public int Accuracy
+ {
+ get
+ {
+ return accuracy;
+ }
+
+ set
+ {
+ accuracy = value;
+ }
+ }
+
+ public int BootFeature
+ {
+ get
+ {
+ return bootFeature;
+ }
+
+ set
+ {
+ bootFeature = value;
+ }
+ }
+
+ public int AgeRate
+ {
+ get
+ {
+ return ageRate;
+ }
+
+ set
+ {
+ ageRate = value;
+ }
+ }
+
+ public string Interval
+ {
+ get
+ {
+ return interval;
+ }
+
+ set
+ {
+ interval = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Device.cs b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
new file mode 100644
index 0000000..639832a
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Device.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 设备
+ ///
+ public class Device
+ {
+ private int id;
+
+ //设备名称
+ private String devName;
+
+ //设备编号
+ private String devCode;
+
+ //设备类型
+ private String devTypeId;
+
+ //设备型号
+ private String devModel;
+
+ //注册时间
+ private DateTime regTime;
+
+ //客户姓名
+ private String customerName;
+
+ //客户单位
+ private String customerDev;
+
+ //设备状态
+ private String statusId;
+
+ //通道
+ private String channel;
+
+ //逻辑位
+ private int active;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string DevName
+ {
+ get
+ {
+ return devName;
+ }
+
+ set
+ {
+ devName = value;
+ }
+ }
+
+ public string DevCode
+ {
+ get
+ {
+ return devCode;
+ }
+
+ set
+ {
+ devCode = value;
+ }
+ }
+
+ public DateTime RegTime
+ {
+ get
+ {
+ return regTime;
+ }
+
+ set
+ {
+ regTime = value;
+ }
+ }
+
+ public string CustomerName
+ {
+ get
+ {
+ return customerName;
+ }
+
+ set
+ {
+ customerName = value;
+ }
+ }
+
+ public string CustomerDev
+ {
+ get
+ {
+ return customerDev;
+ }
+
+ set
+ {
+ customerDev = value;
+ }
+ }
+
+ public string StatusId
+ {
+ get
+ {
+ return statusId;
+ }
+
+ set
+ {
+ statusId = value;
+ }
+ }
+
+ public string Channel
+ {
+ get
+ {
+ return channel;
+ }
+
+ set
+ {
+ channel = value;
+ }
+ }
+
+ public int Active
+ {
+ get
+ {
+ return active;
+ }
+
+ set
+ {
+ active = value;
+ }
+ }
+
+ public string DevModel
+ {
+ get
+ {
+ return devModel;
+ }
+
+ set
+ {
+ devModel = value;
+ }
+ }
+
+ public string DevTypeId
+ {
+ get
+ {
+ return devTypeId;
+ }
+
+ set
+ {
+ devTypeId = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Dict.cs b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
new file mode 100644
index 0000000..fa7b4a5
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Dict.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ ///
+ /// 字典
+ ///
+ public class Dict
+ {
+ private int id;
+
+ //父节点
+ private int pid;
+
+ //名称
+ private String name;
+
+ //编号
+ private String code;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public int Pid
+ {
+ get
+ {
+ return pid;
+ }
+
+ set
+ {
+ pid = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Code
+ {
+ get
+ {
+ return code;
+ }
+
+ set
+ {
+ code = value;
+ }
+ }
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
new file mode 100644
index 0000000..c8ae202
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Model/Sensitivity.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model
+{
+ public class Sensitivity
+ {
+ private int id;
+
+ private String baudRate;
+
+ private String generatorIp;
+
+ private String signalSourceIp;
+
+ public int Id
+ {
+ get
+ {
+ return id;
+ }
+
+ set
+ {
+ id = value;
+ }
+ }
+
+ public string BaudRate
+ {
+ get
+ {
+ return baudRate;
+ }
+
+ set
+ {
+ baudRate = value;
+ }
+ }
+
+ public string GeneratorIp
+ {
+ get
+ {
+ return generatorIp;
+ }
+
+ set
+ {
+ generatorIp = value;
+ }
+ }
+
+ public string SignalSourceIp
+ {
+ get
+ {
+ return signalSourceIp;
+ }
+
+ set
+ {
+ signalSourceIp = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
new file mode 100644
index 0000000..6714999
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs
@@ -0,0 +1,18 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionItemService
+ {
+ int add(int deviceId,DateTime startTime,DateTime endTime,int stability,int accuracy,int bootFeature,int ageRate,String interval);
+
+ int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval);
+
+ List serach(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
new file mode 100644
index 0000000..cedbce7
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionService.cs
@@ -0,0 +1,17 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DetectionService
+ {
+ int add(int deviceId, DateTime logTime, String frequency);
+
+ List search(int deviceId);
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
new file mode 100644
index 0000000..806deab
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs
@@ -0,0 +1,20 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DeviceService
+ {
+ int add(string devName,string devCode,string devTypeId,string devModel, string custometDev,string customerName,string channel);
+
+ int update(int id, string devName, string devCode, string devTypeId, string devModel, string custometDev, string customerName, string channel);
+
+ int delete(int id);
+
+ List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId);
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/DictService.cs b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
new file mode 100644
index 0000000..3c3cfa1
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/DictService.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service
+{
+ interface DictService
+ {
+ String getNameByCode(string codeType,string code);
+
+ List getTypeListByCodeType(string codeType);
+ }
+}
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
new file mode 100644
index 0000000..2685901
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs
@@ -0,0 +1,132 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+
+ class DetectionItemServiceImpl : DetectionItemService
+ {
+ public int add(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection_item (DEVICE_ID,START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values(@DEVICE_ID,@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public int update(int deviceId, DateTime startTime, DateTime endTime, int stability, int accuracy, int bootFeature, int ageRate, String interval)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_detection_item SET (START_TIME,END_TIME,STABILITY,ACCURACY,BOOT_FEATURE,AGE_RATE,INTERVAL)" +
+ "values (@START_TIME,@END_TIME,@STABILITY,@ACCURACY,@BOOT_FEATURE,@AGE_RATE,@INTERVAL) WHERE DEVICE_ID = " + deviceId;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@START_TIME", MySqlDbType.DateTime, 0).Value = startTime;
+ cmd.Parameters.Add("@END_TIME", MySqlDbType.DateTime, 0).Value = endTime;
+ cmd.Parameters.Add("@STABILITY", MySqlDbType.Int64, 10).Value = stability;
+ cmd.Parameters.Add("@ACCURACY", MySqlDbType.Int64, 10).Value = accuracy;
+ cmd.Parameters.Add("@BOOT_FEATURE", MySqlDbType.Int64, 10).Value = bootFeature;
+ cmd.Parameters.Add("@AGE_RATE", MySqlDbType.Int64, 10).Value = ageRate;
+ cmd.Parameters.Add("@INTERVAL", MySqlDbType.String, 30).Value = interval;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+ iRetval = 0;
+ }
+ catch (MySqlException e)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message);
+ iRetval = -1;
+ }
+ return iRetval;
+ }
+
+ public List serach(int deviceId)
+ {
+ List detectionItemList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_detection_item where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionItem detectionItem = new DetectionItem();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionItem.Id=Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt32(aReader.GetString(1));
+ if (!aReader.IsDBNull(2)) detectionItem.StartTime = Convert.ToDateTime(aReader.GetString(2));
+ if (!aReader.IsDBNull(3)) detectionItem.EndTime = Convert.ToDateTime(aReader.GetString(3));
+ if (!aReader.IsDBNull(4)) detectionItem.Stability = Convert.ToInt32(aReader.GetString(4));
+ if (!aReader.IsDBNull(5)) detectionItem.Accuracy = Convert.ToInt32(aReader.GetString(5));
+ if (!aReader.IsDBNull(6)) detectionItem.BootFeature = Convert.ToInt32(aReader.GetString(6));
+ if (!aReader.IsDBNull(7)) detectionItem.AgeRate = Convert.ToInt32(aReader.GetString(7));
+ if (!aReader.IsDBNull(8)) detectionItem.Interval = aReader.GetString(8);
+ detectionItemList.Add(detectionItem);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionItemList = null;
+ }
+ return detectionItemList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
new file mode 100644
index 0000000..bc6c685
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs
@@ -0,0 +1,87 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DetectionServiceImpl : DetectionService
+ {
+ public int add(int deviceId, DateTime logTime,String frequency)
+ {
+ int iRetval = -1;
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_detection (DEVICE_ID,LOG_TIME,FREQUENCY)" +
+ "values(@DEVICE_ID,@LOG_TIME,@FREQUENCY)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId;
+ cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 255).Value = frequency;
+ cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDetection : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(int deviceId)
+ {
+ List detectionDtoList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetection : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT DEVICE_ID,LOG_TIME,FREQUENCY FROM r_detection where DEVICE_ID = " + deviceId;
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DetectionDto detectionDto = new DetectionDto();
+ //姓名
+ if (!aReader.IsDBNull(0)) detectionDto.DeviceId = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) detectionDto.LogTime = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) detectionDto.Frequency = aReader.GetString(2);
+
+ detectionDtoList.Add(detectionDto);
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDetectionItem: " + ex.Message);
+ detectionDtoList = null;
+ }
+ return detectionDtoList;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
new file mode 100644
index 0000000..8d3fc42
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs
@@ -0,0 +1,200 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DeviceServiceImpl:DeviceService
+ {
+ public int add(string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+ //DetectionItemService detectionItemService = new DetectionItemServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "INSERT INTO r_device (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,REG_TIME,CUSTOMER_NAME,CUSTOMER_DEV,STATUSID,CHANNEL,ACTIVE)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@REG_TIME,@CUSTOMER_NAME,@CUSTOMER_DEV,@STATUSID,@CHANNEL,@ACTIVE)";
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@REG_TIME", MySqlDbType.Date, 0).Value = DateTime.Now;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@STATUSID", MySqlDbType.String, 20).Value = 1;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+ cmd.Parameters.Add("@ACTIVE", MySqlDbType.Int64, 0).Value = 0;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "addDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int update(int id, string devName, string devCode, string devTypeId, string devModel,
+ string custometDev, string customerName, string channel)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET (DEV_NAME,DEV_CODE,DEV_TYPEID,DEV_MODEL,CUSTOMER_NAME,CUSTOMER_DEV,CHANNEL)" +
+ "values(@DEV_NAME,@DEV_CODE,@DEV_TYPEID,@DEV_MODEL,@CUSTOMER_NAME,@CUSTOMER_DEV,@CHANNEL) WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+ cmd.Parameters.Add("@DEV_NAME", MySqlDbType.String, 30).Value = devName;
+ cmd.Parameters.Add("@DEV_CODE", MySqlDbType.String, 30).Value = devCode;
+ cmd.Parameters.Add("@DEV_TYPEID", MySqlDbType.String, 30).Value = devTypeId;
+ cmd.Parameters.Add("@DEV_MODEL", MySqlDbType.String, 30).Value = devModel;
+ cmd.Parameters.Add("@CUSTOMER_NAME", MySqlDbType.String, 30).Value = customerName;
+ cmd.Parameters.Add("@CUSTOMER_DEV", MySqlDbType.String, 30).Value = custometDev;
+ cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 20).Value = channel;
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public int delete(int id)
+ {
+ int iRetval = -1;
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : 数据库链接断开");
+ return iRetval;
+ }
+
+ string sQry = "UPDATE r_device SET ACTIVE = 1 WHERE ID = " + id;
+
+ MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ cmd.ExecuteNonQuery();
+
+ cmd.Dispose();
+
+ iRetval = 0;
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "deleteDeviced : " + ex.Message);
+ }
+ return iRetval;
+ }
+
+ public List search(string devName, string devCode, string devModel,
+ string suctomerDev, string customerName, string statusId)
+ {
+
+ List deviceDtoList = new List();
+ DictService dictService = new DictServiceImpl();
+
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT * FROM r_device where active = " + 0;
+
+ if (devName != "" && devName != null)
+ sQry += " and DEV_NAME like '%" + devName + "%'";
+ if (devCode != "" && devCode != null)
+ sQry += " and DEV_CODE like '%" + devCode + "%'";
+ if (devModel != "" && devModel != null)
+ sQry += " and DEV_MODEL like '%" + devModel + "%'";
+ if(suctomerDev!=""&&suctomerDev!=null)
+ sQry+= " and CUSTOMER_DEV like '%"+ suctomerDev + "%'";
+ if (customerName != "" && customerName != null)
+ sQry += " and CUSTOMER_NAME like '%" + customerName + "%'";
+ if (statusId != "" && statusId != null)
+ sQry += "and STATUSID = " + statusId;
+
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ DeviceDto deviceDto = new DeviceDto();
+
+ if (!aReader.IsDBNull(0)) deviceDto.Id = Convert.ToInt32(aReader.GetString(0));
+ if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1);
+ if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2);
+ if (!aReader.IsDBNull(3))
+ {
+ deviceDto.DevTypeId = aReader.GetString(3);
+ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3));
+ }
+ if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4);
+ if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(5);
+ if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(6);
+ if (!aReader.IsDBNull(7))
+ {
+ deviceDto.StatusId = aReader.GetString(7);
+ deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7));
+ }
+ if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8);
+
+ deviceDtoList.Add(deviceDto);
+ }
+
+ aCommand.Dispose();
+
+ }
+ }
+ catch (MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message);
+ deviceDtoList = null;
+ }
+
+ return deviceDtoList;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
new file mode 100644
index 0000000..04f5244
--- /dev/null
+++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs
@@ -0,0 +1,85 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using MySql.Data.MySqlClient;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl
+{
+ class DictServiceImpl:DictService
+ {
+ public String getNameByCode(string codeType,string code)
+ {
+ String name = "";
+ try
+ {
+ string sql = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '"
+ + codeType + "') and code = " + code;
+
+ MySqlCommand cmd = new MySqlCommand(sql, DbConnectService.mySqlConnect);
+
+ MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default);
+
+ if (aReader != null)
+ {
+ if (aReader.Read())
+ {
+ //判断门的状态
+ if (!aReader.IsDBNull(0))
+ {
+ name = aReader.GetString(0);
+ }
+ }
+ }
+
+ cmd.Dispose();
+ return name;
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message);
+ name = "";
+ }
+ return name;
+ }
+
+ public List getTypeListByCodeType(string codeType)
+ {
+ List nameList = new List();
+ try
+ {
+ if (DbConnectService.mySqlConnect.State == ConnectionState.Closed)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开");
+ return null;
+ }
+
+ string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')";
+ MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect);
+
+ using (MySqlDataReader aReader = aCommand.ExecuteReader())
+ {
+ while (aReader.Read())
+ {
+ if (!aReader.IsDBNull(0))
+ nameList.Add(aReader.GetString(0));
+ }
+
+ aCommand.Dispose();
+ }
+ }
+ catch(MySqlException ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message);
+ nameList = null;
+ }
+
+ return nameList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
new file mode 100644
index 0000000..4f1ec53
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/BaseStateDto.cs
@@ -0,0 +1,236 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class BaseStateDto
+ {
+ //基本信息
+ BaseInfo baseInfo;
+
+ //时间信息
+ BaseTime baseTime;
+
+ //位置信息
+ BasePosition basePosition;
+
+ internal BaseInfo BaseInfo
+ {
+ get
+ {
+ return baseInfo;
+ }
+
+ set
+ {
+ baseInfo = value;
+ }
+ }
+
+ internal BaseTime BaseTime
+ {
+ get
+ {
+ return baseTime;
+ }
+
+ set
+ {
+ baseTime = value;
+ }
+ }
+
+ internal BasePosition BasePosition
+ {
+ get
+ {
+ return basePosition;
+ }
+
+ set
+ {
+ basePosition = value;
+ }
+ }
+
+ }
+ ///
+ /// 基本信息
+ ///
+ class BaseInfo
+ {
+ //原子钟
+ String atomicClocksStatus;
+
+ //接收机状态
+ String receiverStatus;
+
+ public string AtomicClocksStatus
+ {
+ get
+ {
+ return atomicClocksStatus;
+ }
+
+ set
+ {
+ atomicClocksStatus = value;
+ }
+ }
+
+ public string ReceiverStatus
+ {
+ get
+ {
+ return receiverStatus;
+ }
+
+ set
+ {
+ receiverStatus = value;
+ }
+ }
+ }
+ ///
+ /// 时间信息
+ ///
+ class BaseTime
+ {
+ //日期
+ String date;
+
+ //时间
+ String time;
+
+ //mjd
+ String mjd;
+
+ public string Date
+ {
+ get
+ {
+ return date;
+ }
+
+ set
+ {
+ date = value;
+ }
+ }
+
+ public string Time
+ {
+ get
+ {
+ return time;
+ }
+
+ set
+ {
+ time = value;
+ }
+ }
+
+ public string Mjd
+ {
+ get
+ {
+ return mjd;
+ }
+
+ set
+ {
+ mjd = value;
+ }
+ }
+ }
+
+ ///
+ /// 位置信息
+ ///
+ class BasePosition
+ {
+ //经度
+ String lng;
+
+ //纬度
+ String lat;
+
+ //x
+ String x;
+
+ //y
+ String y;
+
+ //z
+ String z;
+
+ public string Lng
+ {
+ get
+ {
+ return lng;
+ }
+
+ set
+ {
+ lng = value;
+ }
+ }
+
+ public string Lat
+ {
+ get
+ {
+ return lat;
+ }
+
+ set
+ {
+ lat = value;
+ }
+ }
+
+ public string X
+ {
+ get
+ {
+ return x;
+ }
+
+ set
+ {
+ x = value;
+ }
+ }
+
+ public string Y
+ {
+ get
+ {
+ return y;
+ }
+
+ set
+ {
+ y = value;
+ }
+ }
+
+ public string Z
+ {
+ get
+ {
+ return z;
+ }
+
+ set
+ {
+ z = value;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs b/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs
new file mode 100644
index 0000000..25e25d2
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/BaseInfoService.cs
@@ -0,0 +1,14 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface BaseInfoService
+ {
+ BaseStateDto getBaseStateDto();
+
+ }
+}
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/BaseInfoServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/BaseInfoServiceImpl.cs
new file mode 100644
index 0000000..9f8a7de
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/BaseInfoServiceImpl.cs
@@ -0,0 +1,31 @@
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
+{
+ class BaseInfoServiceImpl
+ {
+ public BaseStateDto getBaseStateDto()
+ {
+ BaseStateDto baseStateDto = new BaseStateDto();
+
+ try
+ {
+
+ }
+ catch(Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, " getBaseStateDto: " + ex.Message);
+ baseStateDto = null;
+ }
+
+ return baseStateDto;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/db/model/Company.cs b/RbFreqStandMeasure/db/model/Company.cs
deleted file mode 100644
index aa04e10..0000000
--- a/RbFreqStandMeasure/db/model/Company.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Casic.Birmm.RbFreqStandMeasure.db.model
-{
- class Company
- {
- // 主键ID
- private string id;
- // 客户公司名称
- private string name;
- // 客户联系地址
- private string address;
- // 客户联系人
- private string contacts;
- // 客户联系电话
- private string phone;
- // 备注
- private string remarks;
- // 是否删除
- private int valid;
- // 时间戳,编辑时更新
- private string ts;
-
- public string Id { get => id; set => id = value; }
- public string Name { get => name; set => name = value; }
- public string Address { get => address; set => address = value; }
- public string Contacts { get => contacts; set => contacts = value; }
- public string Phone { get => phone; set => phone = value; }
- public string Remarks { get => remarks; set => remarks = value; }
- public int Valid { get => valid; set => valid = value; }
- public string Ts { get => ts; set => ts = value; }
- }
-}