.NET 分层开发 一二学生管理系统

本文介绍了使用.NET进行分层开发的一个学生管理系统,主要包括UI层的MyScool.UI,以及数据访问层如MySchool.DAL、Grade.DAL和Student.DAL,利用SQLHelper进行数据库操作。
摘要由CSDN通过智能技术生成

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 WindowsFormsApplication1
{
    public partial class 年级查询信息表 : Form
    {
        public 年级查询信息表()
        {
            InitializeComponent();
        }
        gradeDAL d = new gradeDAL();
        private void 年级查询信息表_Load(object sender, EventAr
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值