F_MST_1702.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. using Dongke.IBOSS.PRD.Basics.BaseControls;
  2. using Dongke.IBOSS.PRD.Basics.BaseResources;
  3. using Dongke.IBOSS.PRD.Client.CommonModule;
  4. using Dongke.IBOSS.PRD.WCF.DataModels;
  5. using Dongke.IBOSS.PRD.WCF.Proxys;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. namespace Dongke.IBOSS.PRD.Client.SystemModule
  15. {
  16. public partial class F_MST_1702 : Form
  17. {
  18. #region 成员变量
  19. //记录版面id
  20. private string LayoutidOne;
  21. // 编辑状态
  22. private Constant.FormMode _editStatus;
  23. private string logocodes;
  24. private string goodscodes;
  25. #endregion
  26. #region 构造函数
  27. public F_MST_1702()
  28. {
  29. InitializeComponent();
  30. }
  31. public F_MST_1702(Constant.FormMode frmStatus, string goodscode,string logocode,string valueflag)
  32. {
  33. InitializeComponent();
  34. _editStatus = frmStatus;
  35. // 设置窗口标题,当为新建状态时显示新建用户,当为编辑状态时显示编辑用户
  36. if (frmStatus == Constant.FormMode.Add)
  37. {
  38. FromStatus = "Add";
  39. this.Text = "新建";
  40. DataSet set = SystemModuleProxy.Service.GetLogoInfo();
  41. this.cmbLogos.DataSource = set.Tables[0];
  42. this.cmbLogos.ValueMember = "LOGOCODE";
  43. this.cmbLogos.DisplayMember = "LOGONAME";
  44. }
  45. else if (frmStatus == Constant.FormMode.Edit)
  46. {
  47. FromStatus = "Edit";
  48. this.Text = "编辑";
  49. if (!string.IsNullOrEmpty(goodscode) && !string.IsNullOrEmpty(logocode))
  50. {
  51. logocodes = logocode;
  52. goodscodes = goodscode;
  53. ClientRequestEntity cres = new ClientRequestEntity();
  54. cres.NameSpace = "F_MST_1701";
  55. cres.Name = "GetLogo";
  56. cres.Properties["LOGOCODE"] = logocode.ToString();
  57. ServiceResultEntity sres = SystemModuleProxy.Service.DoRequest(cres);
  58. DataSet set = sres.Data;
  59. this.cmbLogos.DataSource = set.Tables[0];
  60. this.cmbLogos.ValueMember = "LOGOCODE";
  61. this.cmbLogos.DisplayMember = "LOGONAME";
  62. //产品编码
  63. this.txtGoodsCode.Text = goodscode.ToString();
  64. //有效标识
  65. if (valueflag == "是")
  66. {
  67. this.ccbvalueflag.SelectedIndex = 0;
  68. }
  69. else if (valueflag == "否")
  70. {
  71. this.ccbvalueflag.SelectedIndex = 1;
  72. }
  73. }
  74. }
  75. // 工具栏按钮文本赋值
  76. this.btnSave.Text = ButtonText.BTN_SAVE;
  77. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  78. }
  79. #endregion
  80. #region 属性
  81. /// <summary>
  82. /// 页面状态
  83. /// </summary>
  84. public string FromStatus
  85. {
  86. get;
  87. set;
  88. }
  89. #endregion
  90. #region 事件
  91. //页面加载事件
  92. private void F_MST_1702_Load(object sender, EventArgs e)
  93. {
  94. }
  95. //保存
  96. private void btnSave_Click(object sender, EventArgs e)
  97. {
  98. try
  99. {
  100. //客户编码
  101. if (string.IsNullOrEmpty(this.txtGoodsCode.Text.ToString()))
  102. {
  103. //必须输入
  104. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "产品编码"),
  105. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  106. this.txtGoodsCode.Focus();
  107. return;
  108. }
  109. //有效标识
  110. if (this.ccbvalueflag.SelectedItem == null)
  111. {
  112. //必须输入
  113. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "有效标识"),
  114. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  115. this.ccbvalueflag.Focus();
  116. return;
  117. }
  118. //int returnCustomerID = Constant.INT_IS_ZERO;
  119. //_CustomerEntity = this.SetCustomerEntity();
  120. if (_editStatus == Constant.FormMode.Add)
  121. {
  122. // 新建用户,返回新建的用户ID
  123. this.btnSave.Enabled = false;
  124. this.btnCancel.Enabled = false;
  125. this.AddLauoutInfo();
  126. this.Clear();
  127. }
  128. if (_editStatus == Constant.FormMode.Edit)
  129. {
  130. this.btnSave.Enabled = false;
  131. this.btnCancel.Enabled = false;
  132. this.EditLauout();
  133. this.Close();
  134. }
  135. }
  136. catch (Exception ex)
  137. {
  138. // 对异常进行共通处理
  139. ExceptionManager.HandleEventException(this.ToString(),
  140. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  141. }
  142. }
  143. //退出
  144. private void btnCancel_Click(object sender, EventArgs e)
  145. {
  146. }
  147. #endregion
  148. #region 私有方法
  149. /// <summary>
  150. /// 保存方法
  151. /// </summary>
  152. /// <returns></returns>
  153. private void AddLauoutInfo()
  154. {
  155. int valueflag = 1;
  156. ClientRequestEntity cre = new ClientRequestEntity();
  157. cre.NameSpace = "F_MST_1701";
  158. cre.Name = "AddGoodsLogoInfo";
  159. cre.Properties["LOGOCODE"] = cmbLogos.SelectedValue.ToString();
  160. cre.Properties["LOGONAME"] = cmbLogos.Text.ToString();
  161. cre.Properties["GOODSCODE"] = this.txtGoodsCode.Text.ToString();
  162. if (this.ccbvalueflag.SelectedIndex == 0)
  163. {
  164. valueflag = 1;
  165. }
  166. if (this.ccbvalueflag.SelectedIndex == 1)
  167. {
  168. valueflag = 0;
  169. }
  170. cre.Properties["VALUEFLAG"] = valueflag.ToString();
  171. cre.Properties["FromStatus"] = FromStatus.ToString();
  172. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  173. this.btnSave.Enabled = true;
  174. this.btnCancel.Enabled = true;
  175. if (sre.OtherStatus > 0)
  176. {
  177. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  178. return;
  179. }
  180. else if (Convert.ToInt32(sre.OtherStatus) == -1001)
  181. {
  182. MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
  183. "存在相同客户编码"),
  184. "",
  185. MessageBoxButtons.OK,
  186. MessageBoxIcon.Warning);
  187. return;
  188. }
  189. }
  190. /// <summary>
  191. /// 编辑方法
  192. /// </summary>
  193. public void EditLauout()
  194. {
  195. int valueflag = 1;
  196. ClientRequestEntity cre = new ClientRequestEntity();
  197. cre.NameSpace = "F_MST_1701";
  198. cre.Name = "AddGoodsLogoInfo";
  199. cre.Properties["LOGOCODE"] = cmbLogos.SelectedValue.ToString();
  200. cre.Properties["LOGONAME"] = cmbLogos.Text.ToString();
  201. cre.Properties["GOODSCODE"] = this.txtGoodsCode.Text.ToString();
  202. cre.Properties["OLDLOGOCODE"] = logocodes.ToString();
  203. cre.Properties["OLDGOODSCODE"] = goodscodes.ToString();
  204. if (this.ccbvalueflag.SelectedIndex == 0)
  205. {
  206. valueflag = 1;
  207. }
  208. if (this.ccbvalueflag.SelectedIndex == 1)
  209. {
  210. valueflag = 0;
  211. }
  212. cre.Properties["VALUEFLAG"] = valueflag.ToString();
  213. cre.Properties["FromStatus"] = FromStatus.ToString();
  214. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  215. this.btnSave.Enabled = true;
  216. this.btnCancel.Enabled = true;
  217. if (sre.OtherStatus > 0)
  218. {
  219. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  220. return;
  221. }
  222. else if (Convert.ToInt32(sre.OtherStatus) == -1001)
  223. {
  224. MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
  225. "存在相同版面编码"),
  226. "",
  227. MessageBoxButtons.OK,
  228. MessageBoxIcon.Warning);
  229. return;
  230. }
  231. }
  232. public void GetLogos(String logocode) {
  233. ClientRequestEntity cre = new ClientRequestEntity();
  234. cre.NameSpace = "F_MST_1701";
  235. cre.Name = "GetGoodsLogo";
  236. cre.Properties["LOGOCODE"] = logocode;
  237. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  238. DataSet logoInfo = sre.Data;
  239. if (logoInfo != null && logoInfo.Tables.Count > 0)
  240. {
  241. this.cmbLogos.DataSource = logoInfo.Tables[0];
  242. this.cmbLogos.DisplayMember = "LOGONAME";
  243. this.cmbLogos.ValueMember = "LOGOCODE";
  244. }
  245. }
  246. /// <summary>
  247. /// 清空方法
  248. /// </summary>
  249. public void Clear()
  250. {
  251. this.txtGoodsCode.Clear();
  252. this.ccbvalueflag.SelectedText = "";
  253. }
  254. #endregion
  255. }
  256. }