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

📄 frmsyssupuser.cs

📁 自己编写的基本Orcale的通用的数据库初始化工具。
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using DS.EMIS.StartPrepare.Common;

namespace DS.EMIS.StartPrepare
{
	/// <summary>
	/// FrmSysSupUser 的摘要说明。
	/// </summary>
	public class FrmSysSupUser : FrmAncestor
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.Button btnSave;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.TextBox txtSuperID;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.TextBox txtPassword;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox txtTerminalName;
		private System.Windows.Forms.TextBox txtIP;
		private System.Windows.Forms.GroupBox groupBox4;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.Label label12;
		private System.Windows.Forms.TextBox txtDeskID;
		private System.Windows.Forms.TextBox txtDeskName;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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

		/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.panel1 = new System.Windows.Forms.Panel();
			this.btnCancel = new System.Windows.Forms.Button();
			this.btnSave = new System.Windows.Forms.Button();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.txtSuperID = new System.Windows.Forms.TextBox();
			this.label9 = new System.Windows.Forms.Label();
			this.txtPassword = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.txtTerminalName = new System.Windows.Forms.TextBox();
			this.txtIP = new System.Windows.Forms.TextBox();
			this.groupBox4 = new System.Windows.Forms.GroupBox();
			this.label11 = new System.Windows.Forms.Label();
			this.label12 = new System.Windows.Forms.Label();
			this.txtDeskID = new System.Windows.Forms.TextBox();
			this.txtDeskName = new System.Windows.Forms.TextBox();
			this.groupBox1.SuspendLayout();
			this.panel1.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.groupBox4.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
			this.groupBox1.Location = new System.Drawing.Point(0, 0);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(544, 152);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "创建说明";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(40, 96);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(480, 23);
			this.label3.TabIndex = 2;
			this.label3.Text = "3、超级用户具有创建操作台、创建操作终端、创建用户等权限";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(40, 64);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(480, 23);
			this.label2.TabIndex = 1;
			this.label2.Text = "2、系统超级用户只能登录系统管理终端";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(40, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(480, 23);
			this.label1.TabIndex = 0;
			this.label1.Text = "1、系统超级用户是用于登录EMIS的第一个用户";
			// 
			// panel1
			// 
			this.panel1.Controls.Add(this.btnCancel);
			this.panel1.Controls.Add(this.btnSave);
			this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.panel1.Location = new System.Drawing.Point(0, 366);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(544, 56);
			this.panel1.TabIndex = 3;
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(272, 16);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.TabIndex = 1;
			this.btnCancel.Text = "完成";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// btnSave
			// 
			this.btnSave.Location = new System.Drawing.Point(160, 16);
			this.btnSave.Name = "btnSave";
			this.btnSave.TabIndex = 0;
			this.btnSave.Text = "创建";
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.txtSuperID);
			this.groupBox3.Controls.Add(this.label9);
			this.groupBox3.Controls.Add(this.txtPassword);
			this.groupBox3.Controls.Add(this.label7);
			this.groupBox3.Location = new System.Drawing.Point(8, 256);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(256, 88);
			this.groupBox3.TabIndex = 6;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "超级用户";
			// 
			// txtSuperID
			// 
			this.txtSuperID.Location = new System.Drawing.Point(88, 24);
			this.txtSuperID.Name = "txtSuperID";
			this.txtSuperID.Size = new System.Drawing.Size(144, 21);
			this.txtSuperID.TabIndex = 11;
			this.txtSuperID.Text = "system";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(16, 24);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(56, 16);
			this.label9.TabIndex = 12;
			this.label9.Text = "登陆名";
			// 
			// txtPassword
			// 
			this.txtPassword.Location = new System.Drawing.Point(88, 56);
			this.txtPassword.Name = "txtPassword";
			this.txtPassword.PasswordChar = '*';
			this.txtPassword.Size = new System.Drawing.Size(144, 21);
			this.txtPassword.TabIndex = 9;
			this.txtPassword.Text = "";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(16, 56);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(56, 16);
			this.label7.TabIndex = 10;
			this.label7.Text = "密码";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Controls.Add(this.txtTerminalName);
			this.groupBox2.Controls.Add(this.txtIP);
			this.groupBox2.Location = new System.Drawing.Point(280, 160);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(256, 88);
			this.groupBox2.TabIndex = 5;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "操作终端";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(16, 56);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(64, 16);
			this.label5.TabIndex = 6;
			this.label5.Text = "IP地址";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(16, 24);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(56, 16);
			this.label4.TabIndex = 3;
			this.label4.Text = "终端名称";
			// 
			// txtTerminalName
			// 
			this.txtTerminalName.Location = new System.Drawing.Point(88, 24);
			this.txtTerminalName.Name = "txtTerminalName";
			this.txtTerminalName.Size = new System.Drawing.Size(144, 21);
			this.txtTerminalName.TabIndex = 1;
			this.txtTerminalName.Text = "";
			// 
			// txtIP
			// 
			this.txtIP.Location = new System.Drawing.Point(88, 56);
			this.txtIP.Name = "txtIP";
			this.txtIP.Size = new System.Drawing.Size(144, 21);
			this.txtIP.TabIndex = 2;
			this.txtIP.Text = "";
			// 
			// groupBox4
			// 
			this.groupBox4.Controls.Add(this.label11);
			this.groupBox4.Controls.Add(this.label12);
			this.groupBox4.Controls.Add(this.txtDeskID);
			this.groupBox4.Controls.Add(this.txtDeskName);
			this.groupBox4.Location = new System.Drawing.Point(8, 160);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(256, 88);
			this.groupBox4.TabIndex = 4;
			this.groupBox4.TabStop = false;
			this.groupBox4.Text = "操作台";
			// 
			// label11
			// 
			this.label11.Location = new System.Drawing.Point(8, 24);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(56, 16);
			this.label11.TabIndex = 0;
			this.label11.Text = "操作台号";
			// 
			// label12
			// 
			this.label12.Location = new System.Drawing.Point(8, 56);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(72, 16);
			this.label12.TabIndex = 0;
			this.label12.Text = "操作台名称";
			// 
			// txtDeskID
			// 
			this.txtDeskID.Location = new System.Drawing.Point(88, 24);
			this.txtDeskID.Name = "txtDeskID";
			this.txtDeskID.Size = new System.Drawing.Size(144, 21);
			this.txtDeskID.TabIndex = 0;
			this.txtDeskID.Text = "";
			// 
			// txtDeskName
			// 
			this.txtDeskName.Location = new System.Drawing.Point(88, 56);
			this.txtDeskName.Name = "txtDeskName";
			this.txtDeskName.Size = new System.Drawing.Size(144, 21);
			this.txtDeskName.TabIndex = 0;
			this.txtDeskName.Text = "";
			// 
			// FrmSysSupUser
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(544, 422);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox4);
			this.Controls.Add(this.panel1);
			this.Controls.Add(this.groupBox1);
			this.Name = "FrmSysSupUser";
			this.Text = "FrmSysSupUser";
			this.groupBox1.ResumeLayout(false);
			this.panel1.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion


		private void btnSave_Click(object sender, System.EventArgs e)
		{		
		
			#region 系统操作台
			DtbT_XT_XTCZTXX czt = new DtbT_XT_XTCZTXX();
			czt.CZTBH = 1;
			//组织编号
			//czt.ZZBH = 2;
			czt.ZCSJ = DateTime.Now;
			czt.ZXSJ = DateTime.MinValue;

			czt.CZTH = this.txtDeskID.Text.Trim();
			czt.CZTMC = this.txtDeskName.Text.Trim();

			#endregion 

			#region 系统操作终端
			DtbT_XT_XTCZZDXX czzd = new DtbT_XT_XTCZZDXX();
			czzd.XTZDBH = 1;
			czzd.CZTBH = 1;
			czzd.ZCSJ = DateTime.Now;
			czzd.ZDMC = this.txtTerminalName.Text.Trim();

			//终端类型为系统管理终端
			//czzd.CZZDLX = 4;
			czzd.ZDIPDZ = this.txtIP.Text.Trim();

			#endregion

			#region 系统用户
			DtbT_XT_XTYHXX xtyh = new DtbT_XT_XTYHXX();

			xtyh.XTYHBH = 1;
			xtyh.DSRBH = -1;
			xtyh.ZCSJ = DateTime.Now;
			xtyh.ZXSJ = DateTime.MinValue;

			xtyh.YHDLM = this.txtSuperID.Text.Trim();
			xtyh.YHDLMM = this.txtPassword.Text;
	
			#endregion
			
			SysSupManager sysManager = new SysSupManager();
			try
			{				
				sysManager.CreateSupUser(czt,czzd,xtyh);
			
				MessageBox.Show("超级用户创建成功");
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message,"超级用户创建失败",MessageBoxButtons.OK,MessageBoxIcon.Warning);
			}
		}

		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			//更改状态配置文件"TaskName","OptiDBTask")
			GlobalObject.Instance.LocalSession.UpdateConfig("DBTask.config","task","TaskState","1","TaskName","SysUserTask");
			GlobalObject.Instance.LocalSession.SendMessage("SysUserTask","FrmSysSupUser","TaskStepState",TaskStepState.Done);   
		}

	}
}

⌨️ 快捷键说明

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