助理企业信息管理师技能试题三

发布时间:2024-08-25

技能试题三

题目:工资管理项目的设计与实现

1、创建工资管理项目,名称为第xx组拼音首字母,否则不得分。(如第一组)。(5分)

2、工资管理系统主界面设计。(15分)

3、MDI应用系统基本框架设计。(20分)

4、职工信息管理功能设计。(25分)

5、月工资发放功能设计。(25分)

6、查询功能设计。(10分)

技能试题三参考答案

1、创建工资管理项目,名称为第xx组拼音首字母,否则不得分。(如第一组)。(5分)

2、工资管理系统主界面设计(15分)

3、MDI应用系统基本框架设计。(20分)

只要实现功能即可得分,参考代码如下。

Public Class frmUserManage

Dim UserDa As SqlClient.SqlDataAdapter

Dim UserDs As New DataSet("UserDB")

Private Sub frmUserManage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'从数据库中获取用户表信息

UserDa = New SqlClient.SqlDataAdapter("Select * From 用户WHERE (用户<> 'ADMIN')",

MyApp.DB.DBConnString)

UserDa.Fill(UserDs, "用户")

Dim mcb As SqlClient.SqlCommandBuilder

mcb = New SqlClient.SqlCommandBuilder(UserDa)

'将用户表绑定到UserBindingSource组件上

http://www.77cn.com.cnerBindingSource.DataSource = UserDs

http://www.77cn.com.cnerBindingSource.DataMember = "用户"

'将UserBindingSource组件绑定到DatagridView控件和窗体的MyBindingsource上

http://www.77cn.com.cnerDataGridView.DataSource = http://www.77cn.com.cnerBindingSource

Me.MyBindingsource = http://www.77cn.com.cnerBindingSource

'设置"密码", "、操作人", "操作时间"只独

For i As Integer = 0 To http://www.77cn.com.cnerDataGridView.Columns.Count - 1

Select Case http://www.77cn.com.cnerDataGridView.Columns(i).DataPropertyName

Case "密码", "操作人", "操作时间"

http://www.77cn.com.cnerDataGridView.Columns(i).ReadOnly = True

End Select

Next

End Sub

Private Sub UserBindingSource_AddingNew(ByVal sender As Object, ByVal e As

http://www.77cn.com.cnponentModel.AddingNewEventArgs) Handles UserBindingSource.AddingNew

With UserDs.Tables("用户")

.Columns("用户").DefaultValue = UserBindingSource.Count.ToString

.Columns("用户名").DefaultValue = UserBindingSource.Count.ToString

.Columns("密码").DefaultValue = MyApp.GetEnPassword("123")

.Columns("操作人").DefaultValue = http://www.77cn.com.cnerID

.Columns("操作时间").DefaultValue = MyApp.GetServerTime

End With

End Sub

Private Sub UserBindingSource_DataError(ByVal sender As Object, ByVal e As

System.Windows.Forms.BindingManagerDataErrorEventArgs) Handles UserBindingSource.DataError

MessageBox.Show("数据出错!原因:" & e.Exception.Message, "错误提示:", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Sub

Private Sub UserDataGridView_DataError(ByVal sender As Object, ByVal e As

System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles UserDataGridView.DataError

MessageBox.Show("数据出错!原因:" & e.Exception.Message, "错误提示:", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Sub

Overrides Sub Bar_UpdateData()

http://www.77cn.com.cnerBindingSource.EndEdit()

Me.MyUpdataDataWithDataAdpater(UserDa, UserDs.Tables("用户").GetChanges)

UserDs.Tables("用户").AcceptChanges()

End Sub

Public Overrides Sub Bar_ExcelInfo()

With Me.MyExcelInfo

.ReportTitle = http://www.77cn.com.cn.Unit

.ReportSubTitle = "用户明细表"

.PrintUnit = http://www.77cn.com.cnerName

.XlsFileName = Application.StartupPath & "\" & .ReportSubTitle & ".xls"

.ExcelKey = "123"

End With

End Sub

Public Overrides Sub Bar_DataExport()

With Me.MyDataExport

.FilePath = Application.StartupPath

.FileName = "用户"

End With

End Sub

End Class

4、职工信息管理功能设计(25分)

Private Sub DataTreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As

System.Windows.Forms.TreeViewEventArgs) Handles DataTreeView1.AfterSelect

MyApp.LoadTreeLeaf(Me.DataTreeView1, 1)

_CurrentTreeLevel = Me.DataTreeView1.GetNodeLevel(DataTreeView1.SelectedNode)

_CurrentDept = DataTreeView1.SelectedNode.Text

End Sub

Private Sub 单项维护DataGridView_ColumnHeaderMouseClick(ByVal sender As Object, ByVal e As

System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles 单项维护DataGridView.ColumnHeaderMouseClick

If e.Button = Windows.Forms.MouseButtons.Middle Then

Me.CaptionBar1.ShowLabelHeader(e.ColumnIndex)

End If

End Sub

Private Sub 单项维护DataGridView_RowValidated(ByVal sender As Object, ByVal e As

System.Windows.Forms.DataGridViewCellEventArgs) Handles 单项维护DataGridView.RowValidated

Dim mDr As DataRow = CType(Me.单项维护BindingSource.Current, DataRowView).Row

If mDr(Me.项目.ToString, DataRowVersion.Original) <> mDr(Me.项目.ToString, DataRowVersion.Current) Then

mDr("操作人") = http://www.77cn.com.cnerID

mDr("操作时间") = MyApp.GetServerTime

Else

mDr.RejectChanges()

End If

End Sub

Private Function GetDtdx() As DataTable

Dim mDt As DataTable = 工资管理DataSet.单项维护.Copy

Dim mCount As Integer = 0

For i As Integer = 0 To mDt.Columns.Count - 1 - mCount

Dim mCol As DataColumn = mDt.Columns(0)

With (mDt.Columns(i - mCount))

If Not (.ColumnName = Me.项目.ToString Or .ColumnName = "职工ID" Or .ColumnName = "姓名" Or .ColumnName = "性别" Or .ColumnName = "操作人" Or .ColumnName = "操作时间") Then

mDt.Columns.Remove(.ColumnName)

mCount = mCount + 1

If mCount = 5 Then

Exit For

End If

End If

End With

Next

Return mDt

End Function

(5)月工资发放功能设计(25分)

Public Class frmygzbb

Private Sub frmygzbb_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load App.SetnyCombobox(http://www.77cn.com.cnboBox1)

End Sub

Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click

Dim mDt As New DataTable

Dim mSql As String = "select * ,基础工资+ 岗位工资AS 应发金额, " _

& " 基础工资+ 岗位工资- 工会费- 公积金- 医保- 所得税AS 实发金额" _

& " from 月工资where 年月= '" & http://www.77cn.com.cnboBox1.SelectedValue & "'"

mDt = GetDataTable(mSql, App.DB.DBConnString)

If Me.RadioButton1.Checked Then

Dim oRpt As New Crpgzt

oRpt.SetDataSource(mDt)

Dim GetTextObject As CrystalDecisions.CrystalReports.Engine.TextObject

GetTextObject = oRpt.ReportDefinition.ReportObjects("TextReportTitle")

GetTextObject.Text = http://www.77cn.com.cn.Unit & http://www.77cn.com.cnboBox1.Text & "职工工资条"

GetTextObject = oRpt.ReportDefinition.ReportObjects("TextLister")

GetTextObject.Text = "制表人:" & http://www.77cn.com.cnerName

CrystalReportViewer1.ReportSource() = oRpt

CrystalReportViewer1.DisplayGroupTree = False

End If

If Me.RadioButton2.Checked Then

Dim oRpt As New Crpgzb

oRpt.SetDataSource(mDt)

Dim GetTextObject As CrystalDecisions.CrystalReports.Engine.TextObject

GetTextObject = oRpt.ReportDefinition.ReportObjects("TextReportTitle")

GetTextObject.Text = http://www.77cn.com.cn.Unit & http://www.77cn.com.cnboBox1.Text & "职工工资表"

GetTextObject = oRpt.ReportDefinition.ReportObjects("TextLister")

GetTextObject.Text = "制表人:" & http://www.77cn.com.cnerName

CrystalReportViewer1.ReportSource() = oRpt

CrystalReportViewer1.DisplayGroupTree = True

End If

CrystalReportViewer1.Refresh()

End Sub

End Class

(6)查询功能设计。(10分)

Public Class frmZggzcx

Private Sub frmZgjbxxwh_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.CaptionBar1.MyGrid = Me.月工资DataGridView

MyApp.SetnyCombobox(http://www.77cn.com.cnboBox1)

MyApp.SetnyCombobox(http://www.77cn.com.cnboBox2)

Me.BindingNavigatorAddNewItem.Visible = False

Me.BindingNavigatorDeleteItem.Visible = False

Me.部门编码表TableAdapter.Connection.ConnectionString = MyApp.DB.DBConnString

Me.职工分类编码表TableAdapter.Connection.ConnectionString = MyApp.DB.DBConnString

Me.职工分类编码表TableAdapter.Fill(Me.工资管理DataSet.职工分类编码表)

Me.部门编码表TableAdapter.Fill(Me.工资管理DataSet.部门编码表)

End Sub

Private Sub 月工资DataGridView_ColumnHeaderMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles 月工资DataGridView.ColumnHeaderMouseClick

If e.Button = Windows.Forms.MouseButtons.Middle Then

Me.CaptionBar1.ShowLabelHeader(e.ColumnIndex)

End If

End Sub

Overrides Sub Bar_LoadData()

Try

Dim mSql As String = "select *,基础工资+ 岗位工资AS 应发金额, 基础工资+ 岗位工资- 工会费- 公积金- 医保- 所得税AS 实发金额from 月工资where ( 年月between '" & http://www.77cn.com.cnboBox1.SelectedValue & "' and '" & http://www.77cn.com.cnboBox2.SelectedValue _

& "' ) and (" & Me.月工资DataGridView.Columns(Me.CaptionBar1.MyColumnIndex).DataPropertyName If Me.月工资DataGridView.Columns(Me.CaptionBar1.MyColumnIndex).ValueType.ToString =

"System.String" Then

mSql = mSql & " = '" & RTrim(Me.CaptionBar1.TextBox1.Text) & "')"

Else

mSql = mSql & " = " & RTrim(Me.CaptionBar1.TextBox1.Text) & ")"

End If

Dim mDa As New SqlClient.SqlDataAdapter(mSql, MyApp.DB.DBConnString)

Me.工资管理DataSet.月工资.Clear()

mDa.Fill(Me.工资管理DataSet.月工资)

If Me.工资管理DataSet.月工资.Rows.Count = 0 Then

Me.CaptionBar1.ShowDataGridCaption("")

MessageBox.Show("没有查询到任何数据!", "信息提示:", MessageBoxButtons.OK,

http://www.77cn.com.cnrmation)

Else

Me.CaptionBar1.ShowDataGridCaption("共计:" & Me.工资管理DataSet.月工资.Rows.Count.ToString & "条")

End If

Catch ex As Exception

Me.CaptionBar1.ShowDataGridCaption("")

MessageBox.Show("数据加载出错!原因:" & ex.Message, "错误提示:", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

End Sub

End Class

    精彩图片

    热门精选

    大家正在看