经济管理学院
程序设计训练A(二)课程设计
课程设计题目: 高等院校科研管理信息系统
专 业 班 级: 信管101班
学 生 姓 名: 张沛梅
学 号: 100201138
指 导 教 师: 李庆恒 王玉恒 陈军霞 董绍辉
20##年 1 月 18 日
1. 系统描述
1.1背景
某高等学校拟建立一套科研管理信息系统,实现对科研工作的信息化管理,要求系统对数据的存储完整,查询迅速,操作方便。
教职员工分属于各个学院下的系或行政机关,在学院的教职员工分属于不同的系,在行政机关的教职员工分属于不同的部门如教务处,人事处,财务处等。各级单位均有单位名称,单位地址,电话等属性。
教职员工基本信息包括姓名,性别,出生年月,政治面貌,籍贯,毕业院校,所学专业,学历,学位,研究方向,联系电话等信息;教职员工的科研工作主要包括撰写论文,著作和承担课题的研究,发明创造等工作,其研究成果主要包括论文,著作,课题,专利四大类。
撰写的论文信息包括论文名称,所有作者姓名,出版刊物名称,刊号,时间,刊物级别(核心期刊,一般期刊,报纸杂志,会议论文),是否被三大索引收录等信息。
著作主要包括书名,出版社,出版时间,著作类别(专著、编著、教材、译著),字数,作者姓名及其分工等。
课题包括三个环节,立项,鉴定,获奖。课题基本情况包括课题名称,编号,承担单位,合作单位,课题立项情况包括课题来源分为纵向(国家,省部,厅局,一般)横向(其他单位),课题性质(自然科学,软科学,社会科学等),还包括立项时间,完成时间,课题成员,经费等;鉴定包括鉴定时间,鉴定级别(国家,省部,厅局,一般),人员,成果等级(国际先进,国际领先,国内先进,国内领先)等;获奖包括获奖时间,级别(国家,省部,厅局),等级(一等奖,二等奖,三等奖),人员等。
专利包括专利号,名称,专利类型(发明,实用新型,外观设计等),授予时间,人员等。
每位教职员工会参与多项课题,论文,著作和专利。每项科研也会有多人参加。教职员工的科研工作成果评价和他参与科研的数量和质量都有关系。根据科研参与人数的不同和该教职员工的排名不同,他可以获得相应的科研分数,所以科研的总体信息和各人的对应信息必须完整。最终提供的数据模式可以使用户按照不同年份,人员,单位等各种口径进行查询及统计工作,要求信息完整,设计规范。
1.2目的和意义
目的是使教职员工科研管理工作更加的简捷,管理更加先进。其意义是通过系统开发使学生更深入的理解相关编程知识,同时开发出有实际作用的系统,用实践带动学习积极性。
2. 程序功能介绍
程序从登陆窗口进入,根据角色不同进入的主页不同。当是用户登录时,进入到个人科研信息系统页面,在这个页面教职员工可以实现以下功能:
(1) 查看个人的详细信息;
(2) 修改个人的密码;
(3) 可以进行参加论文,著作,课题,专利信息的录入;
(4) 可以查询个人参加不同科研项目的基本信息与得分。
当是管理员登录时,进入到管理员的主页,可以实现以下功能:
(1)可以查看管理员自己的详细信息;
(2)修改个人密码;
(3)可以查看全部教职员工的登录密码;
(4)可以查看参加不同科研项目的详细情况,进行录入,删除,更新科研信息的操作;
(5)可以按时间段对不同项目进行时间检索,查看某个时间段某个项目的具体信息;
(6)对科研项目的评分规则进行修改。
3. 系统实现
3.1开发环境
软硬件本系统适用于微型机,内存容量2G,应配备的外部设备有鼠标、键盘、显示器、主机等. 软件环境Microsoft Visual Studio 2010和SQL server 2005.本系统的设计采用的是ASP.NET语言,在Windows 7操作系统下Microsoft Visual Studio 2010和SQL server 2005软件环境下使用。
3.2程序调试情况
1、调试登陆窗口遇到的问题
在写登陆按钮的单击事件代码是出现了错误,此登陆功能是:如果输入的职工号是管理员,就倒转到管理员的界面,如果输入职工号是用户,就跳转到用户界面。因为没有写对代码,导致没有跳转正确。
解决方案:
if((Eid1!=null) && (paw1!=null) &&(js1=="管¨¹理¤¨ª员¡À"))
{
Session["CurrentValue"] = user.Text;
Response.Redirect("LiuyiDefault2.aspx");
}
if((Eid1!=null) && (paw1!=null) &&(js1=="用®?户¡ì"))
{
Session["CurrentValue"] = user.Text;
Response.Redirect("LiuyiDefault.aspx");
}
2.调试按时间检索参加各项项目的具体情况出现的问题
如上图,我以论文时间检索为例,时间检索论文的详细情况,需要调用数据库的存储过程。但是起初没有调用,导致检索不出结果。
解决方案:
myCommand.CommandText = "time_select_Eplw";
SqlParameter parInput = myCommand.Parameters.Add("@time1", SqlDbType.DateTime);
parInput.Direction = ParameterDirection.Input;
parInput.Value = Convert.ToDateTime(DropDownList1.Text + "/" + DropDownList2.Text + "/" + DropDownList3.Text);
SqlParameter parInput2 = myCommand.Parameters.Add("@time2", SqlDbType.DateTime);
parInput2.Direction = ParameterDirection.Input;
parInput2.Value = Convert.ToDateTime(DropDownList4.Text + "/" + DropDownList5.Text + "/" + DropDownList6.Text);
3.调试评分规则管理时出现的问题
如上图,以著作评分规则修改为例,要修改评分规则需要查询出数据库中原始的评分,但是在查询单击事件的代码没有写对,执行了很多次都没有成功。
解决方案:
SqlConnection myCon = null;
SqlCommand myCom = null;
try
{
string myConStr = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
myCon = new SqlConnection(myConStr);
myCon.Open();
string sql = "select ZZgrade from zz_sum where zzlx='"+DropDownListZZjb.Text+"'";
myCom = new SqlCommand(sql ,myCon);
SqlDataReader result = myCom.ExecuteReader();
if (result.Read())
{
TextBoxZZfz.Text = result["ZZgrade"].ToString();
}
}
catch (Exception oe)
{
Response.Write("数ºy据Y库a操¨´作Á¡Â失º¡ì败㨹" + oe);
}
finally
{
if (myCon != null)
{
myCon.Close();
}
3.3 结论
本系统是高等院校教职员工科研管理信息系统,能够简单的处理个人科研信息,界面清晰,易于理解,操作简单方便。用户可以进入用户界面查询个人参加项目的情况,修改密码,可以进行科研申报。管理员通过进入管理界面查询各个项目的具体情况,可以对参加项目的人员或其他信息进行更新,删除等工作,管理参加人员。管理员还可以根据需要更改各项目的评分规则。但是还存在一些问题,不能做到按折线图或饼图的形式输出,也不能按报表的形式输出。
完善方案如下:(1)应该做到用折线图或饼图输出各项目的情况;
(2)应该做到各个工能灵活使用。
4. 结束语
通过做本次课程设计,我有很大的感受,也学到了很多的东西。首先,我明白了自身所处的位置,我掌握的知识还很有限,在课程设计过程遇到很多问题,常常需要花很多时间去解决一个问题,这是因为没有充分掌握相关知识,这就需要我在课下多学习。如果毕业后想从事这方面的工作,课余时间还应该多看看有关的知识。另外,还应该在课余多做一些类似的系统,多接触这种做系统的练习,让自己对数据库和编程这方面做到熟练,总结出经验,以便于在以后做系统时能处理好,出现类似的错误能尽快的解决。 其次,我明白了自己在做界面和编写代码时还是做得不够好,还是经常出现错误,在编程方面的能力也还是十分有限的,不能灵活掌握课本的知识。自己有不明白的问题时,应该尽快的询问老师或者参考其他资料。自己编写代码时考虑问题还欠缺全面性,不能做到令人很满意。最后,我明白了开发一个系统不是一朝一夕的事情,虽然三个星期的时间不算太长,但是也有很多其他的同学做的很好。经过这次训练,自己要加油,下次能做得更好。
附录:源代码清单
1. 登陆页面
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 dl : System.Web.UI.Page
{
protected void Buttsure_Click(object sender, EventArgs e)
{
string Eid1 = null;
string paw1 = null;
string js1 = null;
String sqlconn = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
SqlConnection myConnection = new SqlConnection(sqlconn);
myConnection.Open();
string sqlsel="select Eid,paw,js from dl where Eid='"+user.Text+"'and paw='"+paw.Text+"'";
SqlCommand myCommand = new SqlCommand(sqlsel,myConnection);
SqlDataReader result = myCommand.ExecuteReader();
if(result.Read())
{
Eid1 = result["Eid"].ToString();
paw1 = result["paw"].ToString();
js1= result["js"].ToString();
}
if((user.Text==null)&&(paw.Text==null)){Response.Write("请?输º?入¨?用®?户¡ì名?和¨ª密¨¹码?!ê?!ê?!ê?");}
if((Eid1!=user.Text) &&(paw1!=paw.Text))
{
Response.Write("<Script Language=JavaScript>if(confirm('用®?户¡ì名?或¨°密¨¹码?不?正y确¨¡¤!ê?!ê?!ê?')){window.navigate('dl.aspx');} </Script>");
}
if((Eid1!=null) && (paw1!=null) &&(js1=="管¨¹理¤¨ª员¡À"))
{
Session["CurrentValue"] = user.Text;
Response.Redirect("LiuyiDefault2.aspx");
}
if((Eid1!=null) && (paw1!=null) &&(js1=="用®?户¡ì"))
{
Session["CurrentValue"] = user.Text;
Response.Redirect("LiuyiDefault.aspx");
}
myConnection.Close();
}
protected void ButtonCZ_Click(object sender, EventArgs e)
{
user.Text = "";
paw.Text = "";
}
}
2. 管理员界面
2.1 管理员人员基本信息
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 glyJbxinix : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String sqlconn = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
SqlConnection myConnection = new SqlConnection(sqlconn);
myConnection.Open();
SqlCommand myCommand = new SqlCommand("select Employee.*,Section.Sname,Department.Dname from Employee,Section,Department where Employee.Eid='" + Session["CurrentValue"] + "' and Section.Sid= Employee.Sid and Department.Did=Section.Did", myConnection);
SqlDataReader myReader;
myReader = myCommand.ExecuteReader();
if (myReader.Read())
{
Label4.Text = myReader["Eid"].ToString();
Label2.Text = myReader["Ename"].ToString();
Label6.Text = myReader["Esex"].ToString();
Label14.Text = myReader["Sname"].ToString();
Label8.Text = myReader["Ebri"].ToString();
Label20.Text = myReader["Esxzy"].ToString();
Label10.Text = myReader["Emm"].ToString();
Label12.Text = myReader["Ejg"].ToString();
Label18.Text = myReader["Ebyxy"].ToString();
Label16.Text = myReader["Dname"].ToString();
Label22.Text = myReader["Exw"].ToString();
Label24.Text = myReader["Exl"].ToString();
Label26.Text = myReader["Eyjfx"].ToString();
Label28.Text = myReader["Etel"].ToString();
}
myReader.Close();
myConnection.Close();
}
}
2.2管理员密码修改
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 glymima1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection myCon = null;
SqlCommand myCom = null;
SqlDataReader result=null;
SqlCommand comm=null;
string paw1=null;
try
{
string myConStr = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
myCon = new SqlConnection(myConStr);
myCon.Open();
myCom = new SqlCommand();
myCom.Connection = myCon;
string oldmm = ysmm.Text.Trim();
string newmm = xmm.Text.Trim();
string sqlsel="select paw from dl where Eid='"+Session["CurrentValue"]+"'";
comm = new SqlCommand(sqlsel,myCon);
result = comm.ExecuteReader();
if(result.Read())
{
paw1 = result["paw"].ToString();
}
if (paw1 == ysmm.Text)
{
if (result != null)
{
result.Close();
}
//string strUpdate = "Update stu set stuName='李¤?芳¤?',XyDm='02',ZyDm='0201' where stuNum='091001'";
string strUpdate = "Update dl set paw='{0}' where Eid='{1}'";
string sql = string.Format(strUpdate, newmm, Session["CurrentValue"]);
myCom.CommandType = CommandType.Text;
myCom.CommandText = sql;
myCom.ExecuteNonQuery();
Response.Write("<Script Language=JavaScript>alert('数ºy据Y库a内¨²容¨Y修T改?成¨¦功|!ê?!ê?!ê?') </Script>");
}
else
{
if (result != null)
{
result.Close();
}
Response.Write("<Script Language=JavaScript>if(confirm('此ä?原-始º?密¨¹码?与®?数ºy据Y库a中D的Ì?不?符¤?!ê?!ê?!ê?请?重?新?输º?入¨?!ê?!ê?')){window.navigate('glymima1.aspx');} </Script>");
}
}
catch (Exception oe)
{
Response.Write("数ºy据Y库a操¨´作Á¡Â失º¡ì败㨹" + oe);
}
finally
{
if (myCon != null)
{
myCon.Close();
}
}//try 结¨¢束º?
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("LiuyiDefault2.aspx");
}
3. 用户密码修改代码(同管理员密码修改的代码)
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 mima : System.Web.UI.Page
{
protected void qd_Click(object sender, EventArgs e)
{
//定义要使用的对象
SqlConnection myCon = null;
SqlCommand myCom = null;
try
{
string myConStr = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
myCon = new SqlConnection(myConStr);
myCon.Open();
myCom = new SqlCommand();
myCom.Connection = myCon;
string oldmm = ysmm.Text.Trim();
string newmm = xmm.Text.Trim();
//Eid1 = "E000000022";
//string strUpdate = "Update stu set stuName='李芳',XyDm='02',ZyDm='0201' where stuNum='091001'";
string strUpdate = "Update dl set paw='{0}' where Eid='{1}'";
string sql = string.Format(strUpdate, newmm, Session["CurrentValue"]);
myCom.CommandType = CommandType.Text;
myCom.CommandText = sql;
myCom.ExecuteNonQuery();
Response.Write("<Script Language=JavaScript>alert('数据库内容修改成功!!!') </Script>");
}
//Response.Write("<Script Language=JavaScript>if(confirm('数据库内容修改成功')){window.navigate('LiuyiDefault.aspx');} </Script>");
catch (Exception oe)
{ Response.Write("数据库操作失败" + oe);
}
finally
{
if (myCon != null)
{
myCon.Close();
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void qx_Click(object sender, EventArgs e)
{
RequiredFieldValidator1.Visible = false;
RequiredFieldValidator2.Visible = false;
RequiredFieldValidator3.Visible = false;
CompareValidator1.Visible = false;
xmm.Text = "";
zsr.Text = "";
ysmm.Text = "";
Response.Redirect("LiuyiDefault.aspx");
}
}
4.论文信息录入代码
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class lwsb : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 2000; i < 2014; i++)
this.DropDownList2.Items.Add(i.ToString());
for (int i = 1; i < 13; i++)
this.DropDownList3.Items.Add(i.ToString());
for (int i = 1; i <= 31; i++)
this.DropDownList4.Items.Add(i.ToString());
this.Label2.Visible = false; this.TextBox8.Visible = false; this.Label7.Visible = false; this.TextBox13.Visible = false;
this.Label3.Visible = false; this.TextBox9.Visible = false; this.Label8.Visible = false; this.TextBox14.Visible = false;
this.Label4.Visible = false; this.TextBox10.Visible = false; this.Label9.Visible = false; this.TextBox15.Visible = false;
this.Label5.Visible = false; this.TextBox11.Visible = false; this.Label10.Visible = false; this.TextBox16.Visible = false;
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedIndex == 1) { dfh1.Text = "lw_ l1"; }
if (DropDownList1.SelectedIndex == 2) { dfh1.Text = "lw_l4"; }
if (DropDownList1.SelectedIndex == 3) { dfh1.Text = "lw_l2"; }
if (DropDownList1.SelectedIndex == 0) { dfh1.Text = "lw_l3"; }
}
protected void Button2_Click(object sender, EventArgs e)
{
string cbsj = DropDownList2.Text + "/" + DropDownList3.Text + "/" + DropDownList4.Text;
string sqlconn = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
SqlConnection conn = new SqlConnection(sqlconn);
conn.Open();
//SqlCommand comm0 = new SqlCommand("select * from kylw where lwbh='" + lwbh.Text.Trim() + "'",conn);
//int j = comm0.ExecuteNonQuery();
//if (j == 0)
//{
string sfsl;
if (RadioButton1.Checked)
{ sfsl = "是"; }
else
{ sfsl = "否"; }
string strsql = "insert into LW(LWid,LWname,LWpublic,LWlx,rank,kan_no,LWtime,LWrecord)values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')";
string str = string.Format(strsql, TextBox1.Text.Trim(), TextBox2.Text.Trim(), TextBox4.Text.Trim(), DropDownList1.Text,dfh1.Text.Trim(), TextBox5.Text.Trim(), cbsj, sfsl);
SqlCommand comm1 = new SqlCommand(str, conn);
int n = Convert.ToInt32(TextBox6.Text.Trim());
string[] zzbh = new string[n - 1];
string[] fgh = new string[n - 1];
switch (n)
{
case 1:
zzbh = new string[1] { TextBox7.Text.Trim() };
fgh = new string[1] { TextBox12.Text.Trim() };
break;
case 2:
zzbh = new string[2] { TextBox7.Text.Trim(), TextBox8.Text.Trim() };
fgh = new string[2] { TextBox12.Text.Trim(), TextBox13.Text.Trim() };
break;
case 3:
zzbh = new string[3] { TextBox7.Text.Trim(), TextBox8.Text.Trim(), TextBox9.Text.Trim() };
fgh = new string[3] { TextBox12.Text.Trim(), TextBox13.Text.Trim(), TextBox14.Text.Trim() };
break;
case 4:
zzbh = new string[4] { TextBox7.Text.Trim(), TextBox8.Text.Trim(), TextBox9.Text.Trim(), TextBox10.Text.Trim() };
fgh = new string[4] { TextBox12.Text.Trim(), TextBox13.Text.Trim(), TextBox14.Text.Trim(), TextBox15.Text.Trim() };
break;
case 5:
zzbh = new string[5] { TextBox7.Text.Trim(), TextBox8.Text.Trim(), TextBox9.Text.Trim(), TextBox10.Text.Trim(), TextBox11.Text.Trim() };
fgh = new string[5] { TextBox12.Text.Trim(), TextBox13.Text.Trim(), TextBox14.Text.Trim(), TextBox15.Text.Trim(), TextBox16.Text.Trim() };
break;
default:
Response.Write("请?输º?入¨?人¨?数ºy!ê?");
break;
}
comm1.ExecuteNonQuery();
string str2 = "insert into zx(LWid,Eid,fgpx)values('{0}','{1}','{2}')";
for (int i = 0; i < n; i++)
{
string sql = string.Format(str2, TextBox1.Text.Trim(), zzbh[i].ToString(), fgh[i].ToString());
SqlCommand comm2 = new SqlCommand(sql, conn);
comm2.ExecuteNonQuery();
//SqlParameter input = mycomm.Parameters.Add("@zgbh", SqlDbType.VarChar);
//input.Direction = ParameterDirection.Input;
//input.Value = zzbh[i].ToString().Trim();
//SqlParameter input1 = mycomm.Parameters.Add("@lwbh", SqlDbType.Char);
//input1.Direction = ParameterDirection.Input;
//input1.Value = lwbh.Text.Trim();
//SqlParameter input2 = mycomm.Parameters.Add("@rens", SqlDbType.Int);
//input2.Direction = ParameterDirection.Input;
//input2.Value = n;
//mycomm.ExecuteNonQuery();
//mycomm.Parameters.Clear();
}
conn.Close();
Response.Write("<Script language='javascript'> alert('已°?提¬¨¢交?!ê?');</script>");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox4.Text = "";
TextBox5.Text = ""
RadioButton1.Text = "";
RadioButton2.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox8.Text = "";
TextBox9.Text = ""; TextBox10.Text = ""; TextBox11.Text = "";
//Response.Write(j);
}
protected void TextBox6_TextChanged(object sender, EventArgs e)
{
string str = TextBox6.Text.Trim();
int rs = Convert.ToInt32(str);
if (rs == 1)
{
Label1.Visible= true; TextBox7.Visible = true; Label6.Visible = true; TextBox12.Visible = true;
Label2.Visible = false; TextBox8.Visible = false; Label7.Visible = false; TextBox13.Visible= false;
Label3.Visible = false; TextBox9.Visible = false; Label8.Visible = false; TextBox14.Visible = false;
Label4.Visible = false; TextBox10.Visible = false; Label9.Visible= false; TextBox15.Visible = false;
Label5.Visible = false; TextBox11.Visible = false; Label10.Visible= false; TextBox16.Visible= false;
}
if (rs == 2)
{
Label1.Visible = true; TextBox7.Visible = true; Label6.Visible = true; TextBox12.Visible = true;
Label2.Visible = true; TextBox8.Visible = true; Label7.Visible = true; TextBox13.Visible = true;
Label3.Visible = false; TextBox9.Visible = false; Label8.Visible = false; TextBox14.Visible = false;
Label4.Visible = false; TextBox10.Visible = false; Label9.Visible = false; TextBox15.Visible = false;
Label5.Visible = false; TextBox11.Visible = false; Label10.Visible = false;TextBox16.Visible = false;
}
if (rs == 3)
{
Label1.Visible = true; TextBox7.Visible = true; Label6.Visible = true; TextBox12.Visible = true;
Label2.Visible = true; TextBox8.Visible = true; Label7.Visible = true; TextBox13.Visible = true;
Label3.Visible = true; TextBox9.Visible = true; Label8.Visible = true; TextBox14.Visible = true;
Label4.Visible = false; TextBox10.Visible = false; Label9.Visible = false; TextBox15.Visible = false;
Label5.Visible = false; TextBox11.Visible = false; Label10.Visible = false;TextBox16.Visible = false;
}
if (rs == 4)
{
Label1.Visible = true; TextBox7.Visible = true; Label6.Visible = true; TextBox12.Visible = true;
Label2.Visible = true; TextBox8.Visible = true; Label7.Visible = true; TextBox13.Visible = true;
Label3.Visible = true; TextBox9.Visible = true; Label8.Visible = true; TextBox14.Visible = true;
Label4.Visible = true; TextBox10.Visible = true; Label9.Visible = true; TextBox15.Visible = true;
Label5.Visible = false; TextBox11.Visible = false;Label10.Visible = false; TextBox16.Visible = false;
}
if (rs == 5)
{
Label1.Visible = true; TextBox7.Visible = true; Label6.Visible = true; TextBox12.Visible = true;
Label2.Visible = true; TextBox8.Visible = true; Label7.Visible = true; TextBox13.Visible = true;
Label3.Visible = true; TextBox9.Visible = true; Label8.Visible = true; TextBox14.Visible = true;
Label4.Visible = true; TextBox10.Visible = true; Label9.Visible = true; TextBox15.Visible = true;
Label5.Visible = true; TextBox11.Visible = true;Label10.Visible = true;TextBox16.Visible = true;
}
}
5.个人信息查询代码(以论文为例)
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 Epselect_lw : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//定义要使用的对象
SqlConnection myConnection = null;
SqlCommand myCommand = null;
SqlDataReader myReader = null;
SqlParameter parInput = null;
try
{
String sqlconn = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
myConnection = new SqlConnection(sqlconn);
myConnection.Open();
myCommand = new SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.StoredProcedure;
//up_InsertData为存储过程的名字
myCommand.CommandText = "select_EplwQK";
parInput = myCommand.Parameters.Add("@j_id",SqlDbType.VarChar);
parInput.Direction = ParameterDirection.Input;
//传值错误????????????????????
parInput.Value = Session["CurrentValue"];
//把存储过程执行的结果保存到SqlDataReader
myReader = myCommand.ExecuteReader();
//获取数据之前,必须不断的调用Read方法,它负责前进到下一条记录.
Response.Write("<table border=1 cellspacing=0 cellpadding=2>");
//显示列名字
Response.Write("<tr bgcolor=#DAB4B4>");
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader.GetName(i) + "</td>");
}
Response.Write("</tr>");
//输出所有的字段值
while (myReader.Read())
{
Response.Write("<tr>");
//打印取到的数据
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader[i].ToString() + "</td>");
}
Response.Write("</tr>");
}
Response.Write("</table>");
}
catch (Exception oe)
{
//如果出错的处理语句
Response.Write("数据库操作失败" + oe);
}
finally
{
if (myReader != null)
{
myReader.Close();
}
if (myConnection != null)
{
myConnection.Close();
}
6.按时间检索各科研项目详细情况代码,有得分(以著作为代表):
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 timeSelectZZ1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 2000; i < 2013; i++)
DropDownList1.Items.Add(i.ToString());
for (int i = 1; i <= 12; i++)
DropDownList2.Items.Add(i.ToString());
for (int i = 1; i <= 31; i++)
DropDownList3.Items.Add(i.ToString());
for (int i = 2000; i < 2013; i++)
DropDownList4.Items.Add(i.ToString());
for (int i = 1; i <= 12; i++)
DropDownList5.Items.Add(i.ToString());
for (int i = 1; i <= 31; i++)
DropDownList6.Items.Add(i.ToString());
}
protected void Button1_Click(object sender, EventArgs e)
{
Label2.Text = DropDownList1.Text + "年" + DropDownList2.Text + "月" + DropDownList3.Text + "日";
Label3.Text = DropDownList4.Text + "年" + DropDownList5.Text + "月" + DropDownList6.Text + "日";
String sqlconn = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
SqlConnection myConnection = new SqlConnection(sqlconn);
//打开数据库连接
myConnection.Open();
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.CommandText = "time_select_Epzz";
//myCommand.Parameters.Add("@type", SqlDbType.datatime);
SqlParameter parInput = myCommand.Parameters.Add("@time1", SqlDbType.DateTime);
parInput.Direction = ParameterDirection.Input;
parInput.Value = Convert.ToDateTime(DropDownList1.Text + "/" + DropDownList2.Text + "/" + DropDownList3.Text);
SqlParameter parInput2 = myCommand.Parameters.Add("@time2", SqlDbType.DateTime);
parInput2.Direction = ParameterDirection.Input;
parInput2.Value = Convert.ToDateTime(DropDownList4.Text + "/" + DropDownList5.Text + "/" + DropDownList6.Text);
//把存储过程执行的结果保存到SqlDataReader
SqlDataReader myReader = myCommand.ExecuteReader();
//Response.Write("<h3>使用存储过程查询数据</h3><hr>");
Response.Write("<table border=1 cellspacing=0 cellpadding=2>");
Response.Write("<tr bgcolor=#DAB4B4>");
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader.GetName(i) + "</td>");
}
Response.Write("</tr>");
while (myReader.Read())
{
Response.Write("<tr>");
//打印取到的数据
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader[i].ToString() + "</td>");
}
Response.Write("</tr>");
}
Response.Write("</table>");
//关闭SqlDataReader
myReader.Close();
myConnection.Close();
7、按各项科研项目检索,有得分(以专利为代表);
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 zljs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand myCommand = null;
if (TextBox1.Text != null) { string lwid = TextBox1.Text.Trim(); }
//连接字符串
String sqlconn = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
SqlConnection myConnection = new SqlConnection(sqlconn);
//打开数据库连接http://localhost:2594/keyan/keyan.sln
myConnection.Open();
if (TextBox1.Text != null)
{
myCommand = new SqlCommand("select * from E_zlQK where ZLid='" + TextBox1.Text.Trim() + "'", myConnection);
}
else
{
myCommand = new SqlCommand("select * from E_zlQK where ", myConnection);
}
SqlDataReader myReader;
myReader = myCommand.ExecuteReader();
//Response.Write("<h3>使用OleDbCommand类读取数据</h3><hr>");
Response.Write("<table border=1 cellspacing=0 cellpadding=2>");
//显示列名字
Response.Write("<tr bgcolor=#DAB4B4>");
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader.GetName(i) + "</td>");
}
Response.Write("</tr>");
//输出所有的字段值
while (myReader.Read())
{
Response.Write("<tr>");
//打印取到的数据
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader[i].ToString() + "</td>");
}
Response.Write("</tr>");
}
Response.Write("</table>");
//关闭SqlDataReader
myReader.Close();
//关闭与数据库的连接
myConnection.Close();
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.DropDownList1.SelectedIndex == 0 )
{
TextBox1.Enabled = true;
}
else { TextBox1.Enabled = false; }
}
}
8、 各单位各项目总得分(系或部门为代表):
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 Sallgrade : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//连接字符串
String sqlconn = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
SqlConnection myConnection = new SqlConnection(sqlconn);
//打开数据库连接
myConnection.Open();
SqlCommand myCommand = new SqlCommand("select * from Section_Sumgrade", myConnection);
SqlDataReader myReader;
myReader = myCommand.ExecuteReader();
//Response.Write("<h3>使用OleDbCommand类读取数据</h3><hr>");
Response.Write("<table border=1 cellspacing=0 cellpadding=2>");
//显示列名字
Response.Write("<tr bgcolor=#DAB4B4>");
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader.GetName(i) + "</td>");
}
Response.Write("</tr>");
//输出所有的字段值
while (myReader.Read())
{
Response.Write("<tr>");
for (int i = 0; i < myReader.FieldCount; i++)
{
Response.Write("<td>" + myReader[i].ToString() + "</td>");
}
Response.Write("</tr>");
}
Response.Write("</table>");
//关闭SqlDataReader
myReader.Close();
myConnection.Close();
}
}
9、评分规则管理代码(以课题鉴定为代表):
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 PFgzjd : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection myCon = null;
SqlCommand myCom = null;
try
{
string myConStr = "Data Source=S-PC;Initial Catalog=KYGLSystem;User ID=sa;password=sa";
myCon = new SqlConnection(myConStr);
myCon.Open();
//在连接的基础上建立SqlCommand命令对象,
myCom = new SqlCommand();
myCom.Connection = myCon;
string jddj1 = DropDownList1.Text.Trim();
string jdgrade1 = TextBox1.Text.Trim();
//string strUpdate = "Update stu set stuName='李芳',XyDm='02',ZyDm='0201' where stuNum='091001'";
//改寻该语句
string strUpdate = "Update JDcgdj set JDgrade='{0}' where JDdj='{1}'";
//将变量的内容加入到Update语句中相应的位置。
string sql = string.Format(strUpdate, jdgrade1, jddj1);
myCom.CommandType = CommandType.Text;
myCom.CommandText = sql;
myCom.ExecuteNonQuery();
Response.Write("<Script Language=JavaScript>alert('评分规则修改成功!!!') </Script>");
TextBox1.Text = "";
}
catch (Exception oe)
{
}
finally
{
if (myCon != null)
{
myCon.Close();
}
}//try 结束
}
protected void Button2_Click(object sender, EventArgs e)
{
//定义要使用的对象
SqlConnection myCon = null;
SqlCommand myCom = null;
//SqlDataAdapter myDr = null;
//DataSet myDs = null;
try
{
string myConStr = "Data Source=WIN-20121014EZU;Initial Catalog=KYGLSystem;Persist Security Info=True;User ID=sa;password=sasa";
myCon = new SqlConnection(myConStr);
myCon.Open();
//在连接的基础上建立SqlCommand命令对象,
//myCom = new SqlCommand();
//myCom.Connection = myCon;
//告诉命令对象做什么
//string sql = "select stuName,stuNum,XyDm,ZyDm from stu where stuNum='091001'";
string sql = "select JDgrade from JDcgdj where JDdj='" + DropDownList1.Text + "'";
myCom = new SqlCommand(sql, myCon);
//myCom.CommandType = CommandType.Text;
//myCom.CommandText = sql;
SqlDataReader result = myCom.ExecuteReader();
if (result.Read())
{
TextBox1.Text = result["JDgrade"].ToString();
}
//myDr = new SqlDataAdapter();
//myDr.SelectCommand = myCom;
//myDs = new DataSet();
//myDr.Fill(myDs, "DS_stu");
//dataGridView1.DataSource = myDs.Tables["Ds_stu"].DefaultView;
//Response.Write("数据库内容查询成功");
}
catch (Exception oe)
{
//如果出错的处理语句
Response.Write("数据库操作失败" + oe);
}
finally
{
if (myCon != null)
{
myCon.Close();
}
}//try 结束
}
}
10、 退出系统代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class exit : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("<Script Language=JavaScript>if(confirm('提示信息(YES或NO)?')){window.navigate('dl.aspx');} </Script>");
Response.Write("<Script Language=JavaScript>window.navigate('LiuyiDefault.aspx');</Script>");
东莞理工学院《C语言程序设计》课程设计题目:图书信息管理系统院系:电子工程学院专业:电子信息工程年级:20##班别:2班指导教师:…
C语言程序设计课程设计学生姓名学号系院专业设计论文题目学生选课系统管理完成日期20xx年6月指导教师目录一实验目的二实验内容三总体…
河南理工大学计算机科学与技术学院课程设计报告20XX20XX学年第一学期课程名称C语言课程设计设计题目《小学算术运算测试》学生姓名…
C语言课程设计报告设计题目专业班级学号姓名任课老师时间目录一课程设计题目及所涉及知识点二课程设计思路及设计流程图三课程设计中遇到的…
C语言程序设计课程设计报告20xx20xx学年第1学期题目专业班级姓名学号指导教师成绩计算机科学与技术系20xx年12月31日目录…
广州航海高等专科学校课程设计实训报告课程ASPNET程序设计基础与实训教程题目网络课程生成系统专业计算机应用技术指导教师王琢成绩班…
模拟电子技术课程设计报告设计题目专业电子信息科学与技术班级电信092学号20xx16022230学生姓名夏惜指导教师王瑞设计时间2…
电力牵引供电系统课程设计专业电气工程及其自动化班级电气1004姓名王英帅学号20xx09341指导教师于晓英兰州交通大学自动化与电…
武汉理工大学集成直流稳压源的设计课程设计任务书工作单位信息工程学院题目集成直流稳压源的设计初始条件副边电压15V功率20W的变压器…
模拟电子技术课程设计报告设计题目直流稳压电源设计专业电气工程班级学号学生姓名指导教师设计时间20xx20xx学年上学期教师评分20…