C#人事工資管理系統(tǒng)實(shí)驗(yàn)報(bào)告_第1頁(yè)
C#人事工資管理系統(tǒng)實(shí)驗(yàn)報(bào)告_第2頁(yè)
C#人事工資管理系統(tǒng)實(shí)驗(yàn)報(bào)告_第3頁(yè)
C#人事工資管理系統(tǒng)實(shí)驗(yàn)報(bào)告_第4頁(yè)
C#人事工資管理系統(tǒng)實(shí)驗(yàn)報(bào)告_第5頁(yè)
已閱讀5頁(yè),還剩21頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、武漢學(xué)院數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)報(bào)告計(jì)算機(jī)091學(xué)號(hào):姓名: 班級(jí): 指導(dǎo)教師:090501102畢波人事工資管理系統(tǒng)設(shè)計(jì)總說(shuō)明:在當(dāng)今社會(huì),工資管理是一項(xiàng)必要而且很關(guān)鍵的工作。現(xiàn)在隨著企業(yè)數(shù)量 的急劇增加,處理人們的工資數(shù)據(jù)變的越來(lái)越煩瑣艱巨。如今,計(jì)算機(jī)已經(jīng)普及到了幾乎每 個(gè)學(xué)校、家庭,我們的學(xué)習(xí)和生活已經(jīng)處處離不開(kāi)計(jì)算機(jī)的存在。本系統(tǒng)依據(jù)開(kāi)發(fā)要求主要應(yīng)用于企業(yè)人事系統(tǒng),完成對(duì)日常的工資增刪查改的數(shù)字化管 理。比較系統(tǒng)地對(duì)員工的信息和工資進(jìn)行管理,查詢、增添、修改、刪除都變的非常簡(jiǎn)便, 節(jié)省了大量的工作量。本課程設(shè)計(jì)是在學(xué)習(xí)了數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)和相關(guān)開(kāi)發(fā)軟件課程之后,讓學(xué)生通過(guò)實(shí)際 項(xiàng)目的設(shè)計(jì)、

2、開(kāi)發(fā),培養(yǎng)學(xué)生獨(dú)立進(jìn)行數(shù)據(jù)庫(kù)軟件的建模、在計(jì)算機(jī)中進(jìn)行數(shù)據(jù)庫(kù)設(shè)計(jì)、并 通過(guò)相關(guān)軟件開(kāi)發(fā)系統(tǒng)的能力。本系統(tǒng)的基本功能包括:部門信息的管理(查詢、添加、修改、刪除學(xué)生部門等)、職員信息的管理(錄入、查詢、修改、刪除員工的信息等)、工資信息的管理(錄入、查詢、修改 員工的工資等)。本系統(tǒng)主要用于對(duì)員工工資進(jìn)行管理,能夠進(jìn)行插入、刪除、修改、查詢和顯示員工的 信息。登錄該系統(tǒng)時(shí),用戶需要輸入口令和密碼,以確保數(shù)據(jù)的安全性,成功登錄的用戶, 可以插入員工的信息和工資,并對(duì)員工的信息和工資進(jìn)行增、刪、改操作?;谏鲜鱿敕ǎ覀儗T工數(shù)據(jù)保存到數(shù)據(jù)庫(kù)中。我們要求系統(tǒng)能夠高效快速的處理數(shù) 據(jù),并且要保證數(shù)據(jù)的

3、正確性、相容性和安全性。所以在數(shù)據(jù)庫(kù)中需要定義很多觸發(fā)器,比 如刪除了某個(gè)員工的信息則刪除對(duì)應(yīng)的所有工資信息、活著刪除了某部門則刪除該部門所有 的信息等。所以我們要從數(shù)據(jù)庫(kù)中讀取數(shù)據(jù),并且和界面聯(lián)系起來(lái),同時(shí)也能將用戶界面上的數(shù)據(jù) 存儲(chǔ)到數(shù)據(jù)庫(kù)中。以上是設(shè)計(jì)此系統(tǒng)應(yīng)該注意的地方和設(shè)計(jì)原則,以下就是遵循這些原則和 標(biāo)準(zhǔn)設(shè)計(jì)出的一套完整的管理系統(tǒng)。一系統(tǒng)需求:根據(jù)題目需求,可以把系統(tǒng)分為三個(gè)部分:部門信息管理部分、職員信息管理部分和工 資信息管理部分。本次實(shí)驗(yàn)中,我主要負(fù)責(zé)部門信息管理模塊,題中需要對(duì)部門信息進(jìn)行查 詢、添加、修改、刪除操作,這些操作按是否改變數(shù)據(jù)庫(kù)數(shù)據(jù)可分為兩類:查詢操作,只讀

4、取數(shù)據(jù)庫(kù)信息,不對(duì)信息做修改;刪除、更新和添加操作,需要對(duì)數(shù)據(jù)庫(kù)中的數(shù)據(jù)進(jìn)行讀寫 操作。因此只要寫兩部分代碼,查詢部分:de ptin fo_Query 進(jìn)行部門信息查詢,查詢數(shù)據(jù)庫(kù) 信息;信息管理部分:deptinfo_Manage,對(duì)信息進(jìn)行更新、增加和刪除。數(shù)據(jù)庫(kù)設(shè)計(jì)1. 數(shù)據(jù)需求人事工資管理系統(tǒng)需要完成的主要功能有:1員工的基本信息錄入2. 工資信息表的錄入。3. 部門信息表的查詢、插入、修改、刪除等操作。2.相關(guān)表表 1 職工表:Empioyee_lnfo列名馥據(jù)類型允許Nd值 口 口 団口vardiar®EmpNameuarchar(lO)hlatioiialityvar

5、charCaDSexchar(Z)A護(hù)smallintTelephonevarcharC12)DeptIDvardiar(S)Positionvardiar(lO)Manager工資表:SalaryamplSfiy勻HD匕反出睜57血1虹1里451759戲越1逍虹血35C0:2lO攵反坯湃?W3虹醵彈蚩出護(hù)57血3虹2:342卿M:1虹Xi期鯛如觀W尹國(guó)口炳7g虹lO攵1K?jWM昵哺i?7區(qū)皿炳7002虹lfl.1i嘲違¥區(qū)加胸m貶阮臨ElOlJ蛋1 1刃3孵了005耐J13 図:0£37coollfl:S3&251孫詡;Scm;虹LINGKERONG-PC- d

6、bo.UerJnfo '' LINGKERONG-卩 III Il4il llh-i llHlll- IIIM-IIIII-HIII III ll-ri-ll lll-i II ll+ll 勒據(jù)糞型用 i EmpIDi vardiar(5)輕 MonthSalarvsmallirtfloatEmpIDYearMonthSalarySI200944000oooo200953400oooo200962344ooooZOlO52300oooo201255600woo30071300010002D0931200LOOO如in3120010002010545001000MH412000w

7、oo20125010002012730001001300733600100120074軌ainniWilntvin? Yearchar (4)V DeptiDDeplNafneOfficeTelephoneManager表3部門表:Dept_lnfo數(shù)據(jù)類型VdEr varchdr(20) uarchar(3O) vflfchar(lZ) varchar5)DeptID10000lOOOl00020004100050003IQ009DeptNarreASS 拽朮生產(chǎn) 宣傳部 行政部 計(jì)劃營(yíng)梢部 市場(chǎng)調(diào)查部 保衛(wèi)部 后勤部officeT&lephone0010人事部辦公室 枝朮生產(chǎn)辦魁

8、宣倩部辦處室 行B如公室 計(jì)劃營(yíng)硝辦公 市場(chǎng)調(diào)查部辦 ffl衛(wèi)frii室 后勤辦公室 )h«3辦公室027-12345678027-29337456027-23539565Q27-09SS9765027-25473765027-12J12452027-2-75426027-21314234027-12345673Atn10 L4lOQOML101110IJ1007ALE/1004|l = 0;-.“;_ = .=.?i UserID':PasswordI UserIDPassword允許MJ值O系統(tǒng)用戶表:User_l nfo數(shù)據(jù)捷型*i varchar(S)vardiar5

9、)000010000mnilirwi00001D0200001M3DODO1004nil100600001007nil100300001011nil1012OODO3.數(shù)據(jù)流程圖數(shù)據(jù)流程圖員工工資相關(guān)操作1.查詢部分相關(guān)代碼:dateGrid1數(shù)據(jù)綁定Private void BindData( Stringsql)SqlC onn ecti on conn ecti on = SqlDataAda pter dataAda pter = DataSet dataSet = dataAda pter.Fill(dataSet);n ewSqlC onn ecti on(conn Stri ng

10、);n ewSqlDataAda pter(sql, conn ecti on); newDataSetO;dataGridView1.DataSource = dataSet.TablesO; dataGridView1.Colum ns0.Data Prop ertyName dataGridView1.Colum ns1.Data Prop ertyName dataGridView1.Colum ns2.Data Prop ertyName dataGridView1.Colum ns3.Data Prop ertyName"職? ?工? e號(hào)?";"年份

11、";"月份";"工資0 "部門組合框的數(shù)據(jù)綁定Privatevoid BindDeptBox()stri ng sql = "SELECT * FROM De pt_ln fo"SqlC onn ecti on conn ecti on =n ewSqlC onn ecti on(conn Stri ng);SqlDataAda pter dataAda pter =n ewSqlDataAda pter(sql, conn ecti on);DataSet dataSet =n ewDataSet();dataAda pt

12、er.Fill(dataSet);Dep tBox.DataSource = dataSet.TablesO;"De ptName""DeptID"De ptBox.Dis playMember = Dep tBox.ValueMember = De ptBox.Selectedl ndex = 0;按部門查詢private void check1_CheckedChanged( objectif (check1.Checked)btnYes.Enabled = DeptBox.Enabled = check4.Checked = check4.Enab

13、led =true ;true ; false ; false ;elseDeptBox.Enabled = check4.Enabled =false ;true ;按年份查詢private void check2_CheckedChanged( objectbtnYes.Enabled =true ;if (check2.Checked)YearBox.Enabled =true ;sender,sender,EventArgs e)EventArgs e)elseYearBox.Enabled =false ;YearBox.SelectedIndex = 0;按月份Y査詢private

14、 void check3_CheckedChanged( objectif (check3.Checked)btnYes.Enabled =MonthBox.Enabled =true ;true ;elseMonthBox.Enabled =false ;僅查詢自己的工資private void check4_CheckedChanged( objectif (check4.Checked)btnYes.Enabled =check1.Enabled = DeptBox.Enabled =true ; false ;false ;elsecheck1.Enabled = check1.Che

15、cked =true ; false ;sender,sender,EventArgs e)EventArgs e)private void btnYes_Click( object sender, EventArgs e) count = 0;String YearStr;int MonthStr;StringStringsql = DeptStr =部門號(hào)DeptStr; sqlStr =""HH .Convert .ToString(DeptBox.SelectedValue.ToString();if (check1.Checked)DeptStr =sqlStr

16、=月份', Salary as 'Salary.EmpID=Employee_Info.EmpID" , DeptStr);if (count = 0)Convert .ToString(DeptBox.SelectedValue.ToString();String .Format( "select Salary.EmpID as '職工號(hào) ', Year as ' 年份 ', Month as '工資 o ' from Salary,Employee_Info where DeptID='0'

17、andsql += sqlStr; count = 1;elsesql +=" intersect " + sqlStr;check1.Checked =false ;年份if (check2.Checked)YearStr = Convert .ToString(YearBox.SelectedItem.ToString(); if (this .mainForm.operatorRight=2)sqlStr = String .Format( "select EmpID as ' 職工號(hào) ', Year as '年份', Mon

18、th as ' 月份 ',Salary as '工資' from Salary where Year='0'", YearStr);else if (this .mainForm.operatorRight=1)sqlStr =String .Format( "select Salary.EmpID as '職工號(hào) ', Year as ' 年份 ', Month as '月 ', Salary as '工資 ' from Salary,Employee_Info

19、,Dept_Info where Year='0'andSalary.EmpID=Employee_Info.EmpID and Employee_Info.DeptID=Dept_Info.DeptID and Dept_Info.DeptID in (select DeptID from Employee_Info where EmpID='1')", YearStr, this .mainForm.person.userName);else', Salary as 'YearStr, this .mainForm.person.u

20、serName); sqlStr = String .Format( "select EmpID as ' 職工號(hào) ', Year as ' 年份 ', Month as ' 月份 工資 a ' from Salary where Year='0'and EmpID='1'",if (count = 0)sql += sqlStr; count = 1;elsesql +=check2.Checked =" intersect " + sqlStr;false ;月份if (

21、check3.Checked)MonthStr =Convert .ToInt32(MonthBox.SelectedItem.ToString();if ( this .mainForm.operatorRight = 2)Salary as 'sqlStr = String .Format( "select EmpID as ' 職工號(hào) ', Year as ' 年份', Month as ' 月份 ', 工資' from Salary where Month='0'", MonthStr)

22、;else if ( this .mainForm.operatorRight = 1)sqlStr =String .Format( "select Salary.EmpID as '職工號(hào) ', Year as ' 年份 ', Month as '月份 ', Salary as '工資 ' from Salary,Employee_Info,Dept_Info where Month='0'andSalary.EmpID=Employee_Info.EmpID and Employee_Info.De

23、ptID=Dept_Info.DeptID and Dept_Info.DeptID in (select DeptID from Employee_Info where EmpID='1')", MonthStr, this .mainForm.person.userName);elsesqlStr = String .Format( "select EmpID as ' 職工號(hào) ', Year as ' 年份', Month as ' 月份 ', 工 ' from Salary where Mont

24、h='0' and EmpID='1'" ,Salary as 'MonthStr, this .mainForm.person.userName);if (count = 0)sql += sqlStr; count = 1;elsesql +=" intersect " + sqlStr;check3.Checked =false ;自己工資if (check4.Checked)職工號(hào)', Year as ' 年份', Month as ' 月份', Salary , this .

25、mainForm.person.userName);sql = String .Format( "select EmpID as ' as ' 工資' from Salary where EmpID='0'" if (count = 0)sql += sqlStr; count = 1;elsesql +=check4.Checked =" intersect "+ sqlStr;false ;new Sqlmand(sql, connection);Sqlmand mand =tryconnection.Open

26、();SqlDataReader data = mand.ExecuteReader(); if (data.Read()BindData(sql);elseif (this .mainForm.operatorRight=2)sql =String .Format( "select EmpID as ' 職工號(hào) ', Year as '年份 ', Month as ' 月份', Salary as '工資' from Salary" );else if ( this .mainForm.operatorRig

27、ht = 1)sql =String .Format( "select Salary.EmpID as '職工號(hào) ', Year as ' 年份 ', Month as' 月份 ', Salary as ' 工資 ' from Salary,Employee_Info,Dept_Info where Salary.EmpID=Employee_Info.EmpID and Employee_Info.DeptID=Dept_Info.DeptID and Dept_Info.DeptID in (select DeptI

28、D from Employee_Info where EmpID='0')" , this .mainForm.person.userName);elsesql = String .Format( "select EmpID as ' 職工號(hào) ', Year as ' 年份 ', Month as ' 月份 ', Salary as '工資 ' from Salary where EmpID='0'" , this .mainForm.person.userName);

29、BindData(sql);MessageBox.Show("查詢失敗 , 沒(méi)有符合要求的工資信息 " , "查找失敗 ? ",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);catch ( Exception ex)MessageBox.Show(ex.Message, MessageBoxIcon.Exclamation);" 數(shù)據(jù)庫(kù)操作失敗 1 ", MessageBoxButtons.OK,finallyconnection.Close();private void Load

30、OrCancel()mainForm = (MainForm)this .ParentForm;YearBox.SelectedIndex = 0;false ;false ;false ;false ;MonthBox.SelectedIndex = 0; YearBox.Enabled = MonthBox.Enabled = DeptBox.Enabled = btnYes.Enabled = BindDeptBox();if ( this .mainForm.operatorRight = 2)sql = String .Format( "select EmpID as &#

31、39; 職工號(hào) ', Year as ' 年份 ', Month as ' 月份 ', Salary as ' 工資 ' from Salary" );else if ( this .mainForm.operatorRight = 1)DeptBox.Visible = false ; check1.Visible = false ;sql = String .Format( "select Salary.EmpID as '職工號(hào) ', Year as ' 年份 ', Month a

32、s ' 月份 ',Salary as ' 工資 ' from Salary,Employee_Info,Dept_Info where Salary.EmpID=Employee_Info.EmpID and Employee_Info.DeptID=Dept_Info.DeptID and Dept_Info.DeptID in (select DeptID from Employee_Info where EmpID='0')" , this .mainForm.person.userName);elsefalse ;false ;

33、false ;check1.Visible =check4.Visible =DeptBox.Visible =sql = String .Format( "select EmpID as ' 職工號(hào) ', Year as ' 年份 ', Month as ' 月份 ', Salaryas ' 工資 ' from Salary where EmpID='0'", this .mainForm.person.userName);BindData(sql);count = 0;private voi

34、d groupBox2_Enter( object sender, EventArgs e)2. 對(duì)表的增刪改部分:ataGrid 數(shù)據(jù)綁定private void BindData()sql = String .Format( "select EmpID as ' 職工號(hào) ', Year as ' 年份 ', Month as ' 月份 ', Salary as ' 工資' from Salary" );SqlConnection connection = newSqlConnection(connStrin

35、g);SqlDataAdapter dataAdapter = newSqlDataAdapter(sql, connection);DataSet dataSet =newDataSet();"職工號(hào)""年份" "月份""工資"dataAdapter.Fill(dataSet); dataGridView1.DataSource = dataSet.Tables0; dataGridView1.Columns0.DataPropertyName dataGridView1.Columns1.DataPropert

36、yName dataGridView1.Columns2.DataPropertyName dataGridView1.Columns3.DataPropertyName刪除private void btn3_Click( object sender, EventArgs e)true ; true ; true ;"delete" ;cleartext(); textreadwrite(); btnOkOrCancel(); bMonth.Enabled = bYear.Enabled = txt4.ReadOnly = opterate =修改或更新職工工資信息priv

37、ate void btnOk_Click( object sender, EventArgs e) btnOkOrCancel(); btnOk.Enabled =false ;EmpID = txt1.Text;Year = Month =String salary = txt4.Text; if (salary = "" )Convert .ToString(bYear.SelectedItem.ToString();Convert .ToInt32(bMonth.SelectedItem.ToString();HHsalary = Salary = ( int try

38、"0" ;float ) Convert .ToDouble(salary.Trim(); num = 0;if (EmpID != "" )sql =String.Format( "select count (*) from Employee_Info where EmpID='0'"EmpID);Sqlmand mand = connection.Open();int c = ( connection.Close();if (c > 0)intnewSqlmand(sql, connection);)mand

39、.ExecuteScalar();connection =connection.Open(); sql =if (opterate ="insert" )newSqlConnection(connString);String .Format( "select count (*) from Salary where EmpID='0'and Year='1' and Month='2'", EmpID, Year, Month);Sqlmand mycmd =newSqlmand(sql, connectio

40、n);num = ( int )mycmd.ExecuteScalar(); connection.Close();職工的工資信息存在 if (num > 0)MessageBox.Show("錄入不成功,您要錄入的員工的工資信息已存在! ", " 錄入 失敗 ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);textreadonly();else if (opterate = "update" )sql = String .Format( "update Sal

41、ary set Salary='0'where EmpID='1' and Year='2' and Month='3'", Salary, EmpID, Year, Month);connection.Open();mand =newSqlmand(sql, connection);mand.ExecuteNonQuery(); connection.Close(); BindData(); textreadonly();"更新成功! " , "更新成功 ", MessageBo

42、xButtons.OK,MessageBox.Show(MessageBoxIcon.Exclamation);else connection.Open();sql = String .Format( "delete from Salary where EmpID='0'and Year='1' and Month='2'" , EmpID, Year, Month);mand =newSqlmand(sql, connection);" 刪除成功! " , " 刪除成功 ", Mess

43、ageBoxButtons.OK,mand.ExecuteNonQuery(); connection.Close(); BindData(); MessageBox.Show( MessageBoxIcon.Exclamation);textreadonly();elseif (opterate ="insert" )sql =" 錄入成功! " , " 錄入成功 ", MessageBoxButtons.OK,else if (opterate ="update" )MessageBox.Show(Messag

44、eBoxButtons.OK, MessageBoxIcon.Exclamation);textreadonly();"修改失敗,不存在要修改的工資信息!",“修T改失敗",elseMessageBox.Show(MessageBoxButtons.OK, MessageBoxIcon.Exclamation);textreadonly();"刪除失敗,不存在要?jiǎng)h除的工資信息!", "刪除失敗 ",elseMessageBox.Show(" 不存在要管理的員工工資信息! " , " 操作失敗 &

45、quot;,MessageBoxButtons.OK, MessageBoxIcon.Exclamation);textreadonly();elseMessageBox.Show(MessageBoxIcon.Exclamation);" 操作失敗,請(qǐng)?zhí)钊雴T工號(hào)! ", " 操作失敗 ", MessageBoxButtons.OK,String .Format( "insert into Salary(EmpID,Year,Month,Salary)values ('0','1','2',

46、9;3')" , EmpID, Year, Month, Salary); mand = newSqlmand(sql, connection); connection.Open(); mand.ExecuteNonQuery(); connection.Close();BindData(); MessageBox.Show(MessageBoxIcon.Exclamation); textreadonly();textreadonly();btnModi();true ;btnCancel.Enabled = catch ( Exception ex)MessageBox.

47、Show(ex.Message, MessageBoxIcon.Exclamation);" 數(shù)據(jù)庫(kù)操作失敗 1 ", MessageBoxButtons.OK,finallyconnection.Close();3. 關(guān)于界面 錄入和修改鍵和關(guān)閉鍵能用,確定和取消鍵不能用 private void btnModi()btn1.Enabled =btn2.Enabled =btn3.Enabled =true ; true ; true ;btnOk.Enabled = btnCancel.Enabled =false ;false ;錄入和修改鍵不能用,btnOkOrCancel()private voidbtn1.Enabled = btn2.Enabled = btn3.Enabled = btnCancel.Enabled = btnOk.Enabled =將文本框清空 private voidtxt1.Text =txt4

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論