C#书店管理系统.docx
《C#书店管理系统.docx》由会员分享,可在线阅读,更多相关《C#书店管理系统.docx(15页珍藏版)》请在冰豆网上搜索。
![C#书店管理系统.docx](https://file1.bdocx.com/fileroot1/2023-1/1/07ddf37b-74c5-427c-ab7b-a5fda389c5a8/07ddf37b-74c5-427c-ab7b-a5fda389c5a81.gif)
C#书店管理系统
数据库课程设计
班级软件0601
学号3060605022
姓名
指导老师
二零零八年7月
一、概述
1、项目背景:
数据库原理课程设计
2、编写目的:
掌握数据库设计原理及相关软件的使用
3、软件定义:
书店管理系统
4、开发环境:
语言:
CSharp;
平台:
VisualStudio2005+Microsoft.Net2.0;
数据库:
MicrosoftSQLServer2000;
二、需求分析
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
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
namespacebookmanagesys
{
publicpartialclassForm1:
Form
{
publicForm1()
{
InitializeComponent();
}
privatevoid信息查询ToolStripMenuItem_Click(objectsender,EventArgse)
{
storagesg=newstorage();
sg.Show();
}
privatevoidForm1_Load(objectsender,EventArgse)
{
Global.Con=newSystem.Data.SqlClient.SqlConnection("DataSource=JD-6B3825650DEA;InitialCatalog=Booksale;IntegratedSecurity=True");
Global.Con.Open();
}
privatevoid销售订单ToolStripMenuItem_Click(objectsender,EventArgse)
{
SaleOrderso=newSaleOrder();
so.Show();
}
privatevoid进书定单ToolStripMenuItem_Click(objectsender,EventArgse)
{
stocktablest=newstocktable();
st.Show();
}
privatevoid新书入库ToolStripMenuItem_Click(objectsender,EventArgse)
{
bookInputbi=newbookInput();
bi.Show();
}
privatevoid退出系统ToolStripMenuItem_Click(objectsender,EventArgse)
{
this.Close();
}
privatevoidtextBox1_TextChanged(objectsender,EventArgse)
{
}
privatevoidForm1_FormClosed(objectsender,FormClosedEventArgse)
{
try
{
Global.Con.Close();
}
catch(Exception)
{
return;
}
}
privatevoid销售统计ToolStripMenuItem_Click(objectsender,EventArgse)
{
salestaticsat=newsalestatic();
sat.Show();
}
}
}
//saleorder
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SqlClient;
namespacebookmanagesys
{
publicpartialclassSaleOrder:
Form
{
publicSaleOrder()
{
InitializeComponent();
}
privatevoidbutton_cancel_Click(objectsender,EventArgse)
{
this.Close();
}
privatevoidbutton_ok_Click(objectsender,EventArgse)
{
stringusername=textBox_consumer.Text;
stringbuyip=textBox_ip.Text;
stringisbn=textBox_isbn.Text;
stringprice=textBox_price.Text;
stringbuynum=textBox_num.Text;
stringtitle=textBox_title.Text;
SqlCommandjincommand=newSqlCommand();
jincommand.Connection=Global.Con;
jincommand.CommandText="INSERTINTOoutlist(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+"')";
intjin=jincommand.ExecuteNonQuery();
if(jin>0)
label_show.Text="提交成功";
else
label_show.Text="提交失败!
";
}
privatevoidSaleOrder_Load(objectsender,EventArgse)
{
}
}
}
//stocktable
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SqlClient;
namespacebookmanagesys
{
publicpartialclassstocktable:
Form
{
publicstocktable()
{
InitializeComponent();
}
privatevoidbutton_ok_Click(objectsender,EventArgse)
{
stringtitle=textBox_title.Text;
stringprovider=textBox_provider.Text;
stringbuynum=textBox_num.Text;
stringprice=textBox_price.Text;
stringdtime=textBox_date.Text;
stringisbn=textBox_isbn.Text;
SqlCommandjinCommand=newSqlCommand();
jinCommand.Connection=Global.Con;
jinCommand.CommandText="INSERTINTOinlist(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+"')";
intjin=jinCommand.ExecuteNonQuery();
if(jin>0)
label_show.Text="提交成功";
else
label_show.Text="提交失败!
";
}
privatevoidstocktable_Load_1(objectsender,EventArgse)
{
}
privatevoidbutton_cancel_Click(objectsender,EventArgse)
{
this.Close();
}
//bookInput
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SqlClient;
namespacebookmanagesys
{
publicpartialclassbookInput:
Form
{
publicbookInput()
{
InitializeComponent();
}
privatevoidbutton_ok_Click(objectsender,EventArgse)
{
stringisbn=textBox_isbn.Text;
stringtitle=textBox_title.Text;
stringdtime=textBox_time.Text;
stringauthor=textBox_author.Text;
stringpublisher=textBox_publisher.Text;
stringprice=textBox_price.Text;
stringcomment=textBox_comment.Text;
SqlCommandjinCommand=newSqlCommand();
jinCommand.Connection=Global.Con;
jinCommand.CommandText="INSERTINTObook(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+"')";
intjin=jinCommand.ExecuteNonQuery();
if(jin>0)
label_show.Text="入库成功";
else
label_show.Text="入库失败!
";
}
privatevoidbutton_cancel_Click(objectsender,EventArgse)
{
this.Close();
}
privatevoidbookInput_Load(objectsender,EventArgse)
{
}
privatevoidgroupBox_input_Enter(objectsender,EventArgse)
{
}
}
}
}
}
//gobal
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Text;
usingSystem.Data.SqlClient;
namespacebookmanagesys
{
publicstaticclassGlobal
{
publicstaticSqlConnectionCon;
}
}
七.设计心得
从一开使拿到题目不知道如何下手到看了大量的例子后开始动手尝试是一个很长的过程。
一开遇到的问题是不知道用什么语言做。
后来决定用c#,但是如何建立表格以及需要哪些变量对于没有经验的我来说是一件茫然的事,然而在看了一些的例子后明白了如何建立表格。
下面就是设计界面了。
C#提供了非常简单的界面设计方法,如何设计完全看个人了,在界面的设计上并没有花太多的时但是在代码的设计上遇到了问题。
由于对于c#语言并不是非常的熟悉所以在代码的设计上借鉴了一些书上和别人的代码。
这次的设计让我得到了动手练习的机会,初步明白了网上售书系统的设计与分析,当然这只是最简单的情况,实际的一个售书系统要考虑的更全面,更复杂。
所及今后要更多的动手练习。
感谢老师辛勤指导!