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

📄 traininfoform.cs

📁 c#编写的人事管理系统源码 写得不错 值得收藏
💻 CS
📖 第 1 页 / 共 3 页
字号:
			this.groupBox1.Controls.Add(this.Trainname_txt);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.name_txt);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.ID_txt);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Location = new System.Drawing.Point(16, 40);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(896, 88);
			this.groupBox1.TabIndex = 2;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "查找记录";
			this.groupBox1.Visible = false;
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(544, 56);
			this.button2.Name = "button2";
			this.button2.TabIndex = 11;
			this.button2.Text = "取消";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(328, 56);
			this.button1.Name = "button1";
			this.button1.TabIndex = 10;
			this.button1.Text = "查找记录";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// dateTimePicker2
			// 
			this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Short;
			this.dateTimePicker2.Location = new System.Drawing.Point(104, 48);
			this.dateTimePicker2.Name = "dateTimePicker2";
			this.dateTimePicker2.Size = new System.Drawing.Size(100, 21);
			this.dateTimePicker2.TabIndex = 9;
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(24, 56);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(80, 16);
			this.label5.TabIndex = 8;
			this.label5.Text = "培训结束时间";
			// 
			// dateTimePicker1
			// 
			this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short;
			this.dateTimePicker1.Location = new System.Drawing.Point(760, 16);
			this.dateTimePicker1.Name = "dateTimePicker1";
			this.dateTimePicker1.Size = new System.Drawing.Size(100, 21);
			this.dateTimePicker1.TabIndex = 7;
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(664, 24);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(80, 16);
			this.label4.TabIndex = 6;
			this.label4.Text = "培训开始时间";
			// 
			// Trainname_txt
			// 
			this.Trainname_txt.Location = new System.Drawing.Point(536, 16);
			this.Trainname_txt.Name = "Trainname_txt";
			this.Trainname_txt.TabIndex = 5;
			this.Trainname_txt.Text = "";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(456, 24);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(56, 16);
			this.label3.TabIndex = 4;
			this.label3.Text = "培训名称";
			// 
			// name_txt
			// 
			this.name_txt.Location = new System.Drawing.Point(320, 16);
			this.name_txt.Name = "name_txt";
			this.name_txt.TabIndex = 3;
			this.name_txt.Text = "";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(232, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(56, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "员工姓名";
			// 
			// ID_txt
			// 
			this.ID_txt.Location = new System.Drawing.Point(104, 16);
			this.ID_txt.Name = "ID_txt";
			this.ID_txt.TabIndex = 1;
			this.ID_txt.Text = "";
			this.ID_txt.TextChanged += new System.EventHandler(this.ID_txt_TextChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(32, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(56, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "员工编号";
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = "页面设置";
			this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "打印预览";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "打印";
			this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
			// 
			// printDocument1
			// 
			this.printDocument1.OriginAtMargins = true;
			this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
			// 
			// printPreviewDialog1
			// 
			this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
			this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
			this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
			this.printPreviewDialog1.Document = this.printDocument1;
			this.printPreviewDialog1.Enabled = true;
			this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
			this.printPreviewDialog1.Location = new System.Drawing.Point(362, 17);
			this.printPreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);
			this.printPreviewDialog1.Name = "printPreviewDialog1";
			this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
			this.printPreviewDialog1.UseAntiAlias = true;
			this.printPreviewDialog1.Visible = false;
			this.printPreviewDialog1.Closed += new System.EventHandler(this.printPreviewDialog1_Closed);
			// 
			// printDialog1
			// 
			this.printDialog1.AllowSelection = true;
			this.printDialog1.AllowSomePages = true;
			this.printDialog1.Document = this.printDocument1;
			this.printDialog1.ShowHelp = true;
			// 
			// pageSetupDialog1
			// 
			this.pageSetupDialog1.Document = this.printDocument1;
			this.pageSetupDialog1.ShowHelp = true;
			// 
			// TrainInfoForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(920, 453);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.toolBar1);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "TrainInfoForm";
			this.Text = "培训记录";
			this.Load += new System.EventHandler(this.TrainInfoForm_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		#region  窗体出现相关数据绑定
		private void TrainInfoForm_Load(object sender, System.EventArgs e)
		{
		    DBDataGrid();
			switch(Form1.f1.power)
			{
				case "系统管理员":
				{
					this.toolBarButton5.Enabled = true;
					this.toolBarButton6.Enabled = true;
					this.toolBarButton7.Enabled = true;
					break;
				}
				case "管理员":
				{
					this.toolBarButton5.Enabled = true;
					this.toolBarButton6.Enabled = true;
					this.toolBarButton7.Enabled = true;
					break;
				}
				case "一般用户":
				{
					this.toolBarButton5.Enabled = false;
					this.toolBarButton6.Enabled = false;
					this.toolBarButton7.Enabled = false;
					break;
				}
				default :
				{
					this.toolBarButton5.Enabled = false;
					this.toolBarButton6.Enabled = false;
					this.toolBarButton7.Enabled = false;
					break;
				}
			}
		}
		#endregion

		#region  DataGrid数据绑定
		public void DBDataGrid()
		{
			string s = "select TrainInfo.tttId, TrainInfo.trId as 员工编号,EmployInfo.eName as 员工姓名,TrainInfo.trName as 培训名称,TrainInfo.trContext as 培训内容,";
			s += "TrainInfo.trUnit as 培训单位,TrainInfo.trAddr as 培训地点,TrainInfo.trExp as 培训费用,TrainInfo.trResulte as 培训结果,TrainInfo.trFdate as 培训开始时间,";
			s += "TrainInfo.trLdate as 培训结束时间,TrainInfo.trRemarks as 备注 from TrainInfo,EmployInfo where TrainInfo.trId=EmployInfo.trId order by TrainInfo.trId asc";
			DataTable dt = new DataTable();
			Base bb= new Base();
			this.dt = bb.ExeSQLdt(s);
			this.dataGrid1.DataSource = this.dt.DefaultView;
			this.cm = (CurrencyManager)BindingContext[this.dt];
			File.DataGridStyle(this.dt,8,this.dataGrid1); 
		}
		#endregion

		#region  工具栏事件
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			switch(e.Button.ToolTipText)
			{
				case "首记录":
				{
					if(cm.Position != 0)
					{
						this.dataGrid1.UnSelect(cm.Position);
						cm.Position = 0;
						this.dataGrid1.Select(cm.Position);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "上记录":
				{
					if(cm.Position > 0)
					{
						this.dataGrid1.UnSelect(cm.Position );
						cm.Position -= 1;
						this.dataGrid1.Select(cm.Position);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "下记录":
				{
					if(cm.Position < cm.Count - 1)
					{
						this.dataGrid1.UnSelect(cm.Position );
						cm.Position += 1;
						this.dataGrid1.Select(cm.Position);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "尾记录":
				{
					if(cm.Position != cm.Count - 1)
					{
						this.dataGrid1.UnSelect(cm.Position);
						cm.Position = cm.Count - 1;
						this.dataGrid1.Select(cm.Count - 1);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "添加":
				{
					this.insert(sender,e);
					break;
				}
				case "修改":
				{
					this.updata(sender,e);
					break;
				}
				case "删除":
				{

⌨️ 快捷键说明

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