QCM030609.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Infragistics.Win.UltraWinGrid;
  11. using System.Text.RegularExpressions;
  12. using System.Collections;
  13. using Infragistics.Win;
  14. using Infragistics.Win.UltraWinEditors;
  15. namespace Core.LZMes.Client.QCM
  16. {
  17. public partial class QCM030609 : FrmBase
  18. {
  19. public string flag = "";
  20. private DataTable table1;
  21. private DataTable table2;
  22. public QCM030609()
  23. {
  24. InitializeComponent();
  25. }
  26. public QCM030609(DataTable table1, DataTable table2)
  27. {
  28. this.table1 = table1;
  29. this.table2 = table2;
  30. InitializeComponent();
  31. }
  32. private void btnOK_Click(object sender, EventArgs e)
  33. {
  34. flag = this.comboBox1.Text.ToString();
  35. this.DialogResult = DialogResult.OK;
  36. this.Close();
  37. }
  38. public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
  39. {
  40. if (cbEdt == null || vlist == null)
  41. return false;
  42. cbEdt.Items.Clear();
  43. if (bNull)
  44. cbEdt.Items.Add(null, "");
  45. for (int i = 0; i < vlist.ValueListItems.Count; i++)
  46. {
  47. try
  48. {
  49. cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
  50. }
  51. catch { }
  52. }
  53. return true;
  54. }
  55. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  56. {
  57. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  58. return null;
  59. ArrayList alist = new ArrayList();
  60. ValueList vlist = new ValueList();
  61. for (int i = 0; i < table.Rows.Count; i++)
  62. {
  63. try
  64. {
  65. if (!alist.Contains(table.Rows[i][strKey]))
  66. {
  67. alist.Add(table.Rows[i][strKey]);
  68. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  69. }
  70. }
  71. catch { }
  72. }
  73. return vlist;
  74. }
  75. private void QCM030609_Load(object sender, EventArgs e)
  76. {
  77. /*ValueList valueList1 = GeneralValuelist(ref table1, "SM_CD", "SM_CFNM");
  78. ValueList valueList2 = GeneralValuelist(ref table2, "SM_CD", "SM_CFNM");
  79. ClsControlPack.SetUltraComboEditor(ref ultraComboEditor1, ref valueList1, false);
  80. ClsControlPack.SetUltraComboEditor(ref ultraComboEditor2, ref valueList2, false);*/
  81. }
  82. private void btnCancel_Click(object sender, EventArgs e)
  83. {
  84. //flag = this.comboBox1.Text.ToString();
  85. this.DialogResult = DialogResult.Cancel;
  86. this.Close();
  87. }
  88. }
  89. }