导师制双选系统

综合应用算法训练

任务说明

设计一个用于软件工程系本科导师制双选的系统。

设计要求:

(1) 实现学生信息管理,支持信息更新;

(2) 实现教师信息管理,支持信息更新;

(3) 实现学生填写导师志愿的过程,并提供当前导师的选择情况;

(4) 实现基于规则的志愿调整过程;

(5) 实现导师的学生筛选过程;

(6) 实现各种信息的多类查询。

实验环境及实验准备

C#编程语言

系统分析与设计

此部分包括软件程序的需求分析与软件设计部分,最好图文并茂。

(1)需求分析

参照实验要求,实现调用数据库进行信息显示,导师学生互选,更新互选结果,管理员更改教师、学生信息,查询双选结果,调整志愿。

(2)软件设计

数据库:教师表、学生表、管理员表

登录:点选教师/学生/管理员登录,输入正确用户名(教师号、学号)和密码成功登录。

教师:

默认可带5个学生。

邀请学生:列表显示未分配的学生信息,可选。若学生未达上限,即向选中的学生发出邀请,等待学生处理。学生将收到老师的基本信息和教学经历等内容。

处理学生申请:若收到来自学生的申请,可选择同意或拒绝。

刷新:更新显示信息

学生:

只能有一位导师。

修改个人简介:点击在文本框中输入要更改的内容,保存修改个人简介。

申请导师:若无导师,可在选择申请导师,向导师发送申请,等待老师处理。导师将收到学生的基本信息和个人简介。

处理导师邀请:若收到邀请,进入处理界面查看邀请信息,同意或拒绝邀请。

刷新:刷新显示信息

管理员:

进行教师表、学生表、双选表的增删改查。并将结果导出到.xls文件

说明本程序中用到的所有数据结构及数据类型的定义、主程序的流程以及各程序模块之间的调用关系图。

软件源代码

Form1 登录

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;

using System.Data.SqlClient;

namespace daoshizhi

{

public partial class Form1 : Form

{

public static string welcome = "";

public static string no = "";

SqlConnection conn = new SqlConnection("server=.;database=tutorManagement;uid=sa;pwd=sa");

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

conn.Open();

string username = textBox1.Text.Trim();

string userpwd = textBox2.Text.Trim();

if (username == "" || userpwd == "")

{

label2.Text = "用?户§名?或ò密ü码?不?能ü为a空?!";

}

else

{

string s1 = "select * from tutor where tno=‘" + username + "‘ and pwd=‘" + userpwd + "‘";

string s2 = "select * from student where sno=‘" + username + "‘ and pwd=‘" + userpwd + "‘";

string s3 = "select * from manager where mno=‘" + username + "‘ and pwd=‘" + userpwd + "‘";

if (radioButton1.Checked)

{

SqlCommand s01 = new SqlCommand(s1, conn);

SqlDataReader t = s01.ExecuteReader();

if (t.Read())

{

conn.Close();

SqlDataAdapter s11 = new SqlDataAdapter(s1, conn);

DataSet ds = new DataSet();

conn.Open();

s11.Fill(ds, "tutor");

welcome=ds.Tables["tutor"].Rows[0]["tname"].ToString();

no= ds.Tables["tutor"].Rows[0]["tno"].ToString();

Form Form2 = new Form2();

Form2.Show();

this.Hide();

}

else label2.Text = "用?户§名?或ò密ü码?错洙?误ó!";

}

else if (radioButton2.Checked)

{

SqlCommand s02 = new SqlCommand(s2, conn);

SqlDataReader t = s02.ExecuteReader();

if (t.Read())

{

conn.Close();

SqlDataAdapter s22 = new SqlDataAdapter(s2, conn);

DataSet ds = new DataSet();

conn.Open();

s22.Fill(ds, "student");

welcome = ds.Tables["student"].Rows[0]["name"].ToString();

no = ds.Tables["student"].Rows[0]["sno"].ToString();

Form Form3 = new Form3();

Form3.Show();

this.Hide();

}

else label2.Text = "用?户§名?或ò密ü码?错洙?误ó!";

}

else

{

SqlCommand s03 = new SqlCommand(s3, conn);

SqlDataReader t = s03.ExecuteReader();

if (t.Read())

{

Form Form4 = new Form4();

Form4.Show();

this.Hide();

}

else label2.Text = "用?户§名?或ò密ü码?错洙?误ó!";

}

}

conn.Close();

}

Form2 教师界面

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;

using System.Data.SqlClient;

namespace daoshizhi

{

public partial class Form2 : Form

{

public static string welcome =Form1.welcome;

public static string no = Form1.no;

SqlConnection conn = new SqlConnection("server=.;database=tutorManagement;uid=sa;pwd=sa");

public static int k;

public Form2()

{

InitializeComponent();

label1.Text = "欢?迎?,?"+welcome+"老?师簗!?";

/*显?示?我ò的?学§生Θ?/

conn.Open();

string s = "select * from student where tno=‘"+no+"‘";

SqlCommand a = new SqlCommand(s,conn);

SqlDataReader dr = a.ExecuteReader();

while (dr.Read())

{

listBox1.Items.Add(string.Format("{0}   {1}   {2}   {3}", dr[0], dr[1],dr[2],dr[3]));

}

dr.Close();

/*显?示?待鋣分?配?学§生Θ?/

string s2 = "select sno,name,sex,message from student where tno is NULL";

SqlCommand b = new SqlCommand(s2,conn);

SqlDataReader dr2 = b.ExecuteReader();

while (dr2.Read())

{

listBox2.Items.Add(string.Format("{0}    {1}    {2}   {3}", dr2[0], dr2[1], dr2[2], dr2[3]));

comboBox1.Items.Add(dr2[0]);

}

dr2.Close();

conn.Close();

/*显?示?学§生Θ?邀?请?*/

conn.Open();

string s3 = "select count(sno) from student where selectno=‘" + no + "‘";

SqlCommand c = new SqlCommand(s3, conn);

SqlDataReader dr3 = c.ExecuteReader();

if (dr3.Read())

{

conn.Close();

conn.Open();

SqlDataAdapter da1 = new SqlDataAdapter(s3, conn);

DataSet ds = new DataSet();

da1.Fill(ds, "学§生Θ?邀?请?人?数簓");

string s4 = ds.Tables["学§生Θ?邀?请?人?数簓"].Rows[0][0].ToString();

k = Int32.Parse(s4);

linkLabel2.Text = "收?到?" + s4 + "个?学§生Θ?申Θ?请?";

}

dr3.Close();

conn.Close();

}

private void panel1_Paint(object sender, PaintEventArgs e)

{

}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

{

this.Close();

Form1 f1 = new Form1();

f1.Show();

}

private void Form2_Load(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

//邀?请?学§生Θ?

if (comboBox1.SelectedIndex == -1) { MessageBox.Show("未′选?中D任?何?项?!?"); return; }

/*计?算?已?选?和í正y在ú邀?请?的?学§生Θ?总哩?人?数簓,?不?能ü超?过y 5*/

string m,n;

int x=0,y=0;

string s1 = "select count(*) from student where tno=‘" + no + "‘ group by tno";

string s2 = "select count(*) from student where tnoselect=‘" + no + "‘ group by tnoselect";

conn.Open();

SqlCommand a = new SqlCommand(s1, conn);

SqlDataReader dr1 = a.ExecuteReader();

DataSet ds = new DataSet();

if (dr1.Read())

{

conn.Close();

conn.Open();

SqlDataAdapter da = new SqlDataAdapter(s1, conn);

da.Fill(ds, "selected");

m = ds.Tables["selected"].Rows[0][0].ToString();

x = Int32.Parse(m);

}

conn.Close();

conn.Open();

SqlCommand b = new SqlCommand(s2, conn);

SqlDataReader dr2 = b.ExecuteReader();

if (dr2.Read())

{

conn.Close();

conn.Open();

SqlDataAdapter da1 = new SqlDataAdapter(s1, conn);

da1.Fill(ds, "selecting");

n = ds.Tables["selecting"].Rows[0][0].ToString();

y = Int32.Parse(n);

}

conn.Close();

if (x + y > 4)

{ MessageBox.Show("人?数簓将?超?过y最?大洙?限T制? 5!?"); return; }

else

{

//将?选?择?结á果?添?加ó到?学§生Θ?表括?

y++;

string s3 = "update student set tnoselect=‘" + no + "‘ where sno=‘" + comboBox1.SelectedItem.ToString() + "‘";

SqlCommand cmd = new SqlCommand(s3, conn);

conn.Open();

cmd.ExecuteNonQuery();

conn.Close();

MessageBox.Show("向ò" + comboBox1.SelectedItem + "发ぁ?出?邀?请?\n您ú已?有瓺" + x.ToString() + "个?学§生Θ?,?正y在ú邀?请?" + y.ToString() + "个?学§生Θ?);

}

}

private void button2_Click(object sender, EventArgs e)

{

}

private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

{

Form5 f5 = new Form5();

f5.Show();

f5.Activate();

}

private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

{

//刷¢新?信?息¢

listBox1.Items.Clear();

listBox2.Items.Clear();

//显?示?我ò的?学§生Θ?信?息¢

conn.Open();

string s = "select * from student where tno=‘" + no + "‘";

SqlCommand a = new SqlCommand(s, conn);

SqlDataReader dr = a.ExecuteReader();

while (dr.Read())

{

listBox1.Items.Add(string.Format("{0}   {1}   {2}   {3}", dr[0], dr[1], dr[2], dr[3]));

}

dr.Close();

//显?示?待鋣分?配?学§生Θ?

string s2 = "select sno,name,sex,message from student where tno is NULL";

SqlCommand b = new SqlCommand(s2, conn);

SqlDataReader dr2 = b.ExecuteReader();

while (dr2.Read())

{

listBox2.Items.Add(string.Format("{0}    {1}    {2}   {3}", dr2[0], dr2[1], dr2[2], dr2[3]));

comboBox1.Items.Add(dr2[0]);

}

dr2.Close();

conn.Close();

//显?示?学§生Θ?邀?请?

string s3 = "select count(sno) from student where selectno=‘" + no + "‘";

conn.Open();

SqlCommand c = new SqlCommand(s3, conn);

SqlDataReader dr3 = c.ExecuteReader();

if (dr3.Read())

{

conn.Close();

conn.Open();

SqlDataAdapter da1 = new SqlDataAdapter(s3, conn);

DataSet ds = new DataSet();

da1.Fill(ds, "学§生Θ?邀?请?人?数簓");

string s4 = ds.Tables["学§生Θ?邀?请?人?数簓"].Rows[0][0].ToString();

k = Int32.Parse(s4);

linkLabel2.Text = "收?到?" + s4 + "个?学§生Θ?申Θ?请?";

}

dr3.Close();

conn.Close();

}

}

}

Form3 学生界面

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;

using System.Data.SqlClient;

namespace daoshizhi

{

public partial class Form3 : Form

{

public static int k=0;

public static string welcome =Form1.welcome;

public static string no = Form1.no;

string sql1 = "select message from student where sno=‘" + no + "‘";

string sql2 = "select * from tutor where tno in (select tno from student where sno=‘" + no + "‘)";

SqlConnection conn = new SqlConnection("server=.;database=tutorManagement;uid=sa;pwd=sa");

public Form3()

{

InitializeComponent();

label1.Text = "欢?迎?,?" + welcome+"!?";

//显?示?个?人?简ò介é

conn.Open();

SqlDataAdapter da = new SqlDataAdapter(sql1, conn);

DataSet ds = new DataSet();

da.Fill(ds, "student");

label6.Text = ds.Tables["student"].Rows[0]["message"].ToString();

conn.Close();

//显?示?导?师簗信?息¢

conn.Open();

SqlCommand c1 = new SqlCommand(sql2, conn);

SqlDataReader dr = c1.ExecuteReader();

if (dr.Read())

{

k = 1;//表括?示?已?有瓺导?师簗

conn.Close();

SqlDataAdapter dp = new SqlDataAdapter(sql2, conn);

conn.Open();

dp.Fill(ds, "tutor");

label10.Text = ds.Tables["tutor"].Rows[0]["tname"].ToString();

label11.Text = ds.Tables["tutor"].Rows[0]["tno"].ToString();

label12.Text = ds.Tables["tutor"].Rows[0]["sex"].ToString();

label7.Text = ds.Tables["tutor"].Rows[0]["message"].ToString();

panel3.Show();

}

conn.Close();

//显?示?导?师簗邀?请?人?数簓

string s3 = "select count(tnoselect) from student where sno=‘" + no + "‘";

conn.Open();

SqlCommand c = new SqlCommand(s3, conn);

SqlDataReader dr3 = c.ExecuteReader();

if (dr3.Read())

{

conn.Close();

conn.Open();

SqlDataAdapter da1 = new SqlDataAdapter(s3, conn);

da1.Fill(ds, "导?师簗邀?请?人?数簓");

string s4 = ds.Tables["导?师簗邀?请?人?数簓"].Rows[0][0].ToString();

linkLabel2.Text = "收?到?" + s4 + "个?导?师簗邀?请?";

}

dr3.Close();

conn.Close();

}

private void button1_Click(object sender, EventArgs e)

{

}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

{

this.Close();

Form1 f1 = new Form1();

f1.Show();

}

private void button2_Click(object sender, EventArgs e)

{

//显?示?个?人?简ò介é

panel1.Show();

panel2.Visible = false;

}

private void buttonSave_Click(object sender, EventArgs e)

{

//修T改?数簓据Y库a个?人?简ò介é

string s1 = "update student set message=‘" + textBox1.Text + "‘ where sno=‘" + no + "‘";

conn.Open();

SqlCommand cmd = new SqlCommand(s1, conn);

cmd.ExecuteNonQuery();

conn.Close();

MessageBox.Show("修T改?成é功|");

textBox1.Text = "";

panel1.Visible = false;

//更ü新?显?示?个?人?简ò介é信?息¢

conn.Open();

SqlDataAdapter da = new SqlDataAdapter(sql1, conn);

DataSet ds = new DataSet();

da.Fill(ds, "student");

label6.Text = ds.Tables["student"].Rows[0]["message"].ToString();

conn.Close();

}

private void button6_Click(object sender, EventArgs e)

{

//取?消?简ò介é设Θ?置?

panel1.Visible = false;

textBox1.Text = "";

}

private void button3_Click(object sender, EventArgs e)

{

listBox1.Items.Clear();

comboBox1.Items.Clear();

if (k == 0)

{

panel1.Visible = false;

panel2.Visible = true;

//显?示?导?师簗选?择?框ò

string s2 = "select tno,tname,sex,message from tutor where tno in(select student.tno from student join tutor on student.tno=tutor.tno group by student.tno having count(sno)<5) or tno not in(select student.tno from student join tutor on student.tno=tutor.tno) ";

conn.Open();

SqlCommand a = new SqlCommand(s2, conn);

SqlDataReader dr = a.ExecuteReader();

while (dr.Read())

{

listBox1.Items.Add(string.Format("{0}    {1}    {2}    {3}", dr[0], dr[1], dr[2], dr[3]));

comboBox1.Items.Add(dr[0]);

}

dr.Close();

conn.Close();

}

else

MessageBox.Show("您ú已?经-有瓺导?师簗了?!?");

}

private void button4_Click(object sender, EventArgs e)

{

//选?择?导?师簗

string selectno = comboBox1.SelectedItem.ToString();//获?取?选?择?的?教ì师簗号?

/*教ì师簗所ù带?学§生Θ?是?否?满ú员±*/

string s0 = "select count(*) from student where tno=‘" + selectno + "‘ group by tno";

conn.Open();

SqlCommand a= new SqlCommand(s0,conn);

SqlDataReader dr=a.ExecuteReader();

DataSet ds = new DataSet();

int x=0;

if (dr.Read() )

{

conn.Close();

conn.Open();

SqlDataAdapter da = new SqlDataAdapter(s0, conn);

da.Fill(ds, "selected");

string m = ds.Tables["selected"].Rows[0][0].ToString();

x = Int32.Parse(m);

conn.Close();

}

dr.Close();

conn.Close();

if (x > 5)

MessageBox.Show("该?教ì师簗所ù带?学§生Θ?已?经-满ú员±,?请?重?新?选?择?教ì师簗!?");

else

{

/*选?择?结á果?添?加ó到?表括?/

string s1 = "update student set selectno=‘"+selectno+"‘ where sno=‘"+ no + "‘";

conn.Open();

SqlCommand cmd = new SqlCommand(s1, conn);

cmd.ExecuteNonQuery();

conn.Close();

/*获?得?教ì师簗姓?名?*/

string s2 = "select tname from tutor where tno=‘" + selectno + "‘";

conn.Open();

SqlDataAdapter da1 = new SqlDataAdapter(s2, conn);

da1.Fill(ds, "选?择?教ì师簗");

string selectname = ds.Tables["选?择?教ì师簗"].Rows[0]["tname"].ToString();

conn.Close();

MessageBox.Show("向ò " + selectname + " 老?师簗发ぁ?出?了?申Θ?请?");

panel2.Visible = false;

listBox1.Items.Clear();

comboBox1.Items.Clear();

}

}

private void button5_Click(object sender, EventArgs e)

{

//取?消?选?择?导?师簗

panel2.Visible = false;

listBox1.Items.Clear();

comboBox1.Items.Clear();

}

private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

{

//刷¢新?

conn.Open();

SqlCommand c1 = new SqlCommand(sql2, conn);

SqlDataReader dr = c1.ExecuteReader();

if (dr.Read())

{

k = 1;

conn.Close();

SqlDataAdapter dp = new SqlDataAdapter(sql2, conn);

DataSet ds = new DataSet();

conn.Open();

dp.Fill(ds, "tutor");

label10.Text = ds.Tables["tutor"].Rows[0]["tname"].ToString();

label11.Text = ds.Tables["tutor"].Rows[0]["tno"].ToString();

label12.Text = ds.Tables["tutor"].Rows[0]["sex"].ToString();

label7.Text = ds.Tables["tutor"].Rows[0]["message"].ToString();

panel3.Show();

}

conn.Close();

//显?示?导?师簗邀?请?人?数簓

string s3 = "select count(tnoselect) from student where sno=‘" + no + "‘";

conn.Open();

SqlCommand c = new SqlCommand(s3, conn);

SqlDataReader dr3 = c.ExecuteReader();

if (dr3.Read())

{

conn.Close();

conn.Open();

SqlDataAdapter da1 = new SqlDataAdapter(s3, conn);

DataSet ds = new DataSet();

da1.Fill(ds, "导?师簗邀?请?人?数簓");

string s4 = ds.Tables["导?师簗邀?请?人?数簓"].Rows[0][0].ToString();

linkLabel2.Text = "收?到?" + s4 + "个?导?师簗邀?请?";

}

dr3.Close();

conn.Close();

}

private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

{

Form6 f6 = new Form6();

f6.Show();

}

}

}

Form4 管理员界面

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;

using System.Data.SqlClient;

using Excel = Microsoft.Office.Interop.Excel;

namespace daoshizhi

{

public partial class Form4 : Form

{

SqlConnection conn = new SqlConnection("server=.;database=tutorManagement;uid=sa;pwd=sa");

string s1 = "select student.tno as 教ì师簗号?,tname as 导?师簗姓?名?,sno as 学§号?,name as 学§生Θ?姓?名? from student join tutor on student.tno=tutor.tno order by student.tno,sno";

string s2 = "select tno as 教ì师簗号?,tname as 姓?名?,sex as 性?别纄,message as 简ò介é from tutor";

string s3 = "select sno as 学§号?,name as 姓?名?,sex as 性?别纄,message as 自?我ò简ò介é from student";

string s4 = "select count(sno) from student";

string s5 = "select count(sno) from student where tno is not null";

public SqlDataAdapter adap = new SqlDataAdapter();

public DataSet ds = new DataSet();

public Form4()

{

InitializeComponent();

}

private void Form4_Load(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

//显?示?双?选?表括?

dataGridView1.DataSource = null;

adap.SelectCommand = new SqlCommand(s1, conn);

adap.Fill(ds, "双?选?表括?);

dataGridView1.DataSource = ds.Tables["双?选?表括?];

conn.Open();

SqlDataAdapter da = new SqlDataAdapter(s4,conn);

DataSet ds2 = new DataSet();

da.Fill(ds2, "学§生Θ?人?数簓");

string x0 = ds2.Tables["学§生Θ?人?数簓"].Rows[0][0].ToString();

conn.Close();

conn.Open();

SqlDataAdapter da1 = new SqlDataAdapter(s5, conn);

DataSet ds3 = new DataSet();

da1.Fill(ds3, "已?完?成é双?选?学§生Θ?人?数簓");

string y0 = ds3.Tables["已?完?成é双?选?学§生Θ?人?数簓"].Rows[0][0].ToString();

conn.Close();

label2.Text = "已?有瓺" + y0 + "/" +x0+ "学§生Θ?完?成é双?选?";

ds.Tables.Clear();

ds2.Tables.Clear();

ds3.Tables.Clear();

}

private void button2_Click(object sender, EventArgs e)

{

//显?示?教ì师簗表括?

dataGridView1.DataSource = null;

adap.SelectCommand = new SqlCommand(s2, conn);

adap.Fill(ds, "教ì师簗表括?);

dataGridView1.DataSource = ds.Tables["教ì师簗表括?];

ds.Tables.Clear();

/* button4.Show();

button5.Show();

button6.Show();

button10.Hide();

button9.Hide();

button8.Hide();*/

}

private void button3_Click(object sender, EventArgs e)

{

//显?示?学§生Θ?表括?

dataGridView1.DataSource = null;

adap.SelectCommand = new SqlCommand(s3, conn);

adap.Fill(ds, "学§生Θ?表括?);

dataGridView1.DataSource = ds.Tables["学§生Θ?表括?];

ds.Tables.Clear();

/* button4.Hide();

button5.Hide();

button6.Hide();

button10.Show();

button9.Show();

button8.Show();*/

}

private void button4_Click(object sender, EventArgs e)

{

}

private void button7_Click(object sender, EventArgs e)

{

ExportDataGridview(dataGridView1,true);

}

public bool ExportDataGridview(DataGridView gridView, bool isShowExcle)

{

if (gridView.Rows.Count == 0)

{

return false;

}

//创洹?建¨Excel对?象ó

Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();

excel.Application.Workbooks.Add(true);

//生Θ?成é字?段?名?称?

for (int i = 0; i < gridView.ColumnCount; i++)

{

excel.Cells[1, i + 1] = gridView.Columns[i].HeaderText;

}

//填?充?数簓据Y

for (int i = 0; i < gridView.RowCount - 1; i++)   //循-环·行D

{

for (int j = 0; j < gridView.ColumnCount; j++) //循-环·列

{

if (gridView[j, i].ValueType == typeof(string))

{

excel.Cells[i + 2, j + 1] = "‘" + gridView.Rows[i].Cells[j].Value.ToString();

}

else

{

excel.Cells[i + 2, j + 1] = gridView.Rows[i].Cells[j].Value.ToString();

}

}

}

//设Θ?置?禁?止1弹獭?出?保馈?存?和í覆2盖?询ˉ问ê提?示?框ò

excel.Visible = false;

excel.DisplayAlerts = false;

excel.AlertBeforeOverwriting = false;

//保馈?存?临ⅷ?时骸?工¤作痢?簿?

//excel.Application.Workbooks.Add(true).Save();

//保馈?存?文?件t

excel.Save("D:" + "\\234.xls");

excel.Quit();

return true;

}

}

}

Form5 处理学生申请

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;

using System.Data.SqlClient;

namespace daoshizhi

{

public partial class Form5 : Form

{

SqlConnection conn = new SqlConnection("server=.;database=tutorManagement;uid=sa;pwd=sa");

public static string no = Form2.no;

public Form5()

{

InitializeComponent();

conn.Open();

string s = "select sno,name,sex,message from student where selectno=‘" + no + "‘";

SqlCommand a = new SqlCommand(s, conn);

SqlDataReader dr = a.ExecuteReader();

while (dr.Read())

{

listBox1.Items.Add(string.Format("{0}   {1}   {2}   {3}", dr[0], dr[1], dr[2], dr[3]));

comboBox1.Items.Add(dr[0]);

}

conn.Close();

}

private void button1_Click(object sender, EventArgs e)

{//接ó受酣?邀?请?

if (comboBox1.SelectedIndex == -1) { MessageBox.Show("未′选?中D任?何?项?!?"); return; }

string s1 = comboBox1.SelectedItem.ToString();

string s2 = "update student set tno=‘" + no + "‘ where sno=‘" + s1 + "‘";

string s3 = "update student set tno=null where sno=‘" + s1 + "‘";

conn.Open();

SqlCommand cmd = new SqlCommand(s2, conn);

cmd.ExecuteNonQuery();

conn.Close();

comboBox1.SelectedIndex = 0;

conn.Open();

SqlCommand cmd2 = new SqlCommand(s3, conn);

cmd2.ExecuteNonQuery();

conn.Close();

MessageBox.Show("添?加ó学§生Θ?+s1);

comboBox1.Items.Remove(comboBox1.SelectedItem);

}

private void button2_Click(object sender, EventArgs e)

{//拒ü绝?邀?请?

if (comboBox1.SelectedIndex == -1) { MessageBox.Show("未′选?中D任?何?项?!?"); return; }

string s1 = comboBox1.SelectedItem.ToString();

comboBox1.Items.Remove(comboBox1.SelectedItem);

string s2 = "update student set selectno=null where sno=‘" + s1 + "‘";

conn.Open();

SqlCommand cmd = new SqlCommand(s2, conn);

cmd.ExecuteNonQuery();

conn.Close();

MessageBox.Show("拒ü绝?了?来ぁ?自?"+s1+"的?申Θ?请?");

}

}

}

Form6 处理导师邀请

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;

using System.Data.SqlClient;

namespace daoshizhi

{

public partial class Form6 : Form

{

SqlConnection conn = new SqlConnection("server=.;database=tutorManagement;uid=sa;pwd=sa");

public static string no = Form3.no;

public Form6()

{

InitializeComponent();

conn.Open();

string s = "select tno,tname,sex,message from tutor where tno=(select tnoselect from student where sno=‘" + no + "‘)";

SqlCommand a = new SqlCommand(s, conn);

SqlDataReader dr = a.ExecuteReader();

while (dr.Read())

{

listBox1.Items.Add(string.Format("{0}   {1}   {2}   {3}", dr[0], dr[1], dr[2], dr[3]));

comboBox1.Items.Add(dr[0]);

}

conn.Close();

}

private void button1_Click(object sender, EventArgs e)

{//接ó受酣?邀?请?

if (comboBox1.SelectedIndex == -1) { MessageBox.Show("未′选?中D任?何?项?!?"); return; }

string s1 = comboBox1.SelectedItem.ToString();

string s2 = "update student set tno=‘" + s1 + "‘ where sno=‘" + no + "‘";

string s3 = "update student set tnoselect=null where sno=‘" + no + "‘";

conn.Open();

SqlCommand cmd = new SqlCommand(s2, conn);

cmd.ExecuteNonQuery();

conn.Close();

comboBox1.Items.Remove(comboBox1.SelectedItem);

conn.Open();

SqlCommand cmd2 = new SqlCommand(s3, conn);

cmd2.ExecuteNonQuery();

conn.Close();

MessageBox.Show("添?加ó导?师簗 " + s1);

Form3.k = 1;

}

private void button2_Click(object sender, EventArgs e)

{

//拒ü绝?邀?请?

if (comboBox1.SelectedIndex == -1) { MessageBox.Show("未′选?中D任?何?项?!?"); return; }

string s1 = comboBox1.SelectedItem.ToString();

comboBox1.Items.Remove(comboBox1.SelectedItem);

string s2 = "update student set tnoselect=null where sno=‘" + no + "‘";

conn.Open();

SqlCommand cmd = new SqlCommand(s2, conn);

cmd.ExecuteNonQuery();

conn.Close();

MessageBox.Show("拒ü绝?了?来ぁ?自? " + s1 + " 的?邀?请?");

}

}

}

软件测试说明

登录界面

无导师时

修改个人简介

 

申请导师

教师登录

邀请学生

处理学生申请

管理员

此部分包括软件的测试数据与测试截图及说明,最好使用三中的测试用例。

软件使用说明

登录:点选教师/学生/管理员登录,输入正确用户名(教师号、学号)和密码成功登录。

教师:

默认可带5个学生。界面显示“我的学生”和全部目前无导师的“待分配学生”。

邀请学生:点选下拉框中的学号,点击“邀请”,若学生未达上限,即向选中的学生发出邀请,等待学生处理。学生将收到老师的基本信息和教学经历等内容。

处理学生申请:若收到来自学生的申请,点击进入处理界面,可同意或拒绝。

刷新:点击刷新可更新显示信息

学生:

只能有一位导师。界面显示“个人简介”和导师信息。

修改个人简介:点击在文本框中输入要更改的内容,保存可修改个人简介。

申请导师:若无导师信息,点击“申请导师”按钮可在下拉列表中选择导师,点击“申请”,向导师发送申请,等待老师处理。导师将收到学生的基本信息和个人简介。

处理导师邀请:若收到邀请,点击可进入处理界面查看邀请信息,点选下拉框,点选按钮同意或拒绝邀请。

刷新:刷新显示信息

管理员:

根据按钮提示进行教师表、学生表、双选表的增删改查。

时间: 2024-08-05 07:49:28

导师制双选系统的相关文章

导师双选制系统

导师双选制系统,功能如下: 该系统分为三个用户,一个是老师,一个是学生,一个是管理员,每个角色都有一个不同的界面,对于学生来说可以进行导师信息浏览,申请填报,个人信息修改,导师查询 ,老师登陆包括申请浏览,申请审核,申请筛选,修改个人信息,一个是管理员,可以对学生,老师,申请信息进行浏览以及导出文件 注:当程序第一次开始运行,没有学生,老师,申请的文件,所以就不可以自己初始化,所以第一次运行时就必须利用静态块来实现,Erie必须由管理员登陆进行导出文件,这样下次基于可以直接从文件中获取数据 由于

Flex4 双选下拉列表的实现(源代码)

本文属原创文章,如需转载,请注明出处,谢谢 企业应用中少不了双选下拉列表控件,但几乎都没有独立的控件,Flex在这上面得天独厚,ArrayCollection的过滤功能使得我们只需要一个数据源就可以将数据展示在两个下拉列表中 有呆毛才有真相: 为了实现上图我想要的控件效果,我需要先明确我希望得到的控件该怎么用: <ui:DDList width="400" height="300" labelField="label" labelFunct

黑农瑞选系统开发软件APP

信息成本论到了现代的经济社会,信息的价值被逐渐认可提高,开始变成一种资源,部分观点表示,信息作为组织管理中的关键因素和核心要件,信息的价值不可忽视.由于信息不对称的情况存在,信息可以划分成完全信息及不完全信息.完全信息指的是在博弈论,全体参加者可以获取并得知全部剩余参加者的所有信息,了解全部详情和细节,完全避免了不确定的因素,可以说是百分百的一种形式. 黑农瑞选系统开发案例丨T:l8O.V2854.电8832吴丨.黑农瑞选商城开发,黑农瑞选APP开发,黑农瑞选软件开发,黑农瑞选搭建平台开发,黑农

使用heartbeat+monit实现主备双热备份系统

一.使用背景 项目须要实现主备双热自己主动切换的功能,保证系统7*24小时不间断执行:现已有两台双网卡的IBM的server,为了不再添加成本採购独立外部存储设备和双机热备软件.採用了linux下开源的HA软件进行部署,即heartbeat+monit方式. 1.使用heartbeat来进行心跳监測和资源接管,心跳监測能够通过网络链路和串口进行,此处使用网络链路.并且支持 冗 余链路,它们之间相互发送报文来告诉对方自己当前的状态,假设在指定的时间内未收到对方发送的报文.那么就觉得对方失效,这时需

再次安装双linux系统及kali的grub修复!

打算下学期不带笔记本,平时编程上网本就够了,也就看看一般的算法,于是那上网本装centos7和kali,上网本是APU,但是这两个版本的linux都支持的不错. 先安装centos,由于熟悉了linux,所以boot一个区,根一个区,剩下的给了home,这里的swap和home是两个linux共享的,具体安装的时候分区对了就行, 这里要注意所有分区都是ext4,它默认的是标准分区,不然kali的grub可能不认. centos安装一切正常,接下来装kali,分区什么的一切正常,最后安装grub竟

【Mac双系统设置系统默认启动系统】解决方式

解决方式1: 开机时长按option键,进入系统选择界面: 用左右方向键选择到你要设置为默认启动的盘, 然后同一时候按下ctrl+enter键.就可以将其设置为默认启动的系统. 解决方式2: 选择mac系统进入后, 点击 系统偏好设置----->启动磁盘----->进入例如以下图界面: 首先点击最以下的锁图片.然后再进行更改, 选择你要设置为默认启动的系统后,点击又一次启动button生效.

&quot;Mac双系统设置系统默认启动系统&quot;解决方案

解决方案1: 开机时长按option键,进入系统选择界面: 用左右方向键选择到你要设置为默认启动的盘, 然后同时按下ctrl+enter键,即可将其设置为默认启动的系统. 解决方案2: 选择mac系统进入后, 点击 系统偏好设置----->启动磁盘----->进入如下图界面: 首先点击最下面的锁图片,然后再进行更改, 选择你要设置为默认启动的系统后,点击重新启动按钮生效. 版权声明:本文为博主原创文章,未经博主允许不得转载.

POJ 3281 牛双选问题

题目大意:有F种食物和D种饮料,每种食物或饮料只能供一头牛享用,且每头牛只享用一种食物和一种饮料.现在有N头牛,每头牛都有自己喜欢的食物种类列表和饮料种类列表,问最多能使几头牛同时享用到自己喜欢的食物和饮料.(1 <= F <= 100, 1 <= D <= 100, 1 <= N <= 100) 题解:赤裸裸的网络流分配问题.把牛放到中间,两边放东西即可.每一种食物控汇1控源1再引流牛就行了.注意我一开始Wa是因为忘记牛要拆点了...牛是要限1的...

安装双系统window +ubuntu

在网上,试过很多种方法,有U盘制作安装,感觉好复杂,这边有一个简便的方法就是使用Ubuntu 的 wubi安装. 一直想安装双Ubuntu 系统很久了,可是以前在大学时期的时候一直努力,好像都不行,这次终于可以了,我使用的版本是Ubuntu 14.04 版本 去官网下载: ubuntu-14.04-desktop-amd64.iso . 然后在解压出来,然后会看到一个Wubi.exe 使用RAR打开ubuntu-14.04-desktop-amd64.iso文件,找到wubi.exe文件并将其解