F_MST_1802.cs 7.1 KB

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