文档介绍:学生学籍管理系统详细代码
本文为学生学籍管理系统的各个模块效果图和详细代码;
登录模块:
登录模块代码:
using System;
using ;
using ponentModel;
using ;
using ;
using ;
using ;
using ;
namespace StuIFMS
{
public partial class Form1 : Form
{
public Color temp;//存储临时的按钮颜色
public Form1()
{
ponent();
}
private void button3_Click(object sender, EventArgs e)
{
();
}
public User CurrentUser;
private void button2_Click(object sender, EventArgs e)
{
("学生/教师用自己的学号/教师编号登录!,如过没有注册则点击“注册”进行注册!", "提示");
}
private void button1_Click(object sender, EventArgs e)
{
bool UserExit = false, KeyRight = false;
//声明上下文集合
DataClasses1DataContext myDataContext = new DataClasses1DataContext();
//把用户表里所有内容提取到User集合里
//排查输入错误
//用户名为空
if ( == "")
("用户名不能为空!", "提示");
//用户名不为空
else
{
//密码为空
if ( == "")
("密码不能为空", "提示");
//密码不为空
else
{
//学生身份登录
if (==true)
{
var User = from user in
where == "学生"
select user;
foreach (var stu in User)
{
if ( == )
{
UserExit = true;
if ( == )
{
KeyRight = true;
CurrentUser = new User(, , );
}
}
}
if (UserExit == false)
("用户名不存在!");
else
{
if (KeyRight == false)
("密码错误!");
else
{
//("登录成功");
MainForm fm = new MainForm(CurrentUser);
+= new FormClosedEventHandler(fm_FormClosed);
();
(CurrentUser,0);
();
}
}
}
//教师登录
else
{
var User1 = from teacher in
where == "教师"
select teacher;
foreach (var teac in User1)
{
if ( == )
{
UserExit = true;
if ( == )
{