版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
-完成主界面的設(shè)計;登陸界面的設(shè)計說明:因為各個窗體均需要對數(shù)據(jù)庫進行訪問,可以把對數(shù)據(jù)庫的一個類來實現(xiàn),這樣可以使對數(shù)據(jù)庫的訪問更加簡單。ImportsSystem.DataImportsSystem.Data.OleDbImportsSystem.ComponentModelPublicClassDataBaseImplementsIDisposable'實現(xiàn)接口IDisposable,PrivateOledbConnAsOleDbConnectionPrivatetransAsOleDbTransaction'事務(wù)處理對象DimOledbCommAsPublicSharedsConnAsString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=hrmbook.mdb;PersistSecurityInfo=False"PrivatedisposedValueAsBoolean=FalseProtectedOverridableSubDispose(ByValdisposingAsBoolean)IfNotMe.disposedValueThenIfdisposing'TODO:IfOledbConnIsNothing=FalseThenOledbConn=NothingEndIfEnd'TODO:EndMe.disposedValue=TrueEndSub#Region"IDisposableSupport'VisualBasicPublicSubDispose()Implements'不要更改此代碼。請將清理代碼放入上面的Dispose(ByValdisposingAsBoolean)EndSub#EndPublicSubIfOledbConnIsNothingTrueThenOledbConnNewOleDbConnection(sConn)'me.sConnEndIfEndPublicSubIfOledbConnIsNothing=FalseThenEndIfEndPublicFunctionRunSelectSQL(ByValsSQLStringAsSystem.String)AsDataViewDimOledbDSAsDataSet=NewDimOledbDAAsOleDbDataAdapter=NewOleDbDataAdapter(sSQLString,Me.OledbConn)ReturnOledbDS.Tables(0).DefaultViewEndFunctionPublicSubRunDelOrInsSQL(ByValsSQLStringAsSystem.String)DimOledbCommAsOleDbCommand=NewOleDbCommand(sSQLString,Me.OledbConn)EndPublicSubRunMulDelOrInsSQL(ByValarrAstrans=附主界面代碼以及代碼截圖:(要把啟動對象設(shè)置為DimiAs附主界面代碼以及代碼截圖:(要把啟動對象設(shè)置為Fori=0Toarr.Count-OledbComm=NewOleDbCommand(arr(i),Me.OledbConn)OledbComm.Transaction=transNextiCatchexAsExceptionThrowNewExceptionEndTryEndSubPublicFunctiongetResult(ByValstrSqlAsString)AsOleDbDataReaderOledbComm=NewOleDbCommand(strSql,Me.OledbConn)DimdrAsOleDbDataReader=OledbComm.ExecuteReader()ReturndrEndFunctionEndClass3)SubPublicClassPublicSharedSubDimfrmlAsNewfrml.ShowDialog()Iffrml.bResultThenDimfmAsNewfrmMainEndIfEndSubPrivateFunctionGetInstanceState(ByValnameAsString)AsBooleanDimiAsInteger=Me.MdiChildren.LengthFori=0ToMe.MdiChildren.Length-1IfMe.MdiChildren(i).Name=nameThenReturnTrueEndIfReturnFalseEndFunction'“機構(gòu)編制管理(&X)”PrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles機構(gòu)設(shè)置及編碼ToolStripMenuItem.ClickIfGetInstanceState("frmDepManage")ThenExitSubEndfrmDepManage.MdiParent=Me EndPrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles機構(gòu)詳細(xì)信息ToolStripMenuItem.ClickIfGetInstanceState("frmDepInfo")ThenExitSubEndDimchildFrmAsNewfrmDepInfo'frmDepInfo是“機構(gòu)詳細(xì)信息”模塊窗體的Name屬性值childFrm.MdiParent=MeEndPrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles退出ToolStripMenuItem.ClickEnd'“人員信息管理(&Y)”'2)“職員信息查詢”---對應(yīng)菜單的Name屬性值:職員信息查詢PrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles職員信息維護ToolStripMenuItem.ClickIfGetInstanceState("frmPeopleManage")ThenExitSubEndDimchildFrmAsNewfrmPeopleManage'frmPeopleManage是“職員信息維護”模塊窗體的
childFrm.MdiParent=MeEndPrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles職員信息查詢ToolStripMenuItem.ClickIfGetInstanceState("frmPeopleQuery")ThenExitSubEndDimchildFrmAsNewfrmPeopleQuery'frmPeopleQuery是“職員信息查詢”模塊窗體的NamechildFrm.MdiParent=MeEnd'"薪資福利管理(&Z)"'3)“職員懲罰管理”---對應(yīng)菜單的Name屬性值:職員懲罰管理PrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles當(dāng)月工資管理ToolStripMenuItem.ClickIfGetInstanceState("frmSalaryManage")ThenExitSubEndDimchildFrmAsNewfrmSalaryManage'frmSalaryManage是“當(dāng)月工資管理”模塊窗體的
childFrm.MdiParent=MeEndPrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles工資發(fā)放歷史ToolStripMenuItem.ClickIfGetInstanceState("frmSalaryHis")ThenExitSubEndDimchildFrmAsNewfrmSalaryHis'frmSalaryHis是“工資發(fā)放歷史”模塊窗體的Name屬性值childFrm.MdiParent=MeEndSubPrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles職員獎勵管理ToolStripMenuItem.ClickIfGetInstanceState("frmPrize")ThenExitSubEndDimchildFrmAsNewfrmPrize'frmPrize是“職員獎勵管理”模塊窗體的Name屬性值childFrm.MdiParent=MeEndSubPrivateSubToolStripMenuItem_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handles職員懲罰管理ToolStripMenuItem.ClickIfGetInstanceState("frmPunishInfo")ThenExitSubEndDimchildFrmAsNewfrmPunishInfo'frmPunishInfo是“職員懲罰管理”模塊窗體的NamechildFrm.MdiParent=MeEndEnd本系統(tǒng)的數(shù)據(jù)庫描述如下:(注意表間關(guān)系的建??,請看提供的數(shù)據(jù)庫文件hrmbook.mdb,同學(xué)們可直接使用數(shù)據(jù)庫表(7123457“機構(gòu)編制管理(&X)”“機構(gòu)設(shè)置及編碼”窗體模塊frmDepManage的實現(xiàn)“機構(gòu)詳細(xì)信息”frmDepInfo窗體模塊的實現(xiàn)“機構(gòu)設(shè)置及編碼”窗體frmDepManage織機構(gòu)在TreeViewPublicClassfrmDepManagePrivatedvListAsDataViewPrivateSubInitTree(ByRefnodesAsTreeNodeCollection,ByValsParentIndexAsString)
DimtmpNodeAsTreeNodeDimabsIndexAsStringDimdvTempAsDataViewdvList.Table.DefaultViewDimdataRows()AsDataRow=dvList.Table.Select("ParentIndex='"&sParentIndex'循環(huán)添加ForEachdrAsDataRowIndataRowstmpNode=NewTreeNodetmpNode.Textdr("類別")absIndex=dr("AbsIndex")InitTree(nodes(nodes.Count-1).Nodes,CatchexAsEndTryEndPrivateSubfrmDepManage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDimdbAsNewDataBaseDimstrSQLAsStringstrSQL"select*fromorderbyabsIndex"dvList=db.RunSelectSQL(strSQL)InitTree(trvList.Nodes,"-1")EndEndDataGridViewdgvDepInfo.DataSource=dt.DefaultView“人員信息管理(&Y)”“職員信息維護”窗體模塊frmPeopleManage的實現(xiàn)frmPeopleQuery“職員信息維護”窗體模塊frmPeopleManage的設(shè)計、代碼如下:相應(yīng)文本框控件和相應(yīng)字段綁定,DataGridViewPublicClassPrivateiCurrentLineAsInteger=-1PrivateSubSetDataGridView()Me.OleDbConnection1.ConnectionString=DataBase.sConnDimdtAsdtMe.DataSet11.Tables("職員基本信息表")'dt.DefaultView.AllowDelete=False'dt.DefaultView.AllowNew=FalsedgvPeopleInfo.DataSource=dt.DefaultViewEndPrivateSubfrmPeopleManage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadMe.OleDbDataAdapter1.Fill(Me.DataSet11,DimdbAsDataBase=NewDataBaseDimstrSQLAsString"selectfrom"strSQLorderbyDimdvAsDataView=db.RunSelectSQL(strSQL)ForEachdrvAsDataRowViewIndvIfMe.TextBox18.Text.Trim.Length<>0ThenMe.PictureBox1.Image=Me.PictureBox1.Image=NothingEndIfEndPrivateSubdgvPeopleInfo_CellClick(ByValsenderAsObject,ByValeAsSystem.Windows.Forms.DataGridViewCellEventArgs)HandlesdgvPeopleInfo.CellClickBindingContext(Me.DataSet11,"職員基本信息表IfiCurrentLine=-1OriCurrentLine<>dgvPeopleInfo.CurrentCell.RowIndexTheniCurrentLine=dgvPeopleInfo.CurrentCell.RowIndexBindingContext(Me.DataSet11,").PositionEndIfdgvPeopleInfo.CurrentCell.RowIndexMe.DataSet11.Tables("職員基本信息表").Rows.CountThenBindingContext(Me.DataSet11,").SuspendBinding()EndIfIfMe.TextBox18.Text.Trim.Length<>0ThenMe.PictureBox1.Image=Me.PictureBox1.Image=NothingEndIfCatchexAsExceptionEndTryEndSubPrivateSubToolStrip1_ItemClicked(ByValsenderAsSystem.Object,ByValeAsSystem.Windows.Forms.ToolStripItemClickedEventArgs)HandlesToolStrip1.ItemClickedIfe.ClickedItemIsMe.tbbSaveThenDimrowAsIntegerrow=dgvPeopleInfo.CurrentCell.RowIndexdgvPeopleInfo.CurrentCelldgvPeopleInfo.Rows(row1).Cells(0)BindingContext(Me.DataSet11,"職員基本信息表").Position=IfMe.DataSet11.HasChangesThenMe.DataSet11.Tables("職員基本信息表").DefaultView.RowFilterdgvPeopleInfo.CurrentCell=dgvPeopleInfo.Rows(row).Cells(0)dgvPeopleInfo.CurrentCelldgvPeopleInfo.Rows(row).Cells(0)EndCatchexAsEndTryElseIfe.ClickedItemIsMe.tbbDelThenDimiRowAsiRow=IfMessageBox.Show(""Confirm",MessageBoxButtons.YesNo)=Windows.Forms.DialogResult.YesThenMe.DataSet11.Tables("職員基本信息表ExitSubEndIfIfMe.DataSet11.HasChangesMe.OleDbDataAdapter1.Update(Me.DataSet11,EndIfCatchexAsMessageBox.Show("刪除數(shù)據(jù)出錯1!&ex.Message)EndTryCatchexAsExceptionEndTryEndIfEndPrivateSubcbbDepCode_TextChanged(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlescbbDepCode.TextChangedDimdbAsDataBase=NewDimstrSQLAsString"selectfrom"strSQL+="組織機構(gòu)編碼表where單位編號='"strSQL+=Me.cbbDepCode.Text.Trim+"'"DimdvAsDataView=db.RunSelectSQL(strSQL)Ifdv.Table.Rows.Count<>0ThenMe.TextBox16.Text=Me.TextBox16.Text=""EndIfEndSubEndClass“當(dāng)月工資管理”窗體模塊功能的實現(xiàn)“工資發(fā)放歷史”窗體模塊功能的實現(xiàn)“職員獎勵管理”窗體模塊功能的實現(xiàn)“職員懲罰管理”窗體模塊功能的實現(xiàn)12PublicClassPrivatedvMasterAsDataViewPrivateiCurrentLineAsInteger=-1PrivateSubLoadData()DimstrSQLAsString"selectstrSQL+="工資合計,個人所得稅,實發(fā)金額,發(fā)放否,a.職員編號"strSQL+="from職員基本信息表asa,月工資統(tǒng)計表asb"strSQLwherea.職員編號=b.orderbyDimdbAsDataBase=NewDataBasedvMaster=db.RunSelectSQL(strSQL)dvMaster.AllowDelete=FalsedvMaster.AllowNew=FalsedvMaster.AllowEdit=FalsedgvSalaryInfo.DataSourcedvMasterForiAsInteger0To8Me.dgvSalaryInfo.Columns(i).AutoSizeMode=ForiAsInteger=0To8Me.dgvSalaryInfo.Columns(i).SortMode=Me.OleDbConnection1.ConnectionString=DataBase.sConnMe.OleDbDataAdapter1.Fill(Me.DataSet11,EndPrivateSubfrmSalaryManage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDimstrSQLAsString"insertintoselectfrom基本信息表ashwhereh.職員編號notin(select職員編號from月工資統(tǒng)計表)"DimdbAsDataBase=NewDataBaseEndSubPrivateSubbtnCalSalary_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnCalSalary.ClickIfMe.txbNowSalary.Text.Trim.Length<>6ExitSubEndDimmonthAsInteger=Convert.ToInt32(Me.txbNowSalary.Text.Trim)DimdbAsDataBase=NewDataBaseDimarrAsArrayList=NewDimstrSQLAsString="selectsum(獎勵金額)as獎金,i.職員編號as職員編號from職asiwherei.andi.Convert.ToString(month*100)andi.獎勵日期<"+Convert.ToString((month+1)*100)+"groupbyi.職員編號"DimdrAsOleDb.OleDbDataReader=db.getResult(strSQL)While(dr.Read())DimjineAsDouble=dr.GetDouble(0)DimidAsString=dr.GetString(1)strSQL"Updatesetjine.ToString()where&id&"'and日期="&monthEndWhilestrSQL"updateset=0whereisnull"strSQL="selectsum(懲罰金額)as罰金,i.職員編號as職員編號from職員懲罰表asiwherei.andi.Convert.ToString(month*100)andi.懲罰日期Convert.ToString((month1)*100)groupbyi.dr=db.getResult(strSQL)WhileDimjineAsString=dr.GetDouble(0)DimidAsString=dr.GetString(1)strSQL"updatesetjine.ToString()where&id&"'and日期="&monthEndWhilestrSQL"updateset=0whereisnull"&strSQL="update月工資統(tǒng)計表setstrSQL"updateset補+房補+臨時補+職務(wù)工資+工齡工資+考核工資+獎金"strSQL"updatesetstrSQL"updatesetEndSubPrivateSubdgvSalaryInfo_CellClick(ByValsenderAsObject,ByValeAsSystem.Windows.Forms.DataGridViewCellEventArgs)HandlesdgvSalaryInfo.CellClickIfiCurrentLine1OriCurrentLinedgvSalaryInfo.CurrentCell.RowIndexTheniCurrentLine=dgvSalaryInfo.CurrentCell.RowIndexBindingContext(Me.DataSet11,"月工資統(tǒng)計表").Position=EndIfEndPrivateSubToolStripButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesToolStripButton1.ClickDimrowAsIntegerrow=Me.dgvSalaryInfo.CurrentCell.RowIndexMe.dgvSalaryInfo.CurrentCell=dgvSalaryInfo.Rows((row+1)ModBindingContext(Me.DataSet11,"月工資統(tǒng)計表").Position=IfMe.DataSet11.HasChanges(DataRowState.Modified)ThenMe.DataSet11.Tables("月工資統(tǒng)計表").DefaultView.RowFilter=""Me.dgvSalaryInfo.CurrentCellMe.dgvSalaryInfo.Rows(row).Cells(0)MessageBox.Show("EndIfCatchexAsMe.dgvSalaryInfo.CurrentCellMe.dgvSalaryInfo.Rows(row).Cells(0)MessageBox.Show("修改的數(shù)據(jù)出錯"&ex.Message)EndTryEndSubPrivateSubbtnGiveSalary_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnGiveSalary.ClickIfMessageBox.Show("是否發(fā)放?","Confirm",_MessageBoxButtons.YesNo)Windows.Forms.DialogResult.YesThenDimdbAsDataBase=NewDimidAsString=dvMaster.Table.Rows(dgvSalaryInfo.CurrentCell.RowIndex)("id&
DimarrAsArrayList=NewDimstrSQLAsString="update月工資統(tǒng)計表set發(fā)放否='是'where職員編號='"strSQL="insertinto工資發(fā)放歷史表select*from月工資統(tǒng)計表where='"&id&ExitSubEndIfEndSubEndClass“工資發(fā)放歷史”窗體frmSlaryHis的設(shè)計、運行界面第2次課要完成的任務(wù)2學(xué)時PublicClassPrivateSubSetDataGridView()Me.OleDbConnection1.ConnectionString=DataBase.sConndgvPrizeInfo.DataSourceMe.DataSet11.Tables("職員獎勵表").DefaultViewEndSubPrivateSubfrmPrize_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadEndSubPrivateSubtsbSave_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlestsbSave.ClickDimrowAsrow=Me.dgvPrizeInfo.CurrentCell.RowIndexMe.dgvPrizeInfo.CurrentCell=Me.dgvPrizeInfo.Rows(row+1).Cells(0)IfMe.DataSet11.HasChangesThenMe.DataSet11.Tables("職員獎勵表").DefaultView.RowFilterEndIfCatchexAsMessageBox.Show("修改的數(shù)據(jù)出錯!"&EndTryEndSubPrivateSubtsbDel_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlestsbDel.ClickDimrowAsrow=If
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年中國虛擬現(xiàn)實VR行業(yè)營銷創(chuàng)新戰(zhàn)略制定與實施研究報告
- 2025-2030年中國指紋識別芯片行業(yè)資本規(guī)劃與股權(quán)融資戰(zhàn)略制定與實施研究報告
- 2025-2030年中國玩具行業(yè)資本規(guī)劃與股權(quán)融資戰(zhàn)略制定與實施研究報告
- 2025-2030年中國酒店行業(yè)開拓第二增長曲線戰(zhàn)略制定與實施研究報告
- 2024年汽車智能座艙投融資研究白皮書
- 織物強力標(biāo)準(zhǔn)
- 關(guān)于“臥室裝飾燈”的調(diào)研問卷
- 福建省2024屆高三下學(xué)期6月模擬英語試題
- 收購某供水特許經(jīng)營項目SPV公司股權(quán)項目可行性研究報告
- 甲流防控知識培訓(xùn)課件
- 2025年包鋼(集團)公司招聘筆試參考題庫含答案解析
- 2025年沈陽水務(wù)集團招聘筆試參考題庫含答案解析
- 心肺復(fù)蘇術(shù)課件2024新版
- 2023-2024公需科目(數(shù)字經(jīng)濟與驅(qū)動發(fā)展)考試題庫及答案
- 重癥患者的容量管理課件
- 洪水計算(推理公式法)
- ap系列火焰光度計說明書
- GMW系列往復(fù)式給料機說明書
- 集裝箱碼頭堆場項目可行性研究報告寫作范文
- 食堂成本核算方案
- 醫(yī)保藥店一體化信息管理系統(tǒng)操作手冊
評論
0/150
提交評論