网络应用开发课程设计报告Word格式文档下载.docx
《网络应用开发课程设计报告Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《网络应用开发课程设计报告Word格式文档下载.docx(19页珍藏版)》请在冰豆网上搜索。
90分~100分;
A-:
85分~89分;
B+:
82~84分;
B:
78~81分;
B-:
75分~77分;
C+:
72分~74分;
C:
68分~71分;
C-:
64~67分;
D:
60~63分;
F:
0分~59分。
武汉科技大学计算机科学与技术学院制表
计算机科学与技术学院
课程设计报告
网络应用开发
专业:
网络工程
班级:
2013级03班
学号:
************
****************
***********
一、设计目的
《网络应用开发》是一门实用性、综合性较强的课程。
学生在学完本门课程后,不仅要掌握Web设计的方法和技术,更重要的是能综合应用所学的网页设计、高级编程语言及数据库知识,具有实际开发动态网站的能力。
本课程设计旨在使学生通过完成一个小型的Web应用系统,实现从网站规划、设计、编码和调试的全过程,将理论知识和实践知识相结合,提高学生实际开发网站的动手能力。
二、设计内容
在线留言本
1、用户能够注册
2、用户登录后
●查看并编辑用户注册信息
●首页分页显示全部的留言主题
●可以留言,或对他人的留言进行回复
●对自己的留言进行修改或删除
可增加的功能:
下载专区功能,提供文件的上传、显示和下载
三、系统总体设计
四、数据库设计
SQLServer新建数据库MessageBox,在其中新建3张表,分别为User(用户表)、Send(留言表)、Reply(回复表):
User表:
UserName
Password
Sex
Email
PhoneNumber
Master
Fancy
Birthday
PS
用户名(key)
登录密码
邮箱
手机号码
专业擅长
业余爱好
生日
备注
1.用户经过注册页面Regist.aspx注册后信息插入User表
2.用户经过登录页面Welcome.aspx登录时比对User表,信息核对正确即登陆成功
3.用户经过编辑个人资料页面Edit.aspx修改个人信息时更新User表
Send表:
LeavewordID
Title
Body
Createtime
LUserName
留言编号(key)
留言主题
留言内容
留言时间
留言人的用户名
1.在留言板主页Main.aspx页面可以发表个人留言,同时给每条留言分配留言ID
2.在个人留言记录Home.aspx页面对自己的留言及回复修改或删除的时候更新Send表
Reply表:
ReplyID
回复编号(key)
回复内容
回复时间
留言编号
1.在留言板主页Main.aspx页面可以选择任意一条留言来回复,同时给每条回复分配回复ID
2.在个人留言记录Home.aspx页面对自己的留言及回复修改或删除的时候更新Reply表
五、系统功能设计与实现
1.Welcome.aspx留言板欢迎页面
登录按钮点击事件:
protectedvoidButton1_Click(objectsender,EventArgse)
{
GridView1.DataBind();
if(Page.IsValid==true)
Session["
user"
]=TextBox1.Text;
Response.Redirect("
~/showmessage.aspx"
);
}
}
用户名检测验证功能:
protectedvoidCustomValidator1_ServerValidate(objectsource,ServerValidateEventArgsargs)
if(GridView1.Rows.Count==0)
args.IsValid=false;
2.Regist.aspx注册页面
用户名检测按钮点击事件:
protectedvoidCustomValidator1_ServerValidate(objectsource,ServerValidateEventArgsargs)
args.IsValid=true;
else
籍贯级联功能:
privatestring[]hunan={"
常德市"
"
长沙市"
郴州地区"
张家界市"
衡阳市"
怀化市"
永州市"
娄底市"
邵阳市"
湘潭市"
湘西自治区"
益阳市"
岳阳市"
株洲市"
};
privatestring[]hubei={"
鄂州市"
恩施自治州"
黄冈市"
黄石市"
荆门市"
荆州市"
十堰市"
随州市"
武汉市"
咸宁市"
襄樊市"
孝感地区"
孝感市"
宜昌地区"
宜昌市"
郧阳地区"
protectedvoidBindCity(Stringsheng,DropDownListddl){
if(sheng.Equals("
湖南省"
))
ddl.Items.Clear();
ddl.Items.Add(newListItem("
"
));
for(inti=0;
i<
hunan.Length;
i++)
ddl.Items.Add(newListItem(hunan[i]));
elseif(sheng.Equals("
湖北省"
hubei.Length;
ddl.Items.Add(newListItem(hubei[i]));
}
提交按钮点击事件:
stringstr="
;
stringstr1="
username"
]=username.Text;
password"
]=password.Text;
pro"
]=pro.SelectedValue;
city"
]=city.SelectedValue;
sex"
]=sex.SelectedValue;
email"
]=email.Text;
phone"
]=phone.Text;
good.Items.Count;
if(good.Items[i].Selected)
str1+=good.Items[i].Value+"
"
try
str=str.Substring(0,str.Length-1);
catch{}
like.Items.Count;
if(like.Items[i].Selected)
str+=like.Items[i].Value+"
birth.Text=Calendar1.SelectedDate.ToShortDateString();
good"
]=str1;
likes"
]=str;
birth"
]=birth.Text;
extra"
]=extra.Text;
if(Page.IsValid)
SqlDataSource1.Insert();
~/Welcome.aspx"
3.留言板主页
导航栏四个按钮点击事件:
protectedvoidButton2_Click(objectsender,EventArgse)
~/Edit.aspx"
protectedvoidButton3_Click(objectsender,EventArgse)
~/download.aspx"
~/Home.aspx"
我要留言点击事件:
protectedvoidsend_Click(objectsender,EventArgse)
Panel1.Visible=true;
留言发表:
protectedvoidsubmit_Click(objectsender,EventArgse)
Ucreatetime"
]=DateTime.Now.ToString();
SqlDataSource2.Insert();
选择留言触发事件:
protectedvoidGridView2_SelectedIndexChanged(objectsender,EventArgse)
Session["
Rid"
]=GridView2.Rows[GridView2.SelectedIndex].Cells[1].Text;
回复按钮点击:
protectedvoidButton1_Click(objectsender,EventArgse)
TextBox1.Visible=true;
Button2.Visible=true;
Mbody"
Mcreatetime"
~/main.aspx"
protectedvoidGridView2_SelectedIndexChanged(objectsender,EventArgse)
效果图:
4.Home.aspx页面查看个人留言记录
个人留言表选择触发事件:
protectedvoidGridView1_SelectedIndexChanged(objectsender,EventArgse)
id"
]=GridView1.Rows[GridView1.SelectedIndex].Cells[1].Text;
~/Todo.aspx"
效果:
个人回复表选择触发事件:
5.Edit.aspx页面编辑个人资料
直接使用数据源控件绑定更新User表的信息:
<
asp:
SqlDataSourceID="
SqlDataSource1"
runat="
server"
ConnectionString="
%$ConnectionStrings:
messageConnectionString%>
SelectCommand="
SELECT[Id],[username],[password],[sex],[procy],[Email],[phone],[good],[likes],[birth],[extra]FROM[User]WHERE([username]=@username)"
UpdateCommand="
UPDATE[User]SETusername=@username,password=@password,sex=@sex,procy=@procy,Email=@email,phone=@phone,good=@good,likes=@likes,birth=@birth,extra=@extraWHERE([username]=@username)"
>
<
SelectParameters>
SessionParameterName="
SessionField="
Type="
String"
/>
/SelectParameters>
UpdateParameters>
QueryStringParameterName="
procy"
/UpdateParameters>
/asp:
SqlDataSource>
DetailsViewID="
DetailsView1"
Height="
169px"
Width="
420px"
AutoGenerateRows="
False"
DataSourceID="
style="
margin-left:
194px"
DataKeyNames="
Id"
>
Fields>
BoundFieldDataField="
HeaderText="
SortExpression="
InsertVisible="
ReadOnly="
True"
Email"
CommandFieldShowEditButton="
/Fields>
DetailsView>
6.Download.aspx页面上传下载专区
主要后台代码:
protectedvoidPage_Load(objectsender,EventArgse)
if(!
Page.IsPostBack){
stringstrfilepath=Server.MapPath("
~/files/"
//页面加载获取下载文件的存放目录
DirectoryInfodir=newDirectoryInfo(strfilepath);
//获得该目录下的所有文件
FileSystemInfo[]files=dir.GetFileSystemInfos();
ListItemitems;
//将遍历的文件名称显示在LISTBOX控件中
foreach(FileSystemInfoinfofilesinfiles)
items=newListItem();
//声明一个ListItem对象
items.Text=infofiles.Name;
items.Value=infofiles.FullName;
ListBox1.Items.Add(items);
//向ListBox控件中添加数据信息
stringsaveDir=@"
\files\"
//指定的文件夹要存在
stringappPath=Request.PhysicalApplicationPath;
if(fuImage.HasFile)
stringsavePath=appPath+saveDir+fuImage.FileName;
fuImage.SaveAs(savePath);
Label1.Text="
上传成功!
上传失败"
protectedBooleanDownLoad(stringfileURL){
BooleanDok=false;
try{
stringFullPathURL=Server.MapPath(fileURL);
//获取文件下载路径
System.IO.FileInfofile=newSystem.IO.FileInfo(FullPathURL);
if(file.Exists)//判断要下载的文件是否存在
{
Response.Clear();
//清空response对象中的内容
Response.AddHeader("
Content-disposition"
attachment;
filename="
+HttpUtility.UrlEncode(file.Name));
Content-Length"
file.Length.ToString());
Response.ContentType="
application/octet-stream"
Re