机房重构之学生查看上机记录
来源:互联网 发布:淘宝附近的人取消了吗 编辑:程序博客网 时间:2024/06/03 18:10
敲完查看上机记录感觉很不容易,因为登录没搞懂,直接敲查看上机记录,代码完全照着登录的来,不过敲完能运行,还是有一点点小成就感,分享给大家,代码哪有不足的地方,请大家多多指点。
UI
namespace LoginUI{ public partial class frmStudentCkeck : Form { public frmStudentCkeck() { InitializeComponent(); } private void butquiry_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("请输入卡号!"); } else { string cardno = textBox1.Text.Trim(); frmStudentCkeckFacade fscf = new frmStudentCkeckFacade();//实例化外观层 DataTable list = fscf.frmCheckFacede(cardno);//接收外观层穿过来的值 if (list.Rows.Count>0) { dataGridView1.Rows[0].Cells[0].Value = list.Rows[0][1]; dataGridView1.Rows[0].Cells[1].Value = list.Rows[0][3]; dataGridView1.Rows[0].Cells[2].Value = list.Rows[0][6]; dataGridView1.Rows[0].Cells[3].Value = list.Rows[0][7]; dataGridView1.Rows[0].Cells[4].Value = list.Rows[0][8]; dataGridView1.Rows[0].Cells[5].Value = list.Rows[0][9]; dataGridView1.Rows[0].Cells[6].Value = list.Rows[0][11]; dataGridView1.Rows[0].Cells[7].Value = list.Rows[0][12]; dataGridView1.Rows[0].Cells[8].Value = list.Rows[0][13]; } else { MessageBox .Show ("卡号不存在!"); } } } private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text.Length > 6) { MessageBox.Show("不能超过六个字"); } Regex reg = new Regex(@"[^0-9]");//排除性字符组(取反思想) if (reg.IsMatch(textBox1.Text.Trim())) { //textBox1.Text = "请输入有效数字!"; MessageBox.Show("请输入有效数字!"); textBox1.Text = ""; textBox1.Focus(); } } }}
BLL
namespace BLL{ public class StudentCheckBLL { public DataTable CheckBLL(string cardno) { factory fac = new factory(); StudentCheckIDAL fscI = fac.CreateStudentCheck(); //Factory.frmStudentCheckFoctory fscf = new Factory.frmStudentCheckFoctory(); //IDAL.StudentCheckIDAL fscI = fscf.frmstudenFoctory(); DataTable list = fscI.frmStudent(cardno); return list; } }}
DALnamespace DAL{ public class StudentCkeckDAL:IDAL .StudentCheckIDAL { public DataTable ICheckIDAL(string cardno) { SqlParameter ps = new SqlParameter("@cardno", cardno ); string sql = "select * from Line_info where cardno = @cardno"; //return SqlHelper.GetDataTable(sql, ps); DataTable list = SqlHelper .GetDataTable (sql,ps ); return list ; } public DataTable frmStudent(string cardno) { SqlParameter ps = new SqlParameter("@cardno", cardno); string sql = "select * from Line_info where cardno = @cardno"; return SqlHelper.GetDataTable(sql, ps); } }}Facade
namespace Facade{ public class frmStudentCkeckFacade { public DataTable frmCheckFacede(string cardno) { StudentCheckBLL SCB = new StudentCheckBLL(); DataTable list = SCB.CheckBLL(cardno); return list; } }}
Factorynamespace Factory{ public class frmStudentCheckFoctory { public IDAL.StudentCheckIDAL CreateInstance() { string strDB = System.Configuration.ConfigurationManager.AppSettings["DB"]; // 读取配置文件 string name = strDB + "." + "frmStudentCkeckDAL"; IDAL.StudentCheckIDAL fscI = (IDAL.StudentCheckIDAL)Assembly.Load("DAL").CreateInstance(name); return fscI; } }}
IDALnamespace IDAL{ public interface StudentCheckIDAL { DataTable ICheckIDAL(string cardno); DataTable frmStudent(string cardno); }}
阅读全文
0 0
- 机房重构之学生查看上机记录
- 【机房重构】——查看上机记录、充值记录+三层+存储过程+模板方法
- 机房之学生查看余额
- 【机房重构】职责链模式之上机
- 重构机房组合查询之学生基本信息查询
- 机房收费系统之上机状态查看
- 【机房重构】—上机&订餐
- 机房重构职责链模式-上机
- 机房重构 之 SqlHelper
- 【机房重构】之报表
- 机房重构之用例图
- 机房重构之SqlHelper
- 机房重构之接口
- 机房重构之SqlHelper
- 机房重构之开篇
- 机房重构之结账
- 机房重构之报表
- 机房重构之下机
- POJ 3116 MegaCheckers 笔记
- 逆置反转单链表
- 记录一下我悲催的OI生涯
- activeMQ消息队列之JMS基础(附了一些代码帮助理解前期可跳过)
- HDU 5812 Distance 暴力+素数打表
- 机房重构之学生查看上机记录
- R中的Box-Cox变换
- 实验 6-1 1.针对符号连接文件和硬连接文件。测试以下函数,分析其执行过程并给出结论。 link() unlink() symlink() readlink() stat() lstat(
- 很强大的HTML+CSS+JS面试题(附带答案)
- CFgym:Painting the Wall(BFS)
- Linux下安装mysql
- 开始,做一个自己不认识的人
- 详解mysql的for update
- 爬虫小程序