QCM030608.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 QCM030608 : FrmBase
  18. {
  19. public string prod_type = "";
  20. public string tslx = "";
  21. public string prod_line = "";
  22. private DataTable table1;
  23. private DataTable table2;
  24. public QCM030608()
  25. {
  26. InitializeComponent();
  27. }
  28. public QCM030608(DataTable table1, DataTable table2)
  29. {
  30. this.table1 = table1;
  31. this.table2 = table2;
  32. InitializeComponent();
  33. }
  34. private void btnOK_Click(object sender, EventArgs e)
  35. {
  36. prod_type = this.comboBox1.Text.ToString();
  37. tslx = this.comboBox2.Text.ToString();
  38. prod_line = this.comboBox3.Text.ToString();
  39. this.DialogResult = DialogResult.OK;
  40. this.Close();
  41. }
  42. public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
  43. {
  44. if (cbEdt == null || vlist == null)
  45. return false;
  46. cbEdt.Items.Clear();
  47. if (bNull)
  48. cbEdt.Items.Add(null, "");
  49. for (int i = 0; i < vlist.ValueListItems.Count; i++)
  50. {
  51. try
  52. {
  53. cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
  54. }
  55. catch { }
  56. }
  57. return true;
  58. }
  59. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  60. {
  61. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  62. return null;
  63. ArrayList alist = new ArrayList();
  64. ValueList vlist = new ValueList();
  65. for (int i = 0; i < table.Rows.Count; i++)
  66. {
  67. try
  68. {
  69. if (!alist.Contains(table.Rows[i][strKey]))
  70. {
  71. alist.Add(table.Rows[i][strKey]);
  72. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  73. }
  74. }
  75. catch { }
  76. }
  77. return vlist;
  78. }
  79. private void QCM030608_Load(object sender, EventArgs e)
  80. {
  81. /*ValueList valueList1 = GeneralValuelist(ref table1, "SM_CD", "SM_CFNM");
  82. ValueList valueList2 = GeneralValuelist(ref table2, "SM_CD", "SM_CFNM");
  83. ClsControlPack.SetUltraComboEditor(ref ultraComboEditor1, ref valueList1, false);
  84. ClsControlPack.SetUltraComboEditor(ref ultraComboEditor2, ref valueList2, false);*/
  85. }
  86. private void btnCancel_Click(object sender, EventArgs e)
  87. {
  88. this.DialogResult = DialogResult.Cancel;
  89. this.Close();
  90. }
  91. }
  92. }