📄 otherform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace PM
{
/// <summary>
/// otherForm 的摘要说明。
/// </summary>
public class otherForm : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.ListBox listBox3;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public static otherForm of;
public otherForm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
of = this;
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(otherForm));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.listBox1 = new System.Windows.Forms.ListBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.listBox2 = new System.Windows.Forms.ListBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.button6 = new System.Windows.Forms.Button();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.button5 = new System.Windows.Forms.Button();
this.listBox3 = new System.Windows.Forms.ListBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.tabPage3.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(8, 24);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(432, 360);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Controls.Add(this.listBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(424, 335);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "民族";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Location = new System.Drawing.Point(184, 200);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(200, 88);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "删除选中的民族";
//
// button2
//
this.button2.Location = new System.Drawing.Point(56, 40);
this.button2.Name = "button2";
this.button2.TabIndex = 5;
this.button2.Text = "删除民族";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Location = new System.Drawing.Point(184, 56);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(200, 80);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "添加民族";
//
// button1
//
this.button1.Location = new System.Drawing.Point(56, 32);
this.button1.Name = "button1";
this.button1.TabIndex = 3;
this.button1.Text = "添加民族";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// listBox1
//
this.listBox1.ItemHeight = 12;
this.listBox1.Location = new System.Drawing.Point(16, 16);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(120, 304);
this.listBox1.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.groupBox4);
this.tabPage2.Controls.Add(this.groupBox3);
this.tabPage2.Controls.Add(this.listBox2);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(424, 335);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "职务";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.button4);
this.groupBox4.Location = new System.Drawing.Point(184, 200);
this.groupBox4.Name = "groupBox4";
this.groupBox4.TabIndex = 2;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "删除选中的职务";
//
// button4
//
this.button4.Location = new System.Drawing.Point(56, 40);
this.button4.Name = "button4";
this.button4.TabIndex = 0;
this.button4.Text = "删除职务";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button3);
this.groupBox3.Location = new System.Drawing.Point(184, 40);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(200, 96);
this.groupBox3.TabIndex = 1;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "添加职务";
//
// button3
//
this.button3.Location = new System.Drawing.Point(56, 40);
this.button3.Name = "button3";
this.button3.TabIndex = 2;
this.button3.Text = "添加职务";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// listBox2
//
this.listBox2.ItemHeight = 12;
this.listBox2.Location = new System.Drawing.Point(16, 16);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(120, 304);
this.listBox2.TabIndex = 0;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.groupBox6);
this.tabPage3.Controls.Add(this.groupBox5);
this.tabPage3.Controls.Add(this.listBox3);
this.tabPage3.Location = new System.Drawing.Point(4, 21);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(424, 335);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "职称";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.button6);
this.groupBox6.Location = new System.Drawing.Point(184, 168);
this.groupBox6.Name = "groupBox6";
this.groupBox6.TabIndex = 2;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "删除选中的职称";
//
// button6
//
this.button6.Location = new System.Drawing.Point(64, 48);
this.button6.Name = "button6";
this.button6.TabIndex = 0;
this.button6.Text = "删除职称";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// groupBox5
//
this.groupBox5.Controls.Add(this.button5);
this.groupBox5.Location = new System.Drawing.Point(184, 32);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(200, 80);
this.groupBox5.TabIndex = 1;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "添加职称";
//
// button5
//
this.button5.Location = new System.Drawing.Point(64, 32);
this.button5.Name = "button5";
this.button5.TabIndex = 2;
this.button5.Text = "添加职称";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// listBox3
//
this.listBox3.ItemHeight = 12;
this.listBox3.Location = new System.Drawing.Point(8, 16);
this.listBox3.Name = "listBox3";
this.listBox3.Size = new System.Drawing.Size(120, 292);
this.listBox3.TabIndex = 0;
//
// otherForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(448, 397);
this.Controls.Add(this.tabControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "otherForm";
this.Text = "其他选项设置";
this.Load += new System.EventHandler(this.otherForm_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void otherForm_Load(object sender, System.EventArgs e)
{
DBListBox1();
DBListBox2();
DBListBox3();
}
public void DBListBox1()
{
this.listBox1.Items.Clear();
string str = "select * from RaceInfo";
Base bb = new Base();
DataTable dt = new DataTable();
dt = bb.ExeSQLdt(str);
for(int i = 0 ; i < dt.Rows.Count ; i ++)
{
this.listBox1.Items.Add(dt.Rows[i]["rName"].ToString());
}
}
public void DBListBox2()
{
this.listBox2.Items.Clear();
string str = "select * from JobInfo";
Base bb = new Base();
DataTable dt = new DataTable();
dt = bb.ExeSQLdt(str);
for(int i = 0 ; i < dt.Rows.Count ; i ++)
{
this.listBox2.Items.Add(dt.Rows[i]["JName"].ToString());
}
}
public void DBListBox3()
{
this.listBox3.Items.Clear();
string str = "select * from Title";
Base bb = new Base();
DataTable dt = new DataTable();
dt = bb.ExeSQLdt(str);
for(int i = 0 ; i < dt.Rows.Count ; i ++ )
{
this.listBox3.Items.Add(dt.Rows[i]["tName"].ToString());
}
}
//添加民族
private void button1_Click(object sender, System.EventArgs e)
{
if(mainForm.mf.CheckForm("TreeNodeForm") == true)
{
return;
}
else
{
TreeNodeForm tnf = new TreeNodeForm();
tnf.MdiParent = mainForm.mf;
tnf.Show();
tnf.label1.Text = "请输入民族名称";
tnf.TopMost = true;
}
}
//删除民族
private void button2_Click(object sender, System.EventArgs e)
{
if(this.listBox1.CanSelect == true)
{
string str = "delete from RaceInfo where rName='" + this.listBox1.SelectedItem.ToString() + "'";
Base bb = new Base();
bb.ExeSQL(str);
DBListBox1();
}
else
{
MessageBox.Show("请选择你要删除的项!");
}
}
//添加职务
private void button3_Click(object sender, System.EventArgs e)
{
if(mainForm.mf.CheckForm("TreeNodeForm") == true)
{
return;
}
else
{
TreeNodeForm tnf = new TreeNodeForm();
tnf.MdiParent = mainForm.mf;
tnf.Show();
tnf.label1.Text = "请输入职务名称";
tnf.TopMost = true;
}
}
//删除职务
private void button4_Click(object sender, System.EventArgs e)
{
if(this.listBox2.CanSelect == true)
{
string str = "delete from JobInfo where JName='" + this.listBox2.SelectedItem.ToString() + "'";
Base bb = new Base();
bb.ExeSQL(str);
DBListBox2();
}
else
{
MessageBox.Show("请选择你要删除的项!");
}
}
//删除职称
private void button6_Click(object sender, System.EventArgs e)
{
if(this.listBox3.CanSelect == true)
{
string str = "delete from TitleInfo where tName='" + this.listBox3.SelectedItem.ToString() + "'";
Base bb = new Base();
bb.ExeSQL(str);
DBListBox3();
}
else
{
MessageBox.Show("请选择你要删除的项!");
}
}
//添加职称
private void button5_Click(object sender, System.EventArgs e)
{
if(mainForm.mf.CheckForm("TreeNodeForm") == true)
{
return;
}
else
{
TreeNodeForm tnf = new TreeNodeForm();
tnf.MdiParent = mainForm.mf;
tnf.Show();
tnf.label1.Text = "请输入职称名称";
tnf.TopMost = true;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -