【ASP.NET】高校教育实习管理系统
本帖最后由 夏沫梦影 于 2019-12-31 22:07 编辑项目要求:
使用开发工具Microsoft Visual Studio 2012以上,数据库Microsoft SQL Server 2012以上,服务器IIS,在Windows 平台上开发基于B/S模式的高校教育实习管理系统。
1、 系统的用户角色分为:学生用户、指导老师、实习企业、管理员
2、 学生用户:
(1) 实习信息录入:
(2) 学生个人基本信息 (姓名、班级、学号、联系电话、实习单位、实习地址)
(3) 实习单位基本信息 (公司名称、地点、简介、公司联络人、联系电话)
(4) 实习信息变更
(5) 学生实习成果资料上传区 (实习周记、实习总结报告)
(6) 实习相关文档资料下载区(实习周记、实习鉴定表、实习总结、满意度调查表等)
3、 实习企业:
(1)学生信息查看
(2)实习信息交流
(3)实习成绩评定
4、 指导教师:
(1)学生信息查看
(2)企业信息查看
(3)实习信息交流
(4)学生实习周记查看与评分
(5)实习成绩评定
5、 管理员:
(1)基本信息管理(学生信息、实习企业信息、指导教师信息)
(2)公告管理
(3)实习相关文档资料上传
(4)实习周记、总结报告管理
(5)评价管理
(6)数据管理
(7)系统组件更新
https://static.52pojie.cn/static/image/hrline/3.gifhttps://static.52pojie.cn/static/image/hrline/3.gif
相关说明:
1、后台管理员用户名密码均是:admin 指导老师账号密码都是:teacher 学生账号密码都是:student 企业账号密码都是:commpany
2、开发环境为Microsoft Visual Studio 2019,数据库为Microsoft SQL Server 2017,使用.net 4.7.2开发。
3、数据库文件在Database文件夹中
4、默认数据库连接字符串在web.config配置文件中修改。
下载地址:
度盘:https://pan.baidu.com/s/12FH2hgceKuYxR0mHXWWGrw提取码: v6v8
蓝奏:https://www.lanzouj.com/i8dltab
https://static.52pojie.cn/static/image/hrline/3.gifhttps://static.52pojie.cn/static/image/hrline/3.gif
原型设计:
原型设计文件因为硬盘损坏已丢失,只剩图片了,凑合看吧...
使用Balsamiq_Mockups_3绘画
logo
https://i.loli.net/2019/12/31/mMcqElj1fBSKpWN.jpg
主页
https://i.loli.net/2019/12/31/HErJWDaZQGm3vSh.png
管理员
https://i.loli.net/2019/12/31/hJMfXy6EH3Z4xaL.png
企业
https://i.loli.net/2019/12/31/in9qN1gEs5FC67u.png
学生
https://i.loli.net/2019/12/31/6jfl4sOVCBn5t8q.png
数据库设计:
管理员
https://i.loli.net/2019/12/31/BIVshEtZyzqo3SF.png
企业
https://i.loli.net/2019/12/31/xpUnBYrmvDAE4lG.png
学生
https://i.loli.net/2019/12/31/Mlmo3xDNfyPvpsi.png
指导老师
https://i.loli.net/2019/12/31/7uinjDOJypLQRYf.png
成果
https://i.loli.net/2019/12/31/hbBCDGv7HeVdwXL.png
文件
https://i.loli.net/2019/12/31/nzYpZjFdPhJsVoX.png
公告
https://i.loli.net/2019/12/31/AQoSW6hMVwFKLeJ.png
企业信息
https://i.loli.net/2019/12/31/AgyMFE1CaDKkrBm.png
关系模型
https://i.loli.net/2019/12/31/U17BAn2PRokm3Vf.png
https://i.loli.net/2019/12/31/4SGvBPYJN3V5Xne.png
成品:
演示效果
https://i.loli.net/2019/12/31/pYRqQmfVLDMrzXC.gif
https://static.52pojie.cn/static/image/hrline/3.gifhttps://static.52pojie.cn/static/image/hrline/3.gif
具体文件请下载查看,我这里只简单列出一些
公共类:
Alert.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// Alert 的摘要说明
/// </summary>
public class Alert
{
public Alert()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void Alertjs(string AlertStr)
{
string Alert = "";
Alert = "<script language='javascript'>alert('" + AlertStr + "')</script>";
HttpContext.Current.Response.Write(Alert);
}
/// <summary>
/// 弹出提示并跳转
/// </summary>
/// <param name="Message">提示信息</param>
/// <param name="RedirectUrl">跳转Url</param>
public static void AlertAndRedirect(string Message, string RedirectUrl)
{
string js = "";
js = "<script language='javascript'>alert('{0}');window.location.replace('{1}')</script>";
HttpContext.Current.Response.Write(string.Format(js, Message, RedirectUrl));
} /// <summary>
/// 弹出新页面
/// </summary>
/// <param name="url">页面地址</param>
/// <param name="width">宽度</param>
/// <param name="heigth">高度</param>
/// <param name="top">上边位置</param>
/// <param name="left">左边位置</param>
public static void AlertNewWebForm(string url, int width, int heigth, int top, int left)
{
string js = @"<Script language='JavaScript'>window.open('" + url + @"','','height=" + heigth + ",width=" + width + ",top=" + top + ",left=" + left + ",location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,directories=no');</Script>";
HttpContext.Current.Response.Write(js);
}
}
stUpLoad.cs
using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// stUpLoad 的摘要说明
/// </summary>
public class stUpLoad
{
public stUpLoad()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public string[] Resup ={ "上传失败或指定的文件不存在", "图片大于1000K,重新传图片!", "格式不对,限制上传(只允许gif/jpg格式文件)!", "上传成功!" };
public string s = string.Empty;
public string Up(FileUpload File2, string Pa, string fileName)
{
//
// TODO: 在此处添加构造函数逻辑
//
if (File2.PostedFile.ContentLength.ToString() == "0")
{
return "0";
}
else
{
//获取文件名称
string ss;
ss = fileName;
if (File2.PostedFile.ContentLength / 1024 > 1000)
{ return "1"; }
else
{
File2.PostedFile.SaveAs(System.Web.HttpContext.Current.Server.MapPath(Pa) + ss);
s =ss;
return "3";
//Up= ss;
}
}
}
}
upload.cs
using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// upload 的摘要说明
/// </summary>
public class upload
{
public upload()
{
//
// TODO: 在此处添加构造函数逻辑
//
} public string[] Resup ={ "上传失败或指定的文件不存在", "图片大于1000K,重新传图片!", "格式不对,限制上传(只允许gif/jpg格式文件)!", "上传成功!" };
public string s = string.Empty;
public string Up(System.Web.UI.HtmlControls.HtmlInputFile File2, string Pa)
{
//
// TODO: 在此处添加构造函数逻辑
//
if (File2.PostedFile.ContentLength.ToString() == "0")
{
return "0";
}
else
{
//获取文件名称
string ss;
ss = System.DateTime.Now.ToString().Replace("-", "").Replace(" ", "").Replace(":", "").Replace("/","") + Path.GetExtension(File2.PostedFile.FileName);
if (File2.PostedFile.ContentLength / 1024 > 1000)
{ return "1"; }
else
{
File2.PostedFile.SaveAs(System.Web.HttpContext.Current.Server.MapPath(Pa) + ss);
s =ss;
return "3";
//Up= ss;
}
}
}
}
SqlHelper.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Collections;
using System.Data.SqlClient;
using System.Data;
/// <summary>
/// SqlHelper 的摘要说明
/// </summary>
public class SqlHelper
{
public static readonly string connstring = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
private static Hashtable parmCache = Hashtable.Synchronized(new Hashtable());
private SqlConnection con;
private SqlCommand cmd;
private SqlDataAdapter sda;
private SqlDataReader sdr;
private DataSet ds;
private DataView dv;
public static SqlConnection getConnection()//定义成静态的,很重要!
{
return new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
}
/// <summary>
/// 打开数据库连接
/// </summary>
public void OpenDataBase()
{
con = new SqlConnection(connstring);
con.Open();
}
/// <summary>
/// 关闭数据库连接
/// </summary>
public void CloseDataBase()
{
con.Close();
con.Dispose();
}
/// <summary>
/// 返回DataSet数据集
/// </summary>
/// <param name="SqlStr">数据库查询字符串</param>
/// <returns>dataset</returns>
public DataSet GetDs(string SqlStr, string TableName)
{
OpenDataBase();
sda = new SqlDataAdapter(SqlStr, con);
ds = new DataSet();
sda.Fill(ds, TableName);
CloseDataBase();
return ds;
}
public DataView GetDv(string SqlStr)
{
OpenDataBase();
sda = new SqlDataAdapter(SqlStr, con);
ds = new DataSet();
sda.Fill(ds);
dv = ds.Tables.DefaultView;
CloseDataBase();
return dv;
}
/// <summary>
/// 返回Datareader对象
/// </summary>
/// <param name="Sqlstr">查询字符串</param>
/// <returns>返回值</returns>
public SqlDataReader GetDataReader(string Sqlstr)
{
OpenDataBase();
cmd = new SqlCommand(Sqlstr, con);
sdr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
return sdr;
}
/// <summary>
/// 执行Sql语句方法没有返回值
/// </summary>
/// <param name="SqlStr">传入的查询参数</param>
public void RunSql(string SqlStr)
{
OpenDataBase();
cmd = new SqlCommand(SqlStr, con);
cmd.ExecuteNonQuery();
CloseDataBase();
}
/// <summary>
/// 返回查询结果的首行首列
/// </summary>
/// <param name="SqlStr">查询字符串</param>
/// <returns>返回结果</returns>
public string ReturnSql(string SqlStr)
{
OpenDataBase();
string ReturnSql = "";
try
{
cmd = new SqlCommand(SqlStr, con);
ReturnSql = cmd.ExecuteScalar().ToString();
}
catch { }
CloseDataBase();
return ReturnSql;
}
public static int ExecuteNonQuery(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(connectionString))
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
}
public static int ExecuteNonQuery(SqlConnection connection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
public static int ExecuteNonQuery(SqlTransaction trans, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, trans.Connection, trans, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
public static SqlDataReader ExecuteReader(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
SqlConnection conn = new SqlConnection(connectionString);
try
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
cmd.Parameters.Clear();
return rdr;
}
catch
{
conn.Close();
conn.Dispose();
throw;
}
}
public static object ExecuteScalar(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
using (SqlConnection connection = new SqlConnection(connectionString))
{
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
object val = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return val;
}
}
public static object ExecuteScalar(SqlConnection connection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
object val = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return val;
}
public static void CacheParameters(string cacheKey, params SqlParameter[] commandParameters)
{
parmCache = commandParameters;
}
public static DataTable GetTable(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(connectionString))
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
}
return dt;
}
public static SqlParameter[] GetCachedParameters(string cacheKey)
{
SqlParameter[] cachedParms = (SqlParameter[])parmCache;
if (cachedParms == null)
return null;
SqlParameter[] clonedParms = new SqlParameter;
for (int i = 0, j = cachedParms.Length; i < j; i++)
clonedParms = (SqlParameter)((ICloneable)cachedParms).Clone();
return clonedParms;
}
private static void PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction trans, CommandType cmdType, string cmdText, SqlParameter[] cmdParms)
{
if (conn.State != ConnectionState.Open)
conn.Open();
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
cmd.Transaction = trans;
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (SqlParameter parm in cmdParms)
cmd.Parameters.Add(parm);
}
}
}
https://static.52pojie.cn/static/image/hrline/3.gifhttps://static.52pojie.cn/static/image/hrline/3.gif
主页相关登录按钮:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Login : System.Web.UI.Page
{
SqlHelper data = new SqlHelper();
SqlDataReader dr;
Alert js = new Alert();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void btn_login_Click(object sender, EventArgs e)
{
if (username.Text == "" && password.Text == "")
{
Alert.AlertAndRedirect("没有输入账号和密码!", "Login.aspx");
}
else
{
if (level.SelectedValue == "管理员")
{
dr = data.GetDataReader("select * from where Admin='" + username.Text + "'and pwd='" + password.Text.Trim() + "'");
if (dr.Read())
{
Session["User"] = dr["Admin"].ToString();
Session["Userid"] = dr["id"].ToString();
Session["Roule"] = "管理员";
Response.Redirect("Admin/Default.aspx");
}
else
{
Alert.AlertAndRedirect("账号或者密码不对请重新登陆!", "Login.aspx");
}
}
if (level.SelectedValue == "指导老师")
{
dr = data.GetDataReader("select * from where xuexiao='" + username.Text + "'and Pwd='" + password.Text.Trim() + "'");
if (dr.Read())
{
Session["Userid"] = dr["id"].ToString();
Session["User"] = dr["Name"].ToString();
Session["xuexiao"] = dr["xuexiao"].ToString();
Session["Roule"] = "指导老师";
Response.Redirect("Teachter/Default.aspx");
}
else
{
Alert.AlertAndRedirect("账号或者密码不对请重新登陆!", "Login.aspx");
}
}
if (level.SelectedValue == "学生")
{
dr = data.GetDataReader("select * from where xuexiao='" + username.Text + "'and Pwd='" + password.Text.Trim() + "'");
if (dr.Read())
{
Session["Userid"] = dr["id"].ToString();
Session["xuexiao"] = dr["xuexiao"].ToString();
Session["User"] = dr["Name"].ToString();
Session["Roule"] = "学生";
Response.Redirect("Default.aspx");
}
else
{
Alert.AlertAndRedirect("账号或者密码不对请重新登陆!", "Login.aspx");
}
}
if (level.SelectedValue == "企业")
{
dr = data.GetDataReader("select * from where LoginName='" + username.Text + "'and LoingPwd='" + password.Text.Trim() + "'");
if (dr.Read())
{
Session["Userid"] = dr["id"].ToString();
Session["User"] = dr["fuzeren"].ToString();
Session["Roule"] = "企业";
Response.Redirect("Commpany/Default.aspx");
}
else
{
Alert.AlertAndRedirect("账号或者密码不对请重新登陆!", "Login.aspx");
}
}
}
}
protected void btn_register_Click(object sender, EventArgs e)
{
Response.Redirect("AddAdmin.aspx");
}
}
https://static.52pojie.cn/static/image/hrline/3.gifhttps://static.52pojie.cn/static/image/hrline/3.gif
web.config配置文件中修改数据库连接字符串方法演示:
https://i.loli.net/2019/12/31/u6J5tjpVPo1Aac3.gif
11,级别 14,状态 5,第 1 行
用户没有更改数据库 'C:\USERS\ADMINISTRATOR\DESKTOP\高校教育实习管理系统\高校教育实习管理系统\DATABASE\INTERNSHIP.MDF' 的权限,该数据库不存在,或数据库未处于允许访问检查的状态。
消息 5069,级别 16,状态 1,第 1 行
ALTER DATABASE 语句失败。
消息 911,级别 16,状态 4,第 3 行
数据库 'C:\USERS\ADMINISTRATOR\DESKTOP\高校教育实习 xiaosaohuo11 发表于 2020-1-3 10:30
楼主这个sqlserver版本有点高诶 可以发一下数据库脚本吗
导出了一下脚本 谢谢楼主,东西我先拿走了啊{:1_918:} 不错,谢谢分享。好好学习一下。。。 谢谢哥 ,拿去学习一下 楼主这个sqlserver版本有点高诶 可以发一下数据库脚本吗 夏沫梦影 发表于 2020-1-3 15:12
导出了一下脚本
楼主有心了,但是,我一咬牙下了个sqlserver2019{:1_896:} 主页有图片,登陆进去,没有样式 xiaosaohuo11 发表于 2020-1-7 16:03
主页有图片,登陆进去,没有样式
可以啊,我刚看了一下没问题