1、音像出租管理系统302020年4月19日文档仅供参考,不当之处,请联系改正。第一部份 系统需求分析2.1 系统需求分析音像出租管理系统用于提高音像出租各个环节的效率,因此对雇员信息,顾客信息,音像信息,出租信息,库存信息,采购信息等信息进行控制与优化,减少手工输入和相应库存环节的计算过程,界面应尽量做到友好,使操作员易学易懂,另外,还应提供系统维护功能的设定和权限的设置以及保障系统的安全性。第二部份 功能需求分析1.功能需求分析的描述经过对音像出租店实地调研,能够得到音像出租店的整个业务包括:雇员管理、会员(顾客)信息管理、音像制品采购、音像制品出租、音像制品报废等。因此,根据实际业务需求把系
2、统分为雇员管理、顾客管理、音像制品信息管理、出租管理、报废管理、租金管理等子系统。为满足以上要求,音像出租系统具有如下功能:(1)雇员管理子系统要实现雇员的录入,修改,删除,查询等功能(2)顾客管理子系统要实现顾客和会员信息的获取,删除,修改,查询等功能(3)采购子系统要实现音像制品的购入,入库功能(4)音像制品管理子系统要实现音像信息的录入,修改和查询功能(5)出租管理子系统要实现音像制品的出租,收回,顾客信息录入功能(6)报废子系统要实现音像制品的报废和出库功能(7)租金管理子系统要实现音像制品的出租规则2.2系统功能模块图第三部份 系统设计3.1数据概念设计 1.数据实体属性图2.系统E
3、-R图3.2数据库逻辑结构(关系模式)设计按照E-R图到逻辑关系模式的转换规则,可的得到系统如下8个关系。(1) 雇员信息(雇员序号、姓名、年龄、性别、身份证号、联系电话、城市、地址、职务、工资、参加工作时间、口令、权限);(2) 顾客信息(客户号、顾客姓名、身份证号、联系电话、联系地址、加入时间、类别);(3) 音像制品信息(序号、片名、主演、导演、制片、制片厂、简介、日期、类别);(4) 库存信息(片子序号、数量、级别);(5) 采购信息(序号、片子序号、数量、单价、购买日期、供应商、雇员号);(6) 出租信息(序号、片子序号、顾客序号、租片日期、还片日期、租金、数量、折扣、雇员号);(7
4、) 租金信息(片子级别、租金、押金、超期租金、租期);(8) 报废信息(序号、片子序号、数量、日期、雇员号)33数据库物理结构设计本系统数据库表的物理结构设计经过创立表的SQL命令及数据库关系图来呈现的,是在Microsoft SQL Server 中创立的表,利用SQL Server 的导出SQL脚本,显示了数据库创立的代码。1. 创立数据库表的SQL命令GREATE DATABASE 音像出租系统 -创立数据库-以下为创立各表的SQL上命令CREATE TABLE dbo.Customer (CustomerID int NOT NULL ,Name nvarchar (20) COLLA
5、TE Chinese_PRC_CI_AS NOT NULL ,ID nvarchar (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,Phone nvarchar (20) COLLATE Chinese_PRC_CI_AS NULL ,Address nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,JoinDate nvarchar (8) COLLATE Chinese_PRC_CI_AS NULL ,Sort nvarchar (20) COLLATE Chinese_PRC_CI_AS NOT NULL )
6、ON PRIMARYGOCREATE TABLE dbo.Discard (DiscardID int NOT NULL ,FilmID int NOT NULL ,Amount int NOT NULL ,DisDate datetime NOT NULL ,EmployeeID smallint NOT NULL ) ON PRIMARYGOCREATE TABLE dbo.Employee (EmployeeID smallint NOT NULL ,Name nvarchar (4) COLLATE Chinese_PRC_CI_AS NOT NULL ,Age smallint NO
7、T NULL ,Sex nvarchar (4) COLLATE Chinese_PRC_CI_AS NOT NULL ,ID nvarchar (20) COLLATE Chinese_PRC_CI_AS NULL ,Phone nvarchar (20) COLLATE Chinese_PRC_CI_AS NULL ,City nvarchar (20) COLLATE Chinese_PRC_CI_AS NULL ,Address nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,Title nvarchar (10) COLLATE Chine
8、se_PRC_CI_AS NOT NULL ,Salary int NOT NULL ,HireDate datetime NOT NULL ,PassWord nvarchar (8) COLLATE Chinese_PRC_CI_AS NOT NULL ,Power smallint NOT NULL ) ON PRIMARYGOCREATE TABLE dbo.Film (FilmID int NOT NULL ,FilmName nvarchar (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,Actor nvarchar (20) COLLATE C
9、hinese_PRC_CI_AS NULL ,Director nvarchar (20) COLLATE Chinese_PRC_CI_AS NULL ,Publisher nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,Studio nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,Content nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,PubDate datetime NULL ,Sort nvarchar (20) COLLATE Chinese_P
10、RC_CI_AS NOT NULL ) ON PRIMARYGOCREATE TABLE dbo.Hire (HireID int NOT NULL ,FilmID int NOT NULL ,CustomerID int NOT NULL ,HireDate datetime NOT NULL ,DueDate datetime NOT NULL ,Rent int NOT NULL ,Amount int NOT NULL ,Discount int NOT NULL ,EmployeeID smallint NOT NULL ) ON PRIMARYGOCREATE TABLE dbo.
11、Purchase (PurchaseID int NOT NULL ,FilmID int NOT NULL ,Amount int NOT NULL ,UnitPrice int NOT NULL ,PurchaseDate datetime NOT NULL ,Supplier nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,EmployeeID smallint NOT NULL ) ON PRIMARYGOCREATE TABLE dbo.Rent (Grade smallint NOT NULL ,Rent int NOT NULL ,De
12、posit int NOT NULL ,DateRent int NOT NULL ,Lease datetime NOT NULL ) ON PRIMARYGOCREATE TABLE dbo.Stock (FilmID int NOT NULL ,Amount int NOT NULL ,Grade smallint NOT NULL ) ON PRIMARYGO2. 数据库关系图第四部份 系统功能的实现41数据库连接通用模块数据库的连接和公用的函数如下:数据库连接: /连接字段 string strConnection = user id=student;password=student
13、;strConnection += initial catalog=音像出租系统;Server=LocalHost;/数据连接SqlConnection objConnection = new SqlConnection(strConnection);SqlCommand myCommand = new SqlCommand(str, objConnection);objConnection.Open(); customerSet1.Clear();SqlDataAdapter dAp = new SqlDataAdapter(myCommand);/查询结果放入记录集customerSet1
14、中dAp.Fill(customerSet1, Customer); /执行更新,删除,插入等数据库操作函数private void ExecuteSQL(string SQL) string strConnection = user id=student;password=student; strConnection += initial catalog=音像出租系统;Server=LocalHost; myCon.ConnectionString = strConnection;try myCon.Open(); myCom.CommandText = SQL; myCom.Command
15、Type = CommandType.Text; myCom.Connection = myCon; myCom.ExecuteNonQuery(); catch (SqlException oe) MessageBox.Show(oe.Message, Error); finally if (myCon.State = ConnectionState.Open) myCon.Close(); 42部分功能界面的实现以下只给出各功能块主要函数的代码,1.系统登陆模块 private void button1_Click(object sender, EventArgs e) Form2 loa
16、d_wait = new Form2(); load_wait.Pname = textBox1.Text; load_wait.Pwrd = textBox2.Text; if(textBox1.Text =|textBox2.Text =) MessageBox.Show(请输入用户序号和口令,然后登录); return; if (load_wait.ShowDialog() = DialogResult.OK) MessageBox.Show(登陆成功); access_s = true; power = load_wait.power; load_Name = load_wait.lo
17、ad_Name; this.Close(); private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) this.DialogResult = DialogResult.Cancel; this.Close(); private void timer1_Tick(object sender, EventArgs e) progressBar1.PerformStep();label2.Text = Convert.ToString(i-);string SQL = select Power,Name from Empl
18、oyee where EmployeeID =;SQL += Pname + and PassWord = + Pwrd.Trim() + ;string strConnection = user id=student;password=student;strConnection += initial catalog=音像出租系统;Server=LocalHost;SqlConnection objConnection = new SqlConnection(strConnection);SqlCommand myCommand = new SqlCommand(SQL, objConnect
19、ion);objConnection.Open();SqlDataReader rd = myCommand.ExecuteReader();if (rd.HasRows)rd.Read(); power = Convert.ToInt32(rd0);load_Name = Convert.ToString(rd1);if (i = 5)this.DialogResult = DialogResult.OK;if (i = 0 & rd.HasRows != true ) MessageBox.Show(没有这个用户或密码不正确,请重新登录!); this.DialogResult = Dia
20、logResult.No; 运行界面2.主界面模块/根据权限值显示可操作的功能项private void Form4_Load(object sender, EventArgs e) ToolStripMenuItem_help.Enabled = true;toolStripStatusLabel_load.Text = load_Name; switch (power) case 1: ToolStripMenuItem_ry.Enabled = true; ToolStripMenuItem_yx.Enabled = true; ToolStripMenuItem_xt.Enabled
21、= true; break; case 2: ToolStripMenuItem_ry.Enabled = false; ToolStripMenuItem_yx.Enabled = true; ToolStripMenuItem_xt.Enabled = false; break; default: MessageBox.Show(您没有使用本系统的权限,请联系管理员); break; /在状态栏上显示当前时间private void timer1_Tick(object sender, EventArgs e) DateTime ahu = DateTime.Now; string tim
22、e = ahu.ToLongDateString(); time += + ahu.Hour.ToString() + 时 + ahu.Minute.ToString() + 时 + ahu.Second.ToString() + 秒 ; toolStripStatusLabel_time.Text = time;运行界面3.音像制品管理模块1.采购管理private void butto_submit_Click(object sender, EventArgs e) String insStr = INSERT INTO Purchase(PurchaseID,FilmID,Amount,
23、UnitPrice,PurchaseDate,Supplier,EmployeeID) insStr += values( + (Navigator.Count + 1).ToString() + , + textBox2.Text + , + textBox3.Text; insStr += , + textBox4.Text + , + textBox5.Text + , + textBox6.Text; insStr += , + textBox7.Text + );string upStr = UPDATE Stock Set Amount = Amount + + textBox3.
24、Text; upStr += WHERE FilmID = + textBox2.Text; String tip = n序 号: + textBox1.Text + n片子序号: + textBox2.Text + n数 量: + textBox3.Text + n单 价: + textBox4.Text; tip += n购买日期: + textBox5.Text + n 供应商: + textBox6.Text;if (MessageBox.Show(tip, 采购信息, MessageBoxButtons.OKCancel) = DialogResult.Cancel) return;
25、 else ExecuteSQL(upStr); ExecuteSQL(insStr); 运行界面: 2.音像信息管理模块 private void Film_Load(object sender, EventArgs e) string strConnection = user id=student;password=student; strConnection += initial catalog=音像出租系统;Server=LocalHost; myCon.ConnectionString = strConnection;try myCon.Open(); myCom.CommandTy
26、pe = CommandType.Text; myCom.Connection = myCon; myCom.CommandText = Select * From Film; myDS.Clear(); myAD.SelectCommand = myCom; myAD.Fill(myDS, Film);bindingSource1.DataSource = myDS; bindingSource1.DataMember = Film; bindingSource1.ResetBindings(true);dataGridView1.DataSource = bindingSource1; c
27、atch (SqlException oe) MessageBox.Show(oe.Message, Error); finally if (myCon.State = ConnectionState.Open) myCon.Close(); private void button1_Click(object sender, EventArgs e)String insStr = INSERT INTO Film(FilmID,FilmName,Actor,Director,Publisher,Studio,Content,PubDate,Sort;insStr += ) values( +
28、(bindingSource1.Count + 1).ToString() + , + textBox2.Text; insStr += , + textBox3.Text + , + textBox4.Text + , + textBox5.Text; insStr += , + textBox6.Text + , + textBox7.Text + , + textBox8.Text; insStr += , + textBox9.Text +);if (MessageBox.Show(确实要添加吗?, 确认, MessageBoxButtons.OKCancel) = DialogResult.Cancel) return; else ExecuteSQL(insStr); 运行界面:3.音像信息管理模块实现方法和上面类似这里就不给出代码了运行结果:4.报废信息模块2.人员管理 1.雇员管理 2.顾客信息管理3.系统维护4.帮助