Web程序开发技术实训报告
题 目 宿舍管理系统 班 级 网络技术0932 学 号 200930907239 姓 名 张天佑 实训地点 实训日期 2011.12.19 - 2011.12.23
目录
1.1 系统需求分析 .................................................................................................................... 4
1.2 系统的体系结构设计 ........................................................................................................ 4
1.3 系统功能模块设计 ............................................................................................................ 4
1.4 数据库设计 ........................................................................................................................ 5
2 系统的实现 ................................................................................................................................... 7
3 实训总结..................................................................................................................................... 14
1 系统的总体设计
1.1 系统需求分析
所作系统名:宿舍管理系统
宿舍管理系统主要是帮助宿舍管理员更好的对宿舍进行管理,实现对宿舍的添加,修改,删除,宿舍损坏管理,文明宿舍的管理,在完成管理功能的同时增加了留言板模块和宿舍公告栏模块已便于宿舍管理员和学生交流和管理。
1.2 系统的体系结构设计
1.3 系统功能模块设计
登录:实现系统在两种账户下登录系统。
管理员账户下的模块:
宿舍楼添加:实现添加宿舍的功能。
宿舍楼修改/删除:实现宿舍的修改和删除宿舍的功能。
文明宿舍管理:实现宿舍的分数的修改和文明宿舍的评比。
宿舍损坏管理:实现损坏内容的上报记录。
宿舍公告栏管理:实现重大事情的通知。
添加管理员:实现宿舍管理员的添加功能。
管理员密码修改:实现管理员账户密码的修改功能。 寝室楼查询:实现各个宿舍情况的查询功能。
回复/删除留言:实现留言板的回复和删除信息的功能。 宿舍长账户下的模块:
查询宿舍信息:实现本宿舍信息的查询功能。
1.4 数据库设计
Users表:用于存放系统用户的信息。
Xx表:用于存放学生的住宿信息。
Tongzhi表:用于存放通知信息。
Guestbook表:用于存放用户信息。
Home表:用于存放宿舍信息。
Homebad表:用于存放宿舍损坏物品信息。
Homedetail表:用于存放宿舍类别。
表1.1 users表
表1.2 xx表
表1.3 tongzhi表
表1.4 guestbook表
表1.5 home表
表1.6 homebad表
表1.7 homedetail表
2 系统的实现
图2.1 adminmain.aspx页
页面代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["adminname"] == null)
{
Response.Redirect("entry.aspx");
}
else
{
lbServerName.Text = "http://" + HttpContext.Current.Request.Url.Host +
HttpContext.Current.Request.ApplicationPath;
lbIp.Text = Request.ServerVariables["LOCAl_ADDR"];
lbDomain.Text = Request.ServerVariables["SERVER_NAME"].ToString();
lbPort.Text = Request.ServerVariables["Server_Port"].ToString();
lbIISVer.Text = Request.ServerVariables["Server_SoftWare"].ToString(); lbPhPath.Text = Request.PhysicalApplicationPath;
lbOperat.Text = Environment.OSVersion.ToString();
lbSystemPath.Text = Environment.SystemDirectory.ToString();
lbTimeOut.Text = (Server.ScriptTimeout / 1000).ToString() + "秒";
lbLan.Text = CultureInfo.InstalledUICulture.EnglishName;
lbAspnetVer.Text = string.Concat(new object[] { Environment.Version.Major, ".",
Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision }); lbCurrentTime.Text = DateTime.Now.ToString();
RegistryKey key =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Version Vector"); lbIEVer.Text = key.GetValue("IE", "未检测到").ToString();
lbServerLastStartToNow.Text = ((Environment.TickCount / 0x3e8) / 60).ToString() + "分钟";
string[] achDrives = Directory.GetLogicalDrives();
for (int i = 0; i < Directory.GetLogicalDrives().Length - 1; i++)
{
lbLogicDriver.Text = lbLogicDriver.Text + achDrives[i].ToString(); }
lbCpuNum.Text =
Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString();
lbCpuType.Text =
Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString();
lbMemory.Text = (Environment.WorkingSet / 1024).ToString() + "M";
lbMemoryPro.Text = ((Double)GC.GetTotalMemory(false) / 1048576).ToString("N2") + "M";
lbMemoryNet.Text = ((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M";
lbCpuNet.Text =
((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N0"); }
}
}
图2.2 homeadd.aspx页
页面代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
if (Session["adminname"] == null)
{
Response.Redirect("entry.aspx");
}
else
{
databind();
}
}
}
public void databind()
{
string sql = "select * from homedetail ";
GridView1.DataSource = DB.getdata(sql,"homedetail");
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
string sql = "insert into homedetail(home,homesex)values('" + TextBox1.Text + "','" + DropDownList1.SelectedValue + "')";
string sql1 = "select * from homedetail where home='"+TextBox1.Text.ToString()+"'"; if (DB.SQLsel(sql1))
{
Response.Write("<script>alert('要添加的宿舍楼已经存在了!')</script>");
}
else
{
if (DB.execSQL(sql))
{
databind();
Response.Write("<script>alert('添加成功')</script>");
}
else
{
Response.Write("<script>alert('添加失败')</script>");
}
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
e.Row.Attributes.Add("onMouseOver",
"Color=this.style.backgroundColor;this.style.backgroundColor='lightBlue'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;"); }
图2.3 admindel.aspx页
页面代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
if (Session["adminname"] == null)
{
Response.Redirect("entry.aspx");
}
else
{
databind();
}
}
}
public void databind()
{
string sql = "select * from homedetail";
GridView1.DataSource = DB.getdata(sql, "homedetail");
GridView1.DataKeyNames = new string[] { "id"};
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
e.Row.Attributes.Add("onMouseOver",
"Color=this.style.backgroundColor;this.style.backgroundColor='lightBlue'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) {
int id =Convert.ToInt32( GridView1.DataKeys[e.RowIndex].Value);
string sql = "delete from homedetail where id=" + id + "";
if (DB.execSQL(sql))
{
Response.Write("<script>alert('删除成功!')</script>");
}
else
{
Response.Write("<script>alert('删除失败!')</script>");
}
databind();
}
图2.4 admingoodhome.aspx页
页面代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
if (Session["adminname"] == null)
{
Response.Redirect("entry.aspx");
}
else
{
databind();
}
}
}
private void databind()
{
string sql = "select * from home";
GridView1.DataSource = DB.getdata(sql, "home");
GridView1.DataKeyNames = new string[] { "homeid" };
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
e.Row.Attributes.Add("onMouseOver",
"Color=this.style.backgroundColor;this.style.backgroundColor='lightBlue'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;"); }
图2.5 adminhomebad.aspx页
页面代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
if (Session["adminname"] == null)
{
Response.Redirect("entry.aspx");
}
else
{
databind();
}
}
}
public void databind()
{
string sql = "select * from homebad";
GridView1.DataSource = DB.getdata(sql, "homebad");
GridView1.DataKeyNames = new string[] { "id" };
GridView1.DataBind();
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
string sql = "delete from homebad where id=" + id + "";
if (DB.execSQL(sql))
{
Response.Write("<script>alert('删除成功!')</script>");
}
else
{
Response.Write("<script>alert('删除失败!')</script>");
}
databind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes.Add("onMouseOver",
"Color=this.style.backgroundColor;this.style.backgroundColor='lightBlue'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;");
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<script
language=javascript>window.open('adminhomebadadd.aspx','','width=300,height=400')</script>") }
3 实训总结
这次实训,让我对asp.net有了更深一层的理解,能简单的使用asp.net的多项控件,并能访问和绑定数据。对asp.net的网站架构也有了自己的一些浅见,最终能够用asp.net软件对网站进行简单的编辑操作。
ASP.NET实训过程中,让我明白理论与实践的关系,只有理论联系实际、举一反三才能逐步形成分析和解决实际问题的能力,这种能力,我相信能够让我在以后的道路上受益匪浅。
这次的实训,我感觉收获最大的并不是我明白了以前asp.net不懂的地方,而是我感觉到在解决别人和各自问题的同时,间接的形成我对学习耐心、细心和一丝不苟的习惯。
工程技术实习工程技术实习工程技术实习摘要本人在本学期进行为期十二周的工程技术实习首先明白此次实习的目的培养我们独立工作能力综合应用…
建筑施工技术实训报告指导老师学生班级学号日期1摘要不实践很多问题都考虑不到实践后才知道什么情况都可能遇到这就要求我们必须有丰富的实…
一、实习时间20xx年x月13号二、实习单位及地点实习单位:青岛理工大学费县校区实习地点:青岛理工大学费县校区新图书馆、教师公寓指…
毕业实习报告根据学校安排我于20xx年10月18日到江苏南通二建集团有限公司承建的马鞍山市鸿泰湖滨公馆12楼工程进行建筑施工及管理…
山西职业技术学院20xx届学生毕业实习报告1实习目的以技术人员助手的身份参加现场施工和管理工作,获取直接知识,巩固所学理论,完成实…
课题:网页设计与制作专业:通信工程班级:学号:一.实验任务:设计制作一个《网页设计与制作》精品课程网站二.实验要求:(1)站点目录…
七、设计总结:1)、首先确定网站的目标是关键,明确谁是网站将来的访问者。确保目标和主题明确、数据充分并保持目标的简洁性。其次是确定…
JavaWeb实习报告一、实习目的与任务为了锻炼我们的实践动手能力,提高我们分析问题、解决问题的能力,培养我们的工作意识和团队合作…
课程设计报告书20xx20xx学年第1学期设计题目Web网页制作实验报告年级专业08级市场营销姓名学号指导老师经济管理系12月20…
课程设计报告书20**/20**学年第1学期设计题目:Web网页制作实验报告年级专业:08级市场营销姓名学号:指导老师:经济管理系…