diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 8d3fc42..e84275f 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -150,7 +150,7 @@ if (customerName != "" && customerName != null) sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; if (statusId != "" && statusId != null) - sQry += "and STATUSID = " + statusId; + sQry += " and STATUSID = " + statusId; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); @@ -193,8 +193,143 @@ return deviceDtoList; } - + public List searchPage(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId, + int page, int limit) + { + List deviceDtoList = new List(); + DictService dictService = new DictServiceImpl(); + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + if (customerName != "" && customerName != null) + sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; + if (statusId != "" && statusId != null) + sQry += " and STATUSID = " + statusId; + + sQry += " limit " + limit + " offset " + (page - 1) * limit; + + 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)); // id + if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1); // devName + if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2); // devCode + if (!aReader.IsDBNull(3)) + { + deviceDto.DevTypeId = aReader.GetString(3); // devType + deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); + } + if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); // devModel + if (!aReader.IsDBNull(5)) + { + DateTime reg = aReader.GetDateTime(5); // regTime + deviceDto.RegTime = reg.ToString("yyyy-MM-dd"); + } + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); // customName + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); // customDev + if (!aReader.IsDBNull(8)) + { + deviceDto.StatusId = aReader.GetString(8); // devStatus + deviceDto.StatusName = dictService.getNameByCode("devStatus", deviceDto.StatusId); + } + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); + + deviceDtoList.Add(deviceDto); + } + + aCommand.Dispose(); + + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message); + deviceDtoList = null; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return deviceDtoList; + } + public int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId) + { + int totalCount = 0; + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + string sQry = "SELECT count(id) 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + 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()) + { + totalCount = aReader.GetInt32(0); + } + + aCommand.Dispose(); + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTotalCount: " + ex.Message); + totalCount = 0; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return totalCount; + } } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 8d3fc42..e84275f 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -150,7 +150,7 @@ if (customerName != "" && customerName != null) sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; if (statusId != "" && statusId != null) - sQry += "and STATUSID = " + statusId; + sQry += " and STATUSID = " + statusId; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); @@ -193,8 +193,143 @@ return deviceDtoList; } - + public List searchPage(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId, + int page, int limit) + { + List deviceDtoList = new List(); + DictService dictService = new DictServiceImpl(); + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + if (customerName != "" && customerName != null) + sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; + if (statusId != "" && statusId != null) + sQry += " and STATUSID = " + statusId; + + sQry += " limit " + limit + " offset " + (page - 1) * limit; + + 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)); // id + if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1); // devName + if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2); // devCode + if (!aReader.IsDBNull(3)) + { + deviceDto.DevTypeId = aReader.GetString(3); // devType + deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); + } + if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); // devModel + if (!aReader.IsDBNull(5)) + { + DateTime reg = aReader.GetDateTime(5); // regTime + deviceDto.RegTime = reg.ToString("yyyy-MM-dd"); + } + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); // customName + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); // customDev + if (!aReader.IsDBNull(8)) + { + deviceDto.StatusId = aReader.GetString(8); // devStatus + deviceDto.StatusName = dictService.getNameByCode("devStatus", deviceDto.StatusId); + } + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); + + deviceDtoList.Add(deviceDto); + } + + aCommand.Dispose(); + + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message); + deviceDtoList = null; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return deviceDtoList; + } + public int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId) + { + int totalCount = 0; + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + string sQry = "SELECT count(id) 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + 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()) + { + totalCount = aReader.GetInt32(0); + } + + aCommand.Dispose(); + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTotalCount: " + ex.Message); + totalCount = 0; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return totalCount; + } } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs index 04f5244..05fcfb3 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs @@ -3,9 +3,7 @@ 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 { @@ -14,12 +12,14 @@ public String getNameByCode(string codeType,string code) { String name = ""; + MySqlConnection conn = null; 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); + + conn = DbConnectService.getConnection(); + MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default); @@ -35,6 +35,7 @@ } } + aReader.Close(); cmd.Dispose(); return name; } @@ -42,6 +43,14 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message); name = ""; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } } return name; } @@ -49,16 +58,13 @@ public List getTypeListByCodeType(string codeType) { List nameList = new List(); + MySqlConnection conn = null; try { - if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开"); - return null; - } + conn = DbConnectService.getConnection(); string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')"; - MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + MySqlCommand aCommand = new MySqlCommand(sQry, conn); using (MySqlDataReader aReader = aCommand.ExecuteReader()) { @@ -69,6 +75,8 @@ } aCommand.Dispose(); + conn.Close(); + conn.Dispose(); // 用完即关闭连接 } } catch(MySqlException ex) @@ -76,10 +84,16 @@ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message); nameList = null; } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } + } return nameList; } - - } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 8d3fc42..e84275f 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -150,7 +150,7 @@ if (customerName != "" && customerName != null) sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; if (statusId != "" && statusId != null) - sQry += "and STATUSID = " + statusId; + sQry += " and STATUSID = " + statusId; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); @@ -193,8 +193,143 @@ return deviceDtoList; } - + public List searchPage(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId, + int page, int limit) + { + List deviceDtoList = new List(); + DictService dictService = new DictServiceImpl(); + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + if (customerName != "" && customerName != null) + sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; + if (statusId != "" && statusId != null) + sQry += " and STATUSID = " + statusId; + + sQry += " limit " + limit + " offset " + (page - 1) * limit; + + 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)); // id + if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1); // devName + if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2); // devCode + if (!aReader.IsDBNull(3)) + { + deviceDto.DevTypeId = aReader.GetString(3); // devType + deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); + } + if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); // devModel + if (!aReader.IsDBNull(5)) + { + DateTime reg = aReader.GetDateTime(5); // regTime + deviceDto.RegTime = reg.ToString("yyyy-MM-dd"); + } + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); // customName + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); // customDev + if (!aReader.IsDBNull(8)) + { + deviceDto.StatusId = aReader.GetString(8); // devStatus + deviceDto.StatusName = dictService.getNameByCode("devStatus", deviceDto.StatusId); + } + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); + + deviceDtoList.Add(deviceDto); + } + + aCommand.Dispose(); + + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message); + deviceDtoList = null; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return deviceDtoList; + } + public int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId) + { + int totalCount = 0; + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + string sQry = "SELECT count(id) 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + 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()) + { + totalCount = aReader.GetInt32(0); + } + + aCommand.Dispose(); + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTotalCount: " + ex.Message); + totalCount = 0; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return totalCount; + } } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs index 04f5244..05fcfb3 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs @@ -3,9 +3,7 @@ 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 { @@ -14,12 +12,14 @@ public String getNameByCode(string codeType,string code) { String name = ""; + MySqlConnection conn = null; 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); + + conn = DbConnectService.getConnection(); + MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default); @@ -35,6 +35,7 @@ } } + aReader.Close(); cmd.Dispose(); return name; } @@ -42,6 +43,14 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message); name = ""; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } } return name; } @@ -49,16 +58,13 @@ public List getTypeListByCodeType(string codeType) { List nameList = new List(); + MySqlConnection conn = null; try { - if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开"); - return null; - } + conn = DbConnectService.getConnection(); string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')"; - MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + MySqlCommand aCommand = new MySqlCommand(sQry, conn); using (MySqlDataReader aReader = aCommand.ExecuteReader()) { @@ -69,6 +75,8 @@ } aCommand.Dispose(); + conn.Close(); + conn.Dispose(); // 用完即关闭连接 } } catch(MySqlException ex) @@ -76,10 +84,16 @@ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message); nameList = null; } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } + } return nameList; } - - } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 53267da..7cf51de 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -48,22 +48,27 @@ this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); - this.textBoxX3 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label8 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.label11 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); - this.comboBoxEx1 = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channelFree = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channel1 = new DevComponents.Editors.ComboItem(); + this.channel2 = new DevComponents.Editors.ComboItem(); + this.channel3 = new DevComponents.Editors.ComboItem(); + this.channel4 = new DevComponents.Editors.ComboItem(); + this.channel5 = new DevComponents.Editors.ComboItem(); this.label4 = new System.Windows.Forms.Label(); - this.textBoxX7 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label2 = new System.Windows.Forms.Label(); - this.textBoxX6 = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.textBoxX5 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustComp = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevModel = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label1 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); - this.textBoxX4 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevCode = new DevComponents.DotNetBar.Controls.TextBoxX(); this.panel4.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.endTimeEst)).BeginInit(); @@ -79,7 +84,7 @@ this.checkBox9.Location = new System.Drawing.Point(506, 348); this.checkBox9.Name = "checkBox9"; this.checkBox9.Size = new System.Drawing.Size(84, 24); - this.checkBox9.TabIndex = 22; + this.checkBox9.TabIndex = 19; this.checkBox9.Text = "立即开始"; this.checkBox9.UseVisualStyleBackColor = true; // @@ -101,9 +106,10 @@ this.btnSave.PressForeColor = System.Drawing.Color.White; this.btnSave.Radius = 5; this.btnSave.Size = new System.Drawing.Size(120, 30); - this.btnSave.TabIndex = 24; + this.btnSave.TabIndex = 17; this.btnSave.Text = "开始检测"; this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // label6 // @@ -112,7 +118,7 @@ this.label6.Margin = new System.Windows.Forms.Padding(0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(100, 27); - this.label6.TabIndex = 8; + this.label6.TabIndex = 38; this.label6.Text = "频率稳定度"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -123,7 +129,7 @@ this.checkBox1.Location = new System.Drawing.Point(420, 12); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(60, 24); - this.checkBox1.TabIndex = 9; + this.checkBox1.TabIndex = 16; this.checkBox1.Text = "100S"; this.checkBox1.UseVisualStyleBackColor = true; // @@ -134,7 +140,7 @@ this.checkBox2.Location = new System.Drawing.Point(326, 12); this.checkBox2.Name = "checkBox2"; this.checkBox2.Size = new System.Drawing.Size(52, 24); - this.checkBox2.TabIndex = 9; + this.checkBox2.TabIndex = 15; this.checkBox2.Text = "20S"; this.checkBox2.UseVisualStyleBackColor = true; // @@ -145,7 +151,7 @@ this.checkBox3.Location = new System.Drawing.Point(218, 12); this.checkBox3.Name = "checkBox3"; this.checkBox3.Size = new System.Drawing.Size(52, 24); - this.checkBox3.TabIndex = 9; + this.checkBox3.TabIndex = 14; this.checkBox3.Text = "10S"; this.checkBox3.UseVisualStyleBackColor = true; // @@ -156,7 +162,7 @@ this.checkBox4.Location = new System.Drawing.Point(110, 12); this.checkBox4.Name = "checkBox4"; this.checkBox4.Size = new System.Drawing.Size(44, 24); - this.checkBox4.TabIndex = 9; + this.checkBox4.TabIndex = 13; this.checkBox4.Text = "1S"; this.checkBox4.UseVisualStyleBackColor = true; // @@ -170,7 +176,7 @@ this.btnCancelSetDev.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.btnCancelSetDev.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancelSetDev.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(47)))), ((int)(((byte)(111)))), ((int)(((byte)(198))))); + this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(86)))), ((int)(((byte)(163)))), ((int)(((byte)(242))))); this.btnCancelSetDev.HoverForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Location = new System.Drawing.Point(310, 342); this.btnCancelSetDev.Name = "btnCancelSetDev"; @@ -178,7 +184,7 @@ this.btnCancelSetDev.PressForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Radius = 5; this.btnCancelSetDev.Size = new System.Drawing.Size(120, 30); - this.btnCancelSetDev.TabIndex = 23; + this.btnCancelSetDev.TabIndex = 18; this.btnCancelSetDev.Text = "取消"; this.btnCancelSetDev.UseVisualStyleBackColor = true; this.btnCancelSetDev.Click += new System.EventHandler(this.btnAddDevCancel_Click); @@ -310,7 +316,7 @@ this.startTime.ShowUpDown = true; this.startTime.Size = new System.Drawing.Size(180, 23); this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 12; + this.startTime.TabIndex = 11; this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // checkBox10 @@ -320,7 +326,7 @@ this.checkBox10.Location = new System.Drawing.Point(420, 12); this.checkBox10.Name = "checkBox10"; this.checkBox10.Size = new System.Drawing.Size(84, 24); - this.checkBox10.TabIndex = 11; + this.checkBox10.TabIndex = 10; this.checkBox10.Text = "日老化率"; this.checkBox10.UseVisualStyleBackColor = true; // @@ -331,7 +337,7 @@ this.checkBox11.Location = new System.Drawing.Point(326, 12); this.checkBox11.Name = "checkBox11"; this.checkBox11.Size = new System.Drawing.Size(84, 24); - this.checkBox11.TabIndex = 10; + this.checkBox11.TabIndex = 9; this.checkBox11.Text = "开机特性"; this.checkBox11.UseVisualStyleBackColor = true; // @@ -342,7 +348,7 @@ this.checkBox12.Location = new System.Drawing.Point(218, 12); this.checkBox12.Name = "checkBox12"; this.checkBox12.Size = new System.Drawing.Size(98, 24); - this.checkBox12.TabIndex = 9; + this.checkBox12.TabIndex = 8; this.checkBox12.Text = "频率准确度"; this.checkBox12.UseVisualStyleBackColor = true; // @@ -353,7 +359,7 @@ this.checkBox13.Location = new System.Drawing.Point(110, 12); this.checkBox13.Name = "checkBox13"; this.checkBox13.Size = new System.Drawing.Size(98, 24); - this.checkBox13.TabIndex = 9; + this.checkBox13.TabIndex = 7; this.checkBox13.Text = "频率稳定度"; this.checkBox13.UseVisualStyleBackColor = true; // @@ -375,7 +381,7 @@ this.label12.Margin = new System.Windows.Forms.Padding(0); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(100, 27); - this.label12.TabIndex = 8; + this.label12.TabIndex = 37; this.label12.Text = "测量开始时间"; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -386,25 +392,25 @@ this.label13.Margin = new System.Windows.Forms.Padding(0); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(100, 27); - this.label13.TabIndex = 8; + this.label13.TabIndex = 36; this.label13.Text = "检测项目"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX3 + // inputDevName // // // // - this.textBoxX3.Border.Class = "TextBoxBorder"; - this.textBoxX3.Border.CornerDiameter = 5; - this.textBoxX3.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX3.Location = new System.Drawing.Point(110, 10); - this.textBoxX3.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX3.Name = "textBoxX3"; - this.textBoxX3.PreventEnterBeep = true; - this.textBoxX3.Size = new System.Drawing.Size(150, 27); - this.textBoxX3.TabIndex = 13; + this.inputDevName.Border.Class = "TextBoxBorder"; + this.inputDevName.Border.CornerDiameter = 5; + this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevName.Location = new System.Drawing.Point(110, 10); + this.inputDevName.Margin = new System.Windows.Forms.Padding(0); + this.inputDevName.Name = "inputDevName"; + this.inputDevName.PreventEnterBeep = true; + this.inputDevName.Size = new System.Drawing.Size(150, 27); + this.inputDevName.TabIndex = 1; // // label8 // @@ -413,7 +419,7 @@ this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(100, 27); - this.label8.TabIndex = 10; + this.label8.TabIndex = 31; this.label8.Text = "仪器编号"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -424,7 +430,7 @@ this.label5.Margin = new System.Windows.Forms.Padding(0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(100, 27); - this.label5.TabIndex = 11; + this.label5.TabIndex = 30; this.label5.Text = "仪器名称"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -469,16 +475,16 @@ // panel2 // this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel2.Controls.Add(this.comboBoxEx1); + this.panel2.Controls.Add(this.channelFree); this.panel2.Controls.Add(this.label4); - this.panel2.Controls.Add(this.textBoxX7); + this.panel2.Controls.Add(this.inputCustName); this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.textBoxX6); - this.panel2.Controls.Add(this.textBoxX5); + this.panel2.Controls.Add(this.inputCustComp); + this.panel2.Controls.Add(this.inputDevModel); this.panel2.Controls.Add(this.label1); this.panel2.Controls.Add(this.label9); - this.panel2.Controls.Add(this.textBoxX4); - this.panel2.Controls.Add(this.textBoxX3); + this.panel2.Controls.Add(this.inputDevCode); + this.panel2.Controls.Add(this.inputDevName); this.panel2.Controls.Add(this.label8); this.panel2.Controls.Add(this.label5); this.panel2.Location = new System.Drawing.Point(10, 40); @@ -486,18 +492,49 @@ this.panel2.Size = new System.Drawing.Size(580, 121); this.panel2.TabIndex = 19; // - // comboBoxEx1 + // channelFree // - this.comboBoxEx1.DisplayMember = "Text"; - this.comboBoxEx1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.comboBoxEx1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.comboBoxEx1.FormattingEnabled = true; - this.comboBoxEx1.ItemHeight = 18; - this.comboBoxEx1.Location = new System.Drawing.Point(400, 87); - this.comboBoxEx1.Name = "comboBoxEx1"; - this.comboBoxEx1.Size = new System.Drawing.Size(150, 24); - this.comboBoxEx1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.comboBoxEx1.TabIndex = 21; + this.channelFree.DisplayMember = "Text"; + this.channelFree.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.channelFree.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.channelFree.FormattingEnabled = true; + this.channelFree.ItemHeight = 18; + this.channelFree.Items.AddRange(new object[] { + this.channel1, + this.channel2, + this.channel3, + this.channel4, + this.channel5}); + this.channelFree.Location = new System.Drawing.Point(400, 87); + this.channelFree.Name = "channelFree"; + this.channelFree.Size = new System.Drawing.Size(150, 24); + this.channelFree.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.channelFree.TabIndex = 6; + // + // channel1 + // + this.channel1.Text = "通道1"; + this.channel1.Value = "1"; + // + // channel2 + // + this.channel2.Text = "通道2"; + this.channel2.Value = "2"; + // + // channel3 + // + this.channel3.Text = "通道3"; + this.channel3.Value = "3"; + // + // channel4 + // + this.channel4.Text = "通道4"; + this.channel4.Value = "4"; + // + // channel5 + // + this.channel5.Text = "通道5"; + this.channel5.Value = "5"; // // label4 // @@ -506,25 +543,25 @@ this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(100, 27); - this.label4.TabIndex = 20; + this.label4.TabIndex = 35; this.label4.Text = "选择通道"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX7 + // inputCustName // // // // - this.textBoxX7.Border.Class = "TextBoxBorder"; - this.textBoxX7.Border.CornerDiameter = 5; - this.textBoxX7.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX7.Location = new System.Drawing.Point(110, 84); - this.textBoxX7.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX7.Name = "textBoxX7"; - this.textBoxX7.PreventEnterBeep = true; - this.textBoxX7.Size = new System.Drawing.Size(150, 27); - this.textBoxX7.TabIndex = 19; + this.inputCustName.Border.Class = "TextBoxBorder"; + this.inputCustName.Border.CornerDiameter = 5; + this.inputCustName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustName.Location = new System.Drawing.Point(110, 84); + this.inputCustName.Margin = new System.Windows.Forms.Padding(0); + this.inputCustName.Name = "inputCustName"; + this.inputCustName.PreventEnterBeep = true; + this.inputCustName.Size = new System.Drawing.Size(150, 27); + this.inputCustName.TabIndex = 5; // // label2 // @@ -533,41 +570,41 @@ this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(100, 27); - this.label2.TabIndex = 18; + this.label2.TabIndex = 34; this.label2.Text = "联系人"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX6 + // inputCustComp // // // // - this.textBoxX6.Border.Class = "TextBoxBorder"; - this.textBoxX6.Border.CornerDiameter = 5; - this.textBoxX6.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX6.Location = new System.Drawing.Point(400, 47); - this.textBoxX6.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX6.Name = "textBoxX6"; - this.textBoxX6.PreventEnterBeep = true; - this.textBoxX6.Size = new System.Drawing.Size(150, 27); - this.textBoxX6.TabIndex = 16; + this.inputCustComp.Border.Class = "TextBoxBorder"; + this.inputCustComp.Border.CornerDiameter = 5; + this.inputCustComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustComp.Location = new System.Drawing.Point(400, 47); + this.inputCustComp.Margin = new System.Windows.Forms.Padding(0); + this.inputCustComp.Name = "inputCustComp"; + this.inputCustComp.PreventEnterBeep = true; + this.inputCustComp.Size = new System.Drawing.Size(150, 27); + this.inputCustComp.TabIndex = 4; // - // textBoxX5 + // inputDevModel // // // // - this.textBoxX5.Border.Class = "TextBoxBorder"; - this.textBoxX5.Border.CornerDiameter = 5; - this.textBoxX5.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX5.Location = new System.Drawing.Point(110, 47); - this.textBoxX5.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX5.Name = "textBoxX5"; - this.textBoxX5.PreventEnterBeep = true; - this.textBoxX5.Size = new System.Drawing.Size(150, 27); - this.textBoxX5.TabIndex = 17; + this.inputDevModel.Border.Class = "TextBoxBorder"; + this.inputDevModel.Border.CornerDiameter = 5; + this.inputDevModel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevModel.Location = new System.Drawing.Point(110, 47); + this.inputDevModel.Margin = new System.Windows.Forms.Padding(0); + this.inputDevModel.Name = "inputDevModel"; + this.inputDevModel.PreventEnterBeep = true; + this.inputDevModel.Size = new System.Drawing.Size(150, 27); + this.inputDevModel.TabIndex = 3; // // label1 // @@ -576,7 +613,7 @@ this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 27); - this.label1.TabIndex = 14; + this.label1.TabIndex = 33; this.label1.Text = "送检单位"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -587,25 +624,25 @@ this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(100, 27); - this.label9.TabIndex = 15; + this.label9.TabIndex = 32; this.label9.Text = "仪器型号"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX4 + // inputDevCode // // // // - this.textBoxX4.Border.Class = "TextBoxBorder"; - this.textBoxX4.Border.CornerDiameter = 5; - this.textBoxX4.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX4.Location = new System.Drawing.Point(400, 10); - this.textBoxX4.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX4.Name = "textBoxX4"; - this.textBoxX4.PreventEnterBeep = true; - this.textBoxX4.Size = new System.Drawing.Size(150, 27); - this.textBoxX4.TabIndex = 12; + this.inputDevCode.Border.Class = "TextBoxBorder"; + this.inputDevCode.Border.CornerDiameter = 5; + this.inputDevCode.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevCode.Location = new System.Drawing.Point(400, 10); + this.inputDevCode.Margin = new System.Windows.Forms.Padding(0); + this.inputDevCode.Name = "inputDevCode"; + this.inputDevCode.PreventEnterBeep = true; + this.inputDevCode.Size = new System.Drawing.Size(150, 27); + this.inputDevCode.TabIndex = 2; // // AddDevDlg // @@ -658,21 +695,26 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX3; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevName; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label5; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button btnExitDev; private System.Windows.Forms.Label label11; private System.Windows.Forms.Panel panel2; - private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1; + private DevComponents.DotNetBar.Controls.ComboBoxEx channelFree; private System.Windows.Forms.Label label4; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX7; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustName; private System.Windows.Forms.Label label2; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX6; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX5; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustComp; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevModel; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX4; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; + private DevComponents.Editors.ComboItem channel1; + private DevComponents.Editors.ComboItem channel2; + private DevComponents.Editors.ComboItem channel3; + private DevComponents.Editors.ComboItem channel4; + private DevComponents.Editors.ComboItem channel5; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 8d3fc42..e84275f 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -150,7 +150,7 @@ if (customerName != "" && customerName != null) sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; if (statusId != "" && statusId != null) - sQry += "and STATUSID = " + statusId; + sQry += " and STATUSID = " + statusId; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); @@ -193,8 +193,143 @@ return deviceDtoList; } - + public List searchPage(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId, + int page, int limit) + { + List deviceDtoList = new List(); + DictService dictService = new DictServiceImpl(); + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + if (customerName != "" && customerName != null) + sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; + if (statusId != "" && statusId != null) + sQry += " and STATUSID = " + statusId; + + sQry += " limit " + limit + " offset " + (page - 1) * limit; + + 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)); // id + if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1); // devName + if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2); // devCode + if (!aReader.IsDBNull(3)) + { + deviceDto.DevTypeId = aReader.GetString(3); // devType + deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); + } + if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); // devModel + if (!aReader.IsDBNull(5)) + { + DateTime reg = aReader.GetDateTime(5); // regTime + deviceDto.RegTime = reg.ToString("yyyy-MM-dd"); + } + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); // customName + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); // customDev + if (!aReader.IsDBNull(8)) + { + deviceDto.StatusId = aReader.GetString(8); // devStatus + deviceDto.StatusName = dictService.getNameByCode("devStatus", deviceDto.StatusId); + } + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); + + deviceDtoList.Add(deviceDto); + } + + aCommand.Dispose(); + + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message); + deviceDtoList = null; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return deviceDtoList; + } + public int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId) + { + int totalCount = 0; + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + string sQry = "SELECT count(id) 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + 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()) + { + totalCount = aReader.GetInt32(0); + } + + aCommand.Dispose(); + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTotalCount: " + ex.Message); + totalCount = 0; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return totalCount; + } } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs index 04f5244..05fcfb3 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs @@ -3,9 +3,7 @@ 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 { @@ -14,12 +12,14 @@ public String getNameByCode(string codeType,string code) { String name = ""; + MySqlConnection conn = null; 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); + + conn = DbConnectService.getConnection(); + MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default); @@ -35,6 +35,7 @@ } } + aReader.Close(); cmd.Dispose(); return name; } @@ -42,6 +43,14 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message); name = ""; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } } return name; } @@ -49,16 +58,13 @@ public List getTypeListByCodeType(string codeType) { List nameList = new List(); + MySqlConnection conn = null; try { - if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开"); - return null; - } + conn = DbConnectService.getConnection(); string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')"; - MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + MySqlCommand aCommand = new MySqlCommand(sQry, conn); using (MySqlDataReader aReader = aCommand.ExecuteReader()) { @@ -69,6 +75,8 @@ } aCommand.Dispose(); + conn.Close(); + conn.Dispose(); // 用完即关闭连接 } } catch(MySqlException ex) @@ -76,10 +84,16 @@ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message); nameList = null; } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } + } return nameList; } - - } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 53267da..7cf51de 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -48,22 +48,27 @@ this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); - this.textBoxX3 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label8 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.label11 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); - this.comboBoxEx1 = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channelFree = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channel1 = new DevComponents.Editors.ComboItem(); + this.channel2 = new DevComponents.Editors.ComboItem(); + this.channel3 = new DevComponents.Editors.ComboItem(); + this.channel4 = new DevComponents.Editors.ComboItem(); + this.channel5 = new DevComponents.Editors.ComboItem(); this.label4 = new System.Windows.Forms.Label(); - this.textBoxX7 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label2 = new System.Windows.Forms.Label(); - this.textBoxX6 = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.textBoxX5 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustComp = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevModel = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label1 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); - this.textBoxX4 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevCode = new DevComponents.DotNetBar.Controls.TextBoxX(); this.panel4.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.endTimeEst)).BeginInit(); @@ -79,7 +84,7 @@ this.checkBox9.Location = new System.Drawing.Point(506, 348); this.checkBox9.Name = "checkBox9"; this.checkBox9.Size = new System.Drawing.Size(84, 24); - this.checkBox9.TabIndex = 22; + this.checkBox9.TabIndex = 19; this.checkBox9.Text = "立即开始"; this.checkBox9.UseVisualStyleBackColor = true; // @@ -101,9 +106,10 @@ this.btnSave.PressForeColor = System.Drawing.Color.White; this.btnSave.Radius = 5; this.btnSave.Size = new System.Drawing.Size(120, 30); - this.btnSave.TabIndex = 24; + this.btnSave.TabIndex = 17; this.btnSave.Text = "开始检测"; this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // label6 // @@ -112,7 +118,7 @@ this.label6.Margin = new System.Windows.Forms.Padding(0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(100, 27); - this.label6.TabIndex = 8; + this.label6.TabIndex = 38; this.label6.Text = "频率稳定度"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -123,7 +129,7 @@ this.checkBox1.Location = new System.Drawing.Point(420, 12); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(60, 24); - this.checkBox1.TabIndex = 9; + this.checkBox1.TabIndex = 16; this.checkBox1.Text = "100S"; this.checkBox1.UseVisualStyleBackColor = true; // @@ -134,7 +140,7 @@ this.checkBox2.Location = new System.Drawing.Point(326, 12); this.checkBox2.Name = "checkBox2"; this.checkBox2.Size = new System.Drawing.Size(52, 24); - this.checkBox2.TabIndex = 9; + this.checkBox2.TabIndex = 15; this.checkBox2.Text = "20S"; this.checkBox2.UseVisualStyleBackColor = true; // @@ -145,7 +151,7 @@ this.checkBox3.Location = new System.Drawing.Point(218, 12); this.checkBox3.Name = "checkBox3"; this.checkBox3.Size = new System.Drawing.Size(52, 24); - this.checkBox3.TabIndex = 9; + this.checkBox3.TabIndex = 14; this.checkBox3.Text = "10S"; this.checkBox3.UseVisualStyleBackColor = true; // @@ -156,7 +162,7 @@ this.checkBox4.Location = new System.Drawing.Point(110, 12); this.checkBox4.Name = "checkBox4"; this.checkBox4.Size = new System.Drawing.Size(44, 24); - this.checkBox4.TabIndex = 9; + this.checkBox4.TabIndex = 13; this.checkBox4.Text = "1S"; this.checkBox4.UseVisualStyleBackColor = true; // @@ -170,7 +176,7 @@ this.btnCancelSetDev.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.btnCancelSetDev.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancelSetDev.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(47)))), ((int)(((byte)(111)))), ((int)(((byte)(198))))); + this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(86)))), ((int)(((byte)(163)))), ((int)(((byte)(242))))); this.btnCancelSetDev.HoverForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Location = new System.Drawing.Point(310, 342); this.btnCancelSetDev.Name = "btnCancelSetDev"; @@ -178,7 +184,7 @@ this.btnCancelSetDev.PressForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Radius = 5; this.btnCancelSetDev.Size = new System.Drawing.Size(120, 30); - this.btnCancelSetDev.TabIndex = 23; + this.btnCancelSetDev.TabIndex = 18; this.btnCancelSetDev.Text = "取消"; this.btnCancelSetDev.UseVisualStyleBackColor = true; this.btnCancelSetDev.Click += new System.EventHandler(this.btnAddDevCancel_Click); @@ -310,7 +316,7 @@ this.startTime.ShowUpDown = true; this.startTime.Size = new System.Drawing.Size(180, 23); this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 12; + this.startTime.TabIndex = 11; this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // checkBox10 @@ -320,7 +326,7 @@ this.checkBox10.Location = new System.Drawing.Point(420, 12); this.checkBox10.Name = "checkBox10"; this.checkBox10.Size = new System.Drawing.Size(84, 24); - this.checkBox10.TabIndex = 11; + this.checkBox10.TabIndex = 10; this.checkBox10.Text = "日老化率"; this.checkBox10.UseVisualStyleBackColor = true; // @@ -331,7 +337,7 @@ this.checkBox11.Location = new System.Drawing.Point(326, 12); this.checkBox11.Name = "checkBox11"; this.checkBox11.Size = new System.Drawing.Size(84, 24); - this.checkBox11.TabIndex = 10; + this.checkBox11.TabIndex = 9; this.checkBox11.Text = "开机特性"; this.checkBox11.UseVisualStyleBackColor = true; // @@ -342,7 +348,7 @@ this.checkBox12.Location = new System.Drawing.Point(218, 12); this.checkBox12.Name = "checkBox12"; this.checkBox12.Size = new System.Drawing.Size(98, 24); - this.checkBox12.TabIndex = 9; + this.checkBox12.TabIndex = 8; this.checkBox12.Text = "频率准确度"; this.checkBox12.UseVisualStyleBackColor = true; // @@ -353,7 +359,7 @@ this.checkBox13.Location = new System.Drawing.Point(110, 12); this.checkBox13.Name = "checkBox13"; this.checkBox13.Size = new System.Drawing.Size(98, 24); - this.checkBox13.TabIndex = 9; + this.checkBox13.TabIndex = 7; this.checkBox13.Text = "频率稳定度"; this.checkBox13.UseVisualStyleBackColor = true; // @@ -375,7 +381,7 @@ this.label12.Margin = new System.Windows.Forms.Padding(0); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(100, 27); - this.label12.TabIndex = 8; + this.label12.TabIndex = 37; this.label12.Text = "测量开始时间"; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -386,25 +392,25 @@ this.label13.Margin = new System.Windows.Forms.Padding(0); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(100, 27); - this.label13.TabIndex = 8; + this.label13.TabIndex = 36; this.label13.Text = "检测项目"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX3 + // inputDevName // // // // - this.textBoxX3.Border.Class = "TextBoxBorder"; - this.textBoxX3.Border.CornerDiameter = 5; - this.textBoxX3.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX3.Location = new System.Drawing.Point(110, 10); - this.textBoxX3.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX3.Name = "textBoxX3"; - this.textBoxX3.PreventEnterBeep = true; - this.textBoxX3.Size = new System.Drawing.Size(150, 27); - this.textBoxX3.TabIndex = 13; + this.inputDevName.Border.Class = "TextBoxBorder"; + this.inputDevName.Border.CornerDiameter = 5; + this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevName.Location = new System.Drawing.Point(110, 10); + this.inputDevName.Margin = new System.Windows.Forms.Padding(0); + this.inputDevName.Name = "inputDevName"; + this.inputDevName.PreventEnterBeep = true; + this.inputDevName.Size = new System.Drawing.Size(150, 27); + this.inputDevName.TabIndex = 1; // // label8 // @@ -413,7 +419,7 @@ this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(100, 27); - this.label8.TabIndex = 10; + this.label8.TabIndex = 31; this.label8.Text = "仪器编号"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -424,7 +430,7 @@ this.label5.Margin = new System.Windows.Forms.Padding(0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(100, 27); - this.label5.TabIndex = 11; + this.label5.TabIndex = 30; this.label5.Text = "仪器名称"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -469,16 +475,16 @@ // panel2 // this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel2.Controls.Add(this.comboBoxEx1); + this.panel2.Controls.Add(this.channelFree); this.panel2.Controls.Add(this.label4); - this.panel2.Controls.Add(this.textBoxX7); + this.panel2.Controls.Add(this.inputCustName); this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.textBoxX6); - this.panel2.Controls.Add(this.textBoxX5); + this.panel2.Controls.Add(this.inputCustComp); + this.panel2.Controls.Add(this.inputDevModel); this.panel2.Controls.Add(this.label1); this.panel2.Controls.Add(this.label9); - this.panel2.Controls.Add(this.textBoxX4); - this.panel2.Controls.Add(this.textBoxX3); + this.panel2.Controls.Add(this.inputDevCode); + this.panel2.Controls.Add(this.inputDevName); this.panel2.Controls.Add(this.label8); this.panel2.Controls.Add(this.label5); this.panel2.Location = new System.Drawing.Point(10, 40); @@ -486,18 +492,49 @@ this.panel2.Size = new System.Drawing.Size(580, 121); this.panel2.TabIndex = 19; // - // comboBoxEx1 + // channelFree // - this.comboBoxEx1.DisplayMember = "Text"; - this.comboBoxEx1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.comboBoxEx1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.comboBoxEx1.FormattingEnabled = true; - this.comboBoxEx1.ItemHeight = 18; - this.comboBoxEx1.Location = new System.Drawing.Point(400, 87); - this.comboBoxEx1.Name = "comboBoxEx1"; - this.comboBoxEx1.Size = new System.Drawing.Size(150, 24); - this.comboBoxEx1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.comboBoxEx1.TabIndex = 21; + this.channelFree.DisplayMember = "Text"; + this.channelFree.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.channelFree.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.channelFree.FormattingEnabled = true; + this.channelFree.ItemHeight = 18; + this.channelFree.Items.AddRange(new object[] { + this.channel1, + this.channel2, + this.channel3, + this.channel4, + this.channel5}); + this.channelFree.Location = new System.Drawing.Point(400, 87); + this.channelFree.Name = "channelFree"; + this.channelFree.Size = new System.Drawing.Size(150, 24); + this.channelFree.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.channelFree.TabIndex = 6; + // + // channel1 + // + this.channel1.Text = "通道1"; + this.channel1.Value = "1"; + // + // channel2 + // + this.channel2.Text = "通道2"; + this.channel2.Value = "2"; + // + // channel3 + // + this.channel3.Text = "通道3"; + this.channel3.Value = "3"; + // + // channel4 + // + this.channel4.Text = "通道4"; + this.channel4.Value = "4"; + // + // channel5 + // + this.channel5.Text = "通道5"; + this.channel5.Value = "5"; // // label4 // @@ -506,25 +543,25 @@ this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(100, 27); - this.label4.TabIndex = 20; + this.label4.TabIndex = 35; this.label4.Text = "选择通道"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX7 + // inputCustName // // // // - this.textBoxX7.Border.Class = "TextBoxBorder"; - this.textBoxX7.Border.CornerDiameter = 5; - this.textBoxX7.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX7.Location = new System.Drawing.Point(110, 84); - this.textBoxX7.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX7.Name = "textBoxX7"; - this.textBoxX7.PreventEnterBeep = true; - this.textBoxX7.Size = new System.Drawing.Size(150, 27); - this.textBoxX7.TabIndex = 19; + this.inputCustName.Border.Class = "TextBoxBorder"; + this.inputCustName.Border.CornerDiameter = 5; + this.inputCustName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustName.Location = new System.Drawing.Point(110, 84); + this.inputCustName.Margin = new System.Windows.Forms.Padding(0); + this.inputCustName.Name = "inputCustName"; + this.inputCustName.PreventEnterBeep = true; + this.inputCustName.Size = new System.Drawing.Size(150, 27); + this.inputCustName.TabIndex = 5; // // label2 // @@ -533,41 +570,41 @@ this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(100, 27); - this.label2.TabIndex = 18; + this.label2.TabIndex = 34; this.label2.Text = "联系人"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX6 + // inputCustComp // // // // - this.textBoxX6.Border.Class = "TextBoxBorder"; - this.textBoxX6.Border.CornerDiameter = 5; - this.textBoxX6.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX6.Location = new System.Drawing.Point(400, 47); - this.textBoxX6.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX6.Name = "textBoxX6"; - this.textBoxX6.PreventEnterBeep = true; - this.textBoxX6.Size = new System.Drawing.Size(150, 27); - this.textBoxX6.TabIndex = 16; + this.inputCustComp.Border.Class = "TextBoxBorder"; + this.inputCustComp.Border.CornerDiameter = 5; + this.inputCustComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustComp.Location = new System.Drawing.Point(400, 47); + this.inputCustComp.Margin = new System.Windows.Forms.Padding(0); + this.inputCustComp.Name = "inputCustComp"; + this.inputCustComp.PreventEnterBeep = true; + this.inputCustComp.Size = new System.Drawing.Size(150, 27); + this.inputCustComp.TabIndex = 4; // - // textBoxX5 + // inputDevModel // // // // - this.textBoxX5.Border.Class = "TextBoxBorder"; - this.textBoxX5.Border.CornerDiameter = 5; - this.textBoxX5.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX5.Location = new System.Drawing.Point(110, 47); - this.textBoxX5.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX5.Name = "textBoxX5"; - this.textBoxX5.PreventEnterBeep = true; - this.textBoxX5.Size = new System.Drawing.Size(150, 27); - this.textBoxX5.TabIndex = 17; + this.inputDevModel.Border.Class = "TextBoxBorder"; + this.inputDevModel.Border.CornerDiameter = 5; + this.inputDevModel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevModel.Location = new System.Drawing.Point(110, 47); + this.inputDevModel.Margin = new System.Windows.Forms.Padding(0); + this.inputDevModel.Name = "inputDevModel"; + this.inputDevModel.PreventEnterBeep = true; + this.inputDevModel.Size = new System.Drawing.Size(150, 27); + this.inputDevModel.TabIndex = 3; // // label1 // @@ -576,7 +613,7 @@ this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 27); - this.label1.TabIndex = 14; + this.label1.TabIndex = 33; this.label1.Text = "送检单位"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -587,25 +624,25 @@ this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(100, 27); - this.label9.TabIndex = 15; + this.label9.TabIndex = 32; this.label9.Text = "仪器型号"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX4 + // inputDevCode // // // // - this.textBoxX4.Border.Class = "TextBoxBorder"; - this.textBoxX4.Border.CornerDiameter = 5; - this.textBoxX4.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX4.Location = new System.Drawing.Point(400, 10); - this.textBoxX4.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX4.Name = "textBoxX4"; - this.textBoxX4.PreventEnterBeep = true; - this.textBoxX4.Size = new System.Drawing.Size(150, 27); - this.textBoxX4.TabIndex = 12; + this.inputDevCode.Border.Class = "TextBoxBorder"; + this.inputDevCode.Border.CornerDiameter = 5; + this.inputDevCode.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevCode.Location = new System.Drawing.Point(400, 10); + this.inputDevCode.Margin = new System.Windows.Forms.Padding(0); + this.inputDevCode.Name = "inputDevCode"; + this.inputDevCode.PreventEnterBeep = true; + this.inputDevCode.Size = new System.Drawing.Size(150, 27); + this.inputDevCode.TabIndex = 2; // // AddDevDlg // @@ -658,21 +695,26 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX3; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevName; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label5; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button btnExitDev; private System.Windows.Forms.Label label11; private System.Windows.Forms.Panel panel2; - private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1; + private DevComponents.DotNetBar.Controls.ComboBoxEx channelFree; private System.Windows.Forms.Label label4; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX7; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustName; private System.Windows.Forms.Label label2; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX6; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX5; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustComp; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevModel; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX4; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; + private DevComponents.Editors.ComboItem channel1; + private DevComponents.Editors.ComboItem channel2; + private DevComponents.Editors.ComboItem channel3; + private DevComponents.Editors.ComboItem channel4; + private DevComponents.Editors.ComboItem channel5; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 592ada3..652c6b4 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -1,4 +1,9 @@ -using System; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using DevComponents.DotNetBar.Controls; +using DevComponents.Editors; +using System; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -31,6 +36,8 @@ public AddDevDlg() { InitializeComponent(); + + ((ComboBoxEx)this.Controls.Find("channelFree", true)[0]).SelectedIndex = 0; } // 关闭对话框 @@ -38,5 +45,32 @@ { this.HideMaskAction(); } + + // 添加并开始检测 + private void btnSave_Click(object sender, EventArgs e) + { + // 取得输入框的参数 + string devName = ((TextBoxX) this.Controls.Find("inputDevName", true)[0]).Text; + string devCode = ((TextBoxX) this.Controls.Find("inputDevCode", true)[0]).Text; + string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; + string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; + string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; + + ComboBoxEx channels = (ComboBoxEx)this.Controls.Find("channelFree", true)[0]; + string channelNo = (string)((ComboItem)channels.SelectedItem).Value; + + // 初始化数据访问接口 + DeviceService devService = new DeviceServiceImpl(); + int id = devService.add(devName, devCode, "1", devModel, devCustomComp, devCustomName, channelNo); + if (id >= 0) + { + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); + } + else + { + LogHelper.WriteErrorLog(this.GetType(), "添加设备[" + devName + "]失败"); + } + } } } diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 8d3fc42..e84275f 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -150,7 +150,7 @@ if (customerName != "" && customerName != null) sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; if (statusId != "" && statusId != null) - sQry += "and STATUSID = " + statusId; + sQry += " and STATUSID = " + statusId; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); @@ -193,8 +193,143 @@ return deviceDtoList; } - + public List searchPage(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId, + int page, int limit) + { + List deviceDtoList = new List(); + DictService dictService = new DictServiceImpl(); + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + if (customerName != "" && customerName != null) + sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; + if (statusId != "" && statusId != null) + sQry += " and STATUSID = " + statusId; + + sQry += " limit " + limit + " offset " + (page - 1) * limit; + + 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)); // id + if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1); // devName + if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2); // devCode + if (!aReader.IsDBNull(3)) + { + deviceDto.DevTypeId = aReader.GetString(3); // devType + deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); + } + if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); // devModel + if (!aReader.IsDBNull(5)) + { + DateTime reg = aReader.GetDateTime(5); // regTime + deviceDto.RegTime = reg.ToString("yyyy-MM-dd"); + } + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); // customName + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); // customDev + if (!aReader.IsDBNull(8)) + { + deviceDto.StatusId = aReader.GetString(8); // devStatus + deviceDto.StatusName = dictService.getNameByCode("devStatus", deviceDto.StatusId); + } + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); + + deviceDtoList.Add(deviceDto); + } + + aCommand.Dispose(); + + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message); + deviceDtoList = null; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return deviceDtoList; + } + public int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId) + { + int totalCount = 0; + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + string sQry = "SELECT count(id) 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + 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()) + { + totalCount = aReader.GetInt32(0); + } + + aCommand.Dispose(); + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTotalCount: " + ex.Message); + totalCount = 0; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return totalCount; + } } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs index 04f5244..05fcfb3 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs @@ -3,9 +3,7 @@ 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 { @@ -14,12 +12,14 @@ public String getNameByCode(string codeType,string code) { String name = ""; + MySqlConnection conn = null; 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); + + conn = DbConnectService.getConnection(); + MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default); @@ -35,6 +35,7 @@ } } + aReader.Close(); cmd.Dispose(); return name; } @@ -42,6 +43,14 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message); name = ""; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } } return name; } @@ -49,16 +58,13 @@ public List getTypeListByCodeType(string codeType) { List nameList = new List(); + MySqlConnection conn = null; try { - if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开"); - return null; - } + conn = DbConnectService.getConnection(); string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')"; - MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + MySqlCommand aCommand = new MySqlCommand(sQry, conn); using (MySqlDataReader aReader = aCommand.ExecuteReader()) { @@ -69,6 +75,8 @@ } aCommand.Dispose(); + conn.Close(); + conn.Dispose(); // 用完即关闭连接 } } catch(MySqlException ex) @@ -76,10 +84,16 @@ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message); nameList = null; } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } + } return nameList; } - - } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 53267da..7cf51de 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -48,22 +48,27 @@ this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); - this.textBoxX3 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label8 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.label11 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); - this.comboBoxEx1 = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channelFree = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channel1 = new DevComponents.Editors.ComboItem(); + this.channel2 = new DevComponents.Editors.ComboItem(); + this.channel3 = new DevComponents.Editors.ComboItem(); + this.channel4 = new DevComponents.Editors.ComboItem(); + this.channel5 = new DevComponents.Editors.ComboItem(); this.label4 = new System.Windows.Forms.Label(); - this.textBoxX7 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label2 = new System.Windows.Forms.Label(); - this.textBoxX6 = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.textBoxX5 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustComp = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevModel = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label1 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); - this.textBoxX4 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevCode = new DevComponents.DotNetBar.Controls.TextBoxX(); this.panel4.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.endTimeEst)).BeginInit(); @@ -79,7 +84,7 @@ this.checkBox9.Location = new System.Drawing.Point(506, 348); this.checkBox9.Name = "checkBox9"; this.checkBox9.Size = new System.Drawing.Size(84, 24); - this.checkBox9.TabIndex = 22; + this.checkBox9.TabIndex = 19; this.checkBox9.Text = "立即开始"; this.checkBox9.UseVisualStyleBackColor = true; // @@ -101,9 +106,10 @@ this.btnSave.PressForeColor = System.Drawing.Color.White; this.btnSave.Radius = 5; this.btnSave.Size = new System.Drawing.Size(120, 30); - this.btnSave.TabIndex = 24; + this.btnSave.TabIndex = 17; this.btnSave.Text = "开始检测"; this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // label6 // @@ -112,7 +118,7 @@ this.label6.Margin = new System.Windows.Forms.Padding(0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(100, 27); - this.label6.TabIndex = 8; + this.label6.TabIndex = 38; this.label6.Text = "频率稳定度"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -123,7 +129,7 @@ this.checkBox1.Location = new System.Drawing.Point(420, 12); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(60, 24); - this.checkBox1.TabIndex = 9; + this.checkBox1.TabIndex = 16; this.checkBox1.Text = "100S"; this.checkBox1.UseVisualStyleBackColor = true; // @@ -134,7 +140,7 @@ this.checkBox2.Location = new System.Drawing.Point(326, 12); this.checkBox2.Name = "checkBox2"; this.checkBox2.Size = new System.Drawing.Size(52, 24); - this.checkBox2.TabIndex = 9; + this.checkBox2.TabIndex = 15; this.checkBox2.Text = "20S"; this.checkBox2.UseVisualStyleBackColor = true; // @@ -145,7 +151,7 @@ this.checkBox3.Location = new System.Drawing.Point(218, 12); this.checkBox3.Name = "checkBox3"; this.checkBox3.Size = new System.Drawing.Size(52, 24); - this.checkBox3.TabIndex = 9; + this.checkBox3.TabIndex = 14; this.checkBox3.Text = "10S"; this.checkBox3.UseVisualStyleBackColor = true; // @@ -156,7 +162,7 @@ this.checkBox4.Location = new System.Drawing.Point(110, 12); this.checkBox4.Name = "checkBox4"; this.checkBox4.Size = new System.Drawing.Size(44, 24); - this.checkBox4.TabIndex = 9; + this.checkBox4.TabIndex = 13; this.checkBox4.Text = "1S"; this.checkBox4.UseVisualStyleBackColor = true; // @@ -170,7 +176,7 @@ this.btnCancelSetDev.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.btnCancelSetDev.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancelSetDev.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(47)))), ((int)(((byte)(111)))), ((int)(((byte)(198))))); + this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(86)))), ((int)(((byte)(163)))), ((int)(((byte)(242))))); this.btnCancelSetDev.HoverForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Location = new System.Drawing.Point(310, 342); this.btnCancelSetDev.Name = "btnCancelSetDev"; @@ -178,7 +184,7 @@ this.btnCancelSetDev.PressForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Radius = 5; this.btnCancelSetDev.Size = new System.Drawing.Size(120, 30); - this.btnCancelSetDev.TabIndex = 23; + this.btnCancelSetDev.TabIndex = 18; this.btnCancelSetDev.Text = "取消"; this.btnCancelSetDev.UseVisualStyleBackColor = true; this.btnCancelSetDev.Click += new System.EventHandler(this.btnAddDevCancel_Click); @@ -310,7 +316,7 @@ this.startTime.ShowUpDown = true; this.startTime.Size = new System.Drawing.Size(180, 23); this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 12; + this.startTime.TabIndex = 11; this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // checkBox10 @@ -320,7 +326,7 @@ this.checkBox10.Location = new System.Drawing.Point(420, 12); this.checkBox10.Name = "checkBox10"; this.checkBox10.Size = new System.Drawing.Size(84, 24); - this.checkBox10.TabIndex = 11; + this.checkBox10.TabIndex = 10; this.checkBox10.Text = "日老化率"; this.checkBox10.UseVisualStyleBackColor = true; // @@ -331,7 +337,7 @@ this.checkBox11.Location = new System.Drawing.Point(326, 12); this.checkBox11.Name = "checkBox11"; this.checkBox11.Size = new System.Drawing.Size(84, 24); - this.checkBox11.TabIndex = 10; + this.checkBox11.TabIndex = 9; this.checkBox11.Text = "开机特性"; this.checkBox11.UseVisualStyleBackColor = true; // @@ -342,7 +348,7 @@ this.checkBox12.Location = new System.Drawing.Point(218, 12); this.checkBox12.Name = "checkBox12"; this.checkBox12.Size = new System.Drawing.Size(98, 24); - this.checkBox12.TabIndex = 9; + this.checkBox12.TabIndex = 8; this.checkBox12.Text = "频率准确度"; this.checkBox12.UseVisualStyleBackColor = true; // @@ -353,7 +359,7 @@ this.checkBox13.Location = new System.Drawing.Point(110, 12); this.checkBox13.Name = "checkBox13"; this.checkBox13.Size = new System.Drawing.Size(98, 24); - this.checkBox13.TabIndex = 9; + this.checkBox13.TabIndex = 7; this.checkBox13.Text = "频率稳定度"; this.checkBox13.UseVisualStyleBackColor = true; // @@ -375,7 +381,7 @@ this.label12.Margin = new System.Windows.Forms.Padding(0); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(100, 27); - this.label12.TabIndex = 8; + this.label12.TabIndex = 37; this.label12.Text = "测量开始时间"; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -386,25 +392,25 @@ this.label13.Margin = new System.Windows.Forms.Padding(0); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(100, 27); - this.label13.TabIndex = 8; + this.label13.TabIndex = 36; this.label13.Text = "检测项目"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX3 + // inputDevName // // // // - this.textBoxX3.Border.Class = "TextBoxBorder"; - this.textBoxX3.Border.CornerDiameter = 5; - this.textBoxX3.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX3.Location = new System.Drawing.Point(110, 10); - this.textBoxX3.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX3.Name = "textBoxX3"; - this.textBoxX3.PreventEnterBeep = true; - this.textBoxX3.Size = new System.Drawing.Size(150, 27); - this.textBoxX3.TabIndex = 13; + this.inputDevName.Border.Class = "TextBoxBorder"; + this.inputDevName.Border.CornerDiameter = 5; + this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevName.Location = new System.Drawing.Point(110, 10); + this.inputDevName.Margin = new System.Windows.Forms.Padding(0); + this.inputDevName.Name = "inputDevName"; + this.inputDevName.PreventEnterBeep = true; + this.inputDevName.Size = new System.Drawing.Size(150, 27); + this.inputDevName.TabIndex = 1; // // label8 // @@ -413,7 +419,7 @@ this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(100, 27); - this.label8.TabIndex = 10; + this.label8.TabIndex = 31; this.label8.Text = "仪器编号"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -424,7 +430,7 @@ this.label5.Margin = new System.Windows.Forms.Padding(0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(100, 27); - this.label5.TabIndex = 11; + this.label5.TabIndex = 30; this.label5.Text = "仪器名称"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -469,16 +475,16 @@ // panel2 // this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel2.Controls.Add(this.comboBoxEx1); + this.panel2.Controls.Add(this.channelFree); this.panel2.Controls.Add(this.label4); - this.panel2.Controls.Add(this.textBoxX7); + this.panel2.Controls.Add(this.inputCustName); this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.textBoxX6); - this.panel2.Controls.Add(this.textBoxX5); + this.panel2.Controls.Add(this.inputCustComp); + this.panel2.Controls.Add(this.inputDevModel); this.panel2.Controls.Add(this.label1); this.panel2.Controls.Add(this.label9); - this.panel2.Controls.Add(this.textBoxX4); - this.panel2.Controls.Add(this.textBoxX3); + this.panel2.Controls.Add(this.inputDevCode); + this.panel2.Controls.Add(this.inputDevName); this.panel2.Controls.Add(this.label8); this.panel2.Controls.Add(this.label5); this.panel2.Location = new System.Drawing.Point(10, 40); @@ -486,18 +492,49 @@ this.panel2.Size = new System.Drawing.Size(580, 121); this.panel2.TabIndex = 19; // - // comboBoxEx1 + // channelFree // - this.comboBoxEx1.DisplayMember = "Text"; - this.comboBoxEx1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.comboBoxEx1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.comboBoxEx1.FormattingEnabled = true; - this.comboBoxEx1.ItemHeight = 18; - this.comboBoxEx1.Location = new System.Drawing.Point(400, 87); - this.comboBoxEx1.Name = "comboBoxEx1"; - this.comboBoxEx1.Size = new System.Drawing.Size(150, 24); - this.comboBoxEx1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.comboBoxEx1.TabIndex = 21; + this.channelFree.DisplayMember = "Text"; + this.channelFree.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.channelFree.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.channelFree.FormattingEnabled = true; + this.channelFree.ItemHeight = 18; + this.channelFree.Items.AddRange(new object[] { + this.channel1, + this.channel2, + this.channel3, + this.channel4, + this.channel5}); + this.channelFree.Location = new System.Drawing.Point(400, 87); + this.channelFree.Name = "channelFree"; + this.channelFree.Size = new System.Drawing.Size(150, 24); + this.channelFree.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.channelFree.TabIndex = 6; + // + // channel1 + // + this.channel1.Text = "通道1"; + this.channel1.Value = "1"; + // + // channel2 + // + this.channel2.Text = "通道2"; + this.channel2.Value = "2"; + // + // channel3 + // + this.channel3.Text = "通道3"; + this.channel3.Value = "3"; + // + // channel4 + // + this.channel4.Text = "通道4"; + this.channel4.Value = "4"; + // + // channel5 + // + this.channel5.Text = "通道5"; + this.channel5.Value = "5"; // // label4 // @@ -506,25 +543,25 @@ this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(100, 27); - this.label4.TabIndex = 20; + this.label4.TabIndex = 35; this.label4.Text = "选择通道"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX7 + // inputCustName // // // // - this.textBoxX7.Border.Class = "TextBoxBorder"; - this.textBoxX7.Border.CornerDiameter = 5; - this.textBoxX7.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX7.Location = new System.Drawing.Point(110, 84); - this.textBoxX7.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX7.Name = "textBoxX7"; - this.textBoxX7.PreventEnterBeep = true; - this.textBoxX7.Size = new System.Drawing.Size(150, 27); - this.textBoxX7.TabIndex = 19; + this.inputCustName.Border.Class = "TextBoxBorder"; + this.inputCustName.Border.CornerDiameter = 5; + this.inputCustName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustName.Location = new System.Drawing.Point(110, 84); + this.inputCustName.Margin = new System.Windows.Forms.Padding(0); + this.inputCustName.Name = "inputCustName"; + this.inputCustName.PreventEnterBeep = true; + this.inputCustName.Size = new System.Drawing.Size(150, 27); + this.inputCustName.TabIndex = 5; // // label2 // @@ -533,41 +570,41 @@ this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(100, 27); - this.label2.TabIndex = 18; + this.label2.TabIndex = 34; this.label2.Text = "联系人"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX6 + // inputCustComp // // // // - this.textBoxX6.Border.Class = "TextBoxBorder"; - this.textBoxX6.Border.CornerDiameter = 5; - this.textBoxX6.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX6.Location = new System.Drawing.Point(400, 47); - this.textBoxX6.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX6.Name = "textBoxX6"; - this.textBoxX6.PreventEnterBeep = true; - this.textBoxX6.Size = new System.Drawing.Size(150, 27); - this.textBoxX6.TabIndex = 16; + this.inputCustComp.Border.Class = "TextBoxBorder"; + this.inputCustComp.Border.CornerDiameter = 5; + this.inputCustComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustComp.Location = new System.Drawing.Point(400, 47); + this.inputCustComp.Margin = new System.Windows.Forms.Padding(0); + this.inputCustComp.Name = "inputCustComp"; + this.inputCustComp.PreventEnterBeep = true; + this.inputCustComp.Size = new System.Drawing.Size(150, 27); + this.inputCustComp.TabIndex = 4; // - // textBoxX5 + // inputDevModel // // // // - this.textBoxX5.Border.Class = "TextBoxBorder"; - this.textBoxX5.Border.CornerDiameter = 5; - this.textBoxX5.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX5.Location = new System.Drawing.Point(110, 47); - this.textBoxX5.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX5.Name = "textBoxX5"; - this.textBoxX5.PreventEnterBeep = true; - this.textBoxX5.Size = new System.Drawing.Size(150, 27); - this.textBoxX5.TabIndex = 17; + this.inputDevModel.Border.Class = "TextBoxBorder"; + this.inputDevModel.Border.CornerDiameter = 5; + this.inputDevModel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevModel.Location = new System.Drawing.Point(110, 47); + this.inputDevModel.Margin = new System.Windows.Forms.Padding(0); + this.inputDevModel.Name = "inputDevModel"; + this.inputDevModel.PreventEnterBeep = true; + this.inputDevModel.Size = new System.Drawing.Size(150, 27); + this.inputDevModel.TabIndex = 3; // // label1 // @@ -576,7 +613,7 @@ this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 27); - this.label1.TabIndex = 14; + this.label1.TabIndex = 33; this.label1.Text = "送检单位"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -587,25 +624,25 @@ this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(100, 27); - this.label9.TabIndex = 15; + this.label9.TabIndex = 32; this.label9.Text = "仪器型号"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX4 + // inputDevCode // // // // - this.textBoxX4.Border.Class = "TextBoxBorder"; - this.textBoxX4.Border.CornerDiameter = 5; - this.textBoxX4.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX4.Location = new System.Drawing.Point(400, 10); - this.textBoxX4.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX4.Name = "textBoxX4"; - this.textBoxX4.PreventEnterBeep = true; - this.textBoxX4.Size = new System.Drawing.Size(150, 27); - this.textBoxX4.TabIndex = 12; + this.inputDevCode.Border.Class = "TextBoxBorder"; + this.inputDevCode.Border.CornerDiameter = 5; + this.inputDevCode.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevCode.Location = new System.Drawing.Point(400, 10); + this.inputDevCode.Margin = new System.Windows.Forms.Padding(0); + this.inputDevCode.Name = "inputDevCode"; + this.inputDevCode.PreventEnterBeep = true; + this.inputDevCode.Size = new System.Drawing.Size(150, 27); + this.inputDevCode.TabIndex = 2; // // AddDevDlg // @@ -658,21 +695,26 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX3; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevName; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label5; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button btnExitDev; private System.Windows.Forms.Label label11; private System.Windows.Forms.Panel panel2; - private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1; + private DevComponents.DotNetBar.Controls.ComboBoxEx channelFree; private System.Windows.Forms.Label label4; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX7; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustName; private System.Windows.Forms.Label label2; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX6; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX5; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustComp; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevModel; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX4; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; + private DevComponents.Editors.ComboItem channel1; + private DevComponents.Editors.ComboItem channel2; + private DevComponents.Editors.ComboItem channel3; + private DevComponents.Editors.ComboItem channel4; + private DevComponents.Editors.ComboItem channel5; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 592ada3..652c6b4 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -1,4 +1,9 @@ -using System; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using DevComponents.DotNetBar.Controls; +using DevComponents.Editors; +using System; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -31,6 +36,8 @@ public AddDevDlg() { InitializeComponent(); + + ((ComboBoxEx)this.Controls.Find("channelFree", true)[0]).SelectedIndex = 0; } // 关闭对话框 @@ -38,5 +45,32 @@ { this.HideMaskAction(); } + + // 添加并开始检测 + private void btnSave_Click(object sender, EventArgs e) + { + // 取得输入框的参数 + string devName = ((TextBoxX) this.Controls.Find("inputDevName", true)[0]).Text; + string devCode = ((TextBoxX) this.Controls.Find("inputDevCode", true)[0]).Text; + string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; + string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; + string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; + + ComboBoxEx channels = (ComboBoxEx)this.Controls.Find("channelFree", true)[0]; + string channelNo = (string)((ComboItem)channels.SelectedItem).Value; + + // 初始化数据访问接口 + DeviceService devService = new DeviceServiceImpl(); + int id = devService.add(devName, devCode, "1", devModel, devCustomComp, devCustomName, channelNo); + if (id >= 0) + { + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); + } + else + { + LogHelper.WriteErrorLog(this.GetType(), "添加设备[" + devName + "]失败"); + } + } } } diff --git a/RbFreqStandMeasure/info/DevicesDto.cs b/RbFreqStandMeasure/info/DevicesDto.cs new file mode 100644 index 0000000..872c3b8 --- /dev/null +++ b/RbFreqStandMeasure/info/DevicesDto.cs @@ -0,0 +1,6 @@ +namespace Casic.Birmm.RbFreqStandMeasure.info +{ + internal class DevicesDto + { + } +} \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 8d3fc42..e84275f 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -150,7 +150,7 @@ if (customerName != "" && customerName != null) sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; if (statusId != "" && statusId != null) - sQry += "and STATUSID = " + statusId; + sQry += " and STATUSID = " + statusId; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); @@ -193,8 +193,143 @@ return deviceDtoList; } - + public List searchPage(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId, + int page, int limit) + { + List deviceDtoList = new List(); + DictService dictService = new DictServiceImpl(); + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + if (customerName != "" && customerName != null) + sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; + if (statusId != "" && statusId != null) + sQry += " and STATUSID = " + statusId; + + sQry += " limit " + limit + " offset " + (page - 1) * limit; + + 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)); // id + if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1); // devName + if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2); // devCode + if (!aReader.IsDBNull(3)) + { + deviceDto.DevTypeId = aReader.GetString(3); // devType + deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); + } + if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); // devModel + if (!aReader.IsDBNull(5)) + { + DateTime reg = aReader.GetDateTime(5); // regTime + deviceDto.RegTime = reg.ToString("yyyy-MM-dd"); + } + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); // customName + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); // customDev + if (!aReader.IsDBNull(8)) + { + deviceDto.StatusId = aReader.GetString(8); // devStatus + deviceDto.StatusName = dictService.getNameByCode("devStatus", deviceDto.StatusId); + } + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); + + deviceDtoList.Add(deviceDto); + } + + aCommand.Dispose(); + + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message); + deviceDtoList = null; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return deviceDtoList; + } + public int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId) + { + int totalCount = 0; + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + string sQry = "SELECT count(id) 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + 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()) + { + totalCount = aReader.GetInt32(0); + } + + aCommand.Dispose(); + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTotalCount: " + ex.Message); + totalCount = 0; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return totalCount; + } } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs index 04f5244..05fcfb3 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs @@ -3,9 +3,7 @@ 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 { @@ -14,12 +12,14 @@ public String getNameByCode(string codeType,string code) { String name = ""; + MySqlConnection conn = null; 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); + + conn = DbConnectService.getConnection(); + MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default); @@ -35,6 +35,7 @@ } } + aReader.Close(); cmd.Dispose(); return name; } @@ -42,6 +43,14 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message); name = ""; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } } return name; } @@ -49,16 +58,13 @@ public List getTypeListByCodeType(string codeType) { List nameList = new List(); + MySqlConnection conn = null; try { - if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开"); - return null; - } + conn = DbConnectService.getConnection(); string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')"; - MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + MySqlCommand aCommand = new MySqlCommand(sQry, conn); using (MySqlDataReader aReader = aCommand.ExecuteReader()) { @@ -69,6 +75,8 @@ } aCommand.Dispose(); + conn.Close(); + conn.Dispose(); // 用完即关闭连接 } } catch(MySqlException ex) @@ -76,10 +84,16 @@ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message); nameList = null; } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } + } return nameList; } - - } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 53267da..7cf51de 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -48,22 +48,27 @@ this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); - this.textBoxX3 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label8 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.label11 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); - this.comboBoxEx1 = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channelFree = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channel1 = new DevComponents.Editors.ComboItem(); + this.channel2 = new DevComponents.Editors.ComboItem(); + this.channel3 = new DevComponents.Editors.ComboItem(); + this.channel4 = new DevComponents.Editors.ComboItem(); + this.channel5 = new DevComponents.Editors.ComboItem(); this.label4 = new System.Windows.Forms.Label(); - this.textBoxX7 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label2 = new System.Windows.Forms.Label(); - this.textBoxX6 = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.textBoxX5 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustComp = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevModel = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label1 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); - this.textBoxX4 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevCode = new DevComponents.DotNetBar.Controls.TextBoxX(); this.panel4.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.endTimeEst)).BeginInit(); @@ -79,7 +84,7 @@ this.checkBox9.Location = new System.Drawing.Point(506, 348); this.checkBox9.Name = "checkBox9"; this.checkBox9.Size = new System.Drawing.Size(84, 24); - this.checkBox9.TabIndex = 22; + this.checkBox9.TabIndex = 19; this.checkBox9.Text = "立即开始"; this.checkBox9.UseVisualStyleBackColor = true; // @@ -101,9 +106,10 @@ this.btnSave.PressForeColor = System.Drawing.Color.White; this.btnSave.Radius = 5; this.btnSave.Size = new System.Drawing.Size(120, 30); - this.btnSave.TabIndex = 24; + this.btnSave.TabIndex = 17; this.btnSave.Text = "开始检测"; this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // label6 // @@ -112,7 +118,7 @@ this.label6.Margin = new System.Windows.Forms.Padding(0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(100, 27); - this.label6.TabIndex = 8; + this.label6.TabIndex = 38; this.label6.Text = "频率稳定度"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -123,7 +129,7 @@ this.checkBox1.Location = new System.Drawing.Point(420, 12); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(60, 24); - this.checkBox1.TabIndex = 9; + this.checkBox1.TabIndex = 16; this.checkBox1.Text = "100S"; this.checkBox1.UseVisualStyleBackColor = true; // @@ -134,7 +140,7 @@ this.checkBox2.Location = new System.Drawing.Point(326, 12); this.checkBox2.Name = "checkBox2"; this.checkBox2.Size = new System.Drawing.Size(52, 24); - this.checkBox2.TabIndex = 9; + this.checkBox2.TabIndex = 15; this.checkBox2.Text = "20S"; this.checkBox2.UseVisualStyleBackColor = true; // @@ -145,7 +151,7 @@ this.checkBox3.Location = new System.Drawing.Point(218, 12); this.checkBox3.Name = "checkBox3"; this.checkBox3.Size = new System.Drawing.Size(52, 24); - this.checkBox3.TabIndex = 9; + this.checkBox3.TabIndex = 14; this.checkBox3.Text = "10S"; this.checkBox3.UseVisualStyleBackColor = true; // @@ -156,7 +162,7 @@ this.checkBox4.Location = new System.Drawing.Point(110, 12); this.checkBox4.Name = "checkBox4"; this.checkBox4.Size = new System.Drawing.Size(44, 24); - this.checkBox4.TabIndex = 9; + this.checkBox4.TabIndex = 13; this.checkBox4.Text = "1S"; this.checkBox4.UseVisualStyleBackColor = true; // @@ -170,7 +176,7 @@ this.btnCancelSetDev.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.btnCancelSetDev.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancelSetDev.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(47)))), ((int)(((byte)(111)))), ((int)(((byte)(198))))); + this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(86)))), ((int)(((byte)(163)))), ((int)(((byte)(242))))); this.btnCancelSetDev.HoverForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Location = new System.Drawing.Point(310, 342); this.btnCancelSetDev.Name = "btnCancelSetDev"; @@ -178,7 +184,7 @@ this.btnCancelSetDev.PressForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Radius = 5; this.btnCancelSetDev.Size = new System.Drawing.Size(120, 30); - this.btnCancelSetDev.TabIndex = 23; + this.btnCancelSetDev.TabIndex = 18; this.btnCancelSetDev.Text = "取消"; this.btnCancelSetDev.UseVisualStyleBackColor = true; this.btnCancelSetDev.Click += new System.EventHandler(this.btnAddDevCancel_Click); @@ -310,7 +316,7 @@ this.startTime.ShowUpDown = true; this.startTime.Size = new System.Drawing.Size(180, 23); this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 12; + this.startTime.TabIndex = 11; this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // checkBox10 @@ -320,7 +326,7 @@ this.checkBox10.Location = new System.Drawing.Point(420, 12); this.checkBox10.Name = "checkBox10"; this.checkBox10.Size = new System.Drawing.Size(84, 24); - this.checkBox10.TabIndex = 11; + this.checkBox10.TabIndex = 10; this.checkBox10.Text = "日老化率"; this.checkBox10.UseVisualStyleBackColor = true; // @@ -331,7 +337,7 @@ this.checkBox11.Location = new System.Drawing.Point(326, 12); this.checkBox11.Name = "checkBox11"; this.checkBox11.Size = new System.Drawing.Size(84, 24); - this.checkBox11.TabIndex = 10; + this.checkBox11.TabIndex = 9; this.checkBox11.Text = "开机特性"; this.checkBox11.UseVisualStyleBackColor = true; // @@ -342,7 +348,7 @@ this.checkBox12.Location = new System.Drawing.Point(218, 12); this.checkBox12.Name = "checkBox12"; this.checkBox12.Size = new System.Drawing.Size(98, 24); - this.checkBox12.TabIndex = 9; + this.checkBox12.TabIndex = 8; this.checkBox12.Text = "频率准确度"; this.checkBox12.UseVisualStyleBackColor = true; // @@ -353,7 +359,7 @@ this.checkBox13.Location = new System.Drawing.Point(110, 12); this.checkBox13.Name = "checkBox13"; this.checkBox13.Size = new System.Drawing.Size(98, 24); - this.checkBox13.TabIndex = 9; + this.checkBox13.TabIndex = 7; this.checkBox13.Text = "频率稳定度"; this.checkBox13.UseVisualStyleBackColor = true; // @@ -375,7 +381,7 @@ this.label12.Margin = new System.Windows.Forms.Padding(0); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(100, 27); - this.label12.TabIndex = 8; + this.label12.TabIndex = 37; this.label12.Text = "测量开始时间"; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -386,25 +392,25 @@ this.label13.Margin = new System.Windows.Forms.Padding(0); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(100, 27); - this.label13.TabIndex = 8; + this.label13.TabIndex = 36; this.label13.Text = "检测项目"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX3 + // inputDevName // // // // - this.textBoxX3.Border.Class = "TextBoxBorder"; - this.textBoxX3.Border.CornerDiameter = 5; - this.textBoxX3.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX3.Location = new System.Drawing.Point(110, 10); - this.textBoxX3.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX3.Name = "textBoxX3"; - this.textBoxX3.PreventEnterBeep = true; - this.textBoxX3.Size = new System.Drawing.Size(150, 27); - this.textBoxX3.TabIndex = 13; + this.inputDevName.Border.Class = "TextBoxBorder"; + this.inputDevName.Border.CornerDiameter = 5; + this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevName.Location = new System.Drawing.Point(110, 10); + this.inputDevName.Margin = new System.Windows.Forms.Padding(0); + this.inputDevName.Name = "inputDevName"; + this.inputDevName.PreventEnterBeep = true; + this.inputDevName.Size = new System.Drawing.Size(150, 27); + this.inputDevName.TabIndex = 1; // // label8 // @@ -413,7 +419,7 @@ this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(100, 27); - this.label8.TabIndex = 10; + this.label8.TabIndex = 31; this.label8.Text = "仪器编号"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -424,7 +430,7 @@ this.label5.Margin = new System.Windows.Forms.Padding(0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(100, 27); - this.label5.TabIndex = 11; + this.label5.TabIndex = 30; this.label5.Text = "仪器名称"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -469,16 +475,16 @@ // panel2 // this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel2.Controls.Add(this.comboBoxEx1); + this.panel2.Controls.Add(this.channelFree); this.panel2.Controls.Add(this.label4); - this.panel2.Controls.Add(this.textBoxX7); + this.panel2.Controls.Add(this.inputCustName); this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.textBoxX6); - this.panel2.Controls.Add(this.textBoxX5); + this.panel2.Controls.Add(this.inputCustComp); + this.panel2.Controls.Add(this.inputDevModel); this.panel2.Controls.Add(this.label1); this.panel2.Controls.Add(this.label9); - this.panel2.Controls.Add(this.textBoxX4); - this.panel2.Controls.Add(this.textBoxX3); + this.panel2.Controls.Add(this.inputDevCode); + this.panel2.Controls.Add(this.inputDevName); this.panel2.Controls.Add(this.label8); this.panel2.Controls.Add(this.label5); this.panel2.Location = new System.Drawing.Point(10, 40); @@ -486,18 +492,49 @@ this.panel2.Size = new System.Drawing.Size(580, 121); this.panel2.TabIndex = 19; // - // comboBoxEx1 + // channelFree // - this.comboBoxEx1.DisplayMember = "Text"; - this.comboBoxEx1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.comboBoxEx1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.comboBoxEx1.FormattingEnabled = true; - this.comboBoxEx1.ItemHeight = 18; - this.comboBoxEx1.Location = new System.Drawing.Point(400, 87); - this.comboBoxEx1.Name = "comboBoxEx1"; - this.comboBoxEx1.Size = new System.Drawing.Size(150, 24); - this.comboBoxEx1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.comboBoxEx1.TabIndex = 21; + this.channelFree.DisplayMember = "Text"; + this.channelFree.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.channelFree.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.channelFree.FormattingEnabled = true; + this.channelFree.ItemHeight = 18; + this.channelFree.Items.AddRange(new object[] { + this.channel1, + this.channel2, + this.channel3, + this.channel4, + this.channel5}); + this.channelFree.Location = new System.Drawing.Point(400, 87); + this.channelFree.Name = "channelFree"; + this.channelFree.Size = new System.Drawing.Size(150, 24); + this.channelFree.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.channelFree.TabIndex = 6; + // + // channel1 + // + this.channel1.Text = "通道1"; + this.channel1.Value = "1"; + // + // channel2 + // + this.channel2.Text = "通道2"; + this.channel2.Value = "2"; + // + // channel3 + // + this.channel3.Text = "通道3"; + this.channel3.Value = "3"; + // + // channel4 + // + this.channel4.Text = "通道4"; + this.channel4.Value = "4"; + // + // channel5 + // + this.channel5.Text = "通道5"; + this.channel5.Value = "5"; // // label4 // @@ -506,25 +543,25 @@ this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(100, 27); - this.label4.TabIndex = 20; + this.label4.TabIndex = 35; this.label4.Text = "选择通道"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX7 + // inputCustName // // // // - this.textBoxX7.Border.Class = "TextBoxBorder"; - this.textBoxX7.Border.CornerDiameter = 5; - this.textBoxX7.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX7.Location = new System.Drawing.Point(110, 84); - this.textBoxX7.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX7.Name = "textBoxX7"; - this.textBoxX7.PreventEnterBeep = true; - this.textBoxX7.Size = new System.Drawing.Size(150, 27); - this.textBoxX7.TabIndex = 19; + this.inputCustName.Border.Class = "TextBoxBorder"; + this.inputCustName.Border.CornerDiameter = 5; + this.inputCustName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustName.Location = new System.Drawing.Point(110, 84); + this.inputCustName.Margin = new System.Windows.Forms.Padding(0); + this.inputCustName.Name = "inputCustName"; + this.inputCustName.PreventEnterBeep = true; + this.inputCustName.Size = new System.Drawing.Size(150, 27); + this.inputCustName.TabIndex = 5; // // label2 // @@ -533,41 +570,41 @@ this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(100, 27); - this.label2.TabIndex = 18; + this.label2.TabIndex = 34; this.label2.Text = "联系人"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX6 + // inputCustComp // // // // - this.textBoxX6.Border.Class = "TextBoxBorder"; - this.textBoxX6.Border.CornerDiameter = 5; - this.textBoxX6.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX6.Location = new System.Drawing.Point(400, 47); - this.textBoxX6.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX6.Name = "textBoxX6"; - this.textBoxX6.PreventEnterBeep = true; - this.textBoxX6.Size = new System.Drawing.Size(150, 27); - this.textBoxX6.TabIndex = 16; + this.inputCustComp.Border.Class = "TextBoxBorder"; + this.inputCustComp.Border.CornerDiameter = 5; + this.inputCustComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustComp.Location = new System.Drawing.Point(400, 47); + this.inputCustComp.Margin = new System.Windows.Forms.Padding(0); + this.inputCustComp.Name = "inputCustComp"; + this.inputCustComp.PreventEnterBeep = true; + this.inputCustComp.Size = new System.Drawing.Size(150, 27); + this.inputCustComp.TabIndex = 4; // - // textBoxX5 + // inputDevModel // // // // - this.textBoxX5.Border.Class = "TextBoxBorder"; - this.textBoxX5.Border.CornerDiameter = 5; - this.textBoxX5.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX5.Location = new System.Drawing.Point(110, 47); - this.textBoxX5.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX5.Name = "textBoxX5"; - this.textBoxX5.PreventEnterBeep = true; - this.textBoxX5.Size = new System.Drawing.Size(150, 27); - this.textBoxX5.TabIndex = 17; + this.inputDevModel.Border.Class = "TextBoxBorder"; + this.inputDevModel.Border.CornerDiameter = 5; + this.inputDevModel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevModel.Location = new System.Drawing.Point(110, 47); + this.inputDevModel.Margin = new System.Windows.Forms.Padding(0); + this.inputDevModel.Name = "inputDevModel"; + this.inputDevModel.PreventEnterBeep = true; + this.inputDevModel.Size = new System.Drawing.Size(150, 27); + this.inputDevModel.TabIndex = 3; // // label1 // @@ -576,7 +613,7 @@ this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 27); - this.label1.TabIndex = 14; + this.label1.TabIndex = 33; this.label1.Text = "送检单位"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -587,25 +624,25 @@ this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(100, 27); - this.label9.TabIndex = 15; + this.label9.TabIndex = 32; this.label9.Text = "仪器型号"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX4 + // inputDevCode // // // // - this.textBoxX4.Border.Class = "TextBoxBorder"; - this.textBoxX4.Border.CornerDiameter = 5; - this.textBoxX4.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX4.Location = new System.Drawing.Point(400, 10); - this.textBoxX4.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX4.Name = "textBoxX4"; - this.textBoxX4.PreventEnterBeep = true; - this.textBoxX4.Size = new System.Drawing.Size(150, 27); - this.textBoxX4.TabIndex = 12; + this.inputDevCode.Border.Class = "TextBoxBorder"; + this.inputDevCode.Border.CornerDiameter = 5; + this.inputDevCode.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevCode.Location = new System.Drawing.Point(400, 10); + this.inputDevCode.Margin = new System.Windows.Forms.Padding(0); + this.inputDevCode.Name = "inputDevCode"; + this.inputDevCode.PreventEnterBeep = true; + this.inputDevCode.Size = new System.Drawing.Size(150, 27); + this.inputDevCode.TabIndex = 2; // // AddDevDlg // @@ -658,21 +695,26 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX3; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevName; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label5; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button btnExitDev; private System.Windows.Forms.Label label11; private System.Windows.Forms.Panel panel2; - private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1; + private DevComponents.DotNetBar.Controls.ComboBoxEx channelFree; private System.Windows.Forms.Label label4; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX7; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustName; private System.Windows.Forms.Label label2; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX6; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX5; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustComp; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevModel; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX4; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; + private DevComponents.Editors.ComboItem channel1; + private DevComponents.Editors.ComboItem channel2; + private DevComponents.Editors.ComboItem channel3; + private DevComponents.Editors.ComboItem channel4; + private DevComponents.Editors.ComboItem channel5; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 592ada3..652c6b4 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -1,4 +1,9 @@ -using System; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using DevComponents.DotNetBar.Controls; +using DevComponents.Editors; +using System; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -31,6 +36,8 @@ public AddDevDlg() { InitializeComponent(); + + ((ComboBoxEx)this.Controls.Find("channelFree", true)[0]).SelectedIndex = 0; } // 关闭对话框 @@ -38,5 +45,32 @@ { this.HideMaskAction(); } + + // 添加并开始检测 + private void btnSave_Click(object sender, EventArgs e) + { + // 取得输入框的参数 + string devName = ((TextBoxX) this.Controls.Find("inputDevName", true)[0]).Text; + string devCode = ((TextBoxX) this.Controls.Find("inputDevCode", true)[0]).Text; + string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; + string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; + string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; + + ComboBoxEx channels = (ComboBoxEx)this.Controls.Find("channelFree", true)[0]; + string channelNo = (string)((ComboItem)channels.SelectedItem).Value; + + // 初始化数据访问接口 + DeviceService devService = new DeviceServiceImpl(); + int id = devService.add(devName, devCode, "1", devModel, devCustomComp, devCustomName, channelNo); + if (id >= 0) + { + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); + } + else + { + LogHelper.WriteErrorLog(this.GetType(), "添加设备[" + devName + "]失败"); + } + } } } diff --git a/RbFreqStandMeasure/info/DevicesDto.cs b/RbFreqStandMeasure/info/DevicesDto.cs new file mode 100644 index 0000000..872c3b8 --- /dev/null +++ b/RbFreqStandMeasure/info/DevicesDto.cs @@ -0,0 +1,6 @@ +namespace Casic.Birmm.RbFreqStandMeasure.info +{ + internal class DevicesDto + { + } +} \ No newline at end of file diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs b/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs index 6a1a538..adaf61f 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs @@ -29,26 +29,20 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.tableDevList = new System.Windows.Forms.DataGridView(); this.panel2 = new System.Windows.Forms.Panel(); - this.btnExport = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnDetail = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnAdd = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnDelete = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnEdit = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); this.inputDevStatus = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.All = new DevComponents.Editors.ComboItem(); - this.tested = new DevComponents.Editors.ComboItem(); - this.testing = new DevComponents.Editors.ComboItem(); this.toBeTested = new DevComponents.Editors.ComboItem(); + this.testing = new DevComponents.Editors.ComboItem(); + this.tested = new DevComponents.Editors.ComboItem(); this.labelDevStatus = new System.Windows.Forms.Label(); - this.btnQuery = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); this.inputDevName = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.inputDevType = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.inputDevNo = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevModel = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevCode = new DevComponents.DotNetBar.Controls.TextBoxX(); this.inputCustomName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.labelCustomName = new System.Windows.Forms.Label(); this.labelDevNo = new System.Windows.Forms.Label(); @@ -56,14 +50,31 @@ this.inputCustomComp = new DevComponents.DotNetBar.Controls.TextBoxX(); this.labelCustomComp = new System.Windows.Forms.Label(); this.labelDevName = new System.Windows.Forms.Label(); + this.btnNext = new System.Windows.Forms.Button(); + this.btnPre = new System.Windows.Forms.Button(); + this.labelPageCount = new System.Windows.Forms.Label(); + this.labelCurrentPage = new System.Windows.Forms.Label(); + this.panelPage = new System.Windows.Forms.Panel(); + this.panelNodata = new System.Windows.Forms.Panel(); + this.labelNodata = new System.Windows.Forms.Label(); + this.btnExport = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnDetail = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnAdd = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnDelete = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnEdit = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnQuery = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tableDevList)).BeginInit(); this.panel2.SuspendLayout(); + this.panelPage.SuspendLayout(); + this.panelNodata.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_dev_list; + this.panel1.Controls.Add(this.panelNodata); + this.panel1.Controls.Add(this.panelPage); this.panel1.Controls.Add(this.tableDevList); this.panel1.Controls.Add(this.panel2); this.panel1.Location = new System.Drawing.Point(10, 5); @@ -78,37 +89,37 @@ this.tableDevList.AllowUserToDeleteRows = false; this.tableDevList.AllowUserToResizeColumns = false; this.tableDevList.AllowUserToResizeRows = false; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(234)))), ((int)(((byte)(238))))); - dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.tableDevList.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(234)))), ((int)(((byte)(238))))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.tableDevList.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; this.tableDevList.BackgroundColor = System.Drawing.Color.White; this.tableDevList.BorderStyle = System.Windows.Forms.BorderStyle.None; this.tableDevList.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.tableDevList.ColumnHeadersHeight = 40; this.tableDevList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - this.tableDevList.Location = new System.Drawing.Point(20, 120); + this.tableDevList.Location = new System.Drawing.Point(20, 100); this.tableDevList.Margin = new System.Windows.Forms.Padding(0); this.tableDevList.Name = "tableDevList"; this.tableDevList.ReadOnly = true; this.tableDevList.RowHeadersVisible = false; this.tableDevList.RowHeadersWidth = 30; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle8.NullValue = "-"; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.tableDevList.RowsDefaultCellStyle = dataGridViewCellStyle8; - this.tableDevList.RowTemplate.Height = 40; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle4.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle4.NullValue = "-"; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.tableDevList.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.tableDevList.RowTemplate.Height = 44; this.tableDevList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.tableDevList.Size = new System.Drawing.Size(964, 440); + this.tableDevList.Size = new System.Drawing.Size(964, 480); this.tableDevList.TabIndex = 2; // // panel2 @@ -123,8 +134,8 @@ this.panel2.Controls.Add(this.labelDevStatus); this.panel2.Controls.Add(this.btnQuery); this.panel2.Controls.Add(this.inputDevName); - this.panel2.Controls.Add(this.inputDevType); - this.panel2.Controls.Add(this.inputDevNo); + this.panel2.Controls.Add(this.inputDevModel); + this.panel2.Controls.Add(this.inputDevCode); this.panel2.Controls.Add(this.inputCustomName); this.panel2.Controls.Add(this.labelCustomName); this.panel2.Controls.Add(this.labelDevNo); @@ -137,6 +148,308 @@ this.panel2.Size = new System.Drawing.Size(964, 80); this.panel2.TabIndex = 1; // + // inputDevStatus + // + this.inputDevStatus.DisplayMember = "Text"; + this.inputDevStatus.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.inputDevStatus.Font = new System.Drawing.Font("微软雅黑", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevStatus.FormattingEnabled = true; + this.inputDevStatus.ItemHeight = 20; + this.inputDevStatus.Items.AddRange(new object[] { + this.All, + this.toBeTested, + this.testing, + this.tested}); + this.inputDevStatus.Location = new System.Drawing.Point(560, 43); + this.inputDevStatus.Margin = new System.Windows.Forms.Padding(0); + this.inputDevStatus.MaximumSize = new System.Drawing.Size(150, 0); + this.inputDevStatus.Name = "inputDevStatus"; + this.inputDevStatus.Size = new System.Drawing.Size(150, 26); + this.inputDevStatus.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.inputDevStatus.TabIndex = 2; + // + // All + // + this.All.Text = "全部"; + // + // toBeTested + // + this.toBeTested.Text = "待检测"; + this.toBeTested.Value = "1"; + // + // testing + // + this.testing.Text = "检测中"; + this.testing.Value = "2"; + // + // tested + // + this.tested.Text = "已检测"; + this.tested.Value = "3"; + // + // labelDevStatus + // + this.labelDevStatus.AutoSize = true; + this.labelDevStatus.BackColor = System.Drawing.Color.Transparent; + this.labelDevStatus.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevStatus.Location = new System.Drawing.Point(480, 45); + this.labelDevStatus.Margin = new System.Windows.Forms.Padding(0); + this.labelDevStatus.Name = "labelDevStatus"; + this.labelDevStatus.Size = new System.Drawing.Size(74, 21); + this.labelDevStatus.TabIndex = 11; + this.labelDevStatus.Text = "仪器状态"; + // + // inputDevName + // + // + // + // + this.inputDevName.Border.Class = "TextBoxBorder"; + this.inputDevName.Border.CornerDiameter = 5; + this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputDevName.Location = new System.Drawing.Point(80, 3); + this.inputDevName.Margin = new System.Windows.Forms.Padding(0); + this.inputDevName.MaximumSize = new System.Drawing.Size(150, 26); + this.inputDevName.Name = "inputDevName"; + this.inputDevName.PreventEnterBeep = true; + this.inputDevName.Size = new System.Drawing.Size(150, 26); + this.inputDevName.TabIndex = 9; + this.inputDevName.Text = "请输入仪器名称"; + this.inputDevName.Click += new System.EventHandler(this.inputDevName_Click); + this.inputDevName.Leave += new System.EventHandler(this.inputDevName_Leave); + // + // inputDevModel + // + // + // + // + this.inputDevModel.Border.Class = "TextBoxBorder"; + this.inputDevModel.Border.CornerDiameter = 5; + this.inputDevModel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevModel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputDevModel.Location = new System.Drawing.Point(320, 3); + this.inputDevModel.Margin = new System.Windows.Forms.Padding(0); + this.inputDevModel.MaximumSize = new System.Drawing.Size(150, 26); + this.inputDevModel.Name = "inputDevModel"; + this.inputDevModel.PreventEnterBeep = true; + this.inputDevModel.Size = new System.Drawing.Size(150, 26); + this.inputDevModel.TabIndex = 8; + this.inputDevModel.Text = "请输入仪器型号"; + this.inputDevModel.Click += new System.EventHandler(this.inputDevModel_Click); + this.inputDevModel.Leave += new System.EventHandler(this.inputDevModel_Leave); + // + // inputDevCode + // + // + // + // + this.inputDevCode.Border.Class = "TextBoxBorder"; + this.inputDevCode.Border.CornerDiameter = 5; + this.inputDevCode.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevCode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputDevCode.Location = new System.Drawing.Point(560, 3); + this.inputDevCode.Margin = new System.Windows.Forms.Padding(0); + this.inputDevCode.MaximumSize = new System.Drawing.Size(150, 26); + this.inputDevCode.Name = "inputDevCode"; + this.inputDevCode.PreventEnterBeep = true; + this.inputDevCode.Size = new System.Drawing.Size(150, 26); + this.inputDevCode.TabIndex = 7; + this.inputDevCode.Text = "请输入仪器编号"; + this.inputDevCode.Click += new System.EventHandler(this.inputDevCode_Click); + this.inputDevCode.Leave += new System.EventHandler(this.inputDevCode_Leave); + // + // inputCustomName + // + // + // + // + this.inputCustomName.Border.Class = "TextBoxBorder"; + this.inputCustomName.Border.CornerDiameter = 5; + this.inputCustomName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustomName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputCustomName.Location = new System.Drawing.Point(320, 43); + this.inputCustomName.Margin = new System.Windows.Forms.Padding(0); + this.inputCustomName.MaximumSize = new System.Drawing.Size(150, 26); + this.inputCustomName.Name = "inputCustomName"; + this.inputCustomName.PreventEnterBeep = true; + this.inputCustomName.Size = new System.Drawing.Size(150, 26); + this.inputCustomName.TabIndex = 6; + this.inputCustomName.Text = "请输入联系人"; + this.inputCustomName.Click += new System.EventHandler(this.inputCustomName_Click); + this.inputCustomName.Leave += new System.EventHandler(this.inputCustomName_Leave); + // + // labelCustomName + // + this.labelCustomName.BackColor = System.Drawing.Color.Transparent; + this.labelCustomName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelCustomName.Location = new System.Drawing.Point(240, 45); + this.labelCustomName.Margin = new System.Windows.Forms.Padding(0); + this.labelCustomName.Name = "labelCustomName"; + this.labelCustomName.Size = new System.Drawing.Size(74, 21); + this.labelCustomName.TabIndex = 5; + this.labelCustomName.Text = "联系人"; + this.labelCustomName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // labelDevNo + // + this.labelDevNo.AutoSize = true; + this.labelDevNo.BackColor = System.Drawing.Color.Transparent; + this.labelDevNo.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevNo.Location = new System.Drawing.Point(480, 5); + this.labelDevNo.Margin = new System.Windows.Forms.Padding(0); + this.labelDevNo.Name = "labelDevNo"; + this.labelDevNo.Size = new System.Drawing.Size(74, 21); + this.labelDevNo.TabIndex = 4; + this.labelDevNo.Text = "仪器编号"; + // + // labelDevType + // + this.labelDevType.AutoSize = true; + this.labelDevType.BackColor = System.Drawing.Color.Transparent; + this.labelDevType.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevType.Location = new System.Drawing.Point(240, 5); + this.labelDevType.Margin = new System.Windows.Forms.Padding(0); + this.labelDevType.Name = "labelDevType"; + this.labelDevType.Size = new System.Drawing.Size(74, 21); + this.labelDevType.TabIndex = 4; + this.labelDevType.Text = "仪器型号"; + // + // inputCustomComp + // + // + // + // + this.inputCustomComp.Border.Class = "TextBoxBorder"; + this.inputCustomComp.Border.CornerDiameter = 5; + this.inputCustomComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustomComp.Border.MaximumHeight = 26; + this.inputCustomComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputCustomComp.Location = new System.Drawing.Point(80, 43); + this.inputCustomComp.Margin = new System.Windows.Forms.Padding(0); + this.inputCustomComp.MaximumSize = new System.Drawing.Size(150, 26); + this.inputCustomComp.Name = "inputCustomComp"; + this.inputCustomComp.PreventEnterBeep = true; + this.inputCustomComp.Size = new System.Drawing.Size(150, 26); + this.inputCustomComp.TabIndex = 3; + this.inputCustomComp.Text = "请输入送检单位名称"; + this.inputCustomComp.Click += new System.EventHandler(this.inputCustomComp_Click); + this.inputCustomComp.Leave += new System.EventHandler(this.inputCustomComp_Leave); + // + // labelCustomComp + // + this.labelCustomComp.AutoSize = true; + this.labelCustomComp.BackColor = System.Drawing.Color.Transparent; + this.labelCustomComp.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelCustomComp.Location = new System.Drawing.Point(0, 45); + this.labelCustomComp.Margin = new System.Windows.Forms.Padding(0); + this.labelCustomComp.Name = "labelCustomComp"; + this.labelCustomComp.Size = new System.Drawing.Size(74, 21); + this.labelCustomComp.TabIndex = 0; + this.labelCustomComp.Text = "送检单位"; + // + // labelDevName + // + this.labelDevName.AutoSize = true; + this.labelDevName.BackColor = System.Drawing.Color.Transparent; + this.labelDevName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevName.Location = new System.Drawing.Point(0, 5); + this.labelDevName.Margin = new System.Windows.Forms.Padding(0); + this.labelDevName.Name = "labelDevName"; + this.labelDevName.Size = new System.Drawing.Size(74, 21); + this.labelDevName.TabIndex = 0; + this.labelDevName.Text = "仪器名称"; + // + // btnNext + // + this.btnNext.BackColor = System.Drawing.Color.Transparent; + this.btnNext.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_page_next; + this.btnNext.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.btnNext.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnNext.Location = new System.Drawing.Point(950, 0); + this.btnNext.Name = "btnNext"; + this.btnNext.Size = new System.Drawing.Size(16, 16); + this.btnNext.TabIndex = 317; + this.btnNext.UseVisualStyleBackColor = false; + this.btnNext.Click += new System.EventHandler(this.btnNext_Click); + // + // btnPre + // + this.btnPre.BackColor = System.Drawing.Color.Transparent; + this.btnPre.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_page_pre; + this.btnPre.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.btnPre.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnPre.Location = new System.Drawing.Point(890, 0); + this.btnPre.Name = "btnPre"; + this.btnPre.Size = new System.Drawing.Size(16, 16); + this.btnPre.TabIndex = 318; + this.btnPre.UseVisualStyleBackColor = false; + this.btnPre.Click += new System.EventHandler(this.btnPre_Click); + // + // labelPageCount + // + this.labelPageCount.AutoSize = true; + this.labelPageCount.BackColor = System.Drawing.Color.Transparent; + this.labelPageCount.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelPageCount.Location = new System.Drawing.Point(690, 0); + this.labelPageCount.Name = "labelPageCount"; + this.labelPageCount.Size = new System.Drawing.Size(151, 17); + this.labelPageCount.TabIndex = 315; + this.labelPageCount.Text = "共10条,每页10条,共2页"; + // + // labelCurrentPage + // + this.labelCurrentPage.AutoSize = true; + this.labelCurrentPage.BackColor = System.Drawing.Color.Transparent; + this.labelCurrentPage.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelCurrentPage.Location = new System.Drawing.Point(920, 0); + this.labelCurrentPage.Name = "labelCurrentPage"; + this.labelCurrentPage.Size = new System.Drawing.Size(15, 17); + this.labelCurrentPage.TabIndex = 315; + this.labelCurrentPage.Text = "1"; + // + // panelPage + // + this.panelPage.BackColor = System.Drawing.Color.Transparent; + this.panelPage.Controls.Add(this.labelPageCount); + this.panelPage.Controls.Add(this.btnNext); + this.panelPage.Controls.Add(this.btnPre); + this.panelPage.Controls.Add(this.labelCurrentPage); + this.panelPage.Location = new System.Drawing.Point(10, 595); + this.panelPage.Name = "panelPage"; + this.panelPage.Size = new System.Drawing.Size(984, 20); + this.panelPage.TabIndex = 319; + // + // panelNodata + // + this.panelNodata.BackColor = System.Drawing.Color.Transparent; + this.panelNodata.Controls.Add(this.labelNodata); + this.panelNodata.Location = new System.Drawing.Point(10, 140); + this.panelNodata.Name = "panelNodata"; + this.panelNodata.Size = new System.Drawing.Size(984, 40); + this.panelNodata.TabIndex = 320; + // + // labelNodata + // + this.labelNodata.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelNodata.Location = new System.Drawing.Point(0, 0); + this.labelNodata.Name = "labelNodata"; + this.labelNodata.Size = new System.Drawing.Size(984, 50); + this.labelNodata.TabIndex = 0; + this.labelNodata.Text = "没有搜索到数据"; + this.labelNodata.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // btnExport // this.btnExport.EnterBackColor = System.Drawing.Color.Blue; @@ -182,6 +495,7 @@ this.btnDetail.TabIndex = 13; this.btnDetail.Text = "详情"; this.btnDetail.UseVisualStyleBackColor = true; + this.btnDetail.Click += new System.EventHandler(this.btnDetail_Click); // // btnAdd // @@ -253,55 +567,6 @@ this.btnEdit.Text = "修改"; this.btnEdit.UseVisualStyleBackColor = true; // - // inputDevStatus - // - this.inputDevStatus.DisplayMember = "Text"; - this.inputDevStatus.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.inputDevStatus.Font = new System.Drawing.Font("微软雅黑", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevStatus.FormattingEnabled = true; - this.inputDevStatus.ItemHeight = 20; - this.inputDevStatus.Items.AddRange(new object[] { - this.All, - this.tested, - this.testing, - this.toBeTested}); - this.inputDevStatus.Location = new System.Drawing.Point(560, 43); - this.inputDevStatus.Margin = new System.Windows.Forms.Padding(0); - this.inputDevStatus.MaximumSize = new System.Drawing.Size(150, 0); - this.inputDevStatus.Name = "inputDevStatus"; - this.inputDevStatus.Size = new System.Drawing.Size(150, 26); - this.inputDevStatus.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.inputDevStatus.TabIndex = 2; - // - // All - // - this.All.Text = "全部"; - // - // tested - // - this.tested.Text = "待检测"; - // - // testing - // - this.testing.Text = "检测中"; - // - // toBeTested - // - this.toBeTested.Text = "已检测"; - // - // labelDevStatus - // - this.labelDevStatus.AutoSize = true; - this.labelDevStatus.BackColor = System.Drawing.Color.Transparent; - this.labelDevStatus.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevStatus.Location = new System.Drawing.Point(480, 45); - this.labelDevStatus.Margin = new System.Windows.Forms.Padding(0); - this.labelDevStatus.Name = "labelDevStatus"; - this.labelDevStatus.Size = new System.Drawing.Size(74, 21); - this.labelDevStatus.TabIndex = 11; - this.labelDevStatus.Text = "仪器状态"; - // // btnQuery // this.btnQuery.EnterBackColor = System.Drawing.Color.Blue; @@ -324,167 +589,7 @@ this.btnQuery.TabIndex = 10; this.btnQuery.Text = "查询"; this.btnQuery.UseVisualStyleBackColor = true; - // - // inputDevName - // - // - // - // - this.inputDevName.Border.Class = "TextBoxBorder"; - this.inputDevName.Border.CornerDiameter = 5; - this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputDevName.Location = new System.Drawing.Point(80, 3); - this.inputDevName.Margin = new System.Windows.Forms.Padding(0); - this.inputDevName.MaximumSize = new System.Drawing.Size(150, 26); - this.inputDevName.Name = "inputDevName"; - this.inputDevName.PreventEnterBeep = true; - this.inputDevName.Size = new System.Drawing.Size(150, 26); - this.inputDevName.TabIndex = 9; - this.inputDevName.Text = "请输入仪器名称"; - // - // inputDevType - // - // - // - // - this.inputDevType.Border.Class = "TextBoxBorder"; - this.inputDevType.Border.CornerDiameter = 5; - this.inputDevType.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputDevType.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputDevType.Location = new System.Drawing.Point(320, 3); - this.inputDevType.Margin = new System.Windows.Forms.Padding(0); - this.inputDevType.MaximumSize = new System.Drawing.Size(150, 26); - this.inputDevType.Name = "inputDevType"; - this.inputDevType.PreventEnterBeep = true; - this.inputDevType.Size = new System.Drawing.Size(150, 26); - this.inputDevType.TabIndex = 8; - this.inputDevType.Text = "请输入仪器型号"; - // - // inputDevNo - // - // - // - // - this.inputDevNo.Border.Class = "TextBoxBorder"; - this.inputDevNo.Border.CornerDiameter = 5; - this.inputDevNo.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputDevNo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputDevNo.Location = new System.Drawing.Point(560, 3); - this.inputDevNo.Margin = new System.Windows.Forms.Padding(0); - this.inputDevNo.MaximumSize = new System.Drawing.Size(150, 26); - this.inputDevNo.Name = "inputDevNo"; - this.inputDevNo.PreventEnterBeep = true; - this.inputDevNo.Size = new System.Drawing.Size(150, 26); - this.inputDevNo.TabIndex = 7; - this.inputDevNo.Text = "请输入仪器编号"; - // - // inputCustomName - // - // - // - // - this.inputCustomName.Border.Class = "TextBoxBorder"; - this.inputCustomName.Border.CornerDiameter = 5; - this.inputCustomName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputCustomName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputCustomName.Location = new System.Drawing.Point(320, 43); - this.inputCustomName.Margin = new System.Windows.Forms.Padding(0); - this.inputCustomName.MaximumSize = new System.Drawing.Size(150, 26); - this.inputCustomName.Name = "inputCustomName"; - this.inputCustomName.PreventEnterBeep = true; - this.inputCustomName.Size = new System.Drawing.Size(150, 26); - this.inputCustomName.TabIndex = 6; - this.inputCustomName.Text = "请输入客户名称"; - // - // labelCustomName - // - this.labelCustomName.BackColor = System.Drawing.Color.Transparent; - this.labelCustomName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelCustomName.Location = new System.Drawing.Point(240, 45); - this.labelCustomName.Margin = new System.Windows.Forms.Padding(0); - this.labelCustomName.Name = "labelCustomName"; - this.labelCustomName.Size = new System.Drawing.Size(74, 21); - this.labelCustomName.TabIndex = 5; - this.labelCustomName.Text = "联系人"; - this.labelCustomName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // labelDevNo - // - this.labelDevNo.AutoSize = true; - this.labelDevNo.BackColor = System.Drawing.Color.Transparent; - this.labelDevNo.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevNo.Location = new System.Drawing.Point(480, 5); - this.labelDevNo.Margin = new System.Windows.Forms.Padding(0); - this.labelDevNo.Name = "labelDevNo"; - this.labelDevNo.Size = new System.Drawing.Size(74, 21); - this.labelDevNo.TabIndex = 4; - this.labelDevNo.Text = "仪器编号"; - // - // labelDevType - // - this.labelDevType.AutoSize = true; - this.labelDevType.BackColor = System.Drawing.Color.Transparent; - this.labelDevType.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevType.Location = new System.Drawing.Point(240, 5); - this.labelDevType.Margin = new System.Windows.Forms.Padding(0); - this.labelDevType.Name = "labelDevType"; - this.labelDevType.Size = new System.Drawing.Size(74, 21); - this.labelDevType.TabIndex = 4; - this.labelDevType.Text = "仪器型号"; - // - // inputCustomComp - // - // - // - // - this.inputCustomComp.Border.Class = "TextBoxBorder"; - this.inputCustomComp.Border.CornerDiameter = 5; - this.inputCustomComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputCustomComp.Border.MaximumHeight = 26; - this.inputCustomComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputCustomComp.Location = new System.Drawing.Point(80, 43); - this.inputCustomComp.Margin = new System.Windows.Forms.Padding(0); - this.inputCustomComp.MaximumSize = new System.Drawing.Size(150, 26); - this.inputCustomComp.Name = "inputCustomComp"; - this.inputCustomComp.PreventEnterBeep = true; - this.inputCustomComp.Size = new System.Drawing.Size(150, 26); - this.inputCustomComp.TabIndex = 3; - this.inputCustomComp.Text = "请输入单位名称"; - // - // labelCustomComp - // - this.labelCustomComp.AutoSize = true; - this.labelCustomComp.BackColor = System.Drawing.Color.Transparent; - this.labelCustomComp.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelCustomComp.Location = new System.Drawing.Point(0, 45); - this.labelCustomComp.Margin = new System.Windows.Forms.Padding(0); - this.labelCustomComp.Name = "labelCustomComp"; - this.labelCustomComp.Size = new System.Drawing.Size(74, 21); - this.labelCustomComp.TabIndex = 0; - this.labelCustomComp.Text = "送检单位"; - // - // labelDevName - // - this.labelDevName.AutoSize = true; - this.labelDevName.BackColor = System.Drawing.Color.Transparent; - this.labelDevName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevName.Location = new System.Drawing.Point(0, 5); - this.labelDevName.Margin = new System.Windows.Forms.Padding(0); - this.labelDevName.Name = "labelDevName"; - this.labelDevName.Size = new System.Drawing.Size(74, 21); - this.labelDevName.TabIndex = 0; - this.labelDevName.Text = "仪器名称"; + this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click); // // InfoCtrlForm // @@ -499,6 +604,9 @@ ((System.ComponentModel.ISupportInitialize)(this.tableDevList)).EndInit(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); + this.panelPage.ResumeLayout(false); + this.panelPage.PerformLayout(); + this.panelNodata.ResumeLayout(false); this.ResumeLayout(false); } @@ -514,21 +622,28 @@ private System.Windows.Forms.Label labelCustomComp; private System.Windows.Forms.Label labelCustomName; private DevComponents.DotNetBar.Controls.TextBoxX inputCustomName; - private DevComponents.DotNetBar.Controls.TextBoxX inputDevNo; - private DevComponents.DotNetBar.Controls.TextBoxX inputDevType; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevModel; private DevComponents.DotNetBar.Controls.TextBoxX inputDevName; private RoundButton btnQuery; private System.Windows.Forms.Label labelDevStatus; private DevComponents.DotNetBar.Controls.ComboBoxEx inputDevStatus; private DevComponents.Editors.ComboItem All; - private DevComponents.Editors.ComboItem toBeTested; - private DevComponents.Editors.ComboItem testing; private DevComponents.Editors.ComboItem tested; + private DevComponents.Editors.ComboItem testing; + private DevComponents.Editors.ComboItem toBeTested; private RoundButton btnEdit; private RoundButton btnAdd; private RoundButton btnDelete; private RoundButton btnDetail; private RoundButton btnExport; private System.Windows.Forms.DataGridView tableDevList; + private System.Windows.Forms.Button btnNext; + private System.Windows.Forms.Button btnPre; + private System.Windows.Forms.Label labelPageCount; + private System.Windows.Forms.Label labelCurrentPage; + private System.Windows.Forms.Panel panelPage; + private System.Windows.Forms.Panel panelNodata; + private System.Windows.Forms.Label labelNodata; } } diff --git a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs index 19ec91c..963b90b 100644 --- a/RbFreqStandMeasure/R_DataBase/DbConnectService.cs +++ b/RbFreqStandMeasure/R_DataBase/DbConnectService.cs @@ -28,7 +28,8 @@ + ";database=" + databaseName + ";password=" + databasePassword + ";Charset=utf8" - + ";Allow User Variables=True"; + + ";Allow User Variables=True" + + ";Pooling=true"; mySqlConnect = new MySqlConnection(sConnection); mySqlConnect.Open(); iRetval = 0; @@ -41,6 +42,22 @@ return iRetval; } + public static MySqlConnection getConnection() + { + string sConnection = "server=" + server + + ";port=" + databasePort + + ";user=" + databaseUser + + ";database=" + databaseName + + ";password=" + databasePassword + + ";Charset=utf8" + + ";Allow User Variables=True" + + ";Pooling=true"; + MySqlConnection conn = new MySqlConnection(sConnection); + conn.Open(); + + return conn; + } + public static int closeDb() { int iRetval = -1; diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index 806deab..5bb46d6 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -15,6 +15,11 @@ int delete(int id); List search(string devName,string devCode, string devModel, string suctomerDev,string customerName,string statusId); + List searchPage(string devName, string devCode, string devModel, + string customDev, string customName, string statusId, + int page, int limit); + int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId); } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 8d3fc42..e84275f 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -150,7 +150,7 @@ if (customerName != "" && customerName != null) sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; if (statusId != "" && statusId != null) - sQry += "and STATUSID = " + statusId; + sQry += " and STATUSID = " + statusId; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); @@ -193,8 +193,143 @@ return deviceDtoList; } - + public List searchPage(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId, + int page, int limit) + { + List deviceDtoList = new List(); + DictService dictService = new DictServiceImpl(); + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + if (customerName != "" && customerName != null) + sQry += " and CUSTOMER_NAME like '%" + customerName + "%'"; + if (statusId != "" && statusId != null) + sQry += " and STATUSID = " + statusId; + + sQry += " limit " + limit + " offset " + (page - 1) * limit; + + 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)); // id + if (!aReader.IsDBNull(1)) deviceDto.DevName = aReader.GetString(1); // devName + if (!aReader.IsDBNull(2)) deviceDto.DevCode = aReader.GetString(2); // devCode + if (!aReader.IsDBNull(3)) + { + deviceDto.DevTypeId = aReader.GetString(3); // devType + deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); + } + if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); // devModel + if (!aReader.IsDBNull(5)) + { + DateTime reg = aReader.GetDateTime(5); // regTime + deviceDto.RegTime = reg.ToString("yyyy-MM-dd"); + } + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); // customName + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); // customDev + if (!aReader.IsDBNull(8)) + { + deviceDto.StatusId = aReader.GetString(8); // devStatus + deviceDto.StatusName = dictService.getNameByCode("devStatus", deviceDto.StatusId); + } + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); + + deviceDtoList.Add(deviceDto); + } + + aCommand.Dispose(); + + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "searchDevice: " + ex.Message); + deviceDtoList = null; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return deviceDtoList; + } + public int getTotalCount(string devName, string devCode, string devModel, + string customDev, string customerName, string statusId) + { + int totalCount = 0; + MySqlConnection conn = null; + + try + { + conn = DbConnectService.getConnection(); + + string sQry = "SELECT count(id) 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 (customDev != "" && customDev != null) + sQry += " and CUSTOMER_DEV like '%" + customDev + "%'"; + 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()) + { + totalCount = aReader.GetInt32(0); + } + + aCommand.Dispose(); + } + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTotalCount: " + ex.Message); + totalCount = 0; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); //用完即关闭连接 + } + } + + return totalCount; + } } } \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs index 04f5244..05fcfb3 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DictServiceImpl.cs @@ -3,9 +3,7 @@ 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 { @@ -14,12 +12,14 @@ public String getNameByCode(string codeType,string code) { String name = ""; + MySqlConnection conn = null; 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); + + conn = DbConnectService.getConnection(); + MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader aReader = cmd.ExecuteReader(CommandBehavior.Default); @@ -35,6 +35,7 @@ } } + aReader.Close(); cmd.Dispose(); return name; } @@ -42,6 +43,14 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getNameByCode: " + ex.Message); name = ""; + } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } } return name; } @@ -49,16 +58,13 @@ public List getTypeListByCodeType(string codeType) { List nameList = new List(); + MySqlConnection conn = null; try { - if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType : 数据库链接断开"); - return null; - } + conn = DbConnectService.getConnection(); string sQry = "SELECT name FROM r_dict where pid = (select id from r_dict where code = '" + codeType + "')"; - MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + MySqlCommand aCommand = new MySqlCommand(sQry, conn); using (MySqlDataReader aReader = aCommand.ExecuteReader()) { @@ -69,6 +75,8 @@ } aCommand.Dispose(); + conn.Close(); + conn.Dispose(); // 用完即关闭连接 } } catch(MySqlException ex) @@ -76,10 +84,16 @@ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getTypeListByCodeType: " + ex.Message); nameList = null; } + finally + { + if (null != conn) + { + conn.Close(); + conn.Dispose(); // 用完即关闭连接 + } + } return nameList; } - - } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 53267da..7cf51de 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -48,22 +48,27 @@ this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); - this.textBoxX3 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label8 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.label11 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); - this.comboBoxEx1 = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channelFree = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.channel1 = new DevComponents.Editors.ComboItem(); + this.channel2 = new DevComponents.Editors.ComboItem(); + this.channel3 = new DevComponents.Editors.ComboItem(); + this.channel4 = new DevComponents.Editors.ComboItem(); + this.channel5 = new DevComponents.Editors.ComboItem(); this.label4 = new System.Windows.Forms.Label(); - this.textBoxX7 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label2 = new System.Windows.Forms.Label(); - this.textBoxX6 = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.textBoxX5 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputCustComp = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevModel = new DevComponents.DotNetBar.Controls.TextBoxX(); this.label1 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); - this.textBoxX4 = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevCode = new DevComponents.DotNetBar.Controls.TextBoxX(); this.panel4.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.endTimeEst)).BeginInit(); @@ -79,7 +84,7 @@ this.checkBox9.Location = new System.Drawing.Point(506, 348); this.checkBox9.Name = "checkBox9"; this.checkBox9.Size = new System.Drawing.Size(84, 24); - this.checkBox9.TabIndex = 22; + this.checkBox9.TabIndex = 19; this.checkBox9.Text = "立即开始"; this.checkBox9.UseVisualStyleBackColor = true; // @@ -101,9 +106,10 @@ this.btnSave.PressForeColor = System.Drawing.Color.White; this.btnSave.Radius = 5; this.btnSave.Size = new System.Drawing.Size(120, 30); - this.btnSave.TabIndex = 24; + this.btnSave.TabIndex = 17; this.btnSave.Text = "开始检测"; this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // label6 // @@ -112,7 +118,7 @@ this.label6.Margin = new System.Windows.Forms.Padding(0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(100, 27); - this.label6.TabIndex = 8; + this.label6.TabIndex = 38; this.label6.Text = "频率稳定度"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -123,7 +129,7 @@ this.checkBox1.Location = new System.Drawing.Point(420, 12); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(60, 24); - this.checkBox1.TabIndex = 9; + this.checkBox1.TabIndex = 16; this.checkBox1.Text = "100S"; this.checkBox1.UseVisualStyleBackColor = true; // @@ -134,7 +140,7 @@ this.checkBox2.Location = new System.Drawing.Point(326, 12); this.checkBox2.Name = "checkBox2"; this.checkBox2.Size = new System.Drawing.Size(52, 24); - this.checkBox2.TabIndex = 9; + this.checkBox2.TabIndex = 15; this.checkBox2.Text = "20S"; this.checkBox2.UseVisualStyleBackColor = true; // @@ -145,7 +151,7 @@ this.checkBox3.Location = new System.Drawing.Point(218, 12); this.checkBox3.Name = "checkBox3"; this.checkBox3.Size = new System.Drawing.Size(52, 24); - this.checkBox3.TabIndex = 9; + this.checkBox3.TabIndex = 14; this.checkBox3.Text = "10S"; this.checkBox3.UseVisualStyleBackColor = true; // @@ -156,7 +162,7 @@ this.checkBox4.Location = new System.Drawing.Point(110, 12); this.checkBox4.Name = "checkBox4"; this.checkBox4.Size = new System.Drawing.Size(44, 24); - this.checkBox4.TabIndex = 9; + this.checkBox4.TabIndex = 13; this.checkBox4.Text = "1S"; this.checkBox4.UseVisualStyleBackColor = true; // @@ -170,7 +176,7 @@ this.btnCancelSetDev.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.btnCancelSetDev.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancelSetDev.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(47)))), ((int)(((byte)(111)))), ((int)(((byte)(198))))); + this.btnCancelSetDev.HoverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(86)))), ((int)(((byte)(163)))), ((int)(((byte)(242))))); this.btnCancelSetDev.HoverForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Location = new System.Drawing.Point(310, 342); this.btnCancelSetDev.Name = "btnCancelSetDev"; @@ -178,7 +184,7 @@ this.btnCancelSetDev.PressForeColor = System.Drawing.Color.White; this.btnCancelSetDev.Radius = 5; this.btnCancelSetDev.Size = new System.Drawing.Size(120, 30); - this.btnCancelSetDev.TabIndex = 23; + this.btnCancelSetDev.TabIndex = 18; this.btnCancelSetDev.Text = "取消"; this.btnCancelSetDev.UseVisualStyleBackColor = true; this.btnCancelSetDev.Click += new System.EventHandler(this.btnAddDevCancel_Click); @@ -310,7 +316,7 @@ this.startTime.ShowUpDown = true; this.startTime.Size = new System.Drawing.Size(180, 23); this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 12; + this.startTime.TabIndex = 11; this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // checkBox10 @@ -320,7 +326,7 @@ this.checkBox10.Location = new System.Drawing.Point(420, 12); this.checkBox10.Name = "checkBox10"; this.checkBox10.Size = new System.Drawing.Size(84, 24); - this.checkBox10.TabIndex = 11; + this.checkBox10.TabIndex = 10; this.checkBox10.Text = "日老化率"; this.checkBox10.UseVisualStyleBackColor = true; // @@ -331,7 +337,7 @@ this.checkBox11.Location = new System.Drawing.Point(326, 12); this.checkBox11.Name = "checkBox11"; this.checkBox11.Size = new System.Drawing.Size(84, 24); - this.checkBox11.TabIndex = 10; + this.checkBox11.TabIndex = 9; this.checkBox11.Text = "开机特性"; this.checkBox11.UseVisualStyleBackColor = true; // @@ -342,7 +348,7 @@ this.checkBox12.Location = new System.Drawing.Point(218, 12); this.checkBox12.Name = "checkBox12"; this.checkBox12.Size = new System.Drawing.Size(98, 24); - this.checkBox12.TabIndex = 9; + this.checkBox12.TabIndex = 8; this.checkBox12.Text = "频率准确度"; this.checkBox12.UseVisualStyleBackColor = true; // @@ -353,7 +359,7 @@ this.checkBox13.Location = new System.Drawing.Point(110, 12); this.checkBox13.Name = "checkBox13"; this.checkBox13.Size = new System.Drawing.Size(98, 24); - this.checkBox13.TabIndex = 9; + this.checkBox13.TabIndex = 7; this.checkBox13.Text = "频率稳定度"; this.checkBox13.UseVisualStyleBackColor = true; // @@ -375,7 +381,7 @@ this.label12.Margin = new System.Windows.Forms.Padding(0); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(100, 27); - this.label12.TabIndex = 8; + this.label12.TabIndex = 37; this.label12.Text = "测量开始时间"; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -386,25 +392,25 @@ this.label13.Margin = new System.Windows.Forms.Padding(0); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(100, 27); - this.label13.TabIndex = 8; + this.label13.TabIndex = 36; this.label13.Text = "检测项目"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX3 + // inputDevName // // // // - this.textBoxX3.Border.Class = "TextBoxBorder"; - this.textBoxX3.Border.CornerDiameter = 5; - this.textBoxX3.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX3.Location = new System.Drawing.Point(110, 10); - this.textBoxX3.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX3.Name = "textBoxX3"; - this.textBoxX3.PreventEnterBeep = true; - this.textBoxX3.Size = new System.Drawing.Size(150, 27); - this.textBoxX3.TabIndex = 13; + this.inputDevName.Border.Class = "TextBoxBorder"; + this.inputDevName.Border.CornerDiameter = 5; + this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevName.Location = new System.Drawing.Point(110, 10); + this.inputDevName.Margin = new System.Windows.Forms.Padding(0); + this.inputDevName.Name = "inputDevName"; + this.inputDevName.PreventEnterBeep = true; + this.inputDevName.Size = new System.Drawing.Size(150, 27); + this.inputDevName.TabIndex = 1; // // label8 // @@ -413,7 +419,7 @@ this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(100, 27); - this.label8.TabIndex = 10; + this.label8.TabIndex = 31; this.label8.Text = "仪器编号"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -424,7 +430,7 @@ this.label5.Margin = new System.Windows.Forms.Padding(0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(100, 27); - this.label5.TabIndex = 11; + this.label5.TabIndex = 30; this.label5.Text = "仪器名称"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -469,16 +475,16 @@ // panel2 // this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel2.Controls.Add(this.comboBoxEx1); + this.panel2.Controls.Add(this.channelFree); this.panel2.Controls.Add(this.label4); - this.panel2.Controls.Add(this.textBoxX7); + this.panel2.Controls.Add(this.inputCustName); this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.textBoxX6); - this.panel2.Controls.Add(this.textBoxX5); + this.panel2.Controls.Add(this.inputCustComp); + this.panel2.Controls.Add(this.inputDevModel); this.panel2.Controls.Add(this.label1); this.panel2.Controls.Add(this.label9); - this.panel2.Controls.Add(this.textBoxX4); - this.panel2.Controls.Add(this.textBoxX3); + this.panel2.Controls.Add(this.inputDevCode); + this.panel2.Controls.Add(this.inputDevName); this.panel2.Controls.Add(this.label8); this.panel2.Controls.Add(this.label5); this.panel2.Location = new System.Drawing.Point(10, 40); @@ -486,18 +492,49 @@ this.panel2.Size = new System.Drawing.Size(580, 121); this.panel2.TabIndex = 19; // - // comboBoxEx1 + // channelFree // - this.comboBoxEx1.DisplayMember = "Text"; - this.comboBoxEx1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.comboBoxEx1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.comboBoxEx1.FormattingEnabled = true; - this.comboBoxEx1.ItemHeight = 18; - this.comboBoxEx1.Location = new System.Drawing.Point(400, 87); - this.comboBoxEx1.Name = "comboBoxEx1"; - this.comboBoxEx1.Size = new System.Drawing.Size(150, 24); - this.comboBoxEx1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.comboBoxEx1.TabIndex = 21; + this.channelFree.DisplayMember = "Text"; + this.channelFree.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.channelFree.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.channelFree.FormattingEnabled = true; + this.channelFree.ItemHeight = 18; + this.channelFree.Items.AddRange(new object[] { + this.channel1, + this.channel2, + this.channel3, + this.channel4, + this.channel5}); + this.channelFree.Location = new System.Drawing.Point(400, 87); + this.channelFree.Name = "channelFree"; + this.channelFree.Size = new System.Drawing.Size(150, 24); + this.channelFree.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.channelFree.TabIndex = 6; + // + // channel1 + // + this.channel1.Text = "通道1"; + this.channel1.Value = "1"; + // + // channel2 + // + this.channel2.Text = "通道2"; + this.channel2.Value = "2"; + // + // channel3 + // + this.channel3.Text = "通道3"; + this.channel3.Value = "3"; + // + // channel4 + // + this.channel4.Text = "通道4"; + this.channel4.Value = "4"; + // + // channel5 + // + this.channel5.Text = "通道5"; + this.channel5.Value = "5"; // // label4 // @@ -506,25 +543,25 @@ this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(100, 27); - this.label4.TabIndex = 20; + this.label4.TabIndex = 35; this.label4.Text = "选择通道"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX7 + // inputCustName // // // // - this.textBoxX7.Border.Class = "TextBoxBorder"; - this.textBoxX7.Border.CornerDiameter = 5; - this.textBoxX7.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX7.Location = new System.Drawing.Point(110, 84); - this.textBoxX7.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX7.Name = "textBoxX7"; - this.textBoxX7.PreventEnterBeep = true; - this.textBoxX7.Size = new System.Drawing.Size(150, 27); - this.textBoxX7.TabIndex = 19; + this.inputCustName.Border.Class = "TextBoxBorder"; + this.inputCustName.Border.CornerDiameter = 5; + this.inputCustName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustName.Location = new System.Drawing.Point(110, 84); + this.inputCustName.Margin = new System.Windows.Forms.Padding(0); + this.inputCustName.Name = "inputCustName"; + this.inputCustName.PreventEnterBeep = true; + this.inputCustName.Size = new System.Drawing.Size(150, 27); + this.inputCustName.TabIndex = 5; // // label2 // @@ -533,41 +570,41 @@ this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(100, 27); - this.label2.TabIndex = 18; + this.label2.TabIndex = 34; this.label2.Text = "联系人"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX6 + // inputCustComp // // // // - this.textBoxX6.Border.Class = "TextBoxBorder"; - this.textBoxX6.Border.CornerDiameter = 5; - this.textBoxX6.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX6.Location = new System.Drawing.Point(400, 47); - this.textBoxX6.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX6.Name = "textBoxX6"; - this.textBoxX6.PreventEnterBeep = true; - this.textBoxX6.Size = new System.Drawing.Size(150, 27); - this.textBoxX6.TabIndex = 16; + this.inputCustComp.Border.Class = "TextBoxBorder"; + this.inputCustComp.Border.CornerDiameter = 5; + this.inputCustComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustComp.Location = new System.Drawing.Point(400, 47); + this.inputCustComp.Margin = new System.Windows.Forms.Padding(0); + this.inputCustComp.Name = "inputCustComp"; + this.inputCustComp.PreventEnterBeep = true; + this.inputCustComp.Size = new System.Drawing.Size(150, 27); + this.inputCustComp.TabIndex = 4; // - // textBoxX5 + // inputDevModel // // // // - this.textBoxX5.Border.Class = "TextBoxBorder"; - this.textBoxX5.Border.CornerDiameter = 5; - this.textBoxX5.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX5.Location = new System.Drawing.Point(110, 47); - this.textBoxX5.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX5.Name = "textBoxX5"; - this.textBoxX5.PreventEnterBeep = true; - this.textBoxX5.Size = new System.Drawing.Size(150, 27); - this.textBoxX5.TabIndex = 17; + this.inputDevModel.Border.Class = "TextBoxBorder"; + this.inputDevModel.Border.CornerDiameter = 5; + this.inputDevModel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevModel.Location = new System.Drawing.Point(110, 47); + this.inputDevModel.Margin = new System.Windows.Forms.Padding(0); + this.inputDevModel.Name = "inputDevModel"; + this.inputDevModel.PreventEnterBeep = true; + this.inputDevModel.Size = new System.Drawing.Size(150, 27); + this.inputDevModel.TabIndex = 3; // // label1 // @@ -576,7 +613,7 @@ this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 27); - this.label1.TabIndex = 14; + this.label1.TabIndex = 33; this.label1.Text = "送检单位"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // @@ -587,25 +624,25 @@ this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(100, 27); - this.label9.TabIndex = 15; + this.label9.TabIndex = 32; this.label9.Text = "仪器型号"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // textBoxX4 + // inputDevCode // // // // - this.textBoxX4.Border.Class = "TextBoxBorder"; - this.textBoxX4.Border.CornerDiameter = 5; - this.textBoxX4.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.textBoxX4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.textBoxX4.Location = new System.Drawing.Point(400, 10); - this.textBoxX4.Margin = new System.Windows.Forms.Padding(0); - this.textBoxX4.Name = "textBoxX4"; - this.textBoxX4.PreventEnterBeep = true; - this.textBoxX4.Size = new System.Drawing.Size(150, 27); - this.textBoxX4.TabIndex = 12; + this.inputDevCode.Border.Class = "TextBoxBorder"; + this.inputDevCode.Border.CornerDiameter = 5; + this.inputDevCode.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevCode.Location = new System.Drawing.Point(400, 10); + this.inputDevCode.Margin = new System.Windows.Forms.Padding(0); + this.inputDevCode.Name = "inputDevCode"; + this.inputDevCode.PreventEnterBeep = true; + this.inputDevCode.Size = new System.Drawing.Size(150, 27); + this.inputDevCode.TabIndex = 2; // // AddDevDlg // @@ -658,21 +695,26 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX3; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevName; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label5; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button btnExitDev; private System.Windows.Forms.Label label11; private System.Windows.Forms.Panel panel2; - private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1; + private DevComponents.DotNetBar.Controls.ComboBoxEx channelFree; private System.Windows.Forms.Label label4; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX7; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustName; private System.Windows.Forms.Label label2; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX6; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX5; + private DevComponents.DotNetBar.Controls.TextBoxX inputCustComp; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevModel; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; - private DevComponents.DotNetBar.Controls.TextBoxX textBoxX4; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; + private DevComponents.Editors.ComboItem channel1; + private DevComponents.Editors.ComboItem channel2; + private DevComponents.Editors.ComboItem channel3; + private DevComponents.Editors.ComboItem channel4; + private DevComponents.Editors.ComboItem channel5; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 592ada3..652c6b4 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -1,4 +1,9 @@ -using System; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using DevComponents.DotNetBar.Controls; +using DevComponents.Editors; +using System; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -31,6 +36,8 @@ public AddDevDlg() { InitializeComponent(); + + ((ComboBoxEx)this.Controls.Find("channelFree", true)[0]).SelectedIndex = 0; } // 关闭对话框 @@ -38,5 +45,32 @@ { this.HideMaskAction(); } + + // 添加并开始检测 + private void btnSave_Click(object sender, EventArgs e) + { + // 取得输入框的参数 + string devName = ((TextBoxX) this.Controls.Find("inputDevName", true)[0]).Text; + string devCode = ((TextBoxX) this.Controls.Find("inputDevCode", true)[0]).Text; + string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; + string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; + string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; + + ComboBoxEx channels = (ComboBoxEx)this.Controls.Find("channelFree", true)[0]; + string channelNo = (string)((ComboItem)channels.SelectedItem).Value; + + // 初始化数据访问接口 + DeviceService devService = new DeviceServiceImpl(); + int id = devService.add(devName, devCode, "1", devModel, devCustomComp, devCustomName, channelNo); + if (id >= 0) + { + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); + } + else + { + LogHelper.WriteErrorLog(this.GetType(), "添加设备[" + devName + "]失败"); + } + } } } diff --git a/RbFreqStandMeasure/info/DevicesDto.cs b/RbFreqStandMeasure/info/DevicesDto.cs new file mode 100644 index 0000000..872c3b8 --- /dev/null +++ b/RbFreqStandMeasure/info/DevicesDto.cs @@ -0,0 +1,6 @@ +namespace Casic.Birmm.RbFreqStandMeasure.info +{ + internal class DevicesDto + { + } +} \ No newline at end of file diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs b/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs index 6a1a538..adaf61f 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.Designer.cs @@ -29,26 +29,20 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.tableDevList = new System.Windows.Forms.DataGridView(); this.panel2 = new System.Windows.Forms.Panel(); - this.btnExport = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnDetail = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnAdd = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnDelete = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); - this.btnEdit = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); this.inputDevStatus = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.All = new DevComponents.Editors.ComboItem(); - this.tested = new DevComponents.Editors.ComboItem(); - this.testing = new DevComponents.Editors.ComboItem(); this.toBeTested = new DevComponents.Editors.ComboItem(); + this.testing = new DevComponents.Editors.ComboItem(); + this.tested = new DevComponents.Editors.ComboItem(); this.labelDevStatus = new System.Windows.Forms.Label(); - this.btnQuery = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); this.inputDevName = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.inputDevType = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.inputDevNo = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevModel = new DevComponents.DotNetBar.Controls.TextBoxX(); + this.inputDevCode = new DevComponents.DotNetBar.Controls.TextBoxX(); this.inputCustomName = new DevComponents.DotNetBar.Controls.TextBoxX(); this.labelCustomName = new System.Windows.Forms.Label(); this.labelDevNo = new System.Windows.Forms.Label(); @@ -56,14 +50,31 @@ this.inputCustomComp = new DevComponents.DotNetBar.Controls.TextBoxX(); this.labelCustomComp = new System.Windows.Forms.Label(); this.labelDevName = new System.Windows.Forms.Label(); + this.btnNext = new System.Windows.Forms.Button(); + this.btnPre = new System.Windows.Forms.Button(); + this.labelPageCount = new System.Windows.Forms.Label(); + this.labelCurrentPage = new System.Windows.Forms.Label(); + this.panelPage = new System.Windows.Forms.Panel(); + this.panelNodata = new System.Windows.Forms.Panel(); + this.labelNodata = new System.Windows.Forms.Label(); + this.btnExport = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnDetail = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnAdd = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnDelete = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnEdit = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); + this.btnQuery = new Casic.Birmm.RbFreqStandMeasure.RoundButton(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tableDevList)).BeginInit(); this.panel2.SuspendLayout(); + this.panelPage.SuspendLayout(); + this.panelNodata.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_dev_list; + this.panel1.Controls.Add(this.panelNodata); + this.panel1.Controls.Add(this.panelPage); this.panel1.Controls.Add(this.tableDevList); this.panel1.Controls.Add(this.panel2); this.panel1.Location = new System.Drawing.Point(10, 5); @@ -78,37 +89,37 @@ this.tableDevList.AllowUserToDeleteRows = false; this.tableDevList.AllowUserToResizeColumns = false; this.tableDevList.AllowUserToResizeRows = false; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(234)))), ((int)(((byte)(238))))); - dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.tableDevList.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(234)))), ((int)(((byte)(238))))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.tableDevList.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; this.tableDevList.BackgroundColor = System.Drawing.Color.White; this.tableDevList.BorderStyle = System.Windows.Forms.BorderStyle.None; this.tableDevList.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.tableDevList.ColumnHeadersHeight = 40; this.tableDevList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - this.tableDevList.Location = new System.Drawing.Point(20, 120); + this.tableDevList.Location = new System.Drawing.Point(20, 100); this.tableDevList.Margin = new System.Windows.Forms.Padding(0); this.tableDevList.Name = "tableDevList"; this.tableDevList.ReadOnly = true; this.tableDevList.RowHeadersVisible = false; this.tableDevList.RowHeadersWidth = 30; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle8.NullValue = "-"; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.tableDevList.RowsDefaultCellStyle = dataGridViewCellStyle8; - this.tableDevList.RowTemplate.Height = 40; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle4.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle4.NullValue = "-"; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.tableDevList.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.tableDevList.RowTemplate.Height = 44; this.tableDevList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.tableDevList.Size = new System.Drawing.Size(964, 440); + this.tableDevList.Size = new System.Drawing.Size(964, 480); this.tableDevList.TabIndex = 2; // // panel2 @@ -123,8 +134,8 @@ this.panel2.Controls.Add(this.labelDevStatus); this.panel2.Controls.Add(this.btnQuery); this.panel2.Controls.Add(this.inputDevName); - this.panel2.Controls.Add(this.inputDevType); - this.panel2.Controls.Add(this.inputDevNo); + this.panel2.Controls.Add(this.inputDevModel); + this.panel2.Controls.Add(this.inputDevCode); this.panel2.Controls.Add(this.inputCustomName); this.panel2.Controls.Add(this.labelCustomName); this.panel2.Controls.Add(this.labelDevNo); @@ -137,6 +148,308 @@ this.panel2.Size = new System.Drawing.Size(964, 80); this.panel2.TabIndex = 1; // + // inputDevStatus + // + this.inputDevStatus.DisplayMember = "Text"; + this.inputDevStatus.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.inputDevStatus.Font = new System.Drawing.Font("微软雅黑", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevStatus.FormattingEnabled = true; + this.inputDevStatus.ItemHeight = 20; + this.inputDevStatus.Items.AddRange(new object[] { + this.All, + this.toBeTested, + this.testing, + this.tested}); + this.inputDevStatus.Location = new System.Drawing.Point(560, 43); + this.inputDevStatus.Margin = new System.Windows.Forms.Padding(0); + this.inputDevStatus.MaximumSize = new System.Drawing.Size(150, 0); + this.inputDevStatus.Name = "inputDevStatus"; + this.inputDevStatus.Size = new System.Drawing.Size(150, 26); + this.inputDevStatus.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.inputDevStatus.TabIndex = 2; + // + // All + // + this.All.Text = "全部"; + // + // toBeTested + // + this.toBeTested.Text = "待检测"; + this.toBeTested.Value = "1"; + // + // testing + // + this.testing.Text = "检测中"; + this.testing.Value = "2"; + // + // tested + // + this.tested.Text = "已检测"; + this.tested.Value = "3"; + // + // labelDevStatus + // + this.labelDevStatus.AutoSize = true; + this.labelDevStatus.BackColor = System.Drawing.Color.Transparent; + this.labelDevStatus.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevStatus.Location = new System.Drawing.Point(480, 45); + this.labelDevStatus.Margin = new System.Windows.Forms.Padding(0); + this.labelDevStatus.Name = "labelDevStatus"; + this.labelDevStatus.Size = new System.Drawing.Size(74, 21); + this.labelDevStatus.TabIndex = 11; + this.labelDevStatus.Text = "仪器状态"; + // + // inputDevName + // + // + // + // + this.inputDevName.Border.Class = "TextBoxBorder"; + this.inputDevName.Border.CornerDiameter = 5; + this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputDevName.Location = new System.Drawing.Point(80, 3); + this.inputDevName.Margin = new System.Windows.Forms.Padding(0); + this.inputDevName.MaximumSize = new System.Drawing.Size(150, 26); + this.inputDevName.Name = "inputDevName"; + this.inputDevName.PreventEnterBeep = true; + this.inputDevName.Size = new System.Drawing.Size(150, 26); + this.inputDevName.TabIndex = 9; + this.inputDevName.Text = "请输入仪器名称"; + this.inputDevName.Click += new System.EventHandler(this.inputDevName_Click); + this.inputDevName.Leave += new System.EventHandler(this.inputDevName_Leave); + // + // inputDevModel + // + // + // + // + this.inputDevModel.Border.Class = "TextBoxBorder"; + this.inputDevModel.Border.CornerDiameter = 5; + this.inputDevModel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevModel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputDevModel.Location = new System.Drawing.Point(320, 3); + this.inputDevModel.Margin = new System.Windows.Forms.Padding(0); + this.inputDevModel.MaximumSize = new System.Drawing.Size(150, 26); + this.inputDevModel.Name = "inputDevModel"; + this.inputDevModel.PreventEnterBeep = true; + this.inputDevModel.Size = new System.Drawing.Size(150, 26); + this.inputDevModel.TabIndex = 8; + this.inputDevModel.Text = "请输入仪器型号"; + this.inputDevModel.Click += new System.EventHandler(this.inputDevModel_Click); + this.inputDevModel.Leave += new System.EventHandler(this.inputDevModel_Leave); + // + // inputDevCode + // + // + // + // + this.inputDevCode.Border.Class = "TextBoxBorder"; + this.inputDevCode.Border.CornerDiameter = 5; + this.inputDevCode.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputDevCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputDevCode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputDevCode.Location = new System.Drawing.Point(560, 3); + this.inputDevCode.Margin = new System.Windows.Forms.Padding(0); + this.inputDevCode.MaximumSize = new System.Drawing.Size(150, 26); + this.inputDevCode.Name = "inputDevCode"; + this.inputDevCode.PreventEnterBeep = true; + this.inputDevCode.Size = new System.Drawing.Size(150, 26); + this.inputDevCode.TabIndex = 7; + this.inputDevCode.Text = "请输入仪器编号"; + this.inputDevCode.Click += new System.EventHandler(this.inputDevCode_Click); + this.inputDevCode.Leave += new System.EventHandler(this.inputDevCode_Leave); + // + // inputCustomName + // + // + // + // + this.inputCustomName.Border.Class = "TextBoxBorder"; + this.inputCustomName.Border.CornerDiameter = 5; + this.inputCustomName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustomName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputCustomName.Location = new System.Drawing.Point(320, 43); + this.inputCustomName.Margin = new System.Windows.Forms.Padding(0); + this.inputCustomName.MaximumSize = new System.Drawing.Size(150, 26); + this.inputCustomName.Name = "inputCustomName"; + this.inputCustomName.PreventEnterBeep = true; + this.inputCustomName.Size = new System.Drawing.Size(150, 26); + this.inputCustomName.TabIndex = 6; + this.inputCustomName.Text = "请输入联系人"; + this.inputCustomName.Click += new System.EventHandler(this.inputCustomName_Click); + this.inputCustomName.Leave += new System.EventHandler(this.inputCustomName_Leave); + // + // labelCustomName + // + this.labelCustomName.BackColor = System.Drawing.Color.Transparent; + this.labelCustomName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelCustomName.Location = new System.Drawing.Point(240, 45); + this.labelCustomName.Margin = new System.Windows.Forms.Padding(0); + this.labelCustomName.Name = "labelCustomName"; + this.labelCustomName.Size = new System.Drawing.Size(74, 21); + this.labelCustomName.TabIndex = 5; + this.labelCustomName.Text = "联系人"; + this.labelCustomName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // labelDevNo + // + this.labelDevNo.AutoSize = true; + this.labelDevNo.BackColor = System.Drawing.Color.Transparent; + this.labelDevNo.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevNo.Location = new System.Drawing.Point(480, 5); + this.labelDevNo.Margin = new System.Windows.Forms.Padding(0); + this.labelDevNo.Name = "labelDevNo"; + this.labelDevNo.Size = new System.Drawing.Size(74, 21); + this.labelDevNo.TabIndex = 4; + this.labelDevNo.Text = "仪器编号"; + // + // labelDevType + // + this.labelDevType.AutoSize = true; + this.labelDevType.BackColor = System.Drawing.Color.Transparent; + this.labelDevType.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevType.Location = new System.Drawing.Point(240, 5); + this.labelDevType.Margin = new System.Windows.Forms.Padding(0); + this.labelDevType.Name = "labelDevType"; + this.labelDevType.Size = new System.Drawing.Size(74, 21); + this.labelDevType.TabIndex = 4; + this.labelDevType.Text = "仪器型号"; + // + // inputCustomComp + // + // + // + // + this.inputCustomComp.Border.Class = "TextBoxBorder"; + this.inputCustomComp.Border.CornerDiameter = 5; + this.inputCustomComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.inputCustomComp.Border.MaximumHeight = 26; + this.inputCustomComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.inputCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inputCustomComp.Location = new System.Drawing.Point(80, 43); + this.inputCustomComp.Margin = new System.Windows.Forms.Padding(0); + this.inputCustomComp.MaximumSize = new System.Drawing.Size(150, 26); + this.inputCustomComp.Name = "inputCustomComp"; + this.inputCustomComp.PreventEnterBeep = true; + this.inputCustomComp.Size = new System.Drawing.Size(150, 26); + this.inputCustomComp.TabIndex = 3; + this.inputCustomComp.Text = "请输入送检单位名称"; + this.inputCustomComp.Click += new System.EventHandler(this.inputCustomComp_Click); + this.inputCustomComp.Leave += new System.EventHandler(this.inputCustomComp_Leave); + // + // labelCustomComp + // + this.labelCustomComp.AutoSize = true; + this.labelCustomComp.BackColor = System.Drawing.Color.Transparent; + this.labelCustomComp.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelCustomComp.Location = new System.Drawing.Point(0, 45); + this.labelCustomComp.Margin = new System.Windows.Forms.Padding(0); + this.labelCustomComp.Name = "labelCustomComp"; + this.labelCustomComp.Size = new System.Drawing.Size(74, 21); + this.labelCustomComp.TabIndex = 0; + this.labelCustomComp.Text = "送检单位"; + // + // labelDevName + // + this.labelDevName.AutoSize = true; + this.labelDevName.BackColor = System.Drawing.Color.Transparent; + this.labelDevName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.labelDevName.Location = new System.Drawing.Point(0, 5); + this.labelDevName.Margin = new System.Windows.Forms.Padding(0); + this.labelDevName.Name = "labelDevName"; + this.labelDevName.Size = new System.Drawing.Size(74, 21); + this.labelDevName.TabIndex = 0; + this.labelDevName.Text = "仪器名称"; + // + // btnNext + // + this.btnNext.BackColor = System.Drawing.Color.Transparent; + this.btnNext.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_page_next; + this.btnNext.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.btnNext.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnNext.Location = new System.Drawing.Point(950, 0); + this.btnNext.Name = "btnNext"; + this.btnNext.Size = new System.Drawing.Size(16, 16); + this.btnNext.TabIndex = 317; + this.btnNext.UseVisualStyleBackColor = false; + this.btnNext.Click += new System.EventHandler(this.btnNext_Click); + // + // btnPre + // + this.btnPre.BackColor = System.Drawing.Color.Transparent; + this.btnPre.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_page_pre; + this.btnPre.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.btnPre.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnPre.Location = new System.Drawing.Point(890, 0); + this.btnPre.Name = "btnPre"; + this.btnPre.Size = new System.Drawing.Size(16, 16); + this.btnPre.TabIndex = 318; + this.btnPre.UseVisualStyleBackColor = false; + this.btnPre.Click += new System.EventHandler(this.btnPre_Click); + // + // labelPageCount + // + this.labelPageCount.AutoSize = true; + this.labelPageCount.BackColor = System.Drawing.Color.Transparent; + this.labelPageCount.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelPageCount.Location = new System.Drawing.Point(690, 0); + this.labelPageCount.Name = "labelPageCount"; + this.labelPageCount.Size = new System.Drawing.Size(151, 17); + this.labelPageCount.TabIndex = 315; + this.labelPageCount.Text = "共10条,每页10条,共2页"; + // + // labelCurrentPage + // + this.labelCurrentPage.AutoSize = true; + this.labelCurrentPage.BackColor = System.Drawing.Color.Transparent; + this.labelCurrentPage.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelCurrentPage.Location = new System.Drawing.Point(920, 0); + this.labelCurrentPage.Name = "labelCurrentPage"; + this.labelCurrentPage.Size = new System.Drawing.Size(15, 17); + this.labelCurrentPage.TabIndex = 315; + this.labelCurrentPage.Text = "1"; + // + // panelPage + // + this.panelPage.BackColor = System.Drawing.Color.Transparent; + this.panelPage.Controls.Add(this.labelPageCount); + this.panelPage.Controls.Add(this.btnNext); + this.panelPage.Controls.Add(this.btnPre); + this.panelPage.Controls.Add(this.labelCurrentPage); + this.panelPage.Location = new System.Drawing.Point(10, 595); + this.panelPage.Name = "panelPage"; + this.panelPage.Size = new System.Drawing.Size(984, 20); + this.panelPage.TabIndex = 319; + // + // panelNodata + // + this.panelNodata.BackColor = System.Drawing.Color.Transparent; + this.panelNodata.Controls.Add(this.labelNodata); + this.panelNodata.Location = new System.Drawing.Point(10, 140); + this.panelNodata.Name = "panelNodata"; + this.panelNodata.Size = new System.Drawing.Size(984, 40); + this.panelNodata.TabIndex = 320; + // + // labelNodata + // + this.labelNodata.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labelNodata.Location = new System.Drawing.Point(0, 0); + this.labelNodata.Name = "labelNodata"; + this.labelNodata.Size = new System.Drawing.Size(984, 50); + this.labelNodata.TabIndex = 0; + this.labelNodata.Text = "没有搜索到数据"; + this.labelNodata.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // btnExport // this.btnExport.EnterBackColor = System.Drawing.Color.Blue; @@ -182,6 +495,7 @@ this.btnDetail.TabIndex = 13; this.btnDetail.Text = "详情"; this.btnDetail.UseVisualStyleBackColor = true; + this.btnDetail.Click += new System.EventHandler(this.btnDetail_Click); // // btnAdd // @@ -253,55 +567,6 @@ this.btnEdit.Text = "修改"; this.btnEdit.UseVisualStyleBackColor = true; // - // inputDevStatus - // - this.inputDevStatus.DisplayMember = "Text"; - this.inputDevStatus.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.inputDevStatus.Font = new System.Drawing.Font("微软雅黑", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevStatus.FormattingEnabled = true; - this.inputDevStatus.ItemHeight = 20; - this.inputDevStatus.Items.AddRange(new object[] { - this.All, - this.tested, - this.testing, - this.toBeTested}); - this.inputDevStatus.Location = new System.Drawing.Point(560, 43); - this.inputDevStatus.Margin = new System.Windows.Forms.Padding(0); - this.inputDevStatus.MaximumSize = new System.Drawing.Size(150, 0); - this.inputDevStatus.Name = "inputDevStatus"; - this.inputDevStatus.Size = new System.Drawing.Size(150, 26); - this.inputDevStatus.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.inputDevStatus.TabIndex = 2; - // - // All - // - this.All.Text = "全部"; - // - // tested - // - this.tested.Text = "待检测"; - // - // testing - // - this.testing.Text = "检测中"; - // - // toBeTested - // - this.toBeTested.Text = "已检测"; - // - // labelDevStatus - // - this.labelDevStatus.AutoSize = true; - this.labelDevStatus.BackColor = System.Drawing.Color.Transparent; - this.labelDevStatus.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevStatus.Location = new System.Drawing.Point(480, 45); - this.labelDevStatus.Margin = new System.Windows.Forms.Padding(0); - this.labelDevStatus.Name = "labelDevStatus"; - this.labelDevStatus.Size = new System.Drawing.Size(74, 21); - this.labelDevStatus.TabIndex = 11; - this.labelDevStatus.Text = "仪器状态"; - // // btnQuery // this.btnQuery.EnterBackColor = System.Drawing.Color.Blue; @@ -324,167 +589,7 @@ this.btnQuery.TabIndex = 10; this.btnQuery.Text = "查询"; this.btnQuery.UseVisualStyleBackColor = true; - // - // inputDevName - // - // - // - // - this.inputDevName.Border.Class = "TextBoxBorder"; - this.inputDevName.Border.CornerDiameter = 5; - this.inputDevName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputDevName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputDevName.Location = new System.Drawing.Point(80, 3); - this.inputDevName.Margin = new System.Windows.Forms.Padding(0); - this.inputDevName.MaximumSize = new System.Drawing.Size(150, 26); - this.inputDevName.Name = "inputDevName"; - this.inputDevName.PreventEnterBeep = true; - this.inputDevName.Size = new System.Drawing.Size(150, 26); - this.inputDevName.TabIndex = 9; - this.inputDevName.Text = "请输入仪器名称"; - // - // inputDevType - // - // - // - // - this.inputDevType.Border.Class = "TextBoxBorder"; - this.inputDevType.Border.CornerDiameter = 5; - this.inputDevType.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputDevType.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputDevType.Location = new System.Drawing.Point(320, 3); - this.inputDevType.Margin = new System.Windows.Forms.Padding(0); - this.inputDevType.MaximumSize = new System.Drawing.Size(150, 26); - this.inputDevType.Name = "inputDevType"; - this.inputDevType.PreventEnterBeep = true; - this.inputDevType.Size = new System.Drawing.Size(150, 26); - this.inputDevType.TabIndex = 8; - this.inputDevType.Text = "请输入仪器型号"; - // - // inputDevNo - // - // - // - // - this.inputDevNo.Border.Class = "TextBoxBorder"; - this.inputDevNo.Border.CornerDiameter = 5; - this.inputDevNo.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputDevNo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputDevNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputDevNo.Location = new System.Drawing.Point(560, 3); - this.inputDevNo.Margin = new System.Windows.Forms.Padding(0); - this.inputDevNo.MaximumSize = new System.Drawing.Size(150, 26); - this.inputDevNo.Name = "inputDevNo"; - this.inputDevNo.PreventEnterBeep = true; - this.inputDevNo.Size = new System.Drawing.Size(150, 26); - this.inputDevNo.TabIndex = 7; - this.inputDevNo.Text = "请输入仪器编号"; - // - // inputCustomName - // - // - // - // - this.inputCustomName.Border.Class = "TextBoxBorder"; - this.inputCustomName.Border.CornerDiameter = 5; - this.inputCustomName.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputCustomName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputCustomName.Location = new System.Drawing.Point(320, 43); - this.inputCustomName.Margin = new System.Windows.Forms.Padding(0); - this.inputCustomName.MaximumSize = new System.Drawing.Size(150, 26); - this.inputCustomName.Name = "inputCustomName"; - this.inputCustomName.PreventEnterBeep = true; - this.inputCustomName.Size = new System.Drawing.Size(150, 26); - this.inputCustomName.TabIndex = 6; - this.inputCustomName.Text = "请输入客户名称"; - // - // labelCustomName - // - this.labelCustomName.BackColor = System.Drawing.Color.Transparent; - this.labelCustomName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelCustomName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelCustomName.Location = new System.Drawing.Point(240, 45); - this.labelCustomName.Margin = new System.Windows.Forms.Padding(0); - this.labelCustomName.Name = "labelCustomName"; - this.labelCustomName.Size = new System.Drawing.Size(74, 21); - this.labelCustomName.TabIndex = 5; - this.labelCustomName.Text = "联系人"; - this.labelCustomName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // labelDevNo - // - this.labelDevNo.AutoSize = true; - this.labelDevNo.BackColor = System.Drawing.Color.Transparent; - this.labelDevNo.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevNo.Location = new System.Drawing.Point(480, 5); - this.labelDevNo.Margin = new System.Windows.Forms.Padding(0); - this.labelDevNo.Name = "labelDevNo"; - this.labelDevNo.Size = new System.Drawing.Size(74, 21); - this.labelDevNo.TabIndex = 4; - this.labelDevNo.Text = "仪器编号"; - // - // labelDevType - // - this.labelDevType.AutoSize = true; - this.labelDevType.BackColor = System.Drawing.Color.Transparent; - this.labelDevType.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevType.Location = new System.Drawing.Point(240, 5); - this.labelDevType.Margin = new System.Windows.Forms.Padding(0); - this.labelDevType.Name = "labelDevType"; - this.labelDevType.Size = new System.Drawing.Size(74, 21); - this.labelDevType.TabIndex = 4; - this.labelDevType.Text = "仪器型号"; - // - // inputCustomComp - // - // - // - // - this.inputCustomComp.Border.Class = "TextBoxBorder"; - this.inputCustomComp.Border.CornerDiameter = 5; - this.inputCustomComp.Border.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.inputCustomComp.Border.MaximumHeight = 26; - this.inputCustomComp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.inputCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inputCustomComp.Location = new System.Drawing.Point(80, 43); - this.inputCustomComp.Margin = new System.Windows.Forms.Padding(0); - this.inputCustomComp.MaximumSize = new System.Drawing.Size(150, 26); - this.inputCustomComp.Name = "inputCustomComp"; - this.inputCustomComp.PreventEnterBeep = true; - this.inputCustomComp.Size = new System.Drawing.Size(150, 26); - this.inputCustomComp.TabIndex = 3; - this.inputCustomComp.Text = "请输入单位名称"; - // - // labelCustomComp - // - this.labelCustomComp.AutoSize = true; - this.labelCustomComp.BackColor = System.Drawing.Color.Transparent; - this.labelCustomComp.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelCustomComp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelCustomComp.Location = new System.Drawing.Point(0, 45); - this.labelCustomComp.Margin = new System.Windows.Forms.Padding(0); - this.labelCustomComp.Name = "labelCustomComp"; - this.labelCustomComp.Size = new System.Drawing.Size(74, 21); - this.labelCustomComp.TabIndex = 0; - this.labelCustomComp.Text = "送检单位"; - // - // labelDevName - // - this.labelDevName.AutoSize = true; - this.labelDevName.BackColor = System.Drawing.Color.Transparent; - this.labelDevName.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labelDevName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.labelDevName.Location = new System.Drawing.Point(0, 5); - this.labelDevName.Margin = new System.Windows.Forms.Padding(0); - this.labelDevName.Name = "labelDevName"; - this.labelDevName.Size = new System.Drawing.Size(74, 21); - this.labelDevName.TabIndex = 0; - this.labelDevName.Text = "仪器名称"; + this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click); // // InfoCtrlForm // @@ -499,6 +604,9 @@ ((System.ComponentModel.ISupportInitialize)(this.tableDevList)).EndInit(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); + this.panelPage.ResumeLayout(false); + this.panelPage.PerformLayout(); + this.panelNodata.ResumeLayout(false); this.ResumeLayout(false); } @@ -514,21 +622,28 @@ private System.Windows.Forms.Label labelCustomComp; private System.Windows.Forms.Label labelCustomName; private DevComponents.DotNetBar.Controls.TextBoxX inputCustomName; - private DevComponents.DotNetBar.Controls.TextBoxX inputDevNo; - private DevComponents.DotNetBar.Controls.TextBoxX inputDevType; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; + private DevComponents.DotNetBar.Controls.TextBoxX inputDevModel; private DevComponents.DotNetBar.Controls.TextBoxX inputDevName; private RoundButton btnQuery; private System.Windows.Forms.Label labelDevStatus; private DevComponents.DotNetBar.Controls.ComboBoxEx inputDevStatus; private DevComponents.Editors.ComboItem All; - private DevComponents.Editors.ComboItem toBeTested; - private DevComponents.Editors.ComboItem testing; private DevComponents.Editors.ComboItem tested; + private DevComponents.Editors.ComboItem testing; + private DevComponents.Editors.ComboItem toBeTested; private RoundButton btnEdit; private RoundButton btnAdd; private RoundButton btnDelete; private RoundButton btnDetail; private RoundButton btnExport; private System.Windows.Forms.DataGridView tableDevList; + private System.Windows.Forms.Button btnNext; + private System.Windows.Forms.Button btnPre; + private System.Windows.Forms.Label labelPageCount; + private System.Windows.Forms.Label labelCurrentPage; + private System.Windows.Forms.Panel panelPage; + private System.Windows.Forms.Panel panelNodata; + private System.Windows.Forms.Label labelNodata; } } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 476c0f8..e7bbb25 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -1,11 +1,14 @@ -using DevComponents.Editors.DateTimeAdv; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; +using DevComponents.DotNetBar.Controls; +using DevComponents.Editors; +using DevComponents.Editors.DateTimeAdv; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace Casic.Birmm.RbFreqStandMeasure.info @@ -14,21 +17,44 @@ { private DataTable devList = null; - #region 样式常量定影 + private int totalCount = 0; // 总行数 + private int currentPage = 1; // 当前页码 + private int pageCount = 0; // 总页数 + private readonly int limitCount = 10; // 每页数据条数,当前页面的表格固定为10条 + + JObject condition = new JObject(); // 查询条件 + + DeviceService deviceService = new DeviceServiceImpl(); + + #region 输入框默认文字 + public readonly string DefaultDevName = "请输入仪器名称"; + public readonly string DefaultDevModel = "请输入仪器型号"; + public readonly string DefaultDevCode = "请输入仪器编号"; + public readonly string DefaultCustomComp = "请输入送检单位名称"; + public readonly string DefaultCustomName = "请输入联系人"; + #endregion + + #region 样式常量定义 private readonly Color titleBackColor = Color.FromArgb(63, 132, 215); // #3F64D7 private readonly Color tableForeColor = Color.White; private readonly Font titleFont = new Font("微软雅黑", 14F, FontStyle.Regular, GraphicsUnit.Pixel, 134); + + private readonly Color inputBlack = Color.FromArgb(51, 51, 51); // #333333 + private readonly Color inputDefault = Color.FromArgb(204, 204, 204); // #CCCCCC #endregion public InfoCtrlForm() { InitializeComponent(); - this.inputDevStatus.SelectedIndex = 0; + this.inputDevStatus.SelectedIndex = 0; // 仪器状态默认选择“全部” + + // 进入页面时默认查询所有的数据 + totalCount = GetTotalCount(condition); // 初始化表格并加载数据 InitTableDevList(); - LoadDevList(); + LoadDevList(condition); } private void InitTableDevList() @@ -98,7 +124,7 @@ TextAlign = ContentAlignment.MiddleCenter, BackColor = titleBackColor, AutoSize = false, - Text = "仪器类型", + Text = "仪器型号", Location = new Point(364, 0), Size = new Size(120, 40) }; @@ -166,23 +192,86 @@ colChannelNo.BringToFront(); } - private void LoadDevList() + private void LoadDevList(JObject condition) { devList = new DataTable(); + // 设置表格的列 devList.Columns.Add("index", Type.GetType("System.String")); - devList.Columns.Add("regTime", Type.GetType("System.DateTime")); + devList.Columns.Add("regTime", Type.GetType("System.String")); devList.Columns.Add("devName", Type.GetType("System.String")); - devList.Columns.Add("devType", Type.GetType("System.String")); - devList.Columns.Add("devNo", Type.GetType("System.String")); + devList.Columns.Add("devModel", Type.GetType("System.String")); + devList.Columns.Add("devCode", Type.GetType("System.String")); devList.Columns.Add("customName", Type.GetType("System.String")); devList.Columns.Add("status", Type.GetType("System.String")); devList.Columns.Add("channelNo", Type.GetType("System.String")); + devList.Columns.Add("id", Type.GetType("System.Int32")); - devList.Rows.Add("1", DateTime.Now, "SF2001-1", "通用计数器", "00001", "李涛", "检测中", "1"); - devList.Rows.Add("2", DateTime.Now, "SF2001-2", "通用计数器", "00002", "李涛", "检完", ""); - devList.Rows.Add("3", DateTime.Now, "SF2001-3", "通用计数器", "00003", "李涛", "检完", ""); - devList.Rows.Add("4", DateTime.Now, "SF2001-4", "通用计数器", "00004", "李涛", "待检", ""); + // 分页查询数据库 + string devName = ""; + string devModel = ""; + string devCode = ""; + string devStatus = ""; + string customComp = ""; + string customName = ""; + int page = 1; + if (condition.Property("devName") != null) + { + devName = condition.Property("devName").Value.ToString(); + } + if (condition.Property("devModel") != null) + { + devModel = condition.Property("devModel").Value.ToString(); + } + if (condition.Property("devCode") != null) + { + devCode = condition.Property("devCode").Value.ToString(); + } + if (condition.Property("devStatus") != null) + { + devStatus = condition.Property("devStatus").Value.ToString(); + } + if (condition.Property("customComp") != null) + { + customComp = condition.Property("customComp").Value.ToString(); + } + if (condition.Property("customName") != null) + { + customName = condition.Property("customName").Value.ToString(); + } + if (condition.Property("page") != null) + { + page = Convert.ToInt32(condition.Property("page").Value.ToString()); + } + + // 获取总条数 + totalCount = deviceService.getTotalCount(devName, devCode, devModel, customComp, customName, devStatus); + + // 获取当前页的数据 + List queryList = deviceService.searchPage(devName, devCode, devModel, customComp, customName, devStatus, page, limitCount); + if (null != queryList && queryList.Count > 0) + { + // 重新计算页码数据 + pageCount = Decimal.ToInt32(Math.Ceiling((decimal) totalCount / limitCount)); + ((Label)this.Controls.Find("labelPageCount", true)[0]).Text = "共 " + totalCount + " 条,每页 " + limitCount + " 条,共 " + pageCount + " 页"; + ((Label)this.Controls.Find("labelCurrentPage", true)[0]).Text = currentPage.ToString(); + + int i = 0; + foreach ( DeviceDto device in queryList ) + { + int index = (page-1) * limitCount + i + 1; + devList.Rows.Add(index, device.RegTime, device.DevName, device.DevModel, device.DevCode, device.CustomerName, device.StatusName, device.Channel, device.Id); + i++; + } + + this.Controls.Find("panelNodata", true)[0].Hide(); + this.Controls.Find("panelPage", true)[0].Show(); + } + else + { + this.Controls.Find("panelNodata", true)[0].Show(); + this.Controls.Find("panelPage", true)[0].Hide(); + } tableDevList.DataSource = devList; @@ -195,6 +284,9 @@ tableDevList.Columns[5].Width = 120; tableDevList.Columns[6].Width = 120; tableDevList.Columns[7].Width = 120; + tableDevList.Columns[8].Width = 0; + + tableDevList.Columns[8].Visible = false; // id不显示 tableDevList.Columns[0].ReadOnly = true; tableDevList.Columns[1].ReadOnly = true; @@ -204,6 +296,45 @@ tableDevList.Columns[5].ReadOnly = true; tableDevList.Columns[6].ReadOnly = true; tableDevList.Columns[7].ReadOnly = true; + tableDevList.Columns[8].ReadOnly = true; + } + + private int GetTotalCount(JObject condition) + { + string devName = ""; + string devModel = ""; + string devCode = ""; + string devStatus = ""; + string customComp = ""; + string customName = ""; + if (condition.Property("devName") != null) + { + devName = condition.Property("devName").Value.ToString(); + } + if (condition.Property("devModel") != null) + { + devModel = condition.Property("devModel").Value.ToString(); + } + if (condition.Property("devCode") != null) + { + devCode = condition.Property("devCode").Value.ToString(); + } + if (condition.Property("devStatus") != null) + { + devStatus = condition.Property("devStatus").Value.ToString(); + } + if (condition.Property("customComp") != null) + { + customComp = condition.Property("customComp").Value.ToString(); + } + if (condition.Property("customName") != null) + { + customName = condition.Property("customName").Value.ToString(); + } + + int total = deviceService.getTotalCount(devName, devCode, devModel, customComp, customName, devStatus); + + return total; } private void btnAdd_Click(object sender, EventArgs e) @@ -241,5 +372,136 @@ maskForm.Close(); } } + + private void btnQuery_Click(object sender, EventArgs e) + { + string devName = CheckInputText("inputDevName", DefaultDevName); + string devModel = CheckInputText("inputDevModel", DefaultDevModel); + string devCode = CheckInputText("inputDevCode", DefaultDevCode); + string customComp = CheckInputText("inputCustomComp", DefaultCustomComp); + string customName = CheckInputText("inputCustomName", DefaultCustomName); + ComboBoxEx statusSelect = (ComboBoxEx)this.Controls.Find("inputDevStatus", true)[0]; + string devStatus = (string)((ComboItem)statusSelect.SelectedItem).Value; + + condition.RemoveAll(); + condition.Add("devName", devName); + condition.Add("devModel", devModel); + condition.Add("devCode", devCode); + condition.Add("devStatus", devStatus); + condition.Add("customComp", customComp); + condition.Add("customName", customName); + condition.Add("page", 1); + + // 查询数据 + LoadDevList(condition); + } + + private string CheckInputText(string inputName, string defaultText) + { + string name = ((TextBoxX)this.Controls.Find(inputName, true)[0]).Text; + if (name == defaultText) + { + return ""; + } + else + { + return name; + } + } + + private void inputClick(string inputName, string defaultText, object sender) + { + string name = CheckInputText(inputName, defaultText); + + ((TextBoxX)sender).Text = name; + ((TextBoxX)sender).ForeColor = inputBlack; + } + + private void inputLeave(string inputName, string defaultText, object sender) + { + string name = CheckInputText(inputName, defaultText); + if (name == "") + { + ((TextBoxX)sender).Text = defaultText; + ((TextBoxX)sender).ForeColor = inputDefault; + } + } + + private void inputDevName_Click(object sender, EventArgs e) + { + inputClick("inputDevName", DefaultDevName, sender); + } + + private void inputDevName_Leave(object sender, EventArgs e) + { + inputLeave("inputDevName", DefaultDevName, sender); + } + + private void inputDevModel_Click(object sender, EventArgs e) + { + inputClick("inputDevModel", DefaultDevModel, sender); + } + + private void inputDevModel_Leave(object sender, EventArgs e) + { + inputLeave("inputDevModel", DefaultDevModel, sender); + } + + private void inputDevCode_Click(object sender, EventArgs e) + { + inputClick("inputDevCode", DefaultDevCode, sender); + } + + private void inputDevCode_Leave(object sender, EventArgs e) + { + inputLeave("inputDevCode", DefaultDevCode, sender); + } + + private void inputCustomComp_Click(object sender, EventArgs e) + { + inputClick("inputCustomComp", DefaultCustomComp, sender); + } + + private void inputCustomComp_Leave(object sender, EventArgs e) + { + inputLeave("inputCustomComp", DefaultCustomComp, sender); + } + + private void inputCustomName_Click(object sender, EventArgs e) + { + inputClick("inputCustomName", DefaultCustomName, sender); + } + + private void inputCustomName_Leave(object sender, EventArgs e) + { + inputLeave("inputCustomName", DefaultCustomName, sender); + } + + private void btnPre_Click(object sender, EventArgs e) + { + if (currentPage > 1) + { + currentPage -= 1; + condition.Remove("page"); + condition.Add("page", currentPage); + LoadDevList(condition); + } + } + + private void btnNext_Click(object sender, EventArgs e) + { + if (currentPage < pageCount) + { + currentPage += 1; + condition.Remove("page"); + condition.Add("page", currentPage); + LoadDevList(condition); + } + } + + private void btnDetail_Click(object sender, EventArgs e) + { + + } } }