F_MST_1401.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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_1401 : DockPanelBase
  18. {
  19. #region 成员变量
  20. private static F_MST_1401 _instance;
  21. #endregion
  22. #region 构造函数
  23. public F_MST_1401()
  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_1401 Instance
  37. {
  38. get
  39. {
  40. if (_instance == null)
  41. {
  42. _instance = new F_MST_1401();
  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.dgvCustomer.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.dgvCustomer.DataSource = this.DataSource.Tables[0];
  76. }
  77. else
  78. {
  79. // 清空明细中的数据
  80. this.dgvCustomer.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.dgvCustomer.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.dgvCustomer.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 tsbtnAdd_Click(object sender, EventArgs e)
  119. {
  120. try
  121. {
  122. F_MST_1402 frmMST1402 = new F_MST_1402(Constant.FormMode.Add,"");
  123. DialogResult dialogResult = frmMST1402.ShowDialog();
  124. // 重新加载GridView
  125. btnSearch_Click(sender, null);
  126. }
  127. catch (Exception ex)
  128. {
  129. // 对异常进行共通处理
  130. ExceptionManager.HandleEventException(this.ToString(),
  131. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  132. }
  133. }
  134. /// <summary>
  135. /// 编辑
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void tsbtnEdit_Click(object sender, EventArgs e)
  140. {
  141. try
  142. {
  143. if (this.dgvCustomer.SelectedRows.Count != 0)
  144. {
  145. string Customerid = this.dgvCustomer.SelectedRows[0].Cells["CUSTOMERID"].Value.ToString();
  146. F_MST_1402 frmFPC1302 = new F_MST_1402(Constant.FormMode.Edit, Customerid);
  147. DialogResult dialogresult = frmFPC1302.ShowDialog();
  148. btnSearch_Click(sender, null);
  149. }
  150. }
  151. catch (Exception ex)
  152. {
  153. // 对异常进行共通处理
  154. ExceptionManager.HandleEventException(this.ToString(),
  155. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  156. }
  157. }
  158. /// <summary>
  159. /// 清空
  160. /// </summary>
  161. /// <param name="sender"></param>
  162. /// <param name="e"></param>
  163. private void btnClearCondition_Click(object sender, EventArgs e)
  164. {
  165. this.txtCustomerCode.Clear();
  166. this.txtCustomerName.Clear();
  167. this.txtGoodsCode.Clear();
  168. this.txtGoodsName.Clear();
  169. this.cbflagtrue.Checked = true;
  170. this.cbflagfalse.Checked = true;
  171. }
  172. /// <summary>
  173. /// 窗体关闭事件
  174. /// </summary>
  175. /// <param name="sender"></param>
  176. /// <param name="e"></param>
  177. private void F_MST_1401_FormClosed(object sender, FormClosedEventArgs e)
  178. {
  179. _instance = null;
  180. }
  181. #endregion
  182. #region 私有方法
  183. /// <summary>
  184. /// 根据界面查询条件获取数据集
  185. /// </summary>
  186. private DataSet GetSearchData()
  187. {
  188. try
  189. {
  190. ClientRequestEntity cre = new ClientRequestEntity();
  191. cre.NameSpace = "F_MST_1401";
  192. cre.Name = "GetCustomer";
  193. cre.Properties["Customerid"] = "";
  194. cre.Properties["CustomerCode"] = this.txtCustomerCode.Text;
  195. cre.Properties["CustomerName"] = this.txtCustomerName.Text;
  196. cre.Properties["GOODSCODE"] = this.txtGoodsCode.Text;
  197. cre.Properties["GOODSNAME"] = this.txtGoodsName.Text;
  198. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  199. {
  200. cre.Properties["VALUEFLAG"] = "";
  201. }
  202. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  203. {
  204. cre.Properties["VALUEFLAG"] = 1;
  205. }
  206. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  207. {
  208. cre.Properties["VALUEFLAG"] = 0;
  209. }
  210. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  211. {
  212. cre.Properties["VALUEFLAG"] = 2;
  213. }
  214. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  215. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  216. {
  217. return sre.Data;
  218. }
  219. return null;
  220. }
  221. catch (Exception ex)
  222. {
  223. throw ex;
  224. }
  225. }
  226. #endregion
  227. }
  228. }