F_MST_1501.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. using Dongke.IBOSS.PRD.Basics.BaseResources;
  2. using Dongke.IBOSS.PRD.Basics.DockPanel;
  3. using Dongke.IBOSS.PRD.Client.CommonModule;
  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.Text;
  14. using System.Windows.Forms;
  15. namespace Dongke.IBOSS.PRD.Client.SystemModule
  16. {
  17. public partial class F_MST_1501 : DockPanelBase
  18. {
  19. #region 成员变量
  20. private static F_MST_1501 _instance;
  21. #endregion
  22. #region 构造函数
  23. public F_MST_1501()
  24. {
  25. InitializeComponent();
  26. this.Text = "版面信息";
  27. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  28. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  29. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  30. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  31. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  32. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  33. }
  34. #endregion
  35. #region 单列模式
  36. public static F_MST_1501 Instance
  37. {
  38. get
  39. {
  40. if (_instance == null)
  41. {
  42. _instance = new F_MST_1501();
  43. }
  44. return _instance;
  45. }
  46. }
  47. #endregion
  48. #region 事件
  49. /// <summary>
  50. /// 页面加载事件
  51. /// </summary>
  52. /// <param name="sender"></param>
  53. /// <param name="e"></param>
  54. private void F_MST_1401_Load(object sender, EventArgs e)
  55. {
  56. // 按钮权限控制
  57. FormPermissionManager.FormPermissionControl(this.Name, this,
  58. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  59. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  60. //设置表格不自动创建列
  61. this.dgvLayout.AutoGenerateColumns = false;
  62. }
  63. /// <summary>
  64. /// 查询事件
  65. /// </summary>
  66. /// <param name="sender"></param>
  67. /// <param name="e"></param>
  68. private void btnSearch_Click(object sender, EventArgs e)
  69. {
  70. this.DataSource = this.GetSearchData();
  71. if (this.DataSource != null)
  72. {
  73. if (this.DataSource.Tables[0] != null && this.DataSource.Tables[0].Rows.Count > 0)
  74. {
  75. this.dgvLayout.DataSource = this.DataSource.Tables[0];
  76. }
  77. else
  78. {
  79. // 清空明细中的数据
  80. this.dgvLayout.DataSource = null;
  81. // 提示未查找到数据
  82. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  83. MessageBoxButtons.OK, MessageBoxIcon.Information);
  84. }
  85. }
  86. else
  87. {
  88. // 清空明细中的数据
  89. this.dgvLayout.DataSource = null;
  90. // 提示未查找到数据
  91. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  92. MessageBoxButtons.OK, MessageBoxIcon.Information);
  93. }
  94. }
  95. /// <summary>
  96. /// 自适应列宽
  97. /// </summary>
  98. /// <param name="sender"></param>
  99. /// <param name="e"></param>
  100. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  101. {
  102. this.dgvLayout.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  103. }
  104. /// <summary>
  105. /// 退出
  106. /// </summary>
  107. /// <param name="sender"></param>
  108. /// <param name="e"></param>
  109. private void tsbtnClose_Click(object sender, EventArgs e)
  110. {
  111. this.Close();
  112. }
  113. /// <summary>
  114. /// 编辑
  115. /// </summary>
  116. /// <param name="sender"></param>
  117. /// <param name="e"></param>
  118. private void tsbtnEdit_Click(object sender, EventArgs e)
  119. {
  120. try
  121. {
  122. if (this.dgvLayout.SelectedRows.Count != 0)
  123. {
  124. string LayoutCode = this.dgvLayout.SelectedRows[0].Cells["LAYOUTCODE"].Value.ToString();
  125. string CustomerCode = this.dgvLayout.SelectedRows[0].Cells["CustomerCode"].Value.ToString();
  126. string GOODSCODE = this.dgvLayout.SelectedRows[0].Cells["GOODSCODE"].Value.ToString();
  127. F_MST_1502 frmFPC1302 = new F_MST_1502(Constant.FormMode.Edit, LayoutCode, CustomerCode, GOODSCODE);
  128. DialogResult dialogresult = frmFPC1302.ShowDialog();
  129. btnSearch_Click(sender, null);
  130. }
  131. }
  132. catch (Exception ex)
  133. {
  134. // 对异常进行共通处理
  135. ExceptionManager.HandleEventException(this.ToString(),
  136. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  137. }
  138. }
  139. /// <summary>
  140. /// 新建
  141. /// </summary>
  142. /// <param name="sender"></param>
  143. /// <param name="e"></param>
  144. private void tsbtnAdd_Click(object sender, EventArgs e)
  145. {
  146. try
  147. {
  148. F_MST_1502 frmMST1502 = new F_MST_1502(Constant.FormMode.Add, "","","");
  149. DialogResult dialogResult = frmMST1502.ShowDialog();
  150. // 重新加载GridView
  151. btnSearch_Click(sender, null);
  152. }
  153. catch (Exception ex)
  154. {
  155. // 对异常进行共通处理
  156. ExceptionManager.HandleEventException(this.ToString(),
  157. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  158. }
  159. }
  160. /// <summary>
  161. /// 清空按钮
  162. /// </summary>
  163. /// <param name="sender"></param>
  164. /// <param name="e"></param>
  165. private void btnClearCondition_Click(object sender, EventArgs e)
  166. {
  167. this.txtCustomerCode.Clear();
  168. this.txtLayoutCode.Clear();
  169. this.txtLayoutName.Clear();
  170. this.txtGoodsCode.Clear();
  171. this.cbflagtrue.Checked = true;
  172. this.cbflagfalse.Checked = true;
  173. }
  174. /// <summary>
  175. /// 窗体关闭事件
  176. /// </summary>
  177. /// <param name="sender"></param>
  178. /// <param name="e"></param>
  179. private void F_MST_1501_FormClosed(object sender, FormClosedEventArgs e)
  180. {
  181. _instance = null;
  182. }
  183. #endregion
  184. #region 私有方法
  185. /// <summary>
  186. /// 根据界面查询条件获取数据集
  187. /// </summary>
  188. private DataSet GetSearchData()
  189. {
  190. try
  191. {
  192. ClientRequestEntity cre = new ClientRequestEntity();
  193. cre.NameSpace = "F_MST_1501";
  194. cre.Name = "GetLayout";
  195. cre.Properties["CustomerCode"] = txtCustomerCode.Text;
  196. cre.Properties["LayoutCode"] = txtLayoutCode.Text;
  197. cre.Properties["LayoutName"] = txtLayoutName.Text;
  198. cre.Properties["GOODSCODE"] = txtGoodsCode.Text;
  199. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  200. {
  201. cre.Properties["ValueFlag"] = "";
  202. }
  203. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  204. {
  205. cre.Properties["ValueFlag"] = 1;
  206. }
  207. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  208. {
  209. cre.Properties["ValueFlag"] = 0;
  210. }
  211. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  212. {
  213. cre.Properties["ValueFlag"] = 2;
  214. }
  215. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  216. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  217. {
  218. return sre.Data;
  219. }
  220. return null;
  221. }
  222. catch (Exception ex)
  223. {
  224. throw ex;
  225. }
  226. }
  227. #endregion
  228. }
  229. }