ucHmpOutInfo.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 ucHmpOutInfo : UserControl
  12. {
  13. public ucHmpOutInfo()
  14. {
  15. InitializeComponent();
  16. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  17. }
  18. private void ucHmpOutInfo_Load(object sender, EventArgs e)
  19. {
  20. ultraDataSource1.Rows.Add(new object[] { null, "", "", "", "" });
  21. }
  22. public void ResetData()
  23. {
  24. try
  25. {
  26. for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++)
  27. {
  28. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  29. this.ultraDataSource1.Rows[0][i] = null;
  30. else
  31. this.ultraDataSource1.Rows[0][i] = "";
  32. }
  33. }
  34. catch { }
  35. }
  36. public void SetData(Hashtable ar)
  37. {
  38. if (ar == null || ar.Count == 0)
  39. return;
  40. int count = this.ultraDataSource1.Band.Columns.Count;
  41. string strKey = "";
  42. for (int i = 0; i < count; i++)
  43. {
  44. try
  45. {
  46. strKey = this.ultraDataSource1.Band.Columns[i].Key;
  47. if (ar.Contains(strKey) && !string.IsNullOrEmpty(ar[strKey].ToString()))
  48. if(strKey == "MOLIRNLEAVE")
  49. {
  50. if (!string.IsNullOrEmpty(ar[strKey].ToString()))
  51. {
  52. string molirnleave = "";
  53. switch (ar[strKey].ToString())
  54. {
  55. case "BOF01":
  56. molirnleave = "1#转炉";
  57. break;
  58. case "BOF02":
  59. molirnleave = "2#转炉";
  60. break;
  61. case "BOF03":
  62. molirnleave = "3#转炉";
  63. break;
  64. default :
  65. break;
  66. }
  67. this.ultraDataSource1.Rows[0][i] = molirnleave;
  68. }
  69. }
  70. else
  71. this.ultraDataSource1.Rows[0][i] = ar[strKey];
  72. else
  73. {
  74. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  75. this.ultraDataSource1.Rows[0][i] = null;
  76. else
  77. this.ultraDataSource1.Rows[0][i] = "";
  78. }
  79. }
  80. catch { }
  81. }
  82. }
  83. }
  84. }