计算机网络课程设计报告之简单新闻发布系统含核心代码.docx

上传人:b****5 文档编号:8309492 上传时间:2023-01-30 格式:DOCX 页数:22 大小:1.21MB
下载 相关 举报
计算机网络课程设计报告之简单新闻发布系统含核心代码.docx_第1页
第1页 / 共22页
计算机网络课程设计报告之简单新闻发布系统含核心代码.docx_第2页
第2页 / 共22页
计算机网络课程设计报告之简单新闻发布系统含核心代码.docx_第3页
第3页 / 共22页
计算机网络课程设计报告之简单新闻发布系统含核心代码.docx_第4页
第4页 / 共22页
计算机网络课程设计报告之简单新闻发布系统含核心代码.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

计算机网络课程设计报告之简单新闻发布系统含核心代码.docx

《计算机网络课程设计报告之简单新闻发布系统含核心代码.docx》由会员分享,可在线阅读,更多相关《计算机网络课程设计报告之简单新闻发布系统含核心代码.docx(22页珍藏版)》请在冰豆网上搜索。

计算机网络课程设计报告之简单新闻发布系统含核心代码.docx

计算机网络课程设计报告之简单新闻发布系统含核心代码

 

计算机网络课程设计报告

 

课程设计名称:

简单新闻发布系统

班级:

姓名:

学号:

课程设计日期:

2010-6-12——2010-7-17

 

2010年7月17日

目录

一、课程设计目的和要求3

1、课程设计目的

2、课程设计要求

二、课程设计环境3

1、课程VisualStudio2005软件开发平台

2、SQLSERVER2005数据库软件

三、程序的逻辑框图4

四、程序源代码5

1、系统登陆验证代码:

2、主体新闻页面代码

3、修改管理员密码代码:

4、添加用户信息代码

5、删除新闻信息代码:

6、添加新闻信息代码:

五、课程设计数据、结果分析12

1、主要数据库表

2、数据库表结构(内容)

(1)、用户信息表:

(2)、新闻信息表:

(3)、用户角色表:

(4)、新闻类别表:

3、结果分析

主要流程截图(管理员和新闻录入员)

六、总结18

七、教师意见19

 

一、课程设计目的和要求

1、课程设计目的

(1)、培养学生理论联系实际的设计思想,训练综合运用所学的基础理论知识,结合生产实际分析和解决网络应用中问题的能力,从而使基础理论知识得到巩固和加深。

(2)、运用软件工程的原理、方法和工具完整地设计并开发一个软件项目。

(3)、学习掌握网络应用系统的一般设计过程和方法。

(4)、熟悉并掌握B/S模式构建网络应用。

2、课程设计要求

(1)、合理设计系统框图和网站结构图。

(2)、根据系统框图设计,编写网页及程序代码。

(3)、程序设计时,要求使用JSP或者ASP.NET语言进行开发,完成课设题目的全部内容。

(4)、完成课程设计报告。

(5)、认真做好实验内容的准备,提前作出思考和分析。

(6)、观察各种现象,作出必要的说明和分析。

(7)、认真书写实验报告。

包括实验目的和要求,实验情况及分析,程序设计说明,框图和清单

二、课程设计环境

1、课程设计VisualStudio2005软件开发平台

VisualStudio2005是一套完整的开发工具,用于生成ASPWeb应用程序、XMLWebservices、桌面应用程序和移动应用程序。

VisualBasic.NET、VisualC++.NET、VisualC#.NET和VisualJ#.NET全都使用相同的集成开发环境(IDE),该环境允许它们共享工具并有助于创建混合语言解决方案。

另外,这些语言利用了.NETFramework的功能,此框架提供对简化ASPWeb应用程序和XMLWebservices开发的关键技术的访问。

2、SQLSERVER2005数据库软件

SQLServer2005是一个全面的数据库平台,使用集成的商业智能(BI)工具提供了企业级的数据管理。

SQLServer2005数据库引擎为关系型数据和结构化数据提供了更安全可靠的存储功能,使您可以构建和管理用于业务的高可用和高性能的数据应用程序。

SQLServer2005数据引擎是本企业数据管理解决方案的核心。

此外SQLServer2005结合了分析、报表、集成和通知功能。

这使您的企业可以构建和部署经济有效的BI解决方案,帮助您的团队通过记分卡、Dashboard、Webservices和移动设备将数据应用推向业务的各个领域。

三、程序的逻辑框图

程序逻辑图描述:

系统启动时默认进入默认界面(新闻浏览界面),一般浏览者可以在此界面浏览各种新闻,点击新闻标题可以查看各条新闻详细信息。

如果是管理员或者是普通用户(新闻录入员),可以在默认页面选择用户登录,然后进行相关操作。

在登陆界面,用户有两种登陆选择,如果您是管理员,您可以通过用户名和密码登陆,登陆后可以实现管理员的相关操作功能。

如果您是普通用户,您也可以通过相应名称和密码登陆,登陆后可以实现普通用户的相关操作功能。

如图所示:

 

 

四、程序源代码(部分)

1、系统登陆验证代码:

publicpartialclassLogin:

System.Web.UI.Page

{

alertsalert=newalerts();

protectedvoidPage_Load(objectsender,EventArgse)

{

txtName.Focus();

FormsAuthentication.SignOut();

if(!

this.IsPostBack)

{

this.ViewState["GUID"]=System.Guid.NewGuid().ToString();

}

}

protectedvoidbtnOK_Click(objectsender,EventArgse)

{

intlogin=0;

SoftLin.BLL.Usersbll=newSoftLin.BLL.Users();

SoftLin.Model.Usersmodel=newSoftLin.Model.Users();

model.UserName=txtName.Text;

model.Password=SoftLin.Common.DEncrypt.EncryptPassword(txtPass.Text);

if(DDLtType.SelectedValue=="管理员")//判断用户身份

{

model.UserType="1";

}

else

{

model.UserType="0";

}

login=bll.Logins(ConfigurationManager.ConnectionStrings["DBW"].ConnectionString,model);

if(login!

=0)//用户登录验证

{

SoftLin.Common.AccountsPrincipalnewuers=AccountsPrincipal.ValidateLogin("df","df");

FormsAuthentication.SetAuthCookie(txtName.Text,false);

Context.User=newuers;

Session["Login"]="Login";

if(model.UserType=="1")//根据用户类型跳转到相应页面

{

Response.Redirect("Admin/Default.aspx");

}

else

Response.Redirect("edit/Default.aspx");

}

else

{

Response.Write(alert.alert("用户名或密码有误!

"));;

}

}

}

2、主体新闻页面代码(一般浏览者可浏览页面):

protectedvoidPage_Load(objectsender,EventArgse)//设置新闻类别

{

SoftLin.BLL.Newsnews=newSoftLin.BLL.News();

SoftLin.Model.Newsmodel=newSoftLin.Model.News();

model.Type="校园大事";

ds=news.NewsTypequery(con,model);

for(inti=0;i

{

matter[i]=ds.Tables[0].Rows[i][1].ToString();

HttpUtility.UrlEncode(matters[i]=ds.Tables[0].Rows[i][1].ToString(),System.Text.Encoding.GetEncoding("GB2312"));

}

model.Type="体育新闻";

ds=news.NewsTypequery(con,model);

for(inti=0;i

{

sport[i]=ds.Tables[0].Rows[i][1].ToString();

HttpUtility.UrlEncode(sports[i]=ds.Tables[0].Rows[i][1].ToString(),System.Text.Encoding.GetEncoding("GB2312"));

}

model.Type="最新活动";

ds=news.NewsTypequery(con,model);

for(inti=0;i

{

activity[i]=ds.Tables[0].Rows[i][1].ToString();

HttpUtility.UrlEncode(activities[i]=ds.Tables[0].Rows[i][1].ToString(),System.Text.Encoding.GetEncoding("GB2312"));

}

model.Type="奇闻轶事";

ds=news.NewsTypequery(con,model);

for(inti=0;i

{

anecdote[i]=ds.Tables[0].Rows[i][1].ToString();

HttpUtility.UrlEncode(anecdotes[i]=ds.Tables[0].Rows[i][1].ToString(),System.Text.Encoding.GetEncoding("GB2312"));

}

model.Type="校园新闻";

ds=news.NewsTypequery(con,model);

for(inti=0;i

{

schoolnew[i]=ds.Tables[0].Rows[i][1].ToString();

HttpUtility.UrlEncode(schoolnews[i]=ds.Tables[0].Rows[i][1].ToString(),System.Text.Encoding.GetEncoding("GB2312"));

}

model.Type="校园论坛";

ds=news.NewsTypequery(con,model);

for(inti=0;i

{

forum[i]=ds.Tables[0].Rows[i][1].ToString();

HttpUtility.UrlEncode(forums[i]=ds.Tables[0].Rows[i][1].ToString(),System.Text.Encoding.GetEncoding("GB2312"));

}

Page.DataBind();

}

}

3、修改管理员密码代码:

publicpartialclassAdmin_UpdatePassword:

System.Web.UI.Page

{

protectedvoidPage_Load(objectsender,EventArgse)

{

if(!

Context.User.Identity.IsAuthenticated)

{

Response.Redirect("../Login.aspx");

}

}

protectedvoidbtnOK_Click(objectsender,EventArgse)

{

SoftLin.Common.alertsalerts=newSoftLin.Common.alerts();

intsucceed=0;

SoftLin.BLL.Usersusers=newSoftLin.BLL.Users();

SoftLin.Model.Usersmodel=newSoftLin.Model.Users();

model.OldPass=SoftLin.Common.DEncrypt.EncryptPassword(txtPass.Text);

model.NewPass=SoftLin.Common.DEncrypt.EncryptPassword(txtPassTwo.Text);

succeed=users.UpdatePassword(ConfigurationManager.ConnectionStrings["DBU"].ConnectionString,model);

if(succeed>0)

{

Response.Write(alerts.alert("修改密码成功!

"));

Response.Redirect("../Login.aspx");

}

else

{

Response.Write(alerts.alert("原密码输入有误!

"));

}

}

}

4、添加用户信息代码(管理员):

protectedvoidbtnOK_Click(objectsender,EventArgse)

{

inttrues=0;

stringtype;

SoftLin.BLL.Usersusers=newSoftLin.BLL.Users();

SoftLin.Model.UsersModel=newSoftLin.Model.Users();

Model.UserName=txtName.Text;

Model.Password=SoftLin.Common.DEncrypt.EncryptPassword(txtPass.Text);

Model.TrueName=txtTName.Text;

if(rbnSex.Checked)

{

Model.Sex="男";

}

else

Model.Sex="女";

Model.Phone=txtPhone.Text;

Model.Birthday=Convert.ToDateTime(txtBirthday.Text);

Model.Email=txtEmail.Text;

Model.LoginTime=DateTime.Now.ToString();

if(ddLiType.SelectedValue=="管理员")

{

type="1";

}

else

type="0";

Model.UserType=type;

trues=users.CreateUsers(ConfigurationManager.ConnectionStrings["DBU"].ConnectionString,Model);

if(trues>0)

{

SoftLin.Common.alertsalerts=newSoftLin.Common.alerts();

Response.Write(alerts.alert("添加成功!

"));

}

}

}

5、删除新闻信息代码:

publicpartialclassAdmin_DeleteNews:

System.Web.UI.Page

{

stringcon=ConfigurationManager.ConnectionStrings["DBU"].ConnectionString;

protectedvoidPage_Load(objectsender,EventArgse)

{

SoftLin.BLL.Newsnews=newSoftLin.BLL.News();

GridView1.DataSource=news.GetNews(con);

GridView1.DataBind();

if(!

Context.User.Identity.IsAuthenticated)

{

Response.Redirect("../Login.aspx");

}

}

protectedvoidbtnUp_Click(objectsender,EventArgse)

{

SoftLin.BLL.Newsnews=newSoftLin.BLL.News();

SoftLin.Model.Newsmodel=newSoftLin.Model.News();

model.NewID=Convert.ToInt32(txtup.Text);

SoftLin.BLL.NewSsortstypen=newSoftLin.BLL.NewSsorts();

SoftLin.Model.NewSsortsmo=newSoftLin.Model.NewSsorts();

mo.NewID=model.NewID;

typen.DeleteNewsSsorts(con,mo);

news.DeleteNews(con,model);

SoftLin.Common.alertsalert=newSoftLin.Common.alerts();

Response.Write(alert.alert("删除成功!

"));

}

protectedvoiddgUser_PageIndexChanged(objectsource,DataGridPageChangedEventArgse)

{

}

protectedvoidGridView1_PageIndexChanging(objectsender,GridViewPageEventArgse)

{

GridView1.PageIndex=e.NewPageIndex;

GridView1.DataBind();

}

}

6、添加新闻信息代码:

publicpartialclassAdmin_AddArticle:

System.Web.UI.Page

{

stringcon=ConfigurationManager.ConnectionStrings["DBU"].ConnectionString;

protectedvoidPage_Load(objectsender,EventArgse)

{

if(!

IsPostBack)

{

DataSetds=newDataSet();

SoftLin.BLL.Ssortstype=newSoftLin.BLL.Ssorts();

ds=type.GetSsorts(ConfigurationManager.ConnectionStrings["DBU"].ConnectionString);

DDlType.DataSource=ds.Tables["ds"].DefaultView;

DDlType.DataTextField="description";

DDlType.DataBind();

}

if(!

Context.User.Identity.IsAuthenticated)

{

Response.Redirect("../Login.aspx");

}

}

protectedvoidGridView1_SelectedIndexChanged(objectsender,EventArgse)

{

}

protectedvoidbtnAdd_Click(objectsender,EventArgse)

{

stringtype=DDlType.SelectedItem.Text;

intnewID=0;

intSsodtID=0;

SoftLin.BLL.Newsnews=newSoftLin.BLL.News();

SoftLin.BLL.NewSsortsns=newSoftLin.BLL.NewSsorts();

SoftLin.Model.Newsmodel=newSoftLin.Model.News();

model.Title=txtArticle.Text;

model.Bodys=txtBodys.Text;

model.Author=Txtauthor.Text;

model.Type=DDlType.SelectedValue;

news.CreateNews(con,model);

 

newID=news.GetNewsID(con,model);

SoftLin.BLL.Ssortsssorts=newSoftLin.BLL.Ssorts();

SsodtID=ssorts.GetSsortID(con,type);

SoftLin.Model.NewSsortsnewsss=newSoftLin.Model.NewSsorts();

newsss.NewID=newID;

newsss.SsortID=SsodtID;

ns.CreateNewSsorts(con,newsss);

SoftLin.Common.alertsalert=newSoftLin.Common.alerts();

Response.Write(alert.alert("添加成功!

"));

}

protectedvoidDDlType_SelectedIndexChanged(objectsender,EventArgse)

{

}

protectedvoidDDlType_TextChanged(objectsender,EventArgse)

{

}

}

五、课程设计数据、结果分析

1、主要数据库表

编号

表名

名称

描述

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1