frmClassSelect.cs.svn-base 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using CoreFS.CA06;
  8. using System.Windows.Forms;
  9. namespace Core.LgMes.Client.LgJobMgt
  10. {
  11. public partial class frmClassSelect : Form
  12. {
  13. public frmClassSelect(string szCLH, string DutyID)
  14. {
  15. InitializeComponent();
  16. //this._szGDH = szGDH;
  17. this._szJRCLH = szCLH;
  18. this._dutyID = DutyID;
  19. SetComboBoxDataSource();
  20. SetComboBoxValue(DutyID);
  21. SetComoboVisible();
  22. }
  23. #region " Variable"
  24. private string _szJRCLH = "";
  25. public string _dutyID = "";
  26. public bool _changeFlag = false;
  27. #endregion
  28. #region
  29. private void SetComboBoxDataSource()
  30. {
  31. this.comboBox1.DataSource = BuildClassTable();
  32. this.comboBox1.DisplayMember = "name";
  33. this.comboBox1.ValueMember = "id";
  34. this.comboBox2.DataSource = BuildGroupTable();
  35. this.comboBox2.DisplayMember = "name";
  36. this.comboBox2.ValueMember = "id";
  37. }
  38. private DataTable BuildClassTable()
  39. {
  40. DataTable dt = new DataTable();
  41. DataColumn dc = new DataColumn("id", typeof(System.String));
  42. dt.Columns.Add(dc);
  43. dc = new DataColumn("name", typeof(System.String));
  44. dt.Columns.Add(dc);
  45. DataRow dr = dt.NewRow();
  46. dr[0] = "0";
  47. dr[1] = "";
  48. dt.Rows.Add(dr);
  49. dr = dt.NewRow();
  50. dr[0] = "2";
  51. dr[1] = "早";
  52. dt.Rows.Add(dr);
  53. dr = dt.NewRow();
  54. dr[0] = "3";
  55. dr[1] = "中";
  56. dt.Rows.Add(dr);
  57. dr = dt.NewRow();
  58. dr[0] = "1";
  59. dr[1] = "晚";
  60. dt.Rows.Add(dr);
  61. dt.AcceptChanges();
  62. return dt;
  63. }
  64. private DataTable BuildGroupTable()
  65. {
  66. DataTable dt = new DataTable();
  67. DataColumn dc = new DataColumn("id", typeof(System.String));
  68. dt.Columns.Add(dc);
  69. dc = new DataColumn("name", typeof(System.String));
  70. dt.Columns.Add(dc);
  71. DataRow dr = dt.NewRow();
  72. dr[0] = "0";
  73. dr[1] = "";
  74. dt.Rows.Add(dr);
  75. dr = dt.NewRow();
  76. dr[0] = "1";
  77. dr[1] = "甲";
  78. dt.Rows.Add(dr);
  79. dr = dt.NewRow();
  80. dr[0] = "2";
  81. dr[1] = "乙";
  82. dt.Rows.Add(dr);
  83. dr = dt.NewRow();
  84. dr[0] = "3";
  85. dr[1] = "丙";
  86. dt.Rows.Add(dr);
  87. dr = dt.NewRow();
  88. dr[0] = "4";
  89. dr[1] = "丁";
  90. dt.Rows.Add(dr);
  91. dt.AcceptChanges();
  92. return dt;
  93. }
  94. #endregion
  95. private void SetComboBoxValue(string strDutyID)
  96. {
  97. if (strDutyID.Length == 2)
  98. {
  99. string str1 = strDutyID.Substring(0, 1);
  100. string str2 = strDutyID.Substring(1, 1);
  101. this.comboBox1.Value = str1;
  102. this.comboBox2.Value = str2;
  103. }
  104. }
  105. private void SetComoboVisible()
  106. {
  107. this.comboBox1.DisplayLayout.Bands[0].Columns["id"].Hidden = true;
  108. this.comboBox2.DisplayLayout.Bands[0].Columns["id"].Hidden = true;
  109. this.comboBox1.DisplayLayout.Bands[0].Columns["id"].Band.ColHeadersVisible = false;
  110. this.comboBox2.DisplayLayout.Bands[0].Columns["id"].Band.ColHeadersVisible = false;
  111. this.comboBox1.DisplayLayout.Bands[0].Columns["name"].Width = this.comboBox1.Width;
  112. this.comboBox2.DisplayLayout.Bands[0].Columns["name"].Width = this.comboBox2.Width;
  113. }
  114. private void button1_Click(object sender, System.EventArgs e)
  115. {
  116. if (this.comboBox1.Value == null || this.comboBox2.Value == null)
  117. {
  118. this.Close();
  119. return;
  120. }
  121. string str = this.comboBox1.Value.ToString() + this.comboBox2.Value.ToString();
  122. if (str == "")
  123. {
  124. this.Close();
  125. return;
  126. }
  127. if (str == _dutyID)
  128. {
  129. _changeFlag = false;
  130. }
  131. else
  132. {
  133. _changeFlag = true;
  134. }
  135. _dutyID = str;
  136. this.Close();
  137. }
  138. }
  139. }