Quản lý điểm khoa công nghệ thông tin C#

1 using System;
2 using
System.Collections.Generic;
3 using
System.ComponentModel;
4 using
System.Data;
5 using
System.Drawing;
6 using
BLL;
7 using
System.Linq;
8 using
System.Text;
9 using
System.Windows.Forms;
10
11 namespace
QuanLyDiem
12 {
13     
public partial class FormHeDaoTao : Form
14     {
15         
public FormHeDaoTao()
16         {
17             InitializeComponent();
18         }
19         ClassBLL business =
new ClassBLL();
20         
private void FormHeDaoTao_Load(object sender, EventArgs e)
21         {
22             dgvHeDaoTao.DataSource = business.ShowData(
"HeDaoTao");
23         }
24
25         
private void btnThoat_Click(object sender, EventArgs e)
26         {
27             
this.Close();
28         }
29         
int dong;
30         
private void dgvHeDaoTao_RowEnter(object sender, DataGridViewCellEventArgs e)
31         {
32             dong = e.RowIndex;
33             txtMaHeDT.Text = dgvHeDaoTao.Rows[dong].Cells[
0].Value.ToString();
34             txtTenHeDT.Text = dgvHeDaoTao.Rows[dong].Cells[
1].Value.ToString();
35         }
36
37         
private void btnThem_Click(object sender, EventArgs e)
38         {
39             
if(txtMaHeDT.Text!="")
40             {
41                 
if (business.Proc_Insert("Insert_HeDaoTao", txtMaHeDT.Text))
42                 {
43                     
string sql = "'" + txtMaHeDT.Text + "','" + txtTenHeDT.Text + "'";
44                     business.Insert(
"HeDaoTao", sql);
45                     FormHeDaoTao_Load(sender, e);
46                 }
47                 
else
48                 {
49                     MessageBox.Show(
"Mã Hệ Đào Tạo đã tồn tại");
50                 }
51             }
52         }
53
54         
private void btnXoa_Click(object sender, EventArgs e)
55         {
56             DialogResult result;
57             result = MessageBox.Show(
"Bạn có chắc chắn muốn xóa không ?","Hệ Thống", MessageBoxButtons.YesNo);
58             
if (result == DialogResult.Yes)
59             {
60                 
string sql = "MaHeDT = '" + txtMaHeDT.Text + "'";
61                 business.Delete(
"HeDaoTao", sql);
62                 FormHeDaoTao_Load(sender, e);
63             }
64         }
65
66         
private void btnSua_Click(object sender, EventArgs e)
67         {
68             
string sql = "TenHeDT ='"+txtTenHeDT.Text+"' where MaHeDT='"+txtMaHeDT.Text+"'";
69             business.Update(
"HeDaoTao",sql);
70             FormHeDaoTao_Load(sender,e);
71         }
72
73         
private void txtMaHeDT_KeyPress(object sender, KeyPressEventArgs e)
74         {
75             
if (e.KeyChar == ' ')
76                 e.Handled =
true;
77         }
78     }
79 }



Quản lý điểm khoa công nghệ thông tin C# 7.376 lượt xem

Gõ tìm kiếm nhanh...