软件工程实验报告

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

系统功能体系图
数据库设计 数据库图
作业提交系统
注册 登录 密码找回
学生用户登录 教师用户登录 管理员用户登录
查看成绩 打包下载作业 发布修改作业 添加班级 添加用户
数据库管理 上传作业 下载作业 查看作业
发布修改成绩
删除作业 添加专业 通用模板 修改密码
查看个人资料
注销系统
编码和测试
系统运行资源管理图
登录界面及编码
屏幕切换编码:
<SCRIPT language=JavaScript type=text/javascript>
if (self != top) {
top.location = self.location;
}
function switchSysBar() {
if (switchPoint.innerHTML == '&lt;') {
switchPoint.innerHTML = '&gt;'
document.getElementById("frmTitle").style.display = "none";
}
else {
switchPoint.innerHTML = '&lt;'
document.getElementById("frmTitle").style.display = "block";
}
}
function changeMainFrameSrc(url) {
//alert(url);
document.getElementById("mainFrame").src = url;
}
</SCRIPT>
<TABLE border=0 cellSpacing=0 cellPadding=0 width="100%" height="100%">
<TBODY>
<TR>
<TD id=frmTitle height="100%" vAlign=center noWrap align=middle><IFRAME id=nagFrame class=iframe1 src="nag.htm" frameBorder=0
name=nagFrame></IFRAME></TD>
<TD class=td2>
<TABLE border=0 cellSpacing=0 cellPadding=0 height="100%">
<TBODY>
<TR>
<TD onclick=switchSysBar()><FONT
class=switchbarfont><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><SPAN
id=switchPoint class=navPoint title=关闭/打开左栏>&lt;</SPAN>
<BR><BR><BR><BR><BR><BR><BR><BR>屏幕切换</FONT></TD></TR></TBODY></TABLE></TD>
<TD style="WIDTH: 100%"><IFRAME id=mainFrame class=iframe2
src="login.aspx"" frameBorder=0 name=mainFrame
scrolling=yes></IFRAME></TD></TR></TBODY></TABLE>
<SCRIPT language=JavaScript type=text/javascript>
if (window.screen.width < '1024') { switchSysBar() }
</SCRIPT>
管理员添加用户界面及编码
protected void b_register_Click(object sender, EventArgs e)
{
string user = "";
string scmd="";
if (r_admin.Checked == true)
{
user = "admin";
scmd = string.Format("insert into admin(username,adminid,password,name) values ('{0}','{1}','{2}','{3}');",t_username.Text.ToString(),t_id.Text.ToString(),t_id.Text.ToString(),t_name.Text. ToString());
}
protected void Page_Load(object sender, EventArgs e)
{
if (Session["username"] == null)
{
Response.Redirect("menus.htm");
}
else{ teachername = Session["username"].ToString();
SetBind();}
}
private void SetBind()
{
DataSet ds = new DataSet();
string sconn = @"server=(local)\SQLEXPRESS;database=homework;Trusted_Connection=True";
SqlConnection conn = new SqlConnection(sconn);
SqlDataAdapter da = new SqlDataAdapter(string.Format("select ID,title,num,conten from work where teaname='{0}'", teachername), conn);
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
conn.Close();
}
protected void b_addhomework_Click(object sender, EventArgs e)
{
string path = string.Format("/work/{0}",t_addhomework.Text.ToString());//目录在E盘
if (!Directory.Exists(path))
教师批量下载作业界面及编码
protected void Button2_Click(object sender, EventArgs e)
{
hello();
string strtxtPath = strFileUploadPath;
string strzipPath = strFileUploadPath+"\\free.zip";
System.Diagnostics.Process Process1 = new System.Diagnostics.Process(); Process1.StartInfo.FileName = "Winrar.exe";
Process1.StartInfo.CreateNoWindow = true;
////压缩c:\freezip\free.txt(即文件夹及其下文件freezip\free.txt)
////到c:\freezip\free.rar
// strzipPath = "C: \\freezip\\free";//设置压缩方式为 .zip
Process1.StartInfo.Arguments = " a -afzip " + strzipPath + " " + strtxtPath;
//// 3
Process1.Start();
if (Process1.HasExited)
{
int iExitCode = Process1.ExitCode;
if (iExitCode == 0)
{
Response.Write(iExitCode.ToString() + " 正常完成");
}
else
{
Response.Write(iExitCode.ToString() + " 有错完成");
}
}
学生上传作业界面及编码
private void hello()
{
strFileUploadPath = string.Format("D: \\work\\{0}\\", title);
string ID = Request.QueryString["ID"].ToString();
SqlConnection conn = new SqlConnection(@"server=(local)\SQLEXPRESS;database=homework;Tr usted_Connection=True");
conn.Open();
SqlCommand cmd = new SqlCommand(string.Format("select * from work where ID={0}", ID), conn );
SqlDataReader read = cmd.ExecuteReader();
read.Read();
teacher = read["teaname"].ToString();
title = read["title"].ToString();
conn.Close();
}
private void InitFileList()
{
hello();
strFileUploadPath = string.Format("D: \\work\\{0}\\", title);
//组合成物理路径 file:///D:\homework\pic\
//string strFilePath = Server.MapPath(strFileUploadPath);
//读取文件夹下所有文件
{
//调用自定义方法显示提示
ShowMessageBox("文件类型不符合要求,请参看上传限制");
}
}
其他功能
protected void btnSubmit_Click(object sender, EventArgs e)
{
string user = Session["user"].ToString();
string sconn = @"server=(local)\SQLEXPRESS;database=homework;Trusted_Connection=True";
SqlConnection conn = new SqlConnection(sconn);
conn.Open();
SqlCommand cmd = new SqlCommand(string.Format("update {0} set password='{1}' where (username='{2}')", user,txtPwd.Text.ToString(), txtName.Text.ToString()),conn);
cmd.ExecuteNonQuery();
conn.Close();
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", string.Format("<script>alert('修改成功!');</script>"));
}。

相关文档
最新文档