班 级 软件0601
学 号 **********
姓 名
指导老师
二零零八年 7 月
一、概述
1、项目背景:数据库原理课程设计
2、编写目的:掌握数据库设计原理及相关软件的使用 3、软件定义:书店管理系统 4、开发环境:
语言:C Sharp;
平台:Visual Studio 2005 + Microsoft .Net 2.0; 数据库:Microsoft SQL Server 2000;
二、需求分析 1、问题的提出
2、完成的功能
1.售书管理:销售订单和销售统计; 2.订购管理; 3.库存管理; 4.信息查询; 5.推出系统。
3、E-R图
三 数据表
Book(isbn,title,author,publisher,price,totalnum,comment,dtime) Inlist(isbn,title,price,provider,buynum,dtime) Outlist(isbn,username,buyip,price,buynum,title)
四、表、视图、索引、存储过程、触发器的创建
Book表:
Inlist:
Outlist:
五、软件功能设计
1.主界面:负责调出资界面;
2.销售订单界面:将销售订单的信息加入销售订单列表outlist; 3.进货单界面:将进货单的信息加入进货单信息表inlist; 4.bookinput界面:将新录入的图书信息家入book表; 5.storage界面:从book表中查询图书信息; 6.退出按钮:退出界面。 主界面:
销售订单界面:
进货单界面
bookinput界面:
storage界面
六、程序代码及控件描述
//form1.cs
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text;
using System.Windows.Forms;
namespace bookmanagesys {
public partial class Form1 : Form {
public Form1() {
InitializeComponent(); }
private void 信息查询
ToolStripMenuItem_Click(object sender, EventArgs e) {
storage sg = new storage(); sg.Show(); }
private void Form1_Load(object sender, EventArgs e) {
Global.Con = new
System.Data.SqlClient.SqlConnection(\"Data Source=JD-6B3825650DEA;Initial
Catalog=Booksale;Integrated Security=True\"); Global.Con.Open(); }
private void 销售订单
ToolStripMenuItem_Click(object sender, EventArgs e) {
SaleOrder so = new SaleOrder(); so.Show(); }
private void 进书定单
ToolStripMenuItem_Click(object sender, EventArgs e) {
stocktable st = new stocktable(); st.Show(); }
private void 新书入库
ToolStripMenuItem_Click(object sender, EventArgs e) {
bookInput bi = new bookInput(); bi.Show(); }
private void 退出系统
ToolStripMenuItem_Click(object sender, EventArgs e) {
this.Close(); }
private void
textBox1_TextChanged(object sender, EventArgs e) {
}
private void Form1_FormClosed(object return; } }
sender, FormClosedEventArgs e) { try {
Global.Con.Close(); }
catch (Exception) {
//saleorder using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text;
using System.Windows.Forms; using System.Data.SqlClient;
namespace bookmanagesys {
public partial class SaleOrder : Form {
public SaleOrder() {
InitializeComponent(); }
private void
button_cancel_Click(object sender, EventArgs e) {
this.Close(); }
private void button_ok_Click(object sender, EventArgs e) {
private void 销售统计
ToolStripMenuItem_Click(object sender, EventArgs e) {
salestatic sat = new salestatic();
sat.Show(); } } }
string username = textBox_consumer.Text;
string buyip = textBox_ip.Text; string isbn = textBox_isbn.Text; string price = textBox_price.Text;
string buynum = textBox_num.Text; string title = textBox_title.Text;
SqlCommand jincommand = new SqlCommand();
jincommand.Connection = Global.Con;
jincommand.CommandText = \"INSERT INTO
outlist(username ,buyip,isbn,price,buynum,title) VALUES('\" + textBox_consumer.Text + \"','\" + textBox_ip.Text + \"','\" + textBox_isbn.Text + \"','\" +
textBox_price.Text + \"','\" + textBox_num.Text +\"','\" + textBox_title.Text+ \"')\"; int jin = jincommand.ExecuteNonQuery(); if (jin > 0)
label_show.Text = \"提交成功\";
else
label_show.Text = \"提交失败!sender, EventArgs e) {
\";
}
private void SaleOrder_Load(object //stocktable using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text;
using System.Windows.Forms; using System.Data.SqlClient;
namespace bookmanagesys {
public partial class stocktable : Form {
public stocktable() {
InitializeComponent(); }
private void button_ok_Click(object sender, EventArgs e) {
string title = textBox_title.Text;
string provider = textBox_provider.Text;
string buynum = textBox_num.Text; string price = textBox_price.Text;
string dtime = textBox_date.Text; string isbn = textBox_isbn.Text;
} } }
SqlCommand jinCommand = new SqlCommand();
jinCommand.Connection = Global.Con;
jinCommand.CommandText = \"INSERT INTO
inlist(isbn,title ,provider,buynum,price,dtime) VALUES('\" + textBox_isbn.Text + \"','\" + textBox_title.Text + \"','\" + textBox_provider.Text + \"','\" +
textBox_num.Text + \"','\" + textBox_price.Text + \"','\" + textBox_date.Text + \"')\"; int jin =
jinCommand.ExecuteNonQuery(); if (jin > 0)
label_show.Text = \"提交成功\";
else
label_show.Text = \"提交失败!\"; }
private void
stocktable_Load_1(object sender, EventArgs e) {
}
private void
button_cancel_Click(object sender, EventArgs
e) { //bookInput using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text;
using System.Windows.Forms; using System.Data.SqlClient;
namespace bookmanagesys {
public partial class bookInput : Form {
public bookInput() {
InitializeComponent(); }
private void button_ok_Click(object sender, EventArgs e) {
string isbn = textBox_isbn.Text; string title = textBox_title.Text;
string dtime = textBox_time.Text; string author = textBox_author.Text;
string publisher = textBox_publisher.Text; string price = textBox_price.Text;
string comment = textBox_comment.Text;
SqlCommand jinCommand = new SqlCommand();
jinCommand.Connection = Global.Con;
jinCommand.CommandText = \"INSERT INTO
this.Close(); }
book(isbn ,title,dtime,author,publisher,price,comment) VALUES('\" + textBox_isbn.Text + \"','\" + textBox_title.Text + \"','\" + textBox_time.Text + \"','\" + textBox_author.Text + \"','\" + textBox_publisher.Text + \"','\" + textBox_price.Text + \"','\" + textBox_comment.Text + \"')\"; int jin =
jinCommand.ExecuteNonQuery(); if( jin > 0)
label_show.Text = \"入库成功\";
else
label_show.Text = \"入库失败!\";
}
private void
button_cancel_Click(object sender, EventArgs e) {
this.Close(); }
private void bookInput_Load(object sender, EventArgs e) {
}
private void
groupBox_input_Enter(object sender, EventArgs e) {
} } } //gobal using System;
using System.Collections.Generic; using System.Text;
using System.Data.SqlClient;
namespace bookmanagesys
} }
{
public static class Global {
public static SqlConnection Con; } }
七.设计心得
从一开使拿到题目不知道如何下手到看了大量的例子后开始动手尝试是一个很长的过程。一开遇到的问题是不知道用什么语言做。后来决定用c#,但是如何建立表格以及需要哪些变量对于没有经验的我来说是一件茫然的事,然而在看了一些的例子后明白了如何建立表格。下面就是设计界面了。C#提供了非常简单的界面设计方法,如何设计完全看个人了,在界面的设计上并没有花太多的时但是在代码的设计上遇到了问题。由于对于c#语言并不是非常的熟悉所以在代码的设计上借鉴了一些书上和别人的代码。
这次的设计让我得到了动手练习的机会,初步明白了网上售书系统的设计与分析,当然这只是最简单的情况,实际的一个售书系统要考虑的更全面,更复杂。所及今后要更多的动手练习。 感谢老师辛勤指导!
因篇幅问题不能全部显示,请点此查看更多更全内容