PopupGrandeRSpec.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.Qcm.model;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Drawing;
  8. namespace Core.StlMes.Client.Qcm
  9. {
  10. public partial class PopupGrandeRSpec : FrmBase
  11. {
  12. private string _msc = "";
  13. public string Msc
  14. {
  15. get { return _msc; }
  16. set { _msc = value; }
  17. }
  18. private string _mscPline = "";
  19. public string MscPline
  20. {
  21. get { return _mscPline; }
  22. set { _mscPline = value; }
  23. }
  24. private string _gradeCode = "";
  25. public string GradeCode
  26. {
  27. get { return _gradeCode; }
  28. set { _gradeCode = value; }
  29. }
  30. private DtGrandeRSpec _dtGradeRSpec = null;
  31. public PopupGrandeRSpec(string msc, string mscPline, string gradeCode, OpeBase ob)
  32. {
  33. InitializeComponent();
  34. ExceptionHelper.RegistException();
  35. _msc = msc;
  36. _mscPline = mscPline;
  37. _gradeCode = gradeCode;
  38. this.ob = ob;
  39. _dtGradeRSpec = new DtGrandeRSpec(this);
  40. EntityHelper.ShowGridCaption<ComMscGradeEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  41. EntityHelper.ShowGridCaption<ComMscGradeRSpecEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  42. _dtGradeRSpec.DoQuery("QueryGrade");
  43. }
  44. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  45. {
  46. switch (e.Tool.Key)
  47. {
  48. case "查询":
  49. _dtGradeRSpec.DoQuery("QueryGrade");
  50. break;
  51. case "保存":
  52. _dtGradeRSpec.DoAction(ActionType.Save);
  53. break;
  54. case "作废":
  55. _dtGradeRSpec.DoAction(ActionType.Delete);
  56. break;
  57. case "恢复":
  58. _dtGradeRSpec.DoAction(ActionType.Resume);
  59. break;
  60. case "关闭":
  61. this.Close();
  62. break;
  63. }
  64. }
  65. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  66. {
  67. _dtGradeRSpec.DoQuery("QueryGradeRSpec");
  68. }
  69. private void PopupGrandeRSpec_Shown(object sender, EventArgs e)
  70. {
  71. GridHelper.RefreshAndAutoSize(ultraGrid1);
  72. GridHelper.RefreshAndAutoSize(ultraGrid2);
  73. }
  74. private void ultraGrid2_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e)
  75. {
  76. }
  77. private void ultraGrid2_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
  78. {
  79. ComMscGradeRSpecEntity comMscGradeRSpecEntity = (ComMscGradeRSpecEntity)e.Row.ListObject;
  80. ComMscGradeEntity comMscGradeEntity = (ComMscGradeEntity)ultraGrid1.ActiveRow.ListObject;
  81. comMscGradeRSpecEntity.Msc = comMscGradeEntity.Msc;
  82. comMscGradeRSpecEntity.MscPline = comMscGradeEntity.MscPline;
  83. comMscGradeRSpecEntity.Gradecode = comMscGradeEntity.Gradecode;
  84. comMscGradeRSpecEntity.Gradename = comMscGradeEntity.Gradename;
  85. }
  86. private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  87. {
  88. ComMscGradeEntity comMscGradeEntity = (ComMscGradeEntity)e.Row.ListObject;
  89. if (comMscGradeEntity.Validflag.ToString() == "0")
  90. {
  91. e.Row.Appearance.ForeColor = Color.Red;
  92. }
  93. else
  94. {
  95. e.Row.Appearance.ForeColor = Color.Black;
  96. }
  97. }
  98. private void ultraGrid2_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  99. {
  100. ComMscGradeRSpecEntity comMscGradeRSpecEntity = (ComMscGradeRSpecEntity)e.Row.ListObject;
  101. if (comMscGradeRSpecEntity.Validflag.ToString() == "0")
  102. {
  103. e.Row.Appearance.ForeColor = Color.Red;
  104. }
  105. else
  106. {
  107. e.Row.Appearance.ForeColor = Color.Black;
  108. }
  109. ControlGrid2Edit(e);
  110. }
  111. private void ControlGrid2Edit(InitializeRowEventArgs e)
  112. {
  113. if (e.Row.GetValue("CHK") == "True")
  114. {
  115. e.Row.Cells["HeightMin"].Activation = Activation.AllowEdit;
  116. e.Row.Cells["HeightMiax"].Activation = Activation.AllowEdit;
  117. e.Row.Cells["DimaterMin"].Activation = Activation.AllowEdit;
  118. e.Row.Cells["DimaterMax"].Activation = Activation.AllowEdit;
  119. e.Row.Cells["Memo"].Activation = Activation.AllowEdit;
  120. }
  121. else
  122. {
  123. e.Row.Cells["HeightMin"].Activation = Activation.ActivateOnly;
  124. e.Row.Cells["HeightMiax"].Activation = Activation.ActivateOnly;
  125. e.Row.Cells["DimaterMin"].Activation = Activation.ActivateOnly;
  126. e.Row.Cells["DimaterMax"].Activation = Activation.ActivateOnly;
  127. e.Row.Cells["Memo"].Activation = Activation.ActivateOnly;
  128. }
  129. }
  130. }
  131. }