using System; using DevExpress.XtraEditors; using UAS_PLCDataReader.DataOperate; using UAS_PLCDataReader.Entity; using System.Data; using System.Text; using UAS_PLCDataReader.PublicMethod; using System.Windows.Forms; namespace UAS_PLCDataReader.Device.Infomation { public partial class DeviceDetailInfo : XtraForm { DataHelper dh = SystemInf.dh; StringBuilder sql = new StringBuilder(); string de_code = ""; public DeviceDetailInfo() { InitializeComponent(); repositoryItemCheckEdit1.QueryCheckStateByValue += RepositoryItemCheckEdit1_QueryCheckStateByValue; } private void RepositoryItemCheckEdit1_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e) { string val = ""; if (e.Value != null) { val = e.Value.ToString(); } else { val = "FALSE";//默认为不选 } switch (val.ToUpper()) { case "TRUE": case "YES": case "1": e.CheckState = CheckState.Checked; break; case "FALSE": case "NO": case "0": e.CheckState = CheckState.Unchecked; break; default: e.CheckState = CheckState.Checked; break; } e.Handled = true; } public DeviceDetailInfo(string DevcieCode) { InitializeComponent(); de_code = DevcieCode; Text = DevcieCode; } private void DeviceDetailInfo_Load(object sender, EventArgs e) { DataTable dt = (DataTable)dh.ExecuteSql("select * from devicenetconfig where dnc_decode='" + de_code + "'", "select"); if (dt.Rows.Count > 0) { BaseUtil.SetFormValue(Controls, dt); } dt = (DataTable)dh.ExecuteSql("SELECT DC_CODE,DC_NAME,to_char(DPC_ENABLE)DPC_ENABLE FROM DEVICEPOLLINGCONFIG LEFT JOIN DEVICECOMMAND ON DPC_DCCODE=DC_CODE WHERE DPC_DECODE='" + de_code + "' and rownum<50", "select"); GridDeviceDetailInfo.DataSource = dt; } private void DeviceDetailInfo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) Close(); } } }