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

📄 querypersonnelform.vb

📁 这是一个人事工资管理系统
💻 VB
📖 第 1 页 / 共 2 页
字号:
'文件名:QueryPersonnelForm.vb
Imports System.Data.SqlClient
Public Class QueryPersonnelForm
    Private MyPersonnelTable As DataTable
    Private MyFamilyTable As DataTable
    Private MyTrainingTable As DataTable
    Private MyArchievementTable As DataTable
    Private MyRewardsTable As DataTable
    Private MyLeaveTable As DataTable
    Private MyResumeTable As DataTable
    Public MyCompany As String
    Private Sub 查询ToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 查询ToolStripButton.Click
        Dim MySQLConnectionString As String = My.Settings.MyPersonnelConnectionString
        Dim MyConnection As New SqlConnection(MySQLConnectionString)
        MyConnection.Open()
        MyPersonnelTable = New DataTable()
        Dim MySQL As String = "Select * From 基本档案 Where 姓名 LIKE '" + Me.姓名ToolStripTextBox.Text + "'"
        Dim MyDataAdapter As New SqlDataAdapter(MySQL, MyConnection)
        MyDataAdapter.Fill(MyPersonnelTable)
        Me.基本档案DataGridView.DataSource = MyPersonnelTable
        If (MyConnection.State = ConnectionState.Open) Then
            MyConnection.Close()
        End If
    End Sub
    Private Sub 打印基本档案ToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 打印基本档案ToolStripButton.Click
        Me.printPreviewDialog1.Document = Me.printDocument1
        Me.printPreviewDialog1.ShowDialog()
    End Sub

    Private Sub 基本档案DataGridView_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 基本档案DataGridView.SelectionChanged
        Dim My员工编号 As String = Me.基本档案DataGridView.CurrentRow.Cells(1).Value.ToString()
        Dim MySQLConnectionString As String = My.Settings.MyPersonnelConnectionString
        Dim MyConnection As New SqlConnection(MySQLConnectionString)
        MyConnection.Open()
        MyFamilyTable = New DataTable()
        Dim MySQL As String = "Select 家庭成员姓名,与员工关系,工作单位,担任职务,政治面貌,联系电话,其他 From 员工家庭成员 Where 员工编号= '" + My员工编号 + "'"
        Dim MyDataAdapter As New SqlDataAdapter(MySQL, MyConnection)
        MyDataAdapter.Fill(MyFamilyTable)
        Me.家庭成员DataGridView.DataSource = MyFamilyTable
        MyTrainingTable = New DataTable()
        MySQL = "Select 开始时间,结束时间,培训单位,培训地点,培训内容,培训经费,证书名称,说明 From 培训记录 Where 员工编号= '" + My员工编号 + "'"
        MyDataAdapter = New SqlDataAdapter(MySQL, MyConnection)
        MyDataAdapter.Fill(MyTrainingTable)
        Me.培训记录DataGridView.DataSource = MyTrainingTable
        MyArchievementTable = New DataTable()
        MySQL = "Select 工作业绩,专长描述,说明 From 工作业绩 Where 员工编号= '" + My员工编号 + "'"
        MyDataAdapter = New SqlDataAdapter(MySQL, MyConnection)
        MyDataAdapter.Fill(MyArchievementTable)
        Me.工作业绩DataGridView.DataSource = MyArchievementTable
        MyRewardsTable = New DataTable()
        MySQL = "Select 奖惩日期,奖惩类型,奖惩原因,奖惩批准单位,解除处分日期,说明 From 奖惩记录 Where 员工编号= '" + My员工编号 + "'"
        MyDataAdapter = New SqlDataAdapter(MySQL, MyConnection)
        MyDataAdapter.Fill(MyRewardsTable)
        Me.奖惩记录DataGridView.DataSource = MyRewardsTable
        MyResumeTable = New DataTable()
        MySQL = "Select 开始时间,结束时间,单位名称,担任职务,所在部门,说明 From 工作简历 Where 员工编号= '" + My员工编号 + "'"
        MyDataAdapter = New SqlDataAdapter(MySQL, MyConnection)
        MyDataAdapter.Fill(MyResumeTable)
        Me.工作简历DataGridView.DataSource = MyResumeTable
        MyLeaveTable = New DataTable()
        MySQL = "Select 离职时间,离职原因,批准人,说明 From 离职管理 Where 员工编号= '" + My员工编号 + "'"
        MyDataAdapter = New SqlDataAdapter(MySQL, MyConnection)
        MyDataAdapter.Fill(MyLeaveTable)
        Me.离职原因DataGridView.DataSource = MyLeaveTable
        If (MyConnection.State = ConnectionState.Open) Then
            MyConnection.Close()
        End If
    End Sub
    Private Sub printDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDocument1.PrintPage
        '打印员工人事档案
        e.Graphics.DrawString(Me.MyCompany + "员工人事档案", New Font("宋体", 20), Brushes.Black, 150, 80)
        e.Graphics.DrawString("单位公章:", New Font("宋体", 12), Brushes.Black, 100, 145)
        e.Graphics.DrawString("打印日期:" + DateTime.Now.ToString(), New Font("宋体", 12), Brushes.Black, 450, 145)
        e.Graphics.DrawLine(New Pen(Color.Black, 3.0), 100, 165, 720, 165)
        e.Graphics.DrawString("员工编号:" + Me.基本档案DataGridView.CurrentRow.Cells(1).Value.ToString(), New Font("宋体", 12), Brushes.Black, 110, 175)
        e.Graphics.DrawString("部门:" + Me.基本档案DataGridView.CurrentRow.Cells(2).Value.ToString(), New Font("宋体", 12), Brushes.Black, 300, 175)
        e.Graphics.DrawString("姓名:" + Me.基本档案DataGridView.CurrentRow.Cells(3).Value.ToString(), New Font("宋体", 12), Brushes.Black, 450, 175)
        e.Graphics.DrawString("性别:" + Me.基本档案DataGridView.CurrentRow.Cells(4).Value.ToString(), New Font("宋体", 12), Brushes.Black, 620, 175)
        e.Graphics.DrawLine(New Pen(Color.Black), 100, 195, 720, 195)
        e.Graphics.DrawString("出生年月:" + (Me.基本档案DataGridView.CurrentRow.Cells(5).Value).ToShortDateString(), New Font("宋体", 12), Brushes.Black, 110, 200)
        e.Graphics.DrawString("身份证号码:" + Me.基本档案DataGridView.CurrentRow.Cells(6).Value.ToString(), New Font("宋体", 12), Brushes.Black, 300, 200)
        e.Graphics.DrawString("民族:" + Me.基本档案DataGridView.CurrentRow.Cells(7).Value.ToString(), New Font("宋体", 12), Brushes.Black, 620, 200)
        e.Graphics.DrawLine(New Pen(Color.Black), 100, 220, 720, 220)
        e.Graphics.DrawString("政治面貌:" + Me.基本档案DataGridView.CurrentRow.Cells(8).Value.ToString(), New Font("宋体", 12), Brushes.Black, 110, 225)
        e.Graphics.DrawString("婚姻状况:" + Me.基本档案DataGridView.CurrentRow.Cells(9).Value.ToString(), New Font("宋体", 12), Brushes.Black, 270, 225)
        e.Graphics.DrawString("文化程度:" + Me.基本档案DataGridView.CurrentRow.Cells(10).Value.ToString(), New Font("宋体", 12), Brushes.Black, 400, 225)
        e.Graphics.DrawString("专业:" + Me.基本档案DataGridView.CurrentRow.Cells(11).Value.ToString(), New Font("宋体", 12), Brushes.Black, 530, 225)
        e.Graphics.DrawLine(New Pen(Color.Black), 100, 245, 720, 245)
        e.Graphics.DrawString("毕业院校:" + Me.基本档案DataGridView.CurrentRow.Cells(12).Value.ToString(), New Font("宋体", 12), Brushes.Black, 110, 250)
        e.Graphics.DrawString("职称:" + Me.基本档案DataGridView.CurrentRow.Cells(13).Value.ToString(), New Font("宋体", 12), Brushes.Black, 450, 250)
        e.Graphics.DrawString("职务:" + Me.基本档案DataGridView.CurrentRow.Cells(14).Value.ToString(), New Font("宋体", 12), Brushes.Black, 600, 250)
        e.Graphics.DrawLine(New Pen(Color.Black), 100, 270, 720, 270)
        e.Graphics.DrawString("进入本单位时间:" + (Me.基本档案DataGridView.CurrentRow.Cells(15).Value).ToShortDateString(), New Font("宋体", 12), Brushes.Black, 110, 275)

⌨️ 快捷键说明

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