MyScool.UI:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySchool.DAL;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StudentDAL dal = new StudentDAL();
string username = this.textBox1.Text;
string pwd = this.textBox2.Text;
bool flag = dal.IsLogin(username, pwd);
if (flag)
{
FrmMain ff = new FrmMain();
ff.Show();
this.Hide();
}
else
{
MessageBox.Show("失败");
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySchool.DAL;
namespace WindowsFormsApplication1
{
public partial class FrmAddStudent : Form
{
public FrmAddStudent()
{
InitializeComponent();
}
private void FrmAddStudent_Load(object sender, EventArgs e)
{
DataTable dt = gradeDAL.FindAllGrade();
cboGrade.DataSource = dt;
cboGrade.ValueMember = "gradeid";
cboGrade.DisplayMember = "gradename";
}
private void btnEdit_Click(object sender, EventArgs e)
{
string pwd = txtPwd.Text;
string uname = txtName.Text;
string gender = rbtnMale.Checked ? "1" : "0";
string gradename = cboGrade.Text;
int gradeid = gradeDAL.GetIdByName(gradename);
string phone = txtPhone.Text;
string address = txtAddress.Text;
string email = txtEmail.Text;
DateTime birthday = dpBirthday.Value;
bool flag = studentDAL.AddStudent(pwd, uname, gender, gradeid, phone, address, birthday, email);
if (flag)
{
MessageBox.Show("对了!");
}
else
{
MessageBox.Show("Failed");
}
}
gradeDAL gradeDAL = new gradeDAL();
StudentDAL studentDAL=new StudentDAL();
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySchool.DAL;
namespace WindowsFormsApplication1
{
public partial class FrmMain : Form
{
public FrmMain()
{
InitializeComponent();
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
FrmAddStudent dd = new FrmAddStudent();
dd.Show();
}
public string username;
private void FrmMain_Load(object sender, EventArgs e)
{
this.toolStripLabel1.Text ="工作日期:"+ DateTime.Now.ToLongDateString()+DateTime.Now.ToLongTimeString();
this.toolStripLabel2.Text ="welcome:"+username;
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
学生信息表 xin = new 学生信息表();
xin.Show();
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
年级查询信息表 nian = new 年级查询信息表();
nian.Show();
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
姓名查询表 xing = new 姓名查询表();
xing.Show();
}
StudentDAL da = new StudentDAL();
private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e)
{
xiu x = new xiu();
x.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySchool.DAL;
using System.Data.SqlClient;
namespace WindowsFormsApp