




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、c#.net程序設計課程設計說明書設計題目: 教師管理系統(tǒng) 學院、系: 軟件學院 專業(yè)班級: 軟升本10-4班 學生姓名: 指導教師: 成 績: 2011 年 7 月 12 日一、課程設計目的通過完成從用戶需求分析、數據庫設計、目錄結構與通用模塊、管理主界面設計及各個具體管理模塊設計到上機編程、調試和應用等全過程,進一步了解和掌握c#.net程序設計技術。2、 課程設計任務與要求1. 基本要求:1)要求利用c#的編程思想以及組件開發(fā)原理來完成系統(tǒng)的設計;2)突出c#語言與其它語言不同點(即體現(xiàn)c#的高級功能,如屬性概念、接口、事件、委托等);3)體現(xiàn)可視化編程基本思想,如系統(tǒng)帶有菜單、工具欄、
2、狀態(tài)欄以及一些常用的高級控件。2. 創(chuàng)新要求:在基本要求達到后,可進行創(chuàng)新設計。完成該系統(tǒng)數據庫設計;實現(xiàn)相應信息的添加、刪除、刪除、查看等功能。三、需求分析在設計數據庫結構時,應盡量可能滿足用戶所提出的各項要求,同時避免冗余數據的產生。由于教師管理系統(tǒng)中需要采集大量的信息,包括院系信息、課程信息、教師信息、收入信息等,如果不能有效合理地組織數據表的結構以及每張表所含的字段,那么在后期進行數據整理及匯總時,將增加開發(fā)人員的工作難度和工作量。根據教師基本信息及相關特點,可以總結出一下規(guī)律:l 一個院系包括一名或多名教師l 一名教師可以教多門課程l 每名教師都有不同的教師編碼l 每名教師都有自己對
3、應的月收入l 一個角色對應一個或多個用戶四、概要設計1. 系統(tǒng)功能模塊劃分教師管理系統(tǒng)院系設置課程設置教師設置收入設置添加院系瀏覽院系修改院系添加課程刪除課程修改課程添加教師修改教師瀏覽教師添加收入修改收入2. 數據庫邏輯結構設計系統(tǒng)數據庫名稱為hanqifang,數據庫中包括:(1)院系信息表dbo.yuanxi;(2)教師表信息dbo.jiaoshi;(3)課程信息表dbo.kecheng.下面列出各個表的數據結構 院系信息表字段名 類 型描 述yuanxibianmayuanximingcheng int varchar院系編碼(主鍵)院系名稱 教師信息表 字段名 類 型描 述jiaos
4、hibianmajiaoshixingmingjiaoshixingbiejiaoshixueli yuanximingchengkechengbianmaintvarcharvarcharvarcharvarcharint教師編碼(主鍵)教師姓名教師性別教師學歷院系名稱課程編碼 課程信息表 字段名 類 型描 述kechengbianmakechengmingchengkechengmiaosuintvarcharvarchar課程編碼(主鍵)課程名稱課程描述五、詳細設計主界面設計主界面設計的作用就是顯示本系統(tǒng)所有的功能菜單項,本且把用戶經常用到的功能設計成菜單項,以方便用戶操作,然后當用戶單
5、擊相應的菜單項或菜單按鈕時,打開對應的模塊窗口。本系統(tǒng)的主界面如圖。由圖可知“院系”菜單下有子菜單,包括“修改”和“添加”。主界面編碼:zhuyemian.csusing system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using windowsformsapplication1hanqifang.yuan
6、xi;/導入用于院系的命名空間using windowsformsapplication1hanqifang.jiaoshi;namespace windowsformsapplication1hanqifang public partial class zhuyemian : form public zhuyemian() initializecomponent(); private void zhuyemian_load(object sender, eventargs e) private void timer1_tick(object sender, eventargs e) this
7、.ttstime.text = 時間為: + datetime.now.tostring(); tianjia a; private void b_click(object sender, eventargs e) if (a= null | a.isdisposed) a = new tianjia (); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); a.mdiparent = this; a.show(); liulan
8、 c; private void 瀏覽toolstripmenuitem_click(object sender, eventargs e) if (c = null | c.isdisposed) c = new liulan (); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); c.mdiparent = this; c.show(); liulan1 c1; private void 瀏覽toolstripmenuite
9、m1_click(object sender, eventargs e) if (c1 = null | c1.isdisposed) c1 = new liulan1(); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); c1.mdiparent = this; c1.show(); tianjia3 a1; private void 修改toolstripmenuitem1_click(object sender, even
10、targs e) if (a1 = null | a.isdisposed) a1 = new tianjia3 (); for (int x = 0; x this.mdichildren.length; x+) form tempchild = (form)this.mdichildrenx; tempchild.close(); a1.mdiparent = this; a1.show(); jiaoshi:liulan1.cs:using system;using system.collections.generic;using system.componentmodel;using
11、system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.data.sqlclient;namespace windowsformsapplication1hanqifang.jiaoshi public partial class liulan1 : form public liulan1() initializecomponent(); public static string strconn = data source=(loca
12、l);initial catalog=hanqifang;integrated security=true; private void liulan1_load(object sender, eventargs e) showinf(); private void showinf() using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try string sql = select jiaoshibianma as 編號,jiaos
13、hixingming as 教師姓名,jiaoshixingbie as 教師性別 from jiaoshi order by jiaoshibianma; sqldataadapter adp = new sqldataadapter(sql, con); dataset ds = new dataset(); ds.clear(); adp.fill(ds, job); this.datagridview1.datasource = ds.tables0.defaultview; catch (exception ex) messagebox.show(錯誤: + ex.message,
14、錯誤提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); xiugai2 frmmodifydepart; private void btnupdate_click(object sender, eventargs e) if (this.datagridview1.currentcell != null) frmmodifydepart = new xiugai2(); frmmodifyd
15、epart.tag = this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim(); /frmmodifydepart.txtdname.text = this.dgvdepartinfo1, this.dgvdepartinfo.currentcell.rowindex.value.tostring().trim(); /frmmodifydepart.txtdleader.text = this.dgvdepartinfo2, this.dgvdepartinfo.currentc
16、ell.rowindex.value.tostring().trim(); /frmmodifydepart.txtdreark.text = this.dgvdepartinfo3, this.dgvdepartinfo.currentcell.rowindex.value.tostring().trim(); frmmodifydepart.startposition = formstartposition.centerparent; frmmodifydepart.showdialog(); if (frmmodifydepart.dialogresult = dialogresult.
17、ok) showinf(); private void btndelete_click(object sender, eventargs e) using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try if (this.datagridview1.currentcell != null) string sql = select kechengmingcheng from dbo.kecheng wherekechengbianma
18、 = + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + and kechengbianma not in (select distinct kechengbianma from dbo.kecheng inner join dbo.jiaoshi on dbo.kecheng.kechengbianma=dbo.jiaoshi.kechengbianma); sqlcommand cmd = new sqlcommand(sql, con); sqldatareade
19、r dr; dr = cmd.executereader(); if (!dr.read() messagebox.show(刪除院系 + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + 失??!, 提示); dr.close(); else dr.close(); sql = delete from dbo.kecheng where kechengbianma= + this.datagridview10, this.datagridview1.currentcell
20、.rowindex.value.tostring().trim() + and kechengbianma not in (select distinct kechengbianma from dbo.jiaoshi); cmd.commandtext = sql; cmd.executenonquery(); messagebox.show(刪除院系 + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + 成功, 提示); catch (exception ex) mes
21、sagebox.show(錯誤: + ex.message, 錯誤提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); showinf(); private void btnexit_click(object sender, eventargs e) this.close(); yuanxi liulan.cs:using system;using system.collections.gen
22、eric;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.data.sqlclient;namespace windowsformsapplication1hanqifang.yuanxi public partial class liulan : form public liulan() initializecomponent(); public stati
23、c string strconn = data source=(local);initial catalog=hanqifang;integrated security=true; private void liulan_load(object sender, eventargs e) showinf(); private void showinf() using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try string sql
24、 = select yuanxibianma as 編號,yuanximingcheng as 院系名稱 from dbo.yuanxi order by yuanxibianma; sqldataadapter adp = new sqldataadapter(sql, con); dataset ds = new dataset(); ds.clear(); adp.fill(ds, job); this.datagridview1.datasource = ds.tables0.defaultview; catch (exception ex) messagebox.show(錯誤: +
25、 ex.message, 錯誤提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); xiugai frmmodifyjob; private void btnupdate_click(object sender, eventargs e) if (this.datagridview1.currentcell != null) frmmodifyjob = new xiugai(); frmmo
26、difyjob.tag = this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim(); /frmmodifyjob.datagridview1.text = this.datagridview11, this.datagridview1.currentcell.rowindex.value.tostring().trim(); frmmodifyjob.startposition = formstartposition.centerparent; frmmodifyjob.showd
27、ialog(); if (frmmodifyjob.dialogresult = dialogresult.ok) showinf(); private void btndelete_click(object sender, eventargs e) using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try if (this.datagridview1.currentcell != null) string sql = selec
28、t yuanximingcheng from dbo.yuanxi where yuanxibianma= + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + and yuanxibianma not in (select distinct dbo.yuanxi.yuanxibianma from dbo.yuanxi inner join dbo.jiaoshi on dbo.jiaoshi.yuanximingcheng=dbo.yuanxi.yuanximingc
29、heng); sqlcommand cmd = new sqlcommand(sql, con); sqldatareader dr; dr = cmd.executereader(); if (!dr.read() messagebox.show(刪除院系 + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + 失敗,請先刪除與此院系相關的教師!, 提示); dr.close(); else dr.close(); sql = delete from dbo.yuanxi
30、 where yuanxibianma= + this.datagridview10, this.datagridview1.currentcell.rowindex.value.tostring().trim() + and yuanximingcheng not in (select yuanximingcheng from dbo.yuanxi); cmd.commandtext = sql; cmd.executenonquery(); messagebox.show(刪除院系 + this.datagridview10, this.datagridview1.currentcell.
31、rowindex.value.tostring().trim() + 成功, 提示); catch (exception ex) messagebox.show(錯誤: + ex.message, 錯誤提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); showinf(); private void btnexit_click(object sender, eventargs e) this
32、.close(); private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) xiugai.cs:using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.dat
33、a.sqlclient;namespace windowsformsapplication1hanqifang.yuanxi public partial class xiugai : form public xiugai() initializecomponent(); private void label3_click(object sender, eventargs e) public static string strconn = data source=(local);initial catalog=hanqifang;integrated security=true; privat
34、e void tnok_click(object sender, eventargs e) if (this.textbox1.text.trim() = | this.textbox2.text.trim() = ) messagebox.show(請輸入完整信息!, 提示, 0); else using (sqlconnection con = new sqlconnection(strconn) if (con.state = connectionstate.closed) con.open(); ; try sqlcommand cmd = new sqlcommand(select
35、* from dbo.yuanxi where yuanximingcheng= + textbox2.text.trim() + and yuanxibianma + this.tag.tostring().trim(), con); if (cmd.executescalar() != null) messagebox.show(學院名稱發(fā)生重復,請重新輸入!, 提示, 0); else string sql = update dbo.yuanxi set yuanximingcheng= + textbox2.text.trim() + where yuanxibianma= + thi
36、s.tag.tostring().trim(); cmd.commandtext = sql; cmd.executenonquery(); messagebox.show(學院信息修改成功!, 提示, 0); catch (exception ex) messagebox.show(錯誤: + ex.message, 錯誤提示, messageboxbuttons.okcancel, messageboxicon.error); finally if (con.state = connectionstate.open) con.close(); con.dispose(); private void btnexit_click(object sender, eventargs e) this.close(); private void xiugai_loa
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 保證合同范本官網
- 丹巴客棧轉讓合同范本
- 優(yōu)化合同范本
- 海南植被垂直綠化施工方案
- 勞動合同保險合同范本
- 出入口智能停車場施工方案
- 1080個常用合同范本
- 第二單元第6課《網絡基礎》教學設計 2023-2024學年青島版(2019)初中信息技術第一冊
- 到家購房合同范本
- 利用資源合同范本
- QC成果:預制扭王字塊體表面缺陷控制知識分享
- 光伏強制性條文執(zhí)行計劃(共25頁)
- 2021新《安全生產法》全面解讀課件(PPT 84頁)
- 企業(yè)、事業(yè)專職消防隊訓練內容及操作規(guī)程
- T∕CCCMHPIE 1.2-2016 植物提取物 檳榔多糖多酚
- 局域網規(guī)劃設計_畢業(yè)論文
- 脛骨平臺骨折(課堂PPT)
- 歐洲文化入門王精品PPT課件
- 中考復習復分解反應類型方程式書寫訓練題(無答案)
- 病理學課程標準
- ASTM-D471橡膠性能的標準試驗方法-液體影響(中文版)(共24頁)
評論
0/150
提交評論