| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- using com.hnshituo.pur.vo;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Pur.Entity;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Pur.configure
- {
- public partial class FrmSuppChangePassword : FrmPmsBase
- {
-
- private string m_suppname;//声明私有化属性用于接母窗体传来的值
- private string m_suppcode;//声明私有化属性用于接母窗体传来的值
- private string m_account;//招标系统账号
-
- public FrmSuppChangePassword(string suppname, string suppcode,OpeBase BO)
- {
- this.ob = BO;
- InitializeComponent();
- this.m_suppcode = suppcode;//将接收到的值赋值给声明的属性
- this.m_suppname = suppname;//将接收到的值赋值给声明的属性
- }
- /// <summary>
- /// 点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- Supp Supp_Entity = new Supp();//new一个实体类的对象
- Supp_Entity.SuppCode = TB_code.Text.Trim();//将控件的文本值赋给对象的代码属性
- Supp_Entity.DeleteName = "PC";//标识为PC端修改
- if (string.IsNullOrEmpty(Supp_Entity.SuppCode))
- {
- MessageUtil.ShowTips("供应商编号不能为空");
- return;
- }
- if (CHK_password.Checked)
- {
- Supp_Entity.Password = TB_pwd.Text.Trim();
- if (String.IsNullOrEmpty(Supp_Entity.Password))
- {
- MessageUtil.ShowTips("重置密码不能为空");
- return;
- }
- }
- if (CHK_account.Checked)
- {
- Supp_Entity.Account = TB_Account.Text.Trim();
- if (String.IsNullOrEmpty(Supp_Entity.Account))
- {
- MessageUtil.ShowTips("重置账号不能为空");
- return;
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("确定重置供应商【" + Supp_Entity.SuppCode + "】登录账号或者密码?") == DialogResult.No)
- {
- return;
- }
- CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "changeword", new object[] { Supp_Entity});
- // CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "changeword", new object[] { Supp_Entity });
- // getsupp(Supp_Entity);//所有订阅的方法将被执行
- if (re.Resultcode != 0)//访问数据库的返回值
- {
- MessageUtil.ShowTips("操作失败:" + re.Resultmsg);//返回不为零则操作失败
- }
- else
- {
- MessageUtil.ShowTips("操作成功,已重置");//返回为零则操作成功
- this.Close();
- }
-
- //大体思路:声明两个string类型的属性用来接收母窗体传来的值,在构造方法里将母窗体传来的值赋值给两个声明的属性,在点击事件的方法里先new一个实体类对象,将前台两个空件
- //的文本值赋值给两个对象相对应的属性(防止处理返回值时报错),调用后台的方法,并对其返回值进行判断,在窗体加载事件的方法体中将两个母窗体传来的值赋值给对应得空件的文本属性
-
- }
- private void FrmSuppChangePassword_Load(object sender, EventArgs e)//窗体加载事件
- {
- Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { this.m_suppcode });
- TB_code.Text = sc.SuppCode;//窗体加载时将母窗体传来的值赋给对应的文本框
- TB_name.Text = sc.SuppName;//窗体加载时将母窗体传来的值赋给TBname的text属性
- TB_Account.Text = sc.Account;
- TB_pwd.Text = "1";
- CHK_account.Checked = false;
- CHK_password.Checked = false;
- TB_pwd.Enabled = false;
- TB_Account.Enabled = false;
- Btn_ok.Enabled = false;
- }
- private void CHK_account_CheckedChanged(object sender, EventArgs e)
- {
- TB_Account.Enabled = CHK_account.Checked;
- if (CHK_password.Checked || CHK_account.Checked)
- {
- Btn_ok.Enabled = true;
- }
- else
- {
- Btn_ok.Enabled = false;
- }
- }
- private void CHK_password_CheckedChanged(object sender, EventArgs e)
- {
- TB_pwd.Enabled = CHK_password.Checked;
- if (CHK_password.Checked || CHK_account.Checked)
- {
- Btn_ok.Enabled = true;
- }
- else
- {
- Btn_ok.Enabled = false;
- }
- }
- }
- }
|