F_MST_1802.cs 7.1 KB

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