ucBofPlan.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. using Core.LgMes.Client.Comm;
  10. namespace Core.LgMes.Client.LgJobMgt
  11. {
  12. public partial class ucBofPlan : UserControl
  13. {
  14. public ucBofPlan()
  15. {
  16. InitializeComponent();
  17. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  18. }
  19. private void ucBofPlan_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
  32. this.ultraDataSource1.Rows[0][i] = "";
  33. }
  34. }
  35. catch { }
  36. }
  37. public void SetData(Hashtable ar)
  38. {
  39. if (ar == null || ar.Count == 0)
  40. return;
  41. int count = this.ultraDataSource1.Band.Columns.Count;
  42. string strKey = "";
  43. for (int i = 0; i < count; i++)
  44. {
  45. try
  46. {
  47. strKey = this.ultraDataSource1.Band.Columns[i].Key;
  48. if (ar.Contains(strKey))
  49. {
  50. if (strKey == "SHIFTCODE") // 班次转换
  51. ultraDataSource1.Rows[0][i] = CStaticMethod.ClassConvert(ar[strKey].ToString());
  52. else if (strKey == "FACT_ROUTE")
  53. ultraDataSource1.Rows[0][i] = CStaticMethod.analysPath(ar[strKey].ToString());
  54. else if (strKey == "PLAN_LINES")
  55. ultraDataSource1.Rows[0][i] = CStaticMethod.analysPlan_Lines(ar[strKey].ToString());
  56. else
  57. ultraDataSource1.Rows[0][i] = ar[strKey];
  58. }
  59. else
  60. {
  61. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  62. this.ultraDataSource1.Rows[0][i] = null;
  63. else
  64. this.ultraDataSource1.Rows[0][i] = "";
  65. }
  66. }
  67. catch { }
  68. }
  69. }
  70. }
  71. }