F_PC_0802.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. using Dongke.IBOSS.PRD.Basics.BaseResources;
  2. using Dongke.IBOSS.PRD.Client.CommonModule;
  3. using Dongke.IBOSS.PRD.Client.Controls;
  4. using Dongke.IBOSS.PRD.Client.DataModels;
  5. using Dongke.IBOSS.PRD.WCF.DataModels;
  6. using Dongke.IBOSS.PRD.WCF.Proxys;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Reflection;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Dongke.IBOSS.PRD.Client.PCModule
  17. {
  18. public partial class F_PC_0802 : DKDockPanelBase
  19. {
  20. #region 成员变量
  21. // 单例模式
  22. private static F_PC_0802 _instance;
  23. // 正在查询
  24. private bool _isSearching = false;
  25. // 选中的名称
  26. private string _dictionaryvalue;
  27. #endregion
  28. #region 构造函数
  29. public F_PC_0802()
  30. {
  31. InitializeComponent();
  32. }
  33. public F_PC_0802( string dictionaryvalue)
  34. {
  35. InitializeComponent();
  36. this.Text = "编辑线边仓组件配置";
  37. this.btnSave.Text = ButtonText.BTN_SAVE;
  38. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  39. this._dictionaryvalue = dictionaryvalue;
  40. }
  41. #endregion
  42. #region 单例模式
  43. /// <summary>
  44. /// 单例模式,防止重复创建窗体
  45. /// </summary>
  46. public static F_PC_0802 Instance
  47. {
  48. get
  49. {
  50. if (_instance == null)
  51. {
  52. _instance = new F_PC_0802();
  53. }
  54. return _instance;
  55. }
  56. }
  57. #endregion
  58. #region 事件
  59. /// <summary>
  60. /// 页面加载
  61. /// </summary>
  62. /// <param name="sender"></param>
  63. /// <param name="e"></param>
  64. private void F_PC_0802_Load(object sender, EventArgs e)
  65. {
  66. // 按钮权限控制
  67. FormPermissionManager.FormPermissionControl(this.Name, this,
  68. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  69. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  70. if(!string.IsNullOrEmpty(_dictionaryvalue))
  71. {
  72. // 调用服务器端获取数据集
  73. ClientRequestEntity cre = new ClientRequestEntity();
  74. cre.NameSpace = "F_PC_0801";
  75. cre.Name = "GetIDNRKTYPE";
  76. cre.Properties["LGORT"] = _dictionaryvalue;
  77. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  78. {
  79. return PCModuleProxyNew.Service.HandleRequest(cre);
  80. });
  81. if (sre.Status == Constant.ServiceResultStatus.Success)
  82. {
  83. if(sre.Data.Tables[0]!=null && sre.Data.Tables[0].Rows.Count>0)
  84. {
  85. string filter = " check1 = 1";
  86. sre.Data.Tables[0].DefaultView.RowFilter= filter;
  87. DataTable CheckedDt = sre.Data.Tables[0].DefaultView.ToTable();
  88. this.dgvChecked.DataSource = CheckedDt;
  89. }
  90. }
  91. }
  92. }
  93. /// <summary>
  94. /// 查询
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. private void tsbtnSearch_Click(object sender, EventArgs e)
  99. {
  100. if (!string.IsNullOrEmpty(_dictionaryvalue))
  101. {
  102. // 调用服务器端获取数据集
  103. ClientRequestEntity cre = new ClientRequestEntity();
  104. cre.NameSpace = "F_PC_0801";
  105. cre.Name = "GetIDNRKTYPE";
  106. cre.Properties["LGORT"] = _dictionaryvalue;
  107. cre.Properties["ModuleName"] = this.txtDICTIONARYTYPE.Text.Trim();
  108. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  109. {
  110. return PCModuleProxyNew.Service.HandleRequest(cre);
  111. });
  112. if (sre.Status == Constant.ServiceResultStatus.Success)
  113. {
  114. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  115. {
  116. string filter = " check1 = 0";
  117. sre.Data.Tables[0].DefaultView.RowFilter = filter;
  118. DataTable CheckedDt = sre.Data.Tables[0].DefaultView.ToTable();
  119. this.dgvCheck.DataSource = CheckedDt;
  120. }
  121. }
  122. }
  123. }
  124. /// <summary>
  125. /// 保存
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void btnSave_Click(object sender, EventArgs e)
  130. {
  131. try
  132. {
  133. DataTable checkDt = (DataTable)this.dgvCheck.DataSource;
  134. DataTable checkedDt = (DataTable)this.dgvChecked.DataSource;
  135. DataTable paramDt = new DataTable();
  136. paramDt.Columns.Add("IDNRKTYPE", typeof(string));
  137. if (checkDt != null && checkDt.Rows.Count > 0)
  138. {
  139. foreach (DataRow item in checkDt.Rows)
  140. {
  141. if ("1".Equals(item["check1"].ToString()))
  142. {
  143. DataRow dr = paramDt.NewRow();
  144. dr["IDNRKTYPE"] = item["ModuleName"].ToString();
  145. paramDt.Rows.Add(dr);
  146. }
  147. }
  148. }
  149. if (checkedDt != null && checkedDt.Rows.Count > 0)
  150. {
  151. foreach (DataRow item in checkedDt.Rows)
  152. {
  153. if ("1".Equals(item["check1"].ToString()))
  154. {
  155. DataRow dr = paramDt.NewRow();
  156. dr["IDNRKTYPE"] = item["ModuleName"].ToString();
  157. paramDt.Rows.Add(dr);
  158. }
  159. }
  160. }
  161. // 调用服务器端获取数据集
  162. ClientRequestEntity cre = new ClientRequestEntity();
  163. cre.NameSpace = "F_PC_0802";
  164. cre.Name = "SaveLgortIdnrktype";
  165. cre.Properties["LGORT"] = this._dictionaryvalue;
  166. paramDt.TableName = "SaveTable";
  167. DataSet ds = new DataSet();
  168. ds.Tables.Add(paramDt.Copy());
  169. cre.Data = ds;
  170. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  171. {
  172. return PCModuleProxyNew.Service.HandleRequest(cre);
  173. });
  174. if (sre.Status == Constant.ServiceResultStatus.Success)
  175. {
  176. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "线边仓组件配置", "保存"),
  177. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  178. this.DialogResult = DialogResult.OK;
  179. }
  180. }
  181. catch (Exception ex)
  182. {
  183. // 对异常进行共通处理
  184. ExceptionManager.HandleEventException(this.ToString(),
  185. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  186. }
  187. }
  188. /// <summary>
  189. /// 清空条件
  190. /// </summary>
  191. /// <param name="sender"></param>
  192. /// <param name="e"></param>
  193. private void btnClearCondition_Click(object sender, EventArgs e)
  194. {
  195. this.txtDICTIONARYTYPE.Clear();
  196. }
  197. /// <summary>
  198. /// 自适应列宽
  199. /// </summary>
  200. /// <param name="sender"></param>
  201. /// <param name="e"></param>
  202. private void toolStripButton3_Click(object sender, EventArgs e)
  203. {
  204. this.dgvCheck.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  205. this.dgvChecked.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  206. }
  207. /// <summary>
  208. /// 关闭
  209. /// </summary>
  210. /// <param name="sender"></param>
  211. /// <param name="e"></param>
  212. private void btnCancel_Click(object sender, EventArgs e)
  213. {
  214. this.Close();
  215. }
  216. /// <summary>
  217. /// 释放窗体
  218. /// </summary>
  219. /// <param name="sender"></param>
  220. /// <param name="e"></param>
  221. private void F_PC_0802_FormClosed(object sender, FormClosedEventArgs e)
  222. {
  223. _instance = null;
  224. }
  225. #endregion
  226. }
  227. }