LayoutDetailBase.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. 
  2. using DllEapEntity;
  3. using DllHsms;
  4. using DllPubInfo;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. namespace DllXqManager
  15. {
  16. public partial class LayoutDetailBase : Form
  17. {
  18. //private int CurrID = 0;
  19. //private DataSet CurrDs = null;
  20. public delegate void closeForm();
  21. public delegate void ModifyEntity(LayoutDetail entity);
  22. public event closeForm eventcloseForm = null;
  23. public event ModifyEntity eventModifyEntity = null;
  24. private LayoutDetail CurrEntity = null;
  25. public LayoutDetailBase(LayoutDetail control)
  26. {
  27. InitializeComponent();
  28. SetCurrID(control);
  29. }
  30. public void SetCurrID(LayoutDetail control)
  31. {
  32. InitForm(control);
  33. }
  34. private void InitForm(LayoutDetail control)
  35. {
  36. CurrEntity = control;
  37. //用实体的值去赋值界面控件显示的值
  38. string errorinfo = "";
  39. int result = DllPubInfo.PubInfo.InitFormControl<LayoutDetail>(panel1, CurrEntity, null, ref errorinfo);
  40. if (result < 0)
  41. MessageBox.Show(errorinfo);
  42. if(CurrEntity.EntityTypeID==EntityType.Machine)
  43. {
  44. editTEntityFCode.ReadOnly = true;
  45. editTEntityFName.ReadOnly = true;
  46. editIPAddress.ReadOnly = true;
  47. }
  48. else
  49. {
  50. editTEntityFCode.ReadOnly = false;
  51. editTEntityFName.ReadOnly = false;
  52. editIPAddress.ReadOnly = false;
  53. }
  54. //if (CurrControl == null)
  55. //{
  56. // edit实体代码.Text = "";
  57. // edit实体名称.Text = "";
  58. // edit备注.Text = "";
  59. // editIP地址.Text = "0";
  60. // editX坐标.Text = "0";
  61. // editY坐标.Text = "0";
  62. // edit宽度.Text = "0";
  63. // edit高度.Text = "0";
  64. //}
  65. //else
  66. //{
  67. // DataRow row = CurrControl.CurrRow;
  68. // edit实体代码.Text = row["实体代码"].ToString();
  69. // edit实体名称.Text = row["实体名称"].ToString();
  70. // edit备注.Text = row["备注"].ToString();
  71. // editIP地址.Text = row["IP地址"].ToString();
  72. // editX坐标.Text = CurrControl.Location.X.ToString();
  73. // editY坐标.Text = CurrControl.Location.Y.ToString();
  74. // edit宽度.Text = CurrControl.Size.Width.ToString();
  75. // edit高度.Text = CurrControl.Size.Height.ToString();
  76. //}
  77. }
  78. private void button1_Click(object sender, EventArgs e)
  79. {
  80. InitForm(null);
  81. }
  82. //private int CallIUBase()
  83. //{
  84. // try
  85. // {
  86. // #region//构造数据集结构
  87. // DataRow newrow = CurrDs.Tables[0].Rows[0];
  88. // newrow["代码"] = edit实体代码.Text.Trim();
  89. // newrow["名称"] = edit实体名称.Text.Trim();
  90. // newrow["备注"] = edit备注.Text.Trim();
  91. // newrow["Offset"] =editIP地址.Text;
  92. // newrow["分辨率X"] = editX坐标.Text;
  93. // newrow["分辨率Y"] =editY坐标.Text;
  94. // newrow["参数1"] =edit宽度.Text;
  95. // newrow["参数2"] =edit高度.Text;
  96. // #endregion
  97. // string errorinfo = "";
  98. // int result = DllDataAcc.XqConsoleAcc.IUTLcd(CurrDs, ref errorinfo);
  99. // if(result<0)
  100. // {
  101. // MessageBox.Show("操作发生错误,错误信息为:" + errorinfo, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  102. // }
  103. // return result;
  104. // }
  105. // catch (Exception e)
  106. // {
  107. // MessageBox.Show("操作发生错误,错误信息为:" + e.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  108. // return -11;
  109. // }
  110. //}
  111. private void button2_Click(object sender, EventArgs e)
  112. {
  113. //DataRow row = CurrControl.CurrRow;
  114. //row["备注"] = edit备注.Text;
  115. //row["实体名称"] = edit实体名称.Text;
  116. //CurrControl.Location = new Point(int.Parse(editX坐标.Text), int.Parse(editY坐标.Text));
  117. //CurrControl.Size = new Size(int.Parse(edit宽度.Text), int.Parse(edit高度.Text));
  118. ////if((CurrControl.Tag as MoveControl).fc!=null)
  119. ////{
  120. //// (CurrControl.Tag as MoveControl).fc.Visible = false;
  121. //// MoveControl.DrawDragBound(CurrControl);
  122. //// (CurrControl.Tag as MoveControl).fc.Draw();
  123. //// (CurrControl.Tag as MoveControl).fc.Visible = true;
  124. ////}
  125. //////CurrControl.Refresh();
  126. //CurrControl.Parent.Refresh();//刷新父容器,清除掉其他控件的边框
  127. //CurrControl.BringToFront();
  128. //FrameControl fc = new FrameControl(CurrControl);
  129. //CurrControl.Parent.Controls.Add(fc);
  130. //fc.Visible = true;
  131. //fc.Draw();
  132. string errorinfo = "";
  133. int result = PubInfo.UpdateRowFormControl(panel1, CurrEntity, ref errorinfo);
  134. if (result < 0)
  135. {
  136. MessageBox.Show("更新数据发生错误:" + errorinfo);
  137. return;
  138. }
  139. eventModifyEntity?.Invoke(CurrEntity);
  140. }
  141. private void mmabase_FormClosing(object sender, FormClosingEventArgs e)
  142. {
  143. eventcloseForm?.Invoke();
  144. }
  145. public void Selmma(DataRow row)
  146. {
  147. //if(row==null)
  148. //{
  149. // edit机型代码.Text = "";
  150. // return;
  151. //}
  152. //edit机型代码.Text = row["代码"].ToString();
  153. }
  154. private void btEmail_Click(object sender, EventArgs e)
  155. {
  156. //mmaquery temp = new mmaquery();
  157. //temp.eventselrow += Selmma;
  158. //temp.ShowDialog();
  159. }
  160. private void button3_Click(object sender, EventArgs e)
  161. {
  162. //if (CurrDs == null)
  163. //{
  164. // InitForm(0);
  165. // return;
  166. //}
  167. //CurrID = 0;
  168. //CurrDs.Tables[0].Rows[0]["id"] = 0;
  169. //edit代码.Text = "";
  170. }
  171. }
  172. }