數(shù)據(jù)庫實驗報告_第1頁
數(shù)據(jù)庫實驗報告_第2頁
數(shù)據(jù)庫實驗報告_第3頁
數(shù)據(jù)庫實驗報告_第4頁
數(shù)據(jù)庫實驗報告_第5頁
已閱讀5頁,還剩32頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、辦公室物品管理系統(tǒng)辦公室物品管理系統(tǒng)實驗報告學(xué)院:數(shù)學(xué)與計算機科學(xué)學(xué)院專業(yè): 計算機科學(xué)與技術(shù)學(xué)號: 120702010001姓名: 付子爔目錄一、需求分析:3二、功能分析:3三、E-R圖4四、數(shù)據(jù)庫設(shè)計41. 數(shù)據(jù)庫設(shè)計42. 表設(shè)計5五、系統(tǒng)設(shè)計71.登錄模塊設(shè)計72.主窗體模塊設(shè)計103.員工基本信息與管理模塊124.物品入庫管理模塊225.物品借用管理模塊276.物品歸還管理模塊33一、需求分析:在當(dāng)前的企業(yè)發(fā)展中,隨著企業(yè)規(guī)模的日益壯大,員工數(shù)量的逐漸增多,會給企業(yè)的各項管理帶來很大的困難,如果不借助信息化手段對公司內(nèi)部的員工和辦公室物品進行有效的管理,那么就會影響公司的管理水平和辦

2、公效率,使公司很難在與其他企業(yè)的競爭中取勝,因此一個自動化的辦公室物品管理系統(tǒng)就顯得非常重要。二、功能分析:辦公室物品管理系統(tǒng)是一個典型的數(shù)據(jù)庫開發(fā)應(yīng)用程序,主要由類別管理、人員管理、部門管理和物品使用管理組成。具體規(guī)劃如下:1. 類別管理模塊:類別管理模塊負責(zé)商品類別信息的錄入、查詢和刪除及部門類別信息的錄入、查詢和刪除。2. 人員管理模塊:人員管理模塊主要負責(zé)員工基本信息的錄入、查詢、刪除和員工職位調(diào)整。3. 部門管理模塊:部門管理模塊主要負責(zé)對各個部門的基本信息和基本人員構(gòu)成的查詢和管理。4. 物品使用管理模塊:物品使用管理主要負責(zé)對物品基本信息的數(shù)據(jù)錄入和查詢、借用物品信息的錄入和查詢

3、、歸還物品信息的錄入和查詢。三、E-R圖四、數(shù)據(jù)庫設(shè)計1. 數(shù)據(jù)庫設(shè)計 辦公室物品管理系統(tǒng)主要用來存儲貨物的庫存、入庫、出庫、物品歸還、員工的信息與管理等信息。其中包括的表如下:2. 表設(shè)計(1)物品出庫表物品出庫信息表用于存儲出庫商品信息的記錄,結(jié)構(gòu)如下:(2)部門基本信息表部門基本信息表用于存儲公司各部門的詳細信息,結(jié)構(gòu)如下:(3)部門名稱表部門名稱表用于保存部門名稱和標(biāo)號信息,結(jié)構(gòu)如下:(4)員工基本信息表員工基本信息表用于存儲員工的詳細信息,結(jié)構(gòu)如下:(5)物品登記表物品登記表用于錄入物品的詳細信息,結(jié)構(gòu)如下:(6)物品歸還表物品歸還表用于登記物品歸還的詳細信息,結(jié)構(gòu)如下:(7)物品分

4、類表物品分類表用于為物品分類登記,結(jié)構(gòu)如下:五、系統(tǒng)設(shè)計1.登錄模塊設(shè)計登錄模塊是通過輸入正確的用戶名和密碼進入窗體,可以提高程序的安全性,保護數(shù)據(jù)資料不外泄。登錄模塊實現(xiàn)的原理是首先將用戶輸入的用戶名與數(shù)據(jù)庫中的用戶名進行比對,如果在數(shù)據(jù)庫中沒有記錄則提示用戶名錯誤,有記錄則以輸入的用戶名為條件進行密碼的查找,如果有相匹配的信息則成功登錄系統(tǒng),反之則彈出提示消息。代碼:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;

5、using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace Office public partial class Loign : Form public Loign() InitializeComponent(); DataBase database = new DataBase(); private void button1_Click(object sender, EventArgs e) textBox1.Text = ""

6、textBox2.Text = "" textBox1.Focus(); private void button2_Click(object sender, EventArgs e) string sqlstr = "select password from tb_information where password='" + textBox2.Text + "'" if (textBox1.Text = ""|textBox2.Text = "") MessageBox.Sho

7、w("用戶名和密碼不能為空!","系統(tǒng)提示",MessageBoxButtons.OK ,MessageBoxIcon.Error ); else if (database.getRead(sqlstr).HasRows) Frm_Main frm_main = new Frm_Main(); Frm_M = textBox1.Text; Frm_Main.time=DateTime.Now.ToShortDateString(); frm_main.Show(); this.Hide(); else MessageBox.Show(&q

8、uot;密碼錯誤","系統(tǒng)提示",MessageBoxButtons.OK,MessageBoxIcon.Error ); private void Loign_FormClosing(object sender, FormClosingEventArgs e) DialogResult dr; dr = MessageBox.Show("確認退出嗎?", "Office物品管理系統(tǒng)", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultBu

9、tton.Button2); if (dr = DialogResult.Yes) else e.Cancel = true; private void button3_Click(object sender, EventArgs e) Application.Exit(); private void textBox1_KeyUp(object sender, KeyEventArgs e) if (e.KeyValue = 13) textBox2.Focus(); private void textBox2_KeyPress(object sender, KeyPressEventArgs

10、 e) if (e.KeyChar = 13) button2_Click(sender, e); private void textBox2_KeyUp(object sender, KeyEventArgs e) if (e.KeyValue = 13) btnLoign.Focus(); 2.主窗體模塊設(shè)計辦公室管理系統(tǒng)中,當(dāng)?shù)卿洿绑w驗證成功后,用戶將進入主窗體,其中提供了系統(tǒng)菜單欄,可以通過它調(diào)用系統(tǒng)中的所有子窗體。代碼:using System;using System.Collections.Generic;using System.ComponentModel;using Sys

11、tem.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace Office public partial class Frm_Main : Form public Frm_Main() InitializeComponent(); public static string name; public static string time; DataBase database = new DataBa

12、se(); private void Frm_Main_Load(object sender, EventArgs e) toolStripStatusLabel2.Text = name; toolStripStatusLabel4.Text = time; toolStripStatusLabel5.Text = "|姓名:付子爔" toolStripStatusLabel6.Text = "|學(xué)號:120702010001" private void 退出EToolStripMenuItem1_Click(object sender, EventA

13、rgs e) Application.Exit(); private void 入庫管理ToolStripMenuItem_Click(object sender, EventArgs e) Frmwerehouse frmwh = new Frmwerehouse(); frmwh.Show(); private void 歸還管理ToolStripMenuItem_Click(object sender, EventArgs e) Form2 frm2 = new Form2(); frm2.Show(); private void 領(lǐng)用管理ToolStripMenuItem_Click(

14、object sender, EventArgs e) recession frm1 = new recession(); frm1.Show(); private void 物品分類ToolStripMenuItem_Click(object sender, EventArgs e) Sort frmsort = new Sort(); frmsort.Show(); private void 部門分類ToolStripMenuItem_Click(object sender, EventArgs e) Dept frmdept = new Dept(); frmdept.Show(); p

15、rivate void 員工基本信息ToolStripMenuItem_Click_1(object sender, EventArgs e) Employee frmemp = new Employee(); frmemp.Show(); private void 質(zhì)量部ToolStripMenuItem_Click(object sender, EventArgs e) Section frmsec = new Section(); frmsec.Show(); private void Frm_Main_FormClosed(object sender, FormClosedEventA

16、rgs e) Application.Exit(); 3.員工基本信息與管理模塊員工基本信息與管理模塊主要用來添加、刪除員工信息、員工職位調(diào)換。代碼: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.Data.SqlClient;namespace Office publ

17、ic partial class Employee : Form public Employee() InitializeComponent(); void textBox5_Enter(object sender, EventArgs e) DataBase database = new DataBase(); private void Employee_Load(object sender, EventArgs e) this.tb_employeeInfoTableAdapter.Fill(this.辦公室物品管理系統(tǒng)DataSet.tb_employeeInfo); comboBox6

18、.Items.Add("男"); comboBox6.Items.Add("女"); comboBox6.SelectedIndex = 0; comboBox5.Items.Add("已婚"); comboBox5.Items.Add("未婚"); comboBox5.SelectedIndex = 1; comboBox3.Items.Add("大專"); comboBox3.Items.Add("本科"); comboBox3.Items.Add("碩士&qu

19、ot;); comboBox3.Items.Add("博士"); comboBox3.SelectedIndex = 1; comboBox1.Items.Add("總經(jīng)理"); comboBox1.Items.Add("總監(jiān)"); comboBox1.Items.Add("部門經(jīng)理"); comboBox1.Items.Add("職員"); comboBox1.Items.Add("實習(xí)員工"); comboBox1.SelectedIndex = 3; comboBox9

20、.Items.Add("總經(jīng)理"); comboBox9.Items.Add("總監(jiān)"); comboBox9.Items.Add("部門經(jīng)理"); comboBox9.Items.Add("職員"); comboBox9.Items.Add("實習(xí)員工"); comboBox9.SelectedIndex = 3; DataSet ds = database.getSet("select deptname from tb_dept", "tb_dept"

21、); comboBox2.DataSource = ds.Tables0.DefaultView; comboBox2.DisplayMember = "deptname" comboBox10.DataSource = ds.Tables0.DefaultView; comboBox10.DisplayMember = "deptname" DataSet ds3 = database.getSet("select deptname from tb_dept", "tb_dept"); textBox1.Enab

22、led = false; textBox10.Enabled = false; private void button2_Click(object sender, EventArgs e) if (textBox2.Text = "" | textBox4.Text = "") MessageBox.Show("用戶姓名、編號不能為空", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); else database.getCon(); string

23、 sqlstr = "insert into tb_employeeInfo(name,employeenum,culture,job,age,sex,marrige,time,section,remark) values('" + textBox2.Text + "','" + textBox4.Text + "','" + comboBox3.Text + "','" + comboBox1.Text + "','" +

24、 comboBox6.Text + "','" + comboBox5.Text + "','" + dateTimePicker1.Value + "','" + comboBox2.Text + "','" + richTextBox1.Text + "')" string sqlstr1 = "select * from tb_employeeInfo where employeenum='"

25、; + textBox4.Text + "'" database.getRead(sqlstr); if (database.getRead(sqlstr1).HasRows) MessageBox.Show("數(shù)據(jù)添加成功!", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox2.Text = "" textBox4.Text = "" richTextBox1.Text = ""

26、textBox2.Focus(); else MessageBox.Show("添加失敗", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Error); BinData(); private void button4_Click(object sender, EventArgs e) if ( textBox1.Enabled =true) DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("select * fro

27、m tb_employeeInfo where name='" + textBox1.Text + "'", database.getCon(); da.Fill(ds); if (ds.Tables0.Rows.Count = 0) MessageBox.Show("查詢無結(jié)果", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); textBox1.SelectAll(); BinData(); else

28、 dataGridView1.DataSource = ds.Tables0; if ( textBox10.Enabled=true ) DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("select * from tb_employeeInfo where employeenum='" + textBox10.Text + "'", database.getCon(); da.Fill(ds); if (ds.Tables0.Rows.Count =

29、 0) MessageBox.Show("查詢無結(jié)果", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); textBox1.SelectAll(); BinData(); else dataGridView1.DataSource = ds.Tables0; if(textBox1.Enabled=true&&textBox10.Enabled=true) DataSet ds = new DataSet(); SqlDataAdap

30、ter da = new SqlDataAdapter("select * from tb_employeeInfo where name='" + textBox1.Text + "'an5d employeenum='" + textBox10.Text + "'", database.getCon(); da.Fill(ds); if (ds.Tables0.Rows.Count = 0) MessageBox.Show("查詢無結(jié)果", "系統(tǒng)提示", M

31、essageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); textBox1.SelectAll(); BinData(); else dataGridView1.DataSource = ds.Tables0; private void button3_Click(object sender, EventArgs e) if (textBox1.Enabled = true) DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(&quo

32、t;select * from tb_employeeInfo where name='" + textBox1.Text + "'", database.getCon(); da.Fill(ds); if (ds.Tables0.Rows.Count = 0) MessageBox.Show("要刪除的數(shù)據(jù)不存在!", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); textBox1.SelectAll

33、(); BinData(); else DialogResult dr; dr = MessageBox.Show("確認刪除嗎?", "系統(tǒng)提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr = DialogResult.Yes) string sqlstr = "delete from tb_employeeInfo where name='" + textBox1.Text + &q

34、uot;'" database.getCon(); database.getCom(sqlstr); MessageBox.Show("刪除成功!", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Text = "" BinData(); if (textBox10.Enabled = true) DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter

35、("select * from tb_employeeInfo where employeenum='" + textBox10.Text + "'", database.getCon(); da.Fill(ds); if (ds.Tables0.Rows.Count = 0) MessageBox.Show("要刪除的數(shù)據(jù)不存在!", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); textB

36、ox1.SelectAll(); BinData(); else DialogResult dr; dr = MessageBox.Show("確認刪除嗎?", "系統(tǒng)提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr = DialogResult.Yes) string sqlstr = "delete from tb_employeeInfo where employeenum='"

37、+ textBox10.Text + "'" database.getCon(); database.getCom(sqlstr); MessageBox.Show("刪除成功!", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Text = "" BinData(); if (textBox1.Enabled = true && textBox10.Enabled = true) DataSet ds

38、 = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("select * from tb_employeeInfo where name='" + textBox1.Text + "'and employeenum='" + textBox10.Text + "'", database.getCon(); da.Fill(ds); if (ds.Tables0.Rows.Count = 0) MessageBox.Show("要刪除的

39、數(shù)據(jù)不存在!", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); textBox1.SelectAll(); BinData(); else DialogResult dr; dr = MessageBox.Show("確認刪除嗎?", "系統(tǒng)提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); i

40、f (dr = DialogResult.Yes) string sqlstr = "delete from tb_employeeInfo where employeenum='" + textBox1.Text + "'or name='" + textBox10.Text + "'" database.getCon(); database.getCom(sqlstr); MessageBox.Show("刪除成功!", "系統(tǒng)提示", MessageBoxB

41、uttons.OK, MessageBoxIcon.Information); textBox1.Text = "" BinData(); public void BinData() string sqlstr3 = "select * from tb_employeeInfo" DataSet ds = database.getSet(sqlstr3, "tb_employeeInfo"); dataGridView1.DataSource = ds.Tables0; private void button6_Click(objec

42、t sender, EventArgs e) this.Close(); private void button5_Click(object sender, EventArgs e) if (textBox5.Text = "") MessageBox.Show("請輸入要調(diào)整的員工的編號", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); else database.getCon(); string sqlstr = "update tb_employe

43、eInfo set section='" + comboBox10.Text + "',job='" + comboBox9.Text + "'where employeenum='" + textBox5.Text+ "'" database.getCom(sqlstr); MessageBox.Show("職位調(diào)整完畢", "系統(tǒng)提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox5.Text = "" textBox6.Text = "" textBox5.Focus(); private void text

溫馨提示

  • 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)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論