资源描述
数据库原理及web开发课程设计及报告
——物业收费管理系统
院系:信息技术工程学院
完成时间:2014年1月9日
第1章 课程设计的题目
某小区拟开发一套小区物业收费管理系统。需求分析如下:
1) 业主信息主要包括:业主编号,姓名、房号、房屋面积、工作单位、联系电话等。房号可唯一标识一条业主信息,且一个房号仅对应一套房屋;一个业主可以有一套或多套房屋。
2) 部门信息包括:部门号、部门名称、部门负责人、部门电话等;一个员工只能属于一个部门,一个部门只有一位负责人。
3) 员工信息主要包括:员工号、姓名、出生年月、性别、住址、联系电话、所在部门号、职务和密码等。根据职务不同员工可以有不同的权限,职务为“经理”的员工有添加、删除和修改员工表中本部门员工信息的操作权限;职务为“收费”的员工只有收费的操作权限。
4) 收费信息包括:房号、业主编号、收费日期、收费类型、数量、收费金额、员工号等。收费类型包括物业费、卫生费、水费和电费,并按月收取,收费标准如表2-1所示。其中,物业费=房屋面积(平方米)X每平米单价,卫生费=套房数量(套)X每套单价,水费=用水数量(吨)X每吨水价,电费=用电数量(度)X每度单价。
5) 收费完毕应为业主生成收费单,收费单示例如表2-2所示。
1.1数据库需求分析
在本系统中要管理的信息有:员工管理、收费管理。因此本系统一共需要5张表。
业主:(业主编号、房号、姓名、房屋面积、工作单位、联系电话)
员工:(员工号、所在部、姓名、出生年月、性别、住址、联系电话、职务、密码、操作权限)
部门:(部门号,部门负责人员工号、部门名称、部门电话
收费标准:(收费类型编号、收费类型、单位、单价)
收费信息:(房号、业主编号,收费日期、收费类型编号、收费金额、员工号、数量)
YZ业主:(业主编号、房号、姓名、房屋面积、工作单位、联系电话、用水量、用电量、卫生费)
备注
列
数据类型
业主编号
YZno
Int
房号
ROOMno
Int
姓名
YZname
Varchat
房屋面积
ROOMmj
Varchat
工作单位
YZDW
Varchat
联系电话
YZTLE
Varchat
员工:(员工号、部门号、姓名、出生年月、性别、住址、联系电话、职务、密码、操作权限)
备注
列
数据类型
员工号
YGno
Int
部门号
BMno
Int
姓名
YGname
Varchat
出生年月
YGage
Varchat
性别
YGsex
Varchat
住址
YGard
Varchat
联系电话
YGTLE
Varchat
职务
ZM
Varchat
密码
MIMA
Varchat
操作权限
CZQX
Int
部门:(部门号、部门负责人员工号、部门名称、部门电话)
备注
列
数据类型
部门号
BMno
Int
部门负责人员工号
YGno
Int
部门名称
BMname
Varchar
部门电话
BMTLE
Varchar
收费标准:(收费类型编号、收费类型、单位、单价)
备注
列
数据类型
收费类型编号
SFLXno
Int
收费类型
SFLX
Varchar
单位
DW
Varchar
单价
DJ
Varchar
收费信息:(房号、业主编号,收费日期、收费类型)
备注
列
数据类型
房号
ROOMno
Int
业主姓名
YZname
Varchar
收费类型
SFLX
Varchar
收费类型编号
SFLXno
Int
金额
JINE
VARCHAR
合计
HEJI
VARCHAR
1.2数据库结构设
1.2.1 E-R图
1.2.2 数据库关系图
第2章 系统实现
2.1系统用户管理模块的实现
创建一个web窗体,利用Button、TextBox等控件制作,如下图:
用户登录窗口
2.2收费管理模块窗体的实现
创建一个web窗体,利用Button、SqlDataSource、GridView、DropDownList、Label等控件制作:
2.3员工管理模块的实现
创建一个web窗体,利用TextBoxButton、SqlDataSource、GridView、DropDownList、等控件制作:
第3章 功能代码设计
登录页
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="denglu.aspx.cs" Inherits="Web_denglu" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="帐号:"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
</div>
<div>
<asp:Label ID="Label2" runat="server" Text="密码:"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" ontextchanged="TextBox2_TextChanged"></asp:TextBox>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="登录" onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="重置" onclick="Button2_Click"
Height="26px" Width="40px" />
</div>
</form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class Web_denglu : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string sqlcon = @"Data Source=ZGC-20121104FNY\SQLEXPRESS;Initial Catalog=wuye;User ID=sa;pwd=123456;";
SqlConnection con = new SqlConnection(sqlcon);
con.Open();
//编写sql语句从数据库里查询到用户名和密码
string sql = "select * from YG where YGno='" + TextBox1.Text.Trim() + "' and MIMA='" + TextBox2.Text.Trim() + "'";
SqlCommand comm=new SqlCommand(sql,con);
SqlDataReader Sqlreader = comm.ExecuteReader();
if (!Sqlreader .Read())
{
Response.Write("<script language='javascript'>window.alert('输入的帐号或密码错误!');</script>");//当系统中不存在当前用户时操作;
}
else
{
Response.Redirect("jingli.aspx");//当系统中存在该用户的时候一些操作;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
}
}
员工管理页
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="YGguanli.aspx.cs" Inherits="Web_YGguanli" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:wuyeConnectionString %>"
SelectCommand="SELECT [ZW] FROM [YG]"></asp:SqlDataSource>
通过职务查询:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="ZW" DataValueField="ZW">
</asp:DropDownList>
</p>
<p>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CellPadding="4" DataKeyNames="YGno" DataSourceID="SqlDataSource1"
ForeColor="#333333" GridLines="None" PageSize="3">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="YGno" HeaderText="员工号" ReadOnly="True"
SortExpression="YGno" />
<asp:BoundField DataField="YGname" HeaderText="姓名" SortExpression="YGname" />
<asp:BoundField DataField="YGage" HeaderText="出生年月" SortExpression="YGage" />
<asp:BoundField DataField="YGsex" HeaderText="性别" SortExpression="YGsex" />
<asp:BoundField DataField="YGard" HeaderText="住址" SortExpression="YGard" />
<asp:BoundField DataField="YGTLE" HeaderText="联系电话" SortExpression="YGTLE" />
<asp:BoundField DataField="BMno" HeaderText="所属部门" SortExpression="BMno" />
<asp:BoundField DataField="ZW" HeaderText="职务" SortExpression="ZW" />
<asp:BoundField DataField="MIMA" HeaderText="密码" SortExpression="MIMA" />
<asp:BoundField DataField="CZQX" HeaderText="操作权限" SortExpression="CZQX" />
<asp:CommandField ShowDeleteButton="True" />
<asp:CommandField ShowEditButton="True" />
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:wuyeConnectionString %>"
SelectCommand="SELECT * FROM [YG] WHERE ([ZW] = @ZW)"
DeleteCommand="DELETE FROM [YG] WHERE [YGno] = @YGno"
InsertCommand="INSERT INTO [YG] ([YGno], [YGname], [YGage], [YGsex], [YGard], [YGTLE], [BMno], [ZW], [MIMA], [CZQX]) VALUES (@YGno, @YGname, @YGage, @YGsex, @YGard, @YGTLE, @BMno, @ZW, @MIMA, @CZQX)"
UpdateCommand="UPDATE [YG] SET [YGname] = @YGname, [YGage] = @YGage, [YGsex] = @YGsex, [YGard] = @YGard, [YGTLE] = @YGTLE, [BMno] = @BMno, [ZW] = @ZW, [MIMA] = @MIMA, [CZQX] = @CZQX WHERE [YGno] = @YGno">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="ZW" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="YGno" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="YGname" Type="String" />
<asp:Parameter Name="YGage" Type="String" />
<asp:Parameter Name="YGsex" Type="String" />
<asp:Parameter Name="YGard" Type="String" />
<asp:Parameter Name="YGTLE" Type="String" />
<asp:Parameter Name="BMno" Type="Int32" />
<asp:Parameter Name="ZW" Type="String" />
<asp:Parameter Name="MIMA" Type="String" />
<asp:Parameter Name="CZQX" Type="Int32" />
<asp:Parameter Name="YGno" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="YGno" Type="Int32" />
<asp:Parameter Name="YGname" Type="String" />
<asp:Parameter Name="YGage" Type="String" />
<asp:Parameter Name="YGsex" Type="String" />
<asp:Parameter Name="YGard" Type="String" />
<asp:Parameter Name="YGTLE" Type="String" />
<asp:Parameter Name="BMno" Type="Int32" />
<asp:Parameter Name="ZW" Type="String" />
<asp:Parameter Name="MIMA" Type="String" />
<asp:Parameter Name="CZQX" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
<p>
员工号:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></p>
<p>
姓名:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></p>
<p>
出生年月:<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></p>
<p>
性别:<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox></p>
<p>
住址:<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox></p>
<p>
联系电话:<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox></p>
<p>
所属部门:<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox></p>
<p>
职务:<asp:TextBox ID="TextBox8" runat="server"></asp:TextBox></p>
<p>
密码:<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox></p>
<p>
操作权限:<asp:TextBox ID="TextBox10" runat="server"></asp:TextBox></p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click1" Text="添加员工" />
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:wuyeConnectionString %>"
InsertCommand="INSERT INTO YG(YGno, YGname, YGage, YGsex, YGard, YGTLE, BMno, ZW, MIMA, CZQX) VALUES (@YGno, @YGname, @YGage, @YGsex, @YGard, @YGTLE, @BMno, @ZW, @MIMA, @CZQX)"
onselecting="SqlDataSource3_Selecting" SelectCommand="SELECT * FROM [YG]">
<InsertParameters>
<asp:ControlParameter ControlID="TextBox1" Name="YGno" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox2" Name="YGname" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox3" Name="YGage" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox4" Name="YGsex" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox5" Name="YGard" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox6" Name="YGTLE" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox7" Name="BMno" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox8" Name="ZW" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox9" Name="MIMA" PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox10" Name="CZQX" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>
</p>
</div>
</form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Web_YGguanli : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource3.Insert();
}
protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
}
protected void SqlDataSource3_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
SqlDataSource3.Insert();
}
}
收费管理页
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SFguanli.aspx.cs" Inherits="Web_SFguanli" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div>
按房间号查询:<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="ROOMno" DataValueField="ROOMno">
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:wuyeConnectionString %>"
SelectCommand="SELECT [ROOMno] FROM [YZ]"></asp:SqlDataSource>
<p>
<asp:GridView ID
展开阅读全文