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

📄 form1.cs

📁 某企业ERP,人员基本信息模块
💻 CS
📖 第 1 页 / 共 2 页
字号:
																						this.toolBarButton4,
																						this.toolBarButton5});
			this.toolBar1.DropDownArrows = true;
			this.toolBar1.Name = "toolBar1";
			this.toolBar1.ShowToolTips = true;
			this.toolBar1.Size = new System.Drawing.Size(626, 38);
			this.toolBar1.TabIndex = 3;
			this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
			// 
			// toolBarButton1
			// 
			this.toolBarButton1.Text = "新建";
			// 
			// toolBarButton2
			// 
			this.toolBarButton2.Text = "浏览";
			// 
			// toolBarButton3
			// 
			this.toolBarButton3.Text = "查询";
			// 
			// toolBarButton4
			// 
			this.toolBarButton4.Text = "退出";
			// 
			// toolBarButton5
			// 
			this.toolBarButton5.Text = "帮助";
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem1,
																					  this.menuItem5,
																					  this.menuItem6});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem2,
																					  this.menuItem3,
																					  this.menuItem4});
			this.menuItem1.Text = "操作";
			
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 0;
			this.menuItem2.Text = "新建";
			
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 1;
			this.menuItem3.Text = "浏览";
			
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 2;
			this.menuItem4.Text = "查询";
			
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 1;
			this.menuItem5.Text = "退出";
			
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 2;
			this.menuItem6.Text = "帮助";
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.comboBox6,
																					this.comboBox5,
																					this.comboBox4,
																					this.label5,
																					this.label4,
																					this.label6});
			this.groupBox3.ForeColor = System.Drawing.SystemColors.Desktop;
			this.groupBox3.Location = new System.Drawing.Point(224, 64);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(192, 184);
			this.groupBox3.TabIndex = 4;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "查询条件";
			// 
			// comboBox6
			// 
			this.comboBox6.Items.AddRange(new object[] {
														   ">",
														   ">=",
														   "=",
														   "<=",
														   "<",
														   "<>"});
			this.comboBox6.Location = new System.Drawing.Point(88, 136);
			this.comboBox6.Name = "comboBox6";
			this.comboBox6.Size = new System.Drawing.Size(88, 20);
			this.comboBox6.TabIndex = 6;
			// 
			// comboBox5
			// 
			this.comboBox5.Items.AddRange(new object[] {
														   ">",
														   ">=",
														   "=",
														   "<=",
														   "<",
														   "<>"});
			this.comboBox5.Location = new System.Drawing.Point(88, 88);
			this.comboBox5.Name = "comboBox5";
			this.comboBox5.Size = new System.Drawing.Size(88, 20);
			this.comboBox5.TabIndex = 5;
			// 
			// comboBox4
			// 
			this.comboBox4.Items.AddRange(new object[] {
														   ">",
														   ">=",
														   "=",
														   "<=",
														   "<",
														   "<>"});
			this.comboBox4.Location = new System.Drawing.Point(88, 40);
			this.comboBox4.Name = "comboBox4";
			this.comboBox4.Size = new System.Drawing.Size(88, 20);
			this.comboBox4.TabIndex = 4;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(626, 267);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.groupBox3,
																		  this.toolBar1,
																		  this.groupBox2,
																		  this.groupBox1});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.MaximizeBox = false;
			this.Menu = this.mainMenu1;
			this.Name = "Form1";
			this.Text = "人员基本信息管理";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());					
			
		}




		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			if ( e.Button == toolBarButton1 )
			{
				string selectString = "SELECT * FROM 人员基本信息管理";
				Form2 frm2 = new Form2();
				frm2.receive = selectString;
				frm2.remark = 1;
				frm2.ShowDialog();
			}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
///*浏览按钮*////////////////////////////////////////////////////////////////////////////////////////////////
			else if(e.Button == toolBarButton2)
			{
				string selectString = "SELECT * FROM 人员基本信息管理";
				string connectionString = "server=server;database=sgerp;uid=sa;pwd=sa";
				SqlConnection mySqlConnection = new SqlConnection(connectionString);
				SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
				mySqlCommand.CommandText = selectString;
				SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
				mySqlDataAdapter.SelectCommand = mySqlCommand;
				DataSet myDataSet = new DataSet();
				mySqlConnection.Open();
				mySqlDataAdapter.Fill(myDataSet,"人员基本信息管理");
				mySqlConnection.Close();
				DataTable myDataTable = myDataSet.Tables["人员基本信息管理"];
				Form3 frm3 = new Form3();
				frm3.test = selectString;
				frm3.ShowDialog();
			    
			}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
///*查询按钮*////////////////////////////////////////////////////////////////////////////////////////////////
			else if(e.Button == toolBarButton3)
			{
				string con1;
				string con2;
				string con3;
				string conf;
				string coe1 = comboBox1.Text;
				string coe2 = comboBox2.Text;
				string coe3 = comboBox3.Text;
				string ope1 = comboBox4.Text;
				string ope2 = comboBox5.Text;
				string ope3 = comboBox6.Text;
				string val1 = textBox1.Text;
				string val2 = textBox2.Text;
				string val3 = textBox3.Text;
				
                
				if ( comboBox3.Text.Length == 0 )
				{
					if ( comboBox2.Text.Length == 0 )
					{
						if ( coe1 == "岗薪工资" || coe1 == "档案工资" || coe1 == "参保额")
						{
							con1 = coe1+" " +ope1+" " +val1;
						}
						else
						{
							con1 = coe1+" " +ope1+" " +"'"+val1+"'";
						}
							conf = con1;
					}
					else
					{
						if ( coe1 == "岗薪工资" || coe1 == "档案工资" || coe1 == "参保额")
						{
							con1 = coe1+" " +ope1+" " +val1;
						}
						else
						{
							con1 = coe1+" " +ope1+" " +"'"+val1+"'";
						}
						if ( coe2 == "岗薪工资" || coe2 == "档案工资" || coe2 == "参保额")
						{
							con2 = coe2+" " +ope2+" " +val2;
						}
						else
						{
							con2 = coe2+" " +ope2+" " +"'"+val2+"'";
						}
						conf = con1+" AND "+con2;
					}
				}
				else 
				{
					if ( coe1 == "岗薪工资" || coe1 == "档案工资" || coe1 == "参保额")
					{
						con1 = coe1+" " +ope1+" " +val1;
					}
					else
					{
						con1 = coe1+" " +ope1+" " +"'"+val1+"'";
					}
					if ( coe2 == "岗薪工资" || coe2 == "档案工资" || coe2 == "参保额")
					{
						con2 = coe2+" " +ope2+" " +val2;
					}
					else
					{
						con2 = coe2+" " +ope2+" " +"'"+val2+"'";
					}
					if ( coe3 == "岗薪工资" || coe3 == "档案工资" || coe3 == "参保额")
					{
						con3 = coe3+" " +ope3+" " +val3;
					}
					else
					{
						con3 = coe3+" " +ope3+" " +"'"+val3+"'";
					}
					conf = con1+" AND "+con2+" AND "+con3;
				}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////检查条件是否为空
				if (textBox1.Text.Length==0)
				{
					MessageBox.Show("请输入值");
					if ( comboBox4.Text.Length == 0)
					{
						MessageBox.Show("请输入关系运算符");
						if (comboBox1.Text.Length == 0 )
						{
							MessageBox.Show("请输入查询项");
						}
					}
				}
			    else if(comboBox1.Text.Length == 0)
				{
					MessageBox.Show("请输入查询项");
					if ( comboBox4.Text.Length == 0)
					{
						MessageBox.Show("请输入关系运算符");
						if(textBox1.Text.Length == 0)
						{
							MessageBox.Show("请输入值");
						}
					}  
				}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////实现查询功能
				else
				{
					string selectString = "SELECT * FROM 人员基本信息管理 WHERE "+conf;
					string connectionString = "server=server;database=sgerp;uid=sa;pwd=sa";
					SqlConnection mySqlConnection = new SqlConnection(connectionString);
					SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
					mySqlCommand.CommandText = selectString;
					SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
					mySqlDataAdapter.SelectCommand = mySqlCommand;
					DataSet myDataSet = new DataSet();
					mySqlConnection.Open();
					mySqlDataAdapter.Fill(myDataSet,"人员基本信息管理");
					mySqlConnection.Close();
					DataTable myDataTable = myDataSet.Tables["人员基本信息管理"];
					Form3 frm3 = new Form3();
					//frm3.dataset1 = myDataSet;
					frm3.test = selectString;
					frm3.ShowDialog();
					
				}
			}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////退出/////////////////////////////////////////////////////////////////////////////////////////////////
			else if ( e.Button == toolBarButton4 )
			{
				Application.Exit();
			}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////帮助/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			else if(e.Button == toolBarButton5)
			{
			}
		}


		private void menuItem3_Click(object sender, System.EventArgs e)//浏览
		{
			string selectString = "SELECT * FROM 人员基本信息管理";
			string connectionString = "server=server;database=sgerp;uid=sa;pwd=sa";
			SqlConnection mySqlConnection = new SqlConnection(connectionString);
			SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
			mySqlCommand.CommandText = selectString;
			SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
			mySqlDataAdapter.SelectCommand = mySqlCommand;
			DataSet myDataSet = new DataSet();
			mySqlConnection.Open();
			mySqlDataAdapter.Fill(myDataSet,"人员基本信息管理");
			mySqlConnection.Close();
			DataTable myDataTable = myDataSet.Tables["人员基本信息管理"];
			Form3 frm3 = new Form3();
			//frm3.dataset1 = myDataSet;
			frm3.test = selectString;
			frm3.ShowDialog();
			
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
		

		}







	}
}

⌨️ 快捷键说明

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