DeviceDetailInfo.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using DevExpress.XtraEditors;
  3. using UAS_PLCDataReader.DataOperate;
  4. using UAS_PLCDataReader.Entity;
  5. using System.Data;
  6. using System.Text;
  7. using UAS_PLCDataReader.PublicMethod;
  8. using System.Windows.Forms;
  9. namespace UAS_PLCDataReader.Device.Infomation
  10. {
  11. public partial class DeviceDetailInfo : XtraForm
  12. {
  13. DataHelper dh = SystemInf.dh;
  14. StringBuilder sql = new StringBuilder();
  15. string de_code = "";
  16. public DeviceDetailInfo()
  17. {
  18. InitializeComponent();
  19. repositoryItemCheckEdit1.QueryCheckStateByValue += RepositoryItemCheckEdit1_QueryCheckStateByValue;
  20. }
  21. private void RepositoryItemCheckEdit1_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e)
  22. {
  23. string val = "";
  24. if (e.Value != null)
  25. {
  26. val = e.Value.ToString();
  27. }
  28. else
  29. {
  30. val = "FALSE";//默认为不选
  31. }
  32. switch (val.ToUpper())
  33. {
  34. case "TRUE":
  35. case "YES":
  36. case "1":
  37. e.CheckState = CheckState.Checked;
  38. break;
  39. case "FALSE":
  40. case "NO":
  41. case "0":
  42. e.CheckState = CheckState.Unchecked;
  43. break;
  44. default:
  45. e.CheckState = CheckState.Checked;
  46. break;
  47. }
  48. e.Handled = true;
  49. }
  50. public DeviceDetailInfo(string DevcieCode)
  51. {
  52. InitializeComponent();
  53. de_code = DevcieCode;
  54. Text = DevcieCode;
  55. }
  56. private void DeviceDetailInfo_Load(object sender, EventArgs e)
  57. {
  58. DataTable dt = (DataTable)dh.ExecuteSql("select * from devicenetconfig where dnc_decode='" + de_code + "'", "select");
  59. if (dt.Rows.Count > 0)
  60. {
  61. BaseUtil.SetFormValue(Controls, dt);
  62. }
  63. 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");
  64. GridDeviceDetailInfo.DataSource = dt;
  65. }
  66. private void DeviceDetailInfo_KeyDown(object sender, KeyEventArgs e)
  67. {
  68. if (e.KeyCode == Keys.Escape)
  69. Close();
  70. }
  71. }
  72. }