收藏 分销(赏)

C程序设计课程教学网站的设计和实现.doc

上传人:精**** 文档编号:2882039 上传时间:2024-06-08 格式:DOC 页数:23 大小:604.04KB 下载积分:10 金币
下载 相关 举报
C程序设计课程教学网站的设计和实现.doc_第1页
第1页 / 共23页
C程序设计课程教学网站的设计和实现.doc_第2页
第2页 / 共23页


点击查看更多>>
资源描述
综合试验汇报 ( -- 年度第 1学期) 名 称: 软件设计和实践 题 目: C++课程设计 网站管理 院 系: 班 级: 学 号: 学生姓名: 指导老师: 设计周数: 成 绩: 日期: 1 月 10 日 《软件综合试验》 任 务 书 一、 目标和要求 软件综合试验是计算机科学和技术、软件工程、网络工程和信息安全专业学生必修实践步骤,本步骤是在第六学期、第七学期设置,关键让学生深入了解、巩固、加深前面所学课程,并能综合利用所学课程知识进行设计,掌握算法设计及实现理论和方法,为毕业设计和以后工作打下良好基础。 课程基础要求: 1. 熟悉微机应用环境。 2. 利用所学课程知识,处理程序设计中实际问题(实际应用题目,或模拟实际应用题目),为毕业设计和以后工作打下良好基础。 二、 关键内容 能熟练地利用微机设计出有实用价值程序。 1. 熟悉Windows和其它工具软件系统, 2. 依据所选题目进行算法设计(画出步骤图,写出各模块文档)。 3. 编程。 4. 上机调试。 三、 进度计划 序号 设计(试验)内容 完成时间 备注 1 查找、熟悉相关资料 2天 2 依据题目进行具体设计 2天 3 编码 4天 4 调试 2天 四、 设计(试验)结果要求 1、用户注册 登陆 用户管理 2、视频教程、讲义浏览、下载 3、能够考虑:各章自测题 习题答案 综合测试 疑难解答 五、 考评方法 试验结果(60%)+试验汇报(30%)+试验过程表现(10%) 学生姓名: 指导老师: 年 月 日 一、 课程设计(综合试验)目标和要求 C++程序设计 课程教学网站设计和实现 功效: 1、用户注册 登陆 用户管理 2、视频教程、讲义浏览、下载 3、能够考虑:各章自测题 习题答案 综合测试 疑难解答 二、 设计(试验)正文 “C++程序设计 课程教学网站”关键功效有:会员登陆;管理员登陆;课程下载、浏览;系统功效以下图 C++程序设计 课程教学网站 会员登陆 管理员登陆 课程下载,浏览 修改密码 修改密码 管理会员 管理课程 功效以下所述: 会员登陆 会员登录后能够修改个人密码和资料,浏览下载课程 管理员登陆 管理员登陆后能够修改管理员密码,增加、编辑、删除课程,管理、删除会员 数据库设计 设计数据库 管理员表 会员表 三、 课程设计(综合试验)总结或结论 经过此次课程设计,使我愈加扎实掌握了相关高频电子线路方面知识,在设计过程中即使碰到了部分问题,但经过一次又一次思索,一遍又一遍检验最终找出了原因所在,也暴露出了前期我在这方面知识欠缺和经验不足。实践出真知,经过亲自动手制作,使我们掌握知识不再是纸上谈兵 四、参考文件 《C#入门经典》 《C#从入门到精通》 附录(设计步骤图、程序、表格、数据等) 1 网站首页 public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds = DBHelper.GetDataSet("select * from TB_KeJian"); this.GridView1.DataSource = ds.Tables[0]; this.GridView1.DataBind(); } } } 2 讲义下载 public partial class NewsDetial : System.Web.UI.Page { public static string lurl; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetNewsInfo(); } } private void GetNewsInfo() { string ID = Request.QueryString["ID"].ToString(); string sqlNews = "select * from TB_KeJian where ID=" + ID; DataSet result = new DataSet(); result = DBHelper.GetDataSet(sqlNews); if (result != null) { if (result.Tables[0].Rows.Count > 0) { lurl = result.Tables[0].Rows[0]["WenJian"].ToString().Trim(); this.dlTopic.DataSource = result.Tables[0]; dlTopic.DataBind(); } else { dlTopic.DataSource = null; dlTopic.DataBind(); } } } protected void Button1_Click(object sender, EventArgs e) { try { Response.ContentType = "application/x-zip-compressed"; Response.AddHeader("Content-Disposition", "attachment;filename=" + lurl); string filename = Server.MapPath(lurl); Response.TransmitFile(filename); } catch { Response.Write("<script>alert('该文件不存在');history.go(-1);</script>"); } } } 3 会员注册 public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("UserReg.aspx"); } protected void Button1_Click1(object sender, EventArgs e) { string SQL = "select * from TB_Member where MemberName='" + this.TextBox1.Text + "' and MemberPwd='"+this.TextBox2.Text+"'"; DataSet ds = DBHelper.GetDataSet(SQL); if (ds.Tables[0].Rows.Count>0) { Session["MemberName"] = this.TextBox1.Text.Trim(); Response.Redirect("Default.aspx"); // Response.Write("<script language='javascript'>alert('登录成功!');location='javascript:history.go(-1)';</script>"); } else { Response.Write("<script language='javascript'>alert('用户名或密码错误!');location='javascript:history.go(-1)';</script>"); } } } 5 管理员登陆 public partial class SysManage_Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button2_Click(object sender, EventArgs e) { this.Txtpwd.Text = ""; this.Txtuid.Text = ""; } protected void Button1_Click(object sender, EventArgs e) { if (Txtpwd.Text.ToString().Trim() == "" || Txtuid.Text.ToString().Trim() == "") { Response.Write("<script>javascript:alert('请输入完整');history.back();</script>"); Response.End(); } string sql; sql = "select * from TB_Admin where UserName='" + Txtuid.Text.ToString().Trim() + "' and PassWord='" + Txtpwd.Text.ToString().Trim() + "'"; DataSet result = DBHelper.GetDataSet(sql); if (result != null) { if (result.Tables[0].Rows.Count > 0) { Session["username"] = Txtuid.Text.ToString().Trim(); Session["cx"] = "管理员"; Response.Redirect("manage.aspx"); } else { Response.Write("<script>javascript:alert('对不起,用户名或密码不正确!');history.back();</script>"); } } else { Response.Write("<script>javascript:alert('对不起,系统错误,请不要越权操作!');</script>"); } } } 6 管理员操作界面 A:删除会员 public partial class Admin_MemberD : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"].ToString(); string sql = "delete from tb_Member where MemberID='" + ID + "'"; bool b = DBHelper.ExecSql(sql); if (b) { Response.Write("<script>javascript:alert('操作成功');window.navigate('Member_List.aspx');</script>"); } else { Response.Write("<script>javascript:alert('操作失败');window.navigate('Member_List.aspx');</script>"); } } } B.添加视频教程 public partial class Video : System.Web.UI.Page { public static string fname; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["ID"] != null) { InitData(); } } } protected void InitData() { string id = Request["ID"].ToString(); try { string sql = "select * from TB_ZiLiao where ID=" + id; DataTable dt = DBHelper.GetDataSet(sql).Tables[0]; if (dt.Rows.Count > 0) { this.TextBox1.Text = dt.Rows[0]["Title"].ToString(); this.WebEditor1.Text = dt.Rows[0]["NeiRong"].ToString(); fname = dt.Rows[0]["WenJian"].ToString(); } } catch { } } private void FileUpLoad() { if (UploadFile.Value != null) { string nam = UploadFile.PostedFile.FileName; //取得文件名(抱括路径)里最终一个"."索引 int i = nam.LastIndexOf("."); //取得文件扩展名 string newext = nam.Substring(i); //这里我自动依据日期和文件大小不一样为文件命名,确保文件名不反复 DateTime now = DateTime.Now; string newname = now.ToFileTimeUtc() + UploadFile.PostedFile.ContentLength.ToString(); //保留文件到你所要目录,这里是IIS根目录下uploadfiles目录 //注意: 我这里用Server.MapPath()取目前文件绝对目录.在里"\"必需用"\\"替换 UploadFile.PostedFile.SaveAs(Server.MapPath("../UpLoad/" + newname + newext)); //得到这个文件相关属性:文件名,文件类型,文件大小 fname = "UpLoad/" + newname + newext; } } protected void Button1_Click(object sender, EventArgs e) { string sql; if (UploadFile.Value != null && UploadFile.Value != "") { FileUpLoad(); } if (Request["ID"] != null) { string id = Request["ID"].ToString(); sql = "update TB_ZiLiao set Title='" + TextBox1.Text + "',WenJian='" + fname + "',NeiRong='" + this.WebEditor1.Text + "' where ID=" + id; bool b = DBHelper.ExecSql(sql); if (b) { Response.Write("<script>javascript:alert('操作成功');</script>"); } else { Response.Write("<script>javascript:alert('系统错误,您没有设置好数据库连接!或您输入了部分非法字符!');</script>"); } } else { sql = "insert into TB_ZiLiao(Title ,NeiRong,WenJian,FaBuRen) values('" + this.TextBox1.Text.Trim() + "','" + this.WebEditor1.Text + "','" + fname + "','" +Session["username"].ToString() + "')"; bool b = DBHelper.ExecSql(sql); if (b) { Response.Write("<script>javascript:alert('操作成功');</script>"); } else { Response.Write("<script>javascript:alert('系统错误,您没有设置好数据库连接!');</script>"); } } } protected void Button2_Click(object sender, EventArgs e) { this.TextBox1.Text = ""; this.WebEditor1.Text = ""; } } C:删除视频资料 public partial class VideoD : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { int ID = Convert.ToInt32(Request.QueryString["ID"].ToString()); string sql = "delete from TB_ZiLiao where ID=" + ID; bool B = DBHelper.ExecSql(sql); if (B) { Response.Write("<script>javascript:alert('操作成功');window.navigate('ZiLiao_List.aspx');</script>"); } else { Response.Write("<script>javascript:alert('操作失败');window.navigate('ZiLiao_List.aspx');</script>"); } } } D:视频资料下载 public partial class Video : System.Web.UI.Page { public static string fname; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["ID"] != null) { InitData(); } } } protected void InitData() { string id = Request["ID"].ToString(); try { string sql = "select * from TB_KeJian where ID=" + id; DataTable dt = DBHelper.GetDataSet(sql).Tables[0]; if (dt.Rows.Count > 0) { this.TextBox1.Text = dt.Rows[0]["Title"].ToString(); this.WebEditor1.Text = dt.Rows[0]["NeiRong"].ToString(); fname = dt.Rows[0]["WenJian"].ToString(); } } catch { } } private void FileUpLoad() { if (UploadFile.Value != null) { string nam = UploadFile.PostedFile.FileName; //取得文件名(抱括路径)里最终一个"."索引 int i = nam.LastIndexOf("."); //取得文件扩展名 string newext = nam.Substring(i); //这里我自动依据日期和文件大小不一样为文件命名,确保文件名不反复 DateTime now = DateTime.Now; string newname = now.ToFileTimeUtc() + UploadFile.PostedFile.ContentLength.ToString(); //保留文件到你所要目录,这里是IIS根目录下uploadfiles目录 //注意: 我这里用Server.MapPath()取目前文件绝对目录.在里"\"必需用"\\"替换 UploadFile.PostedFile.SaveAs(Server.MapPath("../UpLoad/" + newname + newext)); //得到这个文件相关属性:文件名,文件类型,文件大小 fname = "UpLoad/" + newname + newext; } } protected void Button1_Click(object sender, EventArgs e) { string sql; if (UploadFile.Value != null && UploadFile.Value != "") { FileUpLoad(); } if (Request["ID"] != null) { string id = Request["ID"].ToString(); sql = "update TB_KeJian set Title='" + TextBox1.Text + "',WenJian='" + fname + "',NeiRong='" + this.WebEditor1.Text + "' where ID=" + id; bool b = DBHelper.ExecSql(sql); if (b) { Response.Write("<script>javascript:alert('操作成功');</script>"); } else { Response.Write("<script>javascript:alert('系统错误,您没有设置好数据库连接!或您输入了部分非法字符!');</script>"); } } else { sql = "insert into TB_KeJian(Title ,NeiRong,WenJian,FaBuRen) values('" + this.TextBox1.Text.Trim() + "','" + this.WebEditor1.Text + "','" + fname + "','" +Session["username"].ToString() + "')"; bool b = DBHelper.ExecSql(sql); if (b) { Response.Write("<script>javascript:alert('操作成功');</script>"); } else { Response.Write("<script>javascript:alert('系统错误,您没有设置好数据库连接!');</script>"); } } } protected void Button2_Click(object sender, EventArgs e) { this.TextBox1.Text = ""; this.WebEditor1.Text = ""; } }
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 考试专区 > 中考

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服