FrmSuppChangePassword.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using com.hnshituo.pur.vo;
  2. using Core.Mes.Client.Comm.Tool;
  3. using CoreFS.CA06;
  4. using Pur.Entity;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Windows.Forms;
  13. namespace Pur.configure
  14. {
  15. public partial class FrmSuppChangePassword : FrmPmsBase
  16. {
  17. private string m_suppname;//声明私有化属性用于接母窗体传来的值
  18. private string m_suppcode;//声明私有化属性用于接母窗体传来的值
  19. private string m_account;//招标系统账号
  20. public FrmSuppChangePassword(string suppname, string suppcode,OpeBase BO)
  21. {
  22. this.ob = BO;
  23. InitializeComponent();
  24. this.m_suppcode = suppcode;//将接收到的值赋值给声明的属性
  25. this.m_suppname = suppname;//将接收到的值赋值给声明的属性
  26. }
  27. /// <summary>
  28. /// 点击事件
  29. /// </summary>
  30. /// <param name="sender"></param>
  31. /// <param name="e"></param>
  32. private void button1_Click(object sender, EventArgs e)
  33. {
  34. Supp Supp_Entity = new Supp();//new一个实体类的对象
  35. Supp_Entity.SuppCode = TB_code.Text.Trim();//将控件的文本值赋给对象的代码属性
  36. Supp_Entity.DeleteName = "PC";//标识为PC端修改
  37. if (string.IsNullOrEmpty(Supp_Entity.SuppCode))
  38. {
  39. MessageUtil.ShowTips("供应商编号不能为空");
  40. return;
  41. }
  42. if (CHK_password.Checked)
  43. {
  44. Supp_Entity.Password = TB_pwd.Text.Trim();
  45. if (String.IsNullOrEmpty(Supp_Entity.Password))
  46. {
  47. MessageUtil.ShowTips("重置密码不能为空");
  48. return;
  49. }
  50. }
  51. if (CHK_account.Checked)
  52. {
  53. Supp_Entity.Account = TB_Account.Text.Trim();
  54. if (String.IsNullOrEmpty(Supp_Entity.Account))
  55. {
  56. MessageUtil.ShowTips("重置账号不能为空");
  57. return;
  58. }
  59. }
  60. if (MessageUtil.ShowYesNoAndQuestion("确定重置供应商【" + Supp_Entity.SuppCode + "】登录账号或者密码?") == DialogResult.No)
  61. {
  62. return;
  63. }
  64. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "changeword", new object[] { Supp_Entity});
  65. // CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "changeword", new object[] { Supp_Entity });
  66. // getsupp(Supp_Entity);//所有订阅的方法将被执行
  67. if (re.Resultcode != 0)//访问数据库的返回值
  68. {
  69. MessageUtil.ShowTips("操作失败:" + re.Resultmsg);//返回不为零则操作失败
  70. }
  71. else
  72. {
  73. MessageUtil.ShowTips("操作成功,已重置");//返回为零则操作成功
  74. this.Close();
  75. }
  76. //大体思路:声明两个string类型的属性用来接收母窗体传来的值,在构造方法里将母窗体传来的值赋值给两个声明的属性,在点击事件的方法里先new一个实体类对象,将前台两个空件
  77. //的文本值赋值给两个对象相对应的属性(防止处理返回值时报错),调用后台的方法,并对其返回值进行判断,在窗体加载事件的方法体中将两个母窗体传来的值赋值给对应得空件的文本属性
  78. }
  79. private void FrmSuppChangePassword_Load(object sender, EventArgs e)//窗体加载事件
  80. {
  81. Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { this.m_suppcode });
  82. TB_code.Text = sc.SuppCode;//窗体加载时将母窗体传来的值赋给对应的文本框
  83. TB_name.Text = sc.SuppName;//窗体加载时将母窗体传来的值赋给TBname的text属性
  84. TB_Account.Text = sc.Account;
  85. TB_pwd.Text = "1";
  86. CHK_account.Checked = false;
  87. CHK_password.Checked = false;
  88. TB_pwd.Enabled = false;
  89. TB_Account.Enabled = false;
  90. Btn_ok.Enabled = false;
  91. }
  92. private void CHK_account_CheckedChanged(object sender, EventArgs e)
  93. {
  94. TB_Account.Enabled = CHK_account.Checked;
  95. if (CHK_password.Checked || CHK_account.Checked)
  96. {
  97. Btn_ok.Enabled = true;
  98. }
  99. else
  100. {
  101. Btn_ok.Enabled = false;
  102. }
  103. }
  104. private void CHK_password_CheckedChanged(object sender, EventArgs e)
  105. {
  106. TB_pwd.Enabled = CHK_password.Checked;
  107. if (CHK_password.Checked || CHK_account.Checked)
  108. {
  109. Btn_ok.Enabled = true;
  110. }
  111. else
  112. {
  113. Btn_ok.Enabled = false;
  114. }
  115. }
  116. }
  117. }