F_MST_1701.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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_1701 : DockPanelBase
  18. {
  19. #region 成员变量
  20. private static F_MST_1701 _instance;
  21. #endregion
  22. #region 构造函数
  23. public F_MST_1701()
  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_1701 Instance
  37. {
  38. get
  39. {
  40. if (_instance == null)
  41. {
  42. _instance = new F_MST_1701();
  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_1701_Load(object sender, EventArgs e)
  55. {
  56. // 按钮权限控制
  57. FormPermissionManager.FormPermissionControl(this.Name, this,
  58. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  59. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  60. ClientRequestEntity cres = new ClientRequestEntity();
  61. cres.NameSpace = "F_MST_1701";
  62. cres.Name = "GetLogo";
  63. cres.Properties["LOGOCODE"] = "";
  64. ServiceResultEntity sres = SystemModuleProxy.Service.DoRequest(cres);
  65. DataSet set = sres.Data;
  66. DataTable dt = set.Tables[0];
  67. DataRow dr = dt.NewRow();
  68. dr["LOGOCODE"] = "";
  69. dr["LOGONAME"] = "";
  70. dt.Rows.Add(dr);
  71. this.cmbLogo.DataSource = dt;
  72. this.cmbLogo.ValueMember = "LOGOCODE";
  73. this.cmbLogo.DisplayMember = "LOGONAME";
  74. this.cmbLogo.SelectedValue = "";
  75. //设置表格不自动创建列
  76. this.dgvLayout.AutoGenerateColumns = false;
  77. }
  78. /// <summary>
  79. /// 查询事件
  80. /// </summary>
  81. /// <param name="sender"></param>
  82. /// <param name="e"></param>
  83. private void btnSearch_Click(object sender, EventArgs e)
  84. {
  85. this.DataSource = this.GetSearchData();
  86. if (this.DataSource != null)
  87. {
  88. if (this.DataSource.Tables[0] != null && this.DataSource.Tables[0].Rows.Count > 0)
  89. {
  90. this.dgvLayout.DataSource = this.DataSource.Tables[0];
  91. }
  92. else
  93. {
  94. // 清空明细中的数据
  95. this.dgvLayout.DataSource = null;
  96. // 提示未查找到数据
  97. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  98. MessageBoxButtons.OK, MessageBoxIcon.Information);
  99. }
  100. }
  101. else
  102. {
  103. // 清空明细中的数据
  104. this.dgvLayout.DataSource = null;
  105. // 提示未查找到数据
  106. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  107. MessageBoxButtons.OK, MessageBoxIcon.Information);
  108. }
  109. }
  110. /// <summary>
  111. /// 自适应列宽
  112. /// </summary>
  113. /// <param name="sender"></param>
  114. /// <param name="e"></param>
  115. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  116. {
  117. this.dgvLayout.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  118. }
  119. /// <summary>
  120. /// 退出
  121. /// </summary>
  122. /// <param name="sender"></param>
  123. /// <param name="e"></param>
  124. private void tsbtnClose_Click(object sender, EventArgs e)
  125. {
  126. this.Close();
  127. }
  128. /// <summary>
  129. /// 编辑
  130. /// </summary>
  131. /// <param name="sender"></param>
  132. /// <param name="e"></param>
  133. private void tsbtnEdit_Click(object sender, EventArgs e)
  134. {
  135. try
  136. {
  137. if (this.dgvLayout.SelectedRows.Count != 0)
  138. {
  139. string LOGOCODE = this.dgvLayout.SelectedRows[0].Cells["LOGOCODE"].Value.ToString();
  140. string goodscode= this.dgvLayout.SelectedRows[0].Cells["GOODSCODE"].Value.ToString();
  141. string ValueFlag = this.dgvLayout.SelectedRows[0].Cells["ValueFlag"].Value.ToString();
  142. F_MST_1702 frmFPC1702 = new F_MST_1702(Constant.FormMode.Edit, goodscode, LOGOCODE, ValueFlag);
  143. DialogResult dialogresult = frmFPC1702.ShowDialog();
  144. btnSearch_Click(sender, null);
  145. }
  146. }
  147. catch (Exception ex)
  148. {
  149. // 对异常进行共通处理
  150. ExceptionManager.HandleEventException(this.ToString(),
  151. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  152. }
  153. }
  154. /// <summary>
  155. /// 新建
  156. /// </summary>
  157. /// <param name="sender"></param>
  158. /// <param name="e"></param>
  159. private void tsbtnAdd_Click(object sender, EventArgs e)
  160. {
  161. try
  162. {
  163. F_MST_1702 frmMST1702 = new F_MST_1702(Constant.FormMode.Add, "","","");
  164. DialogResult dialogResult = frmMST1702.ShowDialog();
  165. // 重新加载GridView
  166. btnSearch_Click(sender, null);
  167. }
  168. catch (Exception ex)
  169. {
  170. // 对异常进行共通处理
  171. ExceptionManager.HandleEventException(this.ToString(),
  172. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  173. }
  174. }
  175. /// <summary>
  176. /// 清空按钮
  177. /// </summary>
  178. /// <param name="sender"></param>
  179. /// <param name="e"></param>
  180. private void btnClearCondition_Click(object sender, EventArgs e)
  181. {
  182. this.txtGoodsCode.Clear();
  183. this.cmbLogo.SelectedValue = "";
  184. this.cbflagtrue.Checked = true;
  185. this.cbflagfalse.Checked = true;
  186. }
  187. /// <summary>
  188. /// 窗体关闭事件
  189. /// </summary>
  190. /// <param name="sender"></param>
  191. /// <param name="e"></param>
  192. private void F_MST_1701_FormClosed(object sender, FormClosedEventArgs e)
  193. {
  194. _instance = null;
  195. }
  196. #endregion
  197. #region 私有方法
  198. /// <summary>
  199. /// 根据界面查询条件获取数据集
  200. /// </summary>
  201. private DataSet GetSearchData()
  202. {
  203. try
  204. {
  205. ClientRequestEntity cre = new ClientRequestEntity();
  206. cre.NameSpace = "F_MST_1701";
  207. cre.Name = "GetGoodsLogo";
  208. cre.Properties["LogoName"] = this.cmbLogo.SelectedText.ToString();
  209. cre.Properties["LogoCode"] = this.cmbLogo.SelectedValue.ToString();
  210. cre.Properties["GOODSCODE"] = txtGoodsCode.Text;
  211. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  212. {
  213. cre.Properties["VALUEFLAG"] = "";
  214. }
  215. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  216. {
  217. cre.Properties["VALUEFLAG"] = 1;
  218. }
  219. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  220. {
  221. cre.Properties["VALUEFLAG"] = 0;
  222. }
  223. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  224. {
  225. cre.Properties["VALUEFLAG"] = 2;
  226. }
  227. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  228. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  229. {
  230. return sre.Data;
  231. }
  232. return null;
  233. }
  234. catch (Exception ex)
  235. {
  236. throw ex;
  237. }
  238. }
  239. #endregion
  240. private void tsrOperate_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  241. {
  242. }
  243. }
  244. }