C#程序设计作业学生管理系统(带系统初始化)主界面usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespaceSIMS{publicpartialclassMain:Form{publicstringid;publicMain(){InitializeComponent();}privatevoidMain_Load(objectsender,EventArgse){Loginlogin=newLogin(this);login.MdiParent=this;login.Show();}privatevoid退出系统ToolStripMenuItem_Click(objectsender,EventArgse){MessageBoxButtonsmessButton=MessageBoxButtons.OKCancel;DialogResultdr=MessageBox.Show(确定要退出吗?,退出系统,messButton);if(dr==DialogResult.OK)//如果点击“确定”按钮{this.Close();}else//如果点击“取消”按钮{}}privatevoid用户管理ToolStripMenuItem_Click(objectsender,EventArgse){usermanagermentum=newusermanagerment();um.MdiParent=this;um.Show();}privatevoid修改密码ToolStripMenuItem_Click(objectsender,EventArgse){frmAlterPWDalpwd=newfrmAlterPWD(this);alpwd.MdiParent=this;alpwd.Show();}privatevoid系统初始化ToolStripMenuItem_Click(objectsender,EventArgse){MessageBoxButtonsmessButton=MessageBoxButtons.OKCancel;DialogResultdr=MessageBox.Show(确定要系统初始化吗?,系统初始化,messButton);if(dr==DialogResult.OK)//如果点击“确定”按钮{MessageBox.Show(asd);}else//如果点击“取消”按钮{}}privatevoid添加学籍ToolStripMenuItem_Click(objectsender,EventArgse){ViewStuvstu=newViewStu();vstu.MdiParent=this;vstu.Show();}privatevoid添加学籍信息ToolStripMenuItem_Click(objectsender,EventArgse){frmAddstufastu=newfrmAddstu();fastu.MdiParent=this;fastu.Show();}privatevoid查询学籍信息ToolStripMenuItem_Click(objectsender,EventArgse){frmQuerystufqstu=newfrmQuerystu();fqstu.MdiParent=this;fqstu.Show();}privatevoid重新登录ToolStripMenuItem_Click(objectsender,EventArgse){Login2login=newLogin2(this);login.MdiParent=this;login.Show();}privatevoid浏览班级信息ToolStripMenuItem_Click(objectsender,EventArgse){ViewClassvclass=newViewClass();vclass.MdiParent=this;vclass.Show();}privatevoid添加班级信息ToolStripMenuItem_Click(objectsender,EventArgse){frmAddclassfaclass=newfrmAddclass();faclass.MdiParent=this;faclass.Show();}privatevoid查询班级信息ToolStripMenuItem_Click(objectsender,EventArgse){frmQueryclassfqclass=newfrmQueryclass();fqclass.MdiParent=this;fqclass.Show();}privatevoid添加课程信息ToolStripMenuItem_Click(objectsender,EventArgse){frmAddcoursefacou=newfrmAddcourse();facou.MdiParent=this;facou.Show();}privatevoid浏览课程信息ToolStripMenuItem_Click(objectsender,EventArgse){ViewCoursevcourse=newViewCourse();vcourse.MdiParent=this;vcourse.Show();}privatevoid查询课程信息ToolStripMenuItem_Click(objectsender,EventArgse){frmQuerycoursefqcou=newfrmQuerycourse();fqcou.MdiParent=this;fqcou.Show();}privatevoid设置年级课程ToolStripMenuItem_Click(objectsender,EventArgse){frmGradeCoursefgcou=newfrmGradeCourse();fgcou.MdiParent=this;fgcou.Show();}privatevoid浏览成绩信息ToolStripMenuItem_Click(objectsender,EventArgse){ViewScorevscore=newViewScore();vscore.MdiParent=this;vscore.Show();}privatevoid添加成绩信息ToolStripMenuItem_Click(objectsender,EventArgse){frmAddscorefascore=newfrmAddscore();fascore.MdiParent=this;fascore.Show();}privatevoid修改成绩信息ToolStripMenuItem_Click(objectsender,EventArgse){frmQueryscorefqscore=newfrmQueryscore();fqscore.MdiParent=this;fqscore.Show();}privatevoid关于系统ToolStripMenuItem_Click(objectsender,EventArgse){Aboutabout=newAbout();about.MdiParent=this;about.Show();}privatevoid登录日志ToolStripMenuItem_Click(objectsender,EventArgse){LoginLogllog=newLoginLog();llog.MdiParent=this;llog.Show();}}}登录usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespaceSIMS{publicpartialclassLogin:Form{Mainxx;inti=3;publicLogin(Mainyy){InitializeComponent();xx=yy;}privatevoidOKLogin_Click(objectsender,EventArgse){stringconstr=IntegratedSecurity=SSPI;PersistSecurityInfo=False;InitialCatalog=SIMS;DataSource=localhost;SqlConnectioncon=newSqlConnection(constr);con.Open();stringsqlstr=select*fromUSERINFOwhereUSERID='+LoginUser.Text+'andUSERPWD='+LoginPWD.Text+';SqlCommandcmd=newSqlCommand(sqlstr,con);stringstr=selectUSERDESfromUSERINFOwhereUSERID='+LoginUser.Text+';SqlDataAdapterusersql=newSqlDataAdapter(str,con);DataTableuserdes=newDataTable();usersql.Fill(userdes);stringstrinto=insertintoLtime(userid,logintime)values('+LoginUser.Text+','+DateTime.Now.ToString(yyyy-MM-ddhh:mm:ss)+');SqlCommandcmdin=newSqlCommand(strinto,con);try{if(i0){if(cmd.ExecuteScalar()!=null){MessageBox.Show(登录成功);xx.id=LoginUser.Text.ToString();if(userdes.Rows[0][0].ToString()==admin){xx.用户管理ToolStripMenuItem.Enabled=true;xx.登录日志ToolStripMenuItem.Enabled=true;xx.学籍管理ToolStripMenuItem.Enabled=true;xx.添加学籍ToolStripMenuItem.Enabled=true;xx.添加学籍信息ToolStripMenuItem.Enabled=true;xx.课程管理ToolStripMenuItem.Enabled=true;xx.添加课程信息ToolStripMenuItem.Enabled=true;xx.浏览课程信息ToolStripMenuItem.Enabled=true;xx.成绩管理ToolStripMenuItem.Enabled=true;xx.浏览成绩信息ToolStripMenuItem.Enabled=true;xx.添加成绩信息ToolStripMenuItem.Enabled=true;xx.班级管理ToolStripMenuItem.Enabled=true;xx.添加班级信息ToolStripMenuItem.Enabled=true;xx.浏览班级信息ToolStripMenuItem.Enabled