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

📄 updateadmininfoui.cs

📁 真的很不错哦 用了c#开发 面向对象过程
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using SetupOperDBLibrary;

namespace UI
{
	/// <summary>
	/// UpdateAdminInfoUI 的摘要说明。
	/// </summary>
	public class UpdateAdminInfoUI : System.Windows.Forms.Form
	{
		private ListViewItem item;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.RadioButton radioButton1;
		private System.Windows.Forms.RadioButton radioButton2;
		private System.Windows.Forms.CheckBox checkBox1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public UpdateAdminInfoUI()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}
		public UpdateAdminInfoUI(ListViewItem item)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			this.item=item;
			
		}

		/// <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.button1 = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.button2 = new System.Windows.Forms.Button();
			this.radioButton1 = new System.Windows.Forms.RadioButton();
			this.radioButton2 = new System.Windows.Forms.RadioButton();
			this.checkBox1 = new System.Windows.Forms.CheckBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(67, 200);
			this.button1.Name = "button1";
			this.button1.TabIndex = 12;
			this.button1.Text = "更改";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(91, 72);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(54, 17);
			this.label1.TabIndex = 8;
			this.label1.Text = "登陆名:";
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(227, 200);
			this.button2.Name = "button2";
			this.button2.TabIndex = 11;
			this.button2.Text = "取消";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// radioButton1
			// 
			this.radioButton1.Location = new System.Drawing.Point(96, 112);
			this.radioButton1.Name = "radioButton1";
			this.radioButton1.Size = new System.Drawing.Size(88, 24);
			this.radioButton1.TabIndex = 13;
			this.radioButton1.Text = "超级管理员";
			// 
			// radioButton2
			// 
			this.radioButton2.Location = new System.Drawing.Point(200, 112);
			this.radioButton2.Name = "radioButton2";
			this.radioButton2.Size = new System.Drawing.Size(72, 24);
			this.radioButton2.TabIndex = 13;
			this.radioButton2.Text = "管理员";
			// 
			// checkBox1
			// 
			this.checkBox1.Location = new System.Drawing.Point(96, 152);
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.Size = new System.Drawing.Size(168, 24);
			this.checkBox1.TabIndex = 15;
			this.checkBox1.Text = "是否禁用(选中为禁用)";
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(96, 32);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(54, 17);
			this.label3.TabIndex = 16;
			this.label3.Text = "编  号:";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(168, 32);
			this.label4.Name = "label4";
			this.label4.TabIndex = 16;
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(168, 72);
			this.label5.Name = "label5";
			this.label5.TabIndex = 16;
			// 
			// UpdateAdminInfoUI
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(368, 245);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.checkBox1);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.radioButton1);
			this.Controls.Add(this.radioButton2);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.label5);
			this.Name = "UpdateAdminInfoUI";
			this.Text = "UpdateAdminInfoUI";
			this.Load += new System.EventHandler(this.UpdateAdminInfoUI_Load);
			this.ResumeLayout(false);

		}
		#endregion

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

		private void button1_Click(object sender, System.EventArgs e)
		{
			string aid=this.label4.Text.Trim();
			string isSuper="0";
			if(this.radioButton1.Checked)
			{
				isSuper="1";
			}
			string isLock="1";
			if(this.checkBox1.Checked)
			{
				isLock="0";
			}

			try
			{
				SetupUpdateAdminInfo up=new SetupUpdateAdminInfo();
				if(up.UpdateAdminInfo(aid,isSuper,isLock))
				{
					MessageBox.Show("更新成功");
				}
				else
				{
					MessageBox.Show("更新失败");
				}
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.ToString());
			}
		}

		private void UpdateAdminInfoUI_Load(object sender, System.EventArgs e)
		{
			this.label4.Text=this.item.SubItems[0].Text;
			this.label5.Text=this.item.SubItems[1].Text.Trim();
			if(this.item.SubItems[2].Text.Trim()=="超级管理员")
			{
				this.radioButton1.Checked=true;
			}
			else
			{
				this.radioButton2.Checked=true;
			}
			if(this.item.SubItems[2].Text.Trim()=="是")
			{
				this.checkBox1.Checked=true;
			}
			else
			{
				this.checkBox1.Checked=false;
			}
		}
	}
}

⌨️ 快捷键说明

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