ucHmpDevInfo.cs.svn-base 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Collections;
  9. namespace Core.LgMes.Client.LgJobMgt
  10. {
  11. public partial class ucHmpDevInfo : UserControl
  12. {
  13. public Image m_imageDefault = null;
  14. public ucHmpDevInfo()
  15. {
  16. InitializeComponent();
  17. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  18. }
  19. private void ucHmpDevInfo_Load(object sender, EventArgs e)
  20. {
  21. ultraDataSource1.Rows.Add(new object[] { "", "", "", "", "", "", "", "", "" });
  22. }
  23. public void ResetData()
  24. {
  25. try
  26. {
  27. for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++)
  28. {
  29. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  30. this.ultraDataSource1.Rows[0][i] = null;
  31. else if(this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.Drawing.Bitmap))
  32. ultraDataSource1.Rows[0]["TP"] = m_imageDefault;
  33. else
  34. this.ultraDataSource1.Rows[0][i] = "";
  35. }
  36. }
  37. catch { }
  38. }
  39. public void SetData(Hashtable ar)
  40. {
  41. if (ar == null || ar.Count == 0)
  42. return;
  43. int count = this.ultraDataSource1.Band.Columns.Count;
  44. string strKey = "";
  45. for (int i = 0; i < count; i++)
  46. {
  47. try
  48. {
  49. strKey = this.ultraDataSource1.Band.Columns[i].Key;
  50. if (ar.Contains(strKey) && !string.IsNullOrEmpty(ar[strKey].ToString()))
  51. this.ultraDataSource1.Rows[0][i] = ar[strKey];
  52. else
  53. {
  54. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  55. this.ultraDataSource1.Rows[0][i] = null;
  56. else
  57. this.ultraDataSource1.Rows[0][i] = "";
  58. }
  59. }
  60. catch { }
  61. }
  62. }
  63. }
  64. }