⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmpass.cs

📁 考试管理系统CS架构 不需更多说明
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using ExamSystem.BusinessFacade.TeacherFac;
using ExamSystem.Common.Objects;
using ExamSystem.Common;
namespace StudentsClient
{
	/// <summary>
	/// FrmPass 的摘要说明。
	/// </summary>
	public class FrmPass : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtOldPass;
		private System.Windows.Forms.TextBox txtNewPass2;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox txtNewPass1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FrmPass()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}
		
		private bool sub()
		{
			if(this.txtOldPass.Text.Trim()!=CommVal.CurrentStu.StuPass)
			{
				MessageBox.Show("原密码错误,请重新输入","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
				txtOldPass.Focus();
				return false;
			}
			if(this.txtNewPass1.Text.Trim()=="")
			{
				MessageBox.Show("请输入新密码","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
				txtNewPass1.Focus();
				return false;
			}
			if(this.txtNewPass2.Text!=txtNewPass1.Text)
			{
				MessageBox.Show("重复密码错误,请重新输入","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
				txtNewPass2.Focus();
				return false;
			}
			return true;
		}
		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.txtOldPass = new System.Windows.Forms.TextBox();
			this.txtNewPass2 = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.txtNewPass1 = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(24, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(50, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "旧密码:";
			// 
			// txtOldPass
			// 
			this.txtOldPass.Location = new System.Drawing.Point(70, 12);
			this.txtOldPass.Name = "txtOldPass";
			this.txtOldPass.PasswordChar = '*';
			this.txtOldPass.Size = new System.Drawing.Size(144, 21);
			this.txtOldPass.TabIndex = 1;
			this.txtOldPass.Text = "";
			// 
			// txtNewPass2
			// 
			this.txtNewPass2.Location = new System.Drawing.Point(70, 72);
			this.txtNewPass2.Name = "txtNewPass2";
			this.txtNewPass2.PasswordChar = '*';
			this.txtNewPass2.Size = new System.Drawing.Size(144, 21);
			this.txtNewPass2.TabIndex = 3;
			this.txtNewPass2.Text = "";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(14, 76);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(60, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "重复密码:";
			// 
			// txtNewPass1
			// 
			this.txtNewPass1.Location = new System.Drawing.Point(70, 42);
			this.txtNewPass1.Name = "txtNewPass1";
			this.txtNewPass1.PasswordChar = '*';
			this.txtNewPass1.Size = new System.Drawing.Size(144, 21);
			this.txtNewPass1.TabIndex = 5;
			this.txtNewPass1.Text = "";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(24, 46);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(50, 16);
			this.label3.TabIndex = 4;
			this.label3.Text = "新密码:";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(38, 118);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(52, 22);
			this.button1.TabIndex = 6;
			this.button1.Text = "修改";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(136, 118);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(48, 22);
			this.button2.TabIndex = 7;
			this.button2.Text = "关闭";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// FrmPass
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(238, 155);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.txtNewPass1);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.txtNewPass2);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.txtOldPass);
			this.Controls.Add(this.label1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "FrmPass";
			this.Text = "修改密码";
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e)
		{
			if(sub())
			{
				StudentFac stuFac=new StudentFac();
				if(stuFac.updateStudent(CommVal.CurrentStu.StuID,-1,"",this.txtNewPass1.Text,-1,DateTime.MinValue,SearchBooleans.NULL,null,""))
				{
					MessageBox.Show("修改完毕","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
					this.Close();
				}
				else
				{
					MessageBox.Show("修改失败","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
				}
			}
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -