为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

中南民族大学-数据库大作业-《资产管理系统》

2018-04-27 50页 doc 799KB 51阅读

用户头像

is_842972

暂无简介

举报
中南民族大学-数据库大作业-《资产管理系统》中南民族大学-数据库大作业-《资产管理系统》 《数据库系统概论》课程设计 >开发说明书 一?项目名称: 资产管理系统 二(需求分析 随着社会经济的不断发展,企业规模越来越大,企业资产维护变的越来越困难,尤其是在手工管理方式下,财会人员对资产进行折旧时,需要查阅上一个月的资产信息,根据上一个月的资产信息核算、折旧资产。如果企业资产很多,可以想象财会人员的工作强度,既要按时对资产进行折旧,即每月对资产进行折旧,又要保证数据的准确性,因为一旦某个月的折旧有误,就会影响以后的资产核算。随着信息时代的快速发展,管理者意识到只有...
中南民族大学-数据库大作业-《资产管理系统》
中南民族大学-数据库大作业-《资产管理系统》 《数据库系统概论》课程设计 <<资产管理系统>>开发说明书 一?项目名称: 资产管理系统 二(需求分析 随着社会经济的不断发展,企业规模越来越大,企业资产维护变的越来越困难,尤其是在手工管理方式下,财会人员对资产进行折旧时,需要查阅上一个月的资产信息,根据上一个月的资产信息核算、折旧资产。如果企业资产很多,可以想象财会人员的工作强度,既要按时对资产进行折旧,即每月对资产进行折旧,又要保证数据的准确性,因为一旦某个月的折旧有误,就会影响以后的资产核算。随着信息时代的快速发展,管理者意识到只有采用信息化管理,才能取得市场领域的主导地位。本系统课是建立在一个公司希望管理它的每一批资产(如PC机,打印机,汽车,桌子,椅子等)建立一个数据库。资产被分为几类,如计算机和设备。每一份资产被分给一个员工。通常情况下财务部门的工作人员需要检查每一份资产的现有市场价值,并记录下日期和现有市场价值,作为评估的结果,公司也会觉得卖掉现有的资产。同样每批资产都要进行维护,某些情况下,维护是需要工作人员来进行的,另外也有可能拿到外边的公司去维护。 公司资产信息的管理是一个企业正常运作的基本条件,如果公司资产得到有效合理的利用,公司将节约更多的成本,提高企业的经济效益和竞争力。《资产管理系统》应将有关资产的信息纳入电脑系统统一管理,以便及时获取有关信息,提高管理效率。 基于上面的原因,开发和设计公司资产信息管理系统。 1 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 三(概要设计 3.1系统功能分析 该系统的作用是对公司的资产管理进行管理,可以对以下的信息进行操作: ?资产信息: 可以对资产信息进行查询,插入(新增),删除等操作。如公司新购进了资产需要新增资产信息,管理员或者普通用户可以查看资产的使用情况,但管理员可以查询所有的资产,普通的用户只能查看自己的资产使用情况。当然,查询的信息包括资产号,目前使用者,资产的分类,状况,现有市场价值,上次维护时间等等。如果公司打算将一笔资产卖出,则需要删除数据库中源资产信息。 ?职员信息: 在此界面下可以对职员的信息进行查询,插入(新增),删除的等操作。可以查看当前职员的资产使用情况,包括资产的分类,状况,现有市场价值,上次维护时间等等。如果有新的职员调动,这需要新增或者删除用户,同时释放该用户曾经使用的资产 ?服务商信息: 服务商是在资产出现故障需要维修等情况时,由专业的服务商对公司的资产进行维护。在此界面下可以对服务商的信息进行查询,如服务商的地址、联系人电话等等重要的信息。在这里我们还可以对资产的信息有一定的了解。 ?资产状态: 2 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 资产状态是对资产状态的一种描述,如需要服务商维修的状态设置为A,可以使用但是有小问题的状态设置为AA,使用一年的资产,可以正常使用将状态设置为AAA,新买进的资产状态设置为AAAA。在此界面下可以对资产的状态进行查询,修改等操作。查询当前的资产状态可以利于维护与资产的管理,如果公司的PC机坏掉了,那么可以将其数据的信息(状态)修改。当然,若需要对资产的状态种类进行新的描述,也可以直接写入资产状态表中。 ?用户管理: 这里的用户管理是对管理员用户的管理,即对拥有对数据表添加,删除,查询操作的用户的管理。在此界面下我们可以对用户的信息进行查询,新增,删除的等操作,可以用户控制使用该系统的人员,具有授权和冻结的权力。 ?安全退出: 安全的离开数据库,保证个人信息不回泄露(密码)。 ?普通用户 普通用户即是公司里的员工, 公司的员工对自己名下的资产及其状态进行查询操作,是员工可以清楚的知道自己的所使用的公司资产在公司中的记录,及时的核对资产信息。未来不是其他人可以随意的查看别人的资产信息,我们除了初始的密码为统一的1111,登录后用户可以根据自己的需要对自己的用户密码进行修改。 3.2系统功能模块设计 该系统分为以下7个模块: 1. 资产管理系统登陆界面 3 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 管理员:对公司的资产进行总的管理的专业人员,账户和密码在数据库中初始设置,如 果需要可以在用户管理的界面进行修改。 普通用户:公司的普通职员,账号为员工号,初始密码为1111。 2. 资产信息界面 资产查询 :全部查询(显示所用的资产信息),按资产号查询(单个查询)。 加增新资产:即公司新进入的资产信息输入。 资产:即资产报废、出售等情况从记录中删除。 删除 3. 职员信息界面 职员信息查询:全部查询(显示所有员工的信息),按职员号查询(单个查询)。 职员新增:有新的员工进入时增加信息。 职员信息删除:有员工辞职等情况删除员工信息。 4. 服务商信息界面 服务商信息查询:全部查询(显示所有服务商的信息),按服务商信息号查询(单个查 询)。 服务商信息新增:新设备新厂商需要新的服务商时,添加此处信息。 服务商信息删除:因停用某公司的产品,而不需要此服务商信息。 5. 资产状态界面 资产状态查询:对所有的资产状态查询,或者对单独的某个资产的状态进行查询。 资产状态更新:资产的状态总是会发生变化的,我们对有变化的资产修改其状态。 6. 用户管理界面 用户查询:点击显示用户信息,显示所有用户的信息。 添加用户:公司需要新添加资产的管理员,设置新的用户帐号。 修改用户:在这里我们可以将已有用户的密码进行修改。 删除用户:对于不安全的用户,我们直接予以删除的操作。 7. 安全退出 点击后直接退出资产管理系统。 4 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 3.3数据流程图 5 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 四(详细设计 4.1登录界面 登录界面代码: 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 固??定??资Á?º产?? { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); if (radioButton1.Checked == true) { string cmdStr = "SELECT * FROM tb_Login WHERE userName ='" + 6 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 this.textBox1.Text + "'"; SqlCommand selectCmd = new SqlCommand(cmdStr, con); SqlDataReader aRead = selectCmd.ExecuteReader(); aRead.Read(); if (aRead.HasRows) { if (this.textBox2.Text == aRead.GetString(1)) { Form2 form = new Form2(); this.Hide(); form.Show(); } else { MessageBox.Show("密??码?错ä?ª误??~ê?"); } con.Close(); } else { MessageBox.Show("用??户?ì不?存ä?在??~ê?"); con.Close(); } } else if(radioButton2.Checked ==true) { string cmdStr1 = "SELECT * FROM tb_Employee WHERE employeeNo='" + this.textBox1.Text + "'"; SqlCommand selectCmd = new SqlCommand(cmdStr1, con); SqlDataReader aRead1 = selectCmd.ExecuteReader(); aRead1.Read(); if (aRead1.HasRows) { if (this.textBox2.Text == aRead1.GetString(13)) { Form2_1 form = new Form2_1(); this.Hide(); form.Show(); } else { MessageBox.Show("密??码?错ä?ª误??~ê?"); } con.Close(); 7 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 } else { MessageBox.Show("用??户?ì不?存ä?在??~ê?"); con.Close(); } } else { MessageBox.Show("请?选?择?用??户?ì类???型?ª~ê?~ê?~ê?"); } } private void button2_Click(object sender, EventArgs e) { this.Close(); } } } 4.2管理员主界面 界面代码: using System; 8 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace 固??定??资Á?º产?? { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void toolStripButton1_Click(object sender, EventArgs e) { Form3_1 f1 = new Form3_1(); f1.ShowDialog(); } private void toolStripButton2_Click(object sender, EventArgs e) { Form3_2 f2 = new Form3_2(); f2.ShowDialog(); } private void toolStripButton3_Click(object sender, EventArgs e) { Form3_4 f4 = new Form3_4(); f4.ShowDialog(); } private void toolStripButton4_Click(object sender, EventArgs e) { Form3_3 f3= new Form3_3(); f3.ShowDialog(); } private void toolStripButton5_Click(object sender, EventArgs e) { Form3_5 f5 = new Form3_5(); f5.ShowDialog(); } private void toolStripButton6_Click(object sender, EventArgs e) { this.Close(); } 9 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 } } 4.3资产信息界面 界面代码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Windows.Forms; namespace 固??定??资Á?º产?? { public partial class Form3_1 : Form { public Form3_1() { InitializeComponent(); 10 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 } private void toolStripButton1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); StringBuilder sb = new StringBuilder(); if (toolStripComboBox1.Text.ToString() == "全??部?") { string M_str_sql = "select assetNO as 资Á?º产??号?,serialNo as 序??列?D号?,assetDescription as 名?称?,dateAcquired as 购o买??日??期??,purchasePrice as 购o买??价?格?," + "currentValue as 当Ì?À前?ã价?值?Ì,dateSold as 售º?出?日??期??,nextMaintenanceDate as 下?次ä?维?护?è日??期??,employeeNo as 使º1用??员?À工?è号?,assetCategoryNo as 资Á?º产??类???别Àe,statusNo as 资Á?º产??状Á?ä态?? from tb_Asset"; SqlDataAdapter ada = new SqlDataAdapter(M_str_sql, con ); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; toolStripComboBox1.Text = ""; } else { if(toolStripComboBox1.Text.ToString() =="资Á?º产??号?") sb.AppendLine("select assetNO as 资Á?º产??号?,serialNo as 序??列?D号?,assetDescription as 名?称?,dateAcquired as 购o买??日??期??,purchasePrice as 购o买??价?格?," + "currentValue as 当Ì?À前?ã价?值?Ì,dateSold as 售º?出?日??期??,nextMaintenanceDate as 下?次ä?维?护?è日??期??,employeeNo as 使º1用??员?À工?è号?,assetCategoryNo as 资Á?º产??类???别Àe,statusNo as 资Á?º产??状Á?ä态?? from tb_Asset where assetNO=").Append ("'").Append(this.toolStripTextBox1.Text).Append("';"); String abc = sb.ToString(); SqlDataAdapter ada = new SqlDataAdapter(abc, con); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; toolStripTextBox1.Text = ""; toolStripComboBox1.Text = ""; } con.Close(); } private void toolStripButton2_Click(object sender, EventArgs e) { 11 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 SqlConnection con = new SqlConnection(Connection.conn); con.Open(); string insertStr = "INSERT INTO tb_Asset(assetNo,assetDescription,serialNo,dateAcquired,purchasePrice,currentValue,dateSold,nextMainten anceDate,employeeNo,assetCategoryNo,statusNo) VALUES(@assetNo,@assetDescription,@serialNo,@dateAcquired,@purchasePrice,@currentValue,@date Sold,@nextMaintenanceDate,@employeeNo,@assetCategoryNo,@statusNo)"; SqlCommand insertCmd = new SqlCommand(insertStr, con); insertCmd.Parameters.Add("@assetNo", SqlDbType.VarChar); insertCmd.Parameters.Add("@assetDescription", SqlDbType.VarChar); insertCmd.Parameters.Add("@serialNo", SqlDbType.VarChar); insertCmd.Parameters.Add("@dateAcquired", SqlDbType.Date); insertCmd.Parameters.Add("@purchasePrice", SqlDbType.Money); insertCmd.Parameters.Add("@currentValue", SqlDbType.Money); insertCmd.Parameters.Add("@dateSold", SqlDbType.Date); insertCmd.Parameters.Add("@nextMaintenanceDate", SqlDbType.Date); insertCmd.Parameters.Add("@employeeNo", SqlDbType.VarChar); insertCmd.Parameters.Add("@assetCategoryNo", SqlDbType.VarChar); insertCmd.Parameters.Add("@statusNo", SqlDbType.VarChar); insertCmd.Parameters[0].Value = this.textBox1.Text; insertCmd.Parameters[1].Value = this.textBox3.Text; insertCmd.Parameters[2].Value = this.textBox2.Text; insertCmd.Parameters[3].Value = this.dateTimePicker1.Text; insertCmd.Parameters[4].Value = this.textBox5.Text; insertCmd.Parameters[5].Value = this.textBox6.Text; insertCmd.Parameters[6].Value = this.dateTimePicker2.Text; insertCmd.Parameters[7].Value = this.dateTimePicker3.Text; insertCmd.Parameters[8].Value = this.textBox9.Text; insertCmd.Parameters[9].Value = this.textBox11.Text; insertCmd.Parameters[10].Value = this.textBox12.Text; try { insertCmd.ExecuteNonQuery(); MessageBox.Show("固??定??资Á?º产??添??ª加??成??功|~ê?", "系?Ì统ª3提???示º?", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("添??ª加??出?错ä?ª~ê?~ê?~ê?"); } } private void toolStripComboBox1_Click(object sender, EventArgs e) { } 12 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 private void toolStripTextBox1_Click(object sender, EventArgs e) { } private void bindingNavigator1_RefreshItems(object sender, EventArgs e) { } private void toolStripSeparator1_Click(object sender, EventArgs e) { Form3_1_2 f1 = new Form3_1_2(); f1.ShowDialog(); } private void toolStripButton3_Click(object sender, EventArgs e) { this.Close(); } } } 4.3.1删除资产信息界面 界面主要代码: private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); StringBuilder sb = new StringBuilder(); sb.Append("delete from tb_Asset where assetNo='").Append(this.textBox1.Text).Append("';"); String delete = sb.ToString(); SqlCommand deleteCmd = new SqlCommand(delete, con); deleteCmd.ExecuteNonQuery(); 13 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 MessageBox.Show("删??除y成??功|~ê?"); con.Close(); this.Close(); } private void button2_Click(object sender, EventArgs e) { this.Close(); } 4.4职员信息界面 界面主要代码: private void toolStripButton1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); StringBuilder sb = new StringBuilder(); if (toolStripSplitButton1.Text.ToString() == "全??部?") { string M_str_sql = "select employeeNo as 职?ã工?è号?,title as 部?门?,name as 姓?名?,address as 家??庭ª??住Á?址??,workTelExt as 工?è作Á?Â电Ì?话?ã,homeTelNo as 家??庭ª??电Ì?话?ã,empEmailAdress as 邮??º箱?,socialSecurityNumber as 身??ª份?Y证?è号?码?,DOB as 出?生???日??期??,position as 职?ã位?,sex as 性?别Àe,dateStarted as 进?公?司?日??期?? from tb_Employee ;"; SqlDataAdapter ada = new SqlDataAdapter(M_str_sql, con); 14 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; toolStripSplitButton1.Text = ""; } else { if (toolStripSplitButton1.Text.ToString() == "员?À工?è号?") sb.AppendLine("select title as 部?门?,employeeNo as 职?ã工?è号?,name as 姓?名?,address as 家??庭ª??住Á?址??,workTelExt as 工?è作Á?Â电Ì?话?ã,homeTelNo as 家??庭ª??电Ì?话?ã,empEmailAdress as 邮??º箱?,socialSecurityNumber as 身??ª份?Y证?è号?码?,DOB as 出?生???日??期??,position as 职?ã位?,sex as 性?别Àe,dateStarted as 进?公?司?日??期?? from tb_Employee where employeeNo=").Append ("'").Append(this.toolStripTextBox1.Text).Append ("';"); String abc = sb.ToString(); SqlDataAdapter ada = new SqlDataAdapter(abc, con); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; toolStripSplitButton1.Text = ""; toolStripTextBox1.Text = ""; } con.Close(); } private void bindingNavigatorSeparator2_Click(object sender, EventArgs e) { Form3_2_1 f1 = new Form3_2_1(); f1.ShowDialog(); } private void toolStripButton2_Click(object sender, EventArgs e) { Form3_2_2 f2 = new Form3_2_2(); f2.ShowDialog(); } private void toolStripButton3_Click(object sender, EventArgs e) { this.Close(); } 15 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 界面主要代码: private void button2_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); string insertStr = "INSERT INTO tb_Employee (employeeNo,title ,name ,address ,workTelExt ,homeTelNo ,empEmailAdress ,socialSecurityNumber ,DOB ,position ,sex,salary,dateStarted )values(@employeeNo,@title ,@name ,@address ,@workTelExt ,@homeT elNo ,@empEmailAdress ,@socialSecurityNumber ,@DOB ,@position ,@sex,@salary,@dateStarted );"; SqlCommand insertCmd = new SqlCommand(insertStr, con); insertCmd.Parameters.Add("@employeeNo", SqlDbType.VarChar); insertCmd.Parameters.Add("@title", SqlDbType.VarChar); insertCmd.Parameters.Add("@name", SqlDbType.VarChar); insertCmd.Parameters.Add("@address", SqlDbType.VarChar); insertCmd.Parameters.Add("@workTelExt", SqlDbType.VarChar); insertCmd.Parameters.Add("@homeTelNo", SqlDbType.VarChar); insertCmd.Parameters.Add("@empEmailAdress", SqlDbType.VarChar); insertCmd.Parameters.Add("@socialSecurityNumber", SqlDbType.VarChar); insertCmd.Parameters.Add("@DOB", SqlDbType.Date); 16 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 insertCmd.Parameters.Add("@position", SqlDbType.VarChar); insertCmd.Parameters.Add("@sex", SqlDbType.VarChar); insertCmd.Parameters.Add("@salary", SqlDbType.Money ); insertCmd.Parameters.Add("@dateStarted", SqlDbType.Date ); insertCmd.Parameters[0].Value = this.textBox1.Text; insertCmd.Parameters[1].Value = this.textBox3.Text; insertCmd.Parameters[2].Value = this.textBox2.Text; insertCmd.Parameters[3].Value = this.textBox6.Text; insertCmd.Parameters[4].Value = this.textBox7.Text; insertCmd.Parameters[5].Value = this.textBox8.Text; insertCmd.Parameters[6].Value = this.textBox9.Text; insertCmd.Parameters[7].Value = this.textBox5.Text; insertCmd.Parameters[8].Value = this.dateTimePicker1.Text; insertCmd.Parameters[9].Value = this.textBox10.Text; insertCmd.Parameters[10].Value = this.textBox4.Text; insertCmd.Parameters[11].Value = this.textBox11.Text; insertCmd.Parameters[12].Value = this.dateTimePicker2.Text; try { insertCmd.ExecuteNonQuery(); MessageBox.Show("新?增?员?À工?è添??ª加??成??功|~ê?", "系?Ì统ª3提???示º?", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } 17 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 界面主要代码: private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { checkedListBox1.Items.Clear(); } SqlConnection con = new SqlConnection(Connection.conn); con.Open(); SqlCommand com = new SqlCommand(); com.CommandText = "Select * from tb_Employee "; com.CommandType = CommandType.Text; com.Connection = con; SqlDataReader reader = com.ExecuteReader(); int j = 0; (reader.Read()) while { checkedListBox1.Items.Add(reader[j]); } con.Close(); } private void button2_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); for (int i = 0; i < this.checkedListBox1.Items.Count; i++) { if (checkedListBox1.GetItemChecked(i)) { StringBuilder sb = new StringBuilder(); sb.Append("delete from tb_Employee where employeeNo='").Append(this.checkedListBox1.Text).Append("';"); String delete = sb.ToString(); SqlCommand deleteCmd = new SqlCommand(delete, con); deleteCmd.ExecuteNonQuery(); MessageBox.Show("删??除y操??作Á?Â成??功|~ê?~ê?~ê?"); this.Close(); } } con.Close(); } private void groupBox1_Enter(object sender, EventArgs e) 18 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 { } private void button3_Click(object sender, EventArgs e) { this.Close(); } 4.5服务商信息界面 界面主要代码: private void Form3_3_Load(object sender, EventArgs e) { // TODO: 这a行D代ä??码?将?数ºy据Y加??载?到Ì?表 À?ª“?ãdb_AssetMSDataSet.tb_Status”?À中D。?ê您??可??以??根??据Y需??要?a移??动??或??删??除y它??。?ê this.tb_StatusTableAdapter.Fill(this.db_AssetMSDataSet.tb_Status); } private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); StringBuilder sb = new StringBuilder(); if (comboBox1.Text.ToString() == "全??部?") { string M_str_sql = "select assetNo as 资Á?º产??号?,tb_Status.statusNo as 状Á?ä态??类???别Àe, ststusDescription from tb_Asset ,tb_Status where tb_Asset.statusNo =tb_Status . statusNo ;"; SqlDataAdapter ada = new SqlDataAdapter(M_str_sql, con); 19 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; } else { if (comboBox1.Text.ToString() == "资Á?º产??号?") sb.AppendLine("select tb_Asset.assetNo as 资Á?º产??号?,tb_Status.statusNo as 状Á?ä态??类???别Àe,tb_Status . ststusDescription as 资Á?º产??状Á?ä态??描??述º? from tb_Asset ,tb_Status where tb_Asset.assetNo =").Append ("'").Append(this.textBox1.Text).Append ("';"); String abc = sb.ToString(); SqlDataAdapter ada = new SqlDataAdapter(abc, con); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; } con.Close(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button2_Click(object sender, EventArgs e) { Form3_3_3 f1 = new Form3_3_3(); f1.ShowDialog(); } 界面主要代码: 20 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 private void button2_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); String T1 = textBox1.Text.ToString(); String T3 = textBox2.Text.ToString(); string insertStr = "update tb_Asset set statusNo ='" + T3 + "' where assetNo='" + T1 + "'"; SqlCommand abc = new SqlCommand(insertStr, con); abc.ExecuteNonQuery(); con.Close(); MessageBox.Show(" 更?? 新? 成?? 功| ~ê?", " 温? 馨??ã 提??? 示º? "); this.Close(); } 4.6资产状态界面 界面主要代码: private void toolStripButton1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); StringBuilder sb = new StringBuilder(); if (toolStripSplitButton1.Text.ToString() == "全??部?") { string M_str_sql = "select agentNo as 代ä??理??ª商???号?, agentName as 代ä??理??ª 21 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 商???名?称?,contactName as 联?a系?Ì人??姓?名?,contactTelNo as 联?a系?Ì人??电Ì?话?ã,contactFaxNo as 联?a系?Ì人??传ä?真?,contactEmailAdress as 联?a系?Ì人??邮??º箱?,agentTelNo as 公?司?电Ì?话?ã,agentFaxNo as 公?司?传ä?真?,agentEmailAdress as 邮??º箱?,agentWebAdress as 网ª?站? from tb_ServiceAgent;"; SqlDataAdapter ada = new SqlDataAdapter(M_str_sql, con); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; } else { if (toolStripSplitButton1.Text.ToString() == "代ä??理??ª商???号?") sb.AppendLine("select agentNo as 代ä??理??ª商???号?, agentName as 代ä??理??ª商???名?称?,contactName as 联?a系?Ì人??姓?名?,contactTelNo as 联?a系?Ì人??电Ì?话?ã,contactFaxNo as 联?a系?Ì人??传ä?真?,contactEmailAdress as 联?a系?Ì人??邮??º箱?,agentTelNo as 公?司?电Ì?话?ã,agentFaxNo as 公?司?传ä?真?,agentEmailAdress as 邮??º箱?,agentWebAdress as 网ª?站? from tb_ServiceAgent where agentNo =").Append ("'").Append(this.toolStripTextBox1.Text).Append ("';"); String abc = sb.ToString(); SqlDataAdapter ada = new SqlDataAdapter(abc, con); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; } con.Close(); } private void toolStripButton3_Click(object sender, EventArgs e) { this.Close(); } private void bindingNavigatorSeparator2_Click(object sender, EventArgs e) { Form3_4_1 f1 = new Form3_4_1(); f1.ShowDialog(); } private void toolStripButton2_Click(object sender, EventArgs e) { Form3_4_2 f2 = new Form3_4_2(); f2.ShowDialog(); } 22 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 界面主要代码: private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { checkedListBox1.Items.Clear(); } SqlConnection con = new SqlConnection(Connection.conn); con.Open(); SqlCommand com = new SqlCommand(); com.CommandText = "Select * from tb_ServiceAgent;"; com.CommandType = CommandType.Text; com.Connection = con; SqlDataReader reader = com.ExecuteReader(); int j = 0; while (reader.Read()) { checkedListBox1.Items.Add(reader[j]); } con.Close(); } private void button2_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); for (int i = 0; i < this.checkedListBox1.Items.Count; i++) 23 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 { if (checkedListBox1.GetItemChecked(i)) { StringBuilder sb = new StringBuilder(); sb.Append("delete from tb_ServiceAgent where agentNo='").Append(this.checkedListBox1.Text).Append("';"); String delete = sb.ToString(); SqlCommand deleteCmd = new SqlCommand(delete, con); deleteCmd.ExecuteNonQuery(); MessageBox.Show("删??除y操??作Á?Â成??功|~ê?~ê?~ê?"); this.Close(); } } con.Close(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } 4.7用户管理界面 界面主要代码:private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); string M_str_sql = "select userName as 用??户?ì名?,passWord as 用??户?ì密??码? from tb_Login ;"; 24 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 SqlDataAdapter ada = new SqlDataAdapter(M_str_sql, con); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button4_Click(object sender, EventArgs e) { Form3_5_1 f1 = new Form3_5_1(); f1.ShowDialog(); } private void button5_Click(object sender, EventArgs e) { Form3_5_2 f2 = new Form3_5_2(); f2.ShowDialog(); } private void button2_Click(object sender, EventArgs e) { Form3_5_3 f3 = new Form3_5_3(); f3.ShowDialog(); } 界面主要代码: private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { 25 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 checkedListBox1.Items.Clear(); } SqlConnection con = new SqlConnection(Connection.conn); con.Open(); SqlCommand com = new SqlCommand(); com.CommandText = "Select * from tb_Login "; com.CommandType = CommandType.Text; com.Connection = con; SqlDataReader reader = com.ExecuteReader(); int j = 0; while (reader.Read()) { checkedListBox1.Items.Add(reader[j]); } con.Close(); } private void button2_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); for (int i = 0; i < this.checkedListBox1.Items.Count; i++) { if (checkedListBox1.GetItemChecked(i)) { StringBuilder sb = new StringBuilder(); sb.Append("delete from tb_Login where userName='").Append(this.checkedListBox1.Text).Append("';"); String delete = sb.ToString(); SqlCommand deleteCmd = new SqlCommand(delete, con); deleteCmd.ExecuteNonQuery(); MessageBox.Show("删??除y操??作Á?Â成??功|~ê?~ê?~ê?"); this.Close(); } } con.Close(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } 26 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 界面主要代码: private void button2_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); String T1 = textBox1.Text.ToString(); String T3 = textBox3.Text.ToString(); string insertStr = "update tb_Login set passWord ='"+T3+"' where userName ='"+T1+"'"; SqlCommand abc = new SqlCommand(insertStr,con); abc.ExecuteNonQuery(); con.Close(); MessageBox.Show(" 更?? 新? 成?? 功| ~ê?", " 温? 馨??ã 提??? 示º? "); this.Close(); } 4.8普通用户界面 27 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 界面主要代码: private void button1_Click(object sender, EventArgs e) 28 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 { SqlConnection con = new SqlConnection(Connection.conn); con.Open(); StringBuilder sb = new StringBuilder(); sb.AppendLine("select tb_Employee.employeeNo as 员?À工?è号?,tb_Employee.name as 姓?名?,tb_Employee.EnterPassword as 登Ì?录?密??码?,tb_Asset .assetNo as 资Á?º产??号? ,tb_Asset .statusNo as 资Á?º产??状Á?ä态?? from tb_Employee,tb_Asset where tb_Employee.employeeNo=").Append("'").Append(this.textBox1 .Text).Append ("'"); String abc = sb.ToString(); SqlDataAdapter ada = new SqlDataAdapter(abc, con); DataSet ds = new DataSet(); ada.Fill(ds); this.dataGridView1.DataSource = ds.Tables[0].DefaultView; con.Close(); } private void button2_Click(object sender, EventArgs e) { this.Close(); } private void button3_Click(object sender, EventArgs e) { String T2 = textBox2.Text.ToString(); String T4 = textBox4.Text.ToString(); SqlConnection con = new SqlConnection(Connection.conn); con.Open(); string insertStr = "update tb_Employee set EnterPassword ='" + T4+ "' where employeeNo='" + T2+ "'"; SqlCommand abc = new SqlCommand(insertStr, con); abc.ExecuteNonQuery(); con.Close(); MessageBox.Show(" 密?? 码? 修T 改? 成?? 功| ~ê?", " 温? 馨??ã 提??? 示º? "); } private void button4_Click(object sender, EventArgs e) { this.Close(); } 29 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 五(数据库E-R图 六(数据库介绍 6.1数据库表的建立 该数据库的名称为db_AssetMS,其中包含有8张表,分别为: tb_Asset, tb_Login, tb_Employee, tb_AssetCategory, tb_Maintenance, tb_ServiceAgent, tb_Valuation, tb_Status 他们之间存在约束条件为: 1. 无外键约束条件的表:tb_Employee,tb_Status,tb_AssetCategory,tb_ServiceAgent,tb_Login 30 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 2. 外键约束: tb_Valuation表的外键约束:tb_Employee(employeeNo),tb_Asset表的(assetNo) tb_Maintenance表的外键约束:tb_Asset(assetNo),tb_Employee(employeeNo), tb_ServiceAgent(agentNo) tb_Asset表的外键约束:tb_AssetCategory (assetCategoryNo ),tb_Employee (employeeNo), tb_Status(statusNo) 1.tb_Employee 允许键说列名 数据类型 说明 空 明 VarChar(20) employeeNo 职员号 主键 VarChar(20) title 部门 VarChar(20) name 姓名 VarChar(100) address 家庭地址 VarChar(20) workTelExt 工作电话 VarChar(20) homeTelNo 是 家庭电话 VarChar(50) empEmailAdress 是 邮箱 Char(20) socialSecurityNumber 身份证号 唯一 VarChar(20) DOB 出生日期 VarChar(20) position 职称 Char(4) sex 性别 money salary 薪水 date dateStarted 开始日期 2.tb_Asset 允许键说列名 数据类型 说明 空 明 VarChar(20) assetNo 资产ID 主键 VarChar(100) assetDescription 是 资产描述 VarChar(20) serialNo 序列号 唯一 date dateAcquired 进货日期 money purchasePrice 进货价格 money currentValue 是 目前价值 date dateSold 售出日期 date nextMaintenanceDate 是 下次维护日期 VarChar(20) employeeNo 职员号 外键 VarChar(20) assetCategoryNo 类别号 外键 VarChar(20) statusNo 状态号 外键 31 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 3.tb_AssetCategory 允许键说列名 数据类型 说明 空 明 VarChar(20) assetCategoryNo 类别号 主键 VarChar(50) assetCategoryDescriprion 类别描述 4.tb_Maintenance 允许键说列名 数据类型 说明 空 明 VarChar(20) maintenanceNo 维护号 主键 date maintenanceDate 维护日期 VarChar(50) maintenceDescription 是 维护描述 money maintenanceCost 维护费用 VarChar(20) assetNo 资产号 外键 VarChar(20) employeeNo 职员号 外键 VarChar(20) agentNo 代理号 外键 5.tb_ServiceAgent 允许键说列名 数据类型 说明 空 明 VarChar(20) agentNo 代理号 主键 VarChar(50) agentName 代理名字 VarChar(50) agentStreet 代理街道 VarChar(20) agentCity 代理城市 VarChar(20) agentState 代理状态 VarChar(10) agentZipCode 邮政编码 VarChar(20) agentTelNo 代理电话 唯一 VarChar(20) agentFaxNo 代理传真 唯一 VarChar(50) agentEmailAdress 代理邮箱 VarChar(100) agentWebAdress 是 代理网站 VarChar(20) contactName 联系人姓名 VarChar(20) contactTelNo 联系人电话 VarChar(20) contactFaxNo 联系人传真 VarChar(50) contactEmailAdress 联系人邮箱 6.tb_Status 允许键说列名 数据类型 说明 空 明 VarChar(20) statusNo 状态号 主键 VarChar(50) ststusDescription 状态描述 32 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 7.tb_Valuation 允许键说列名 数据类型 说明 空 明 VarChar(20) valuationNo 估价号 主键 date valuationDate 估价日期 money valutionPrice 价值 VarChar(20) assetNo 资产号 外键 VarChar(20) employeeNo 职员号 外键 6.2数据库物理结构设计 数据库的结构图如下: 所有的关系围绕资产来描述,资产的主键是资产号,资产需要维护。 首先对现有资产的情况进行分类,即tb_Status,分为优质,良好差三个等级 其次需要对资产的种类进行分类,即tb_AssetCategory,如:我们可以将PC机分为A类,将桌椅等分为B类,打印机分为C类,汽车分为D类 然后我们需要先对这些资产进行估价,即tb_Valuation,对它的现有市场价格进行评估 最后将这些资产分为员工,即tb_Employee 如果这些资产因使用而折旧或者损坏,我们将对它进行维护,即tb_Maintenance,如果有需要,还要将其送到维修公司,即tb_ServiceAgent 这些数据之间存在相互的联系和约束关系,约束关系在逻辑设计时已经给出,在此不再赘述。 33 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 6.3生成表的代码 CREATE TABLE tb_Employee ( employeeNo Varchar(20) PRIMARY KEY, title Varchar(20), name Varchar(20), address Varchar(100), workTelExt Varchar(20), homeTelNo Varchar(20), empEmailAdress Varchar(50), socialSecurityNumber Char(20) UNIQUE, DOB Varchar(20), position Varchar(20), sex char(4), salary money, dateStarted date ); CREATE TABLE tb_Status ( statusNo Varchar(20) PRIMARY KEY, ststusDescription Varchar(50) ); CREATE TABLE tb_AssetCategory (assetCategoryNo Varchar(20) PRIMARY KEY, assetCategoryDescriprion Varchar(20) ); CREATE TABLE tb_Asset ( assetNo Varchar(20) PRIMARY KEY, assetDescription Varchar(100), serialNo Varchar(20), dateAcquired date, purchasePrice money, currentValue money, dateSold date, nextMaintenanceDate date, employeeNo Varchar(20), assetCategoryNo Varchar(20), statusNo Varchar(20), FOREIGN KEY (assetCategoryNo) REFERENCES tb_AssetCategory (assetCategoryNo )on delete 34 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 cascade, FOREIGN KEY (employeeNo) REFERENCES tb_Employee (employeeNo) on delete cascade, FOREIGN KEY(statusNo) REFERENCES tb_Status(statusNo)on delete cascade ); CREATE TABLE tb_Valuation ( valuationNo Varchar(20) PRIMARY KEY, valuationDate date, valutionPrice money, assetNo Varchar(20), employeeNo Varchar(20), FOREIGN KEY (assetNo) REFERENCES tb_Asset(assetNo)on update cascade, FOREIGN KEY (employeeNo) REFERENCES tb_Employee(employeeNo) on delete cascade on update cascade ); CREATE TABLE tb_Maintenance ( maintenanceNo Varchar(20) PRIMARY KEY, maintenanceDate date, maintenceDescription Varchar(50), maintenanceCost money, assetNo Varchar(20), employeeNo Varchar(20), agentNo Varchar(20), FOREIGN KEY (assetNo ) REFERENCES tb_Asset(assetNo), FOREIGN KEY (employeeNo) REFERENCES tb_Employee(employeeNo)on delete cascade, FOREIGN KEY(agentNo) REFERENCES tb_ServiceAgent(agentNo)on delete cascade ); CREATE TABLE tb_ServiceAgent ( agentNo Varchar(20) PRIMARY KEY, agentName Varchar(50), agentStreet Varchar(50), agentCity Varchar(20), agentState Varchar(20), agentZipCode Varchar(10), agentTelNo Varchar(20) UNIQUE, agentFaxNo Varchar(20) UNIQUE, agentEmailAdress Varchar(100), agentWebAdress Varchar(20), 35 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 contactName Varchar(20), contactTelNo Varchar(20), contactFaxNo Varchar(20), contactEmailAdress Varchar(50) ); 七(用户使用手册 7.1用户登陆模块 登录窗口: 1. 登陆的密码不显示 2. 登陆的实现是使用了一张登录表,表中记录了用户名和密码 3. 有两种模式可以选择,用户和管理员 4. 用户的操作权限仅仅在于查询个人的资产使用情况以及修改个人密码,而管理员可 以提查询所有信息还具有插入,查询,删除等等的功能 注:普通用户的用户名为职员号,密码为1111,管理员的用户名为123,密码为1234 7.2主界面 普通用户主界面: 36 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 1. 在此界面下,可以查询个人的资产使用情况,以及修改个人密码 37 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 2. 修改密码,将新的密码信息写入登录表,并反馈修改成功的提示 管理员用户主界面: 1. 在此界面下可以实现插入,查询,删除等等功能 2. 为了保证数据库的安全性,提供安全退出 3. 查询的内容繁多,可分别查询资产信息,职员信息,服务商信息,资产状态等等信息 4. 为了方便管理,还专门设置了管理界面 7.3资产信息界面 38 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 1. 可对资产的信息进行查询,修改等等操作,查询包括:全部查询或者按资产号查询;修 改包括添加,删除,关闭。 当前数据库里的信息,查询如下: 39 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 添加资产信息: 删除资产信息: 40 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 7.4职员信息界面: 可对职员的信息进行查询,修改等等操作,查询包括:全部查询或者按职工号查询;修改包括新增,删除,关闭 添加职员: 41 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 删除职员信息: 7.5服务商界面: 查询全部内容: 可对服务商的信息进行查询操作,从中可以知道服务商的有关信息。 42 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 按服务商号查询: 7.6资产状态界面: 资产信息主界面: 查询全部资产: 43 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 按资产号进行查询: 44 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 添加资产: 添加后查询全部(显示添加的信息): 45 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 删除资产信息: 查看数据库(验证已经删除): 46 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 7.7用户管理界面: 当前数据库的用户: 1. 实际上就是登录表中的用户数据 2. 通过用户管理,可以对使用该数据库的用户进行管理 3. 对用户的操作有,查询(显示用户),授权(添加用户),修改密码,删除等操作 添加新用户: 47 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 添加后: 用户修改密码: 48 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 验证修改后的信息: 1.原来qi这位用户的密码为123,现在修改为1234 2.密码在管理员界面是可见的 删除用户: 49 / 50 中南民族大学计算机科学学院网络工程专业 《数据库系统概论》课程设计 验证用户已删除: 注意:再次以上的实现代码就不在此列出,详细代码见000中的源文件 50 / 50 中南民族大学计算机科学学院网络工程专业
/
本文档为【中南民族大学-数据库大作业-《资产管理系统》】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索