学生学籍管理系统代码

上传人:飞*** 文档编号:30660120 上传时间:2018-01-31 格式:DOC 页数:77 大小:2.69MB
返回 下载 相关 举报
学生学籍管理系统代码_第1页
第1页 / 共77页
学生学籍管理系统代码_第2页
第2页 / 共77页
学生学籍管理系统代码_第3页
第3页 / 共77页
学生学籍管理系统代码_第4页
第4页 / 共77页
学生学籍管理系统代码_第5页
第5页 / 共77页
点击查看更多>>
资源描述

《学生学籍管理系统代码》由会员分享,可在线阅读,更多相关《学生学籍管理系统代码(77页珍藏版)》请在金锄头文库上搜索。

1、学生学籍管理系统详细代码本文为学生学籍管理系统的各个模块效果图和详细代码;登录模块:登录模块代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace StuIFMSpublic partial class Form1 : Formpublic Color temp;/存储临时的按

2、钮颜色public Form1()InitializeComponent();private void button3_Click(object sender, EventArgs e)Application.Exit();public User CurrentUser;private void button2_Click(object sender, EventArgs e) MessageBox.Show(学生/教师用自己的学号/教师编号登录!,如过没有注册则点击“注册”进行注册!, 提示);private void button1_Click(object sender, EventAr

3、gs e)bool UserExit = false, KeyRight = false;/声明上下文集合DataClasses1DataContext myDataContext = new DataClasses1DataContext();/把用户表里所有内容提取到 User 集合里/排查输入错误/用户名为空if (textBox1.Text = )MessageBox.Show(用户名不能为空!, 提示);/用户名不为空else/密码为空if (textBox2.Text = )MessageBox.Show(密码不能为空, 提示);/密码不为空else/学生身份登录if (radio

4、Button1.Checked=true)var User = from user in myDataContext.UsersTablewhere user.Identity = 学生select user;foreach (var stu in User)if (stu.UerID = textBox1.Text)UserExit = true;if (stu.Password = textBox2.Text)KeyRight = true;CurrentUser = new User(textBox1.Text, textBox2.Text, radioButton1.Text); if

5、 (UserExit = false)MessageBox.Show(用户名不存在!);elseif (KeyRight = false)MessageBox.Show(密码错误!);else/MessageBox.Show(登录成功);MainForm fm = new MainForm(CurrentUser);fm.FormClosed += new FormClosedEventHandler(fm_FormClosed);this.Hide();fm.Initial(CurrentUser,0);fm.Show();/教师登录elsevar User1 = from teacher

6、in myDataContext.UsersTablewhere teacher.Identity = 教师select teacher;foreach (var teac in User1)if (teac.UerID = textBox1.Text)UserExit = true;if (teac.Password = textBox2.Text)KeyRight = true;/记录登录用户用户名身份信息CurrentUser = new User(textBox1.Text, textBox2.Text, radioButton2.Text);if (UserExit = false)

7、MessageBox.Show(用户名不存在);elseif (KeyRight = false)MessageBox.Show(密码错误); else/登录教师界面/MessageBox.Show(登录成功!);MainForm fm = new MainForm(CurrentUser);fm.Initial(CurrentUser,1);this.Hide();fm.Show();void fm_FormClosed(object sender, FormClosedEventArgs e)this.Close();/注册按钮实现private void button4_Click(ob

8、ject sender, EventArgs e)LogForm fm = new LogForm();fm.ShowDialog();/鼠标进去按钮事件private void button1_MouseEnter(object sender, EventArgs e)temp = button1.BackColor;button1.BackColor = System.Drawing.Color.Pink;/鼠标离开按钮的事件private void button1_MouseLeave(object sender, EventArgs e)button1.BackColor = temp

9、;private void button3_MouseEnter(object sender, EventArgs e)temp = button3.BackColor;button3.BackColor = System.Drawing.Color.Pink;/鼠标离开事件 private void button3_MouseLeave(object sender, EventArgs e)button3.BackColor = temp;private void button4_MouseEnter(object sender, EventArgs e)temp = button4.Bac

10、kColor;button4.BackColor = Color.Orange;private void button4_MouseLeave(object sender, EventArgs e)button4.BackColor = temp;private void button2_MouseEnter(object sender, EventArgs e)temp = button2.BackColor;button2.BackColor = Color.Pink;private void button2_MouseLeave(object sender, EventArgs e)bu

11、tton2.BackColor = temp;注册模块代码:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace StuIFMSpublic partial class LogForm : Formpublic LogForm()InitializeComponent();p

12、rivate void textBox1_TextChanged(object sender, EventArgs e)checkBox1.Checked = false;textBox2.Enabled = false;bool isRegeisted=false;/帐号是否被注册标记bool isexited=false;/帐号是否存在标记/提取出用户数据表里所有用户资料DataClasses1DataContext myDataContext = new DataClasses1DataContext(); var UsersQuery = from User in myDataCont

13、ext.UsersTableselect User;/文本数据发生变化时候,检查输入是否可以申请/学生身份申请帐号if (radioButton1.Checked = true)/在用户表里检查该学生帐号是否被注册了foreach (var user in UsersQuery)/学生用户帐号已经被注册if (user.UerID = textBox1.Text & user.Identity = radioButton1.Text)isRegeisted = true;/检出该学号被注册了if (isRegeisted = true)checkBox1.Text = 已注册的号码;/Mess

14、ageBox.Show(该学号已经被注册了!);/帐号没有被注册 ,在学生表里检查该学号存在与否elseDataClasses2DataContext myDataContext2 = new DataClasses2DataContext();/从学生表里提取所有数据var StuQuery = from Stud in myDataContext2.StudentsTableselect Stud;foreach (var stu in StuQuery)/学号被找到了,说明该学号存在且没有被注册,可以注册该学号if (stu.StudentN = textBox1.Text)isexit

15、ed = true;if (isexited = false)/MessageBox.Show(该学号不存在!);checkBox1.Text = 不存在的学号;else/checkBox1 打勾,说明可用checkBox1.Checked = true;checkBox1.Text = ;textBox2.Enabled = true; /教师注册else/检查用户表看帐号有没有被注册foreach (var user in UsersQuery)/教师帐号已经被注册了if (textBox1.Text = user.UerID & radioButton2.Text = user.Identity)isRegeisted = true;/被注册的处理if (isRegeisted = true)checkBox1.Text = 帐号被注册;else/未被注册的帐号,到教师信息表里查找该教师编号是否存在DataClasses3DataContext TeacherDataContext = new DataClasses3DataContext();/取出教师

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号