Pro
How do I use Pro
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ClassBLL.cs
Copy
275 public bool Proc_Insert(string proc,string test)
276 {
277 SqlConnection con = da.GetConnect();
278 con.Open();
279 SqlCommand cmd = new SqlCommand(proc, con);
280 cmd.CommandType = CommandType.StoredProcedure;
281 cmd.Parameters.Add("@test", SqlDbType.NVarChar).Value = test;
282 SqlDataReader dr = cmd.ExecuteReader();
283 if (dr.Read())
284 {
285 return false;
286 }
287 return true;
288 }
File name: FormGiangVien.cs
Copy
40 private void btnThem_Click(object sender, EventArgs e)
41 {
42 if (txtMaGV.Text!="")
43 {
44 if(business.Proc_Insert("Insert_GiangVien",txtMaGV.Text))
45 {
46 string sql = "'"+txtMaGV.Text+"','"+txtTenGV.Text+"','"+dtpNamSinh.Text+"','"+txtDiaChi.Text+"'";
47 business.Insert("GiangVien",sql);
48 FormGiangVien_Load(sender,e);
49 }
50 else
51 {
52 MessageBox.Show("Mã GV đã tồn tại");
53 }
54 }
55 }
File name: FormHeDaoTao.cs
Copy
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 }
File name: FormHocKy.cs
Copy
52 private void btnThem_Click(object sender, EventArgs e)
53 {
54 if (txtMaHocKy.Text!="")
55 {
56 if (business.Proc_Insert("Insert_HocKy", txtMaHocKy.Text))
57 {
58 string sql = "'" + txtMaHocKy.Text + "','" + txtTenHocKy.Text + "','" + txtNamHoc.Text + "','" + dtpBatDau.Text + "','" + dtpKetThuc.Text + "'";
59 business.Insert("HocKy", sql);
60 FormHocKy_Load(sender, e);
61 }
62 else
63 {
64 MessageBox.Show("Mã Học Kỳ đã tồn tại");
65 }
66 }
67 }
File name: FormHocPhan.cs
Copy
25 private void btnThem_Click(object sender, EventArgs e)
26 {
27 if (txtMaHP.Text != "")
28 {
29 if (business.Proc_Insert("Insert_HocPhan", txtMaHP.Text))
30 {
31 string sql = "'" + txtMaHP.Text + "','" + txtTenHP.Text + "'," + Convert.ToInt32(txtSoTC.Text) + "," + Convert.ToInt32(txtSoTietTH.Text) + "," + Convert.ToInt32(txtSoTietLT.Text) + "," + Convert.ToInt32(txtPhanTramDQT.Text) + "," + Convert.ToInt32(txtPhanTramDT.Text) + "";
32 business.Insert("HocPhan",sql);
33 FormHocPhan_Load(sender,e);
34 }
35 else
36 {
37 MessageBox.Show("Mã Học Phần đã tồn tại");
38 }
39 }
40 }
File name: FormKHGD.cs
Copy
34 private void btnThem_Click(object sender, EventArgs e)
35 {
36 if (txtMaKHGD.Text != "")
37 {
38 if (business.Proc_Insert("Insert_KHGD",txtMaKHGD.Text))
39 {
40 string sql = "'"+txtMaKHGD.Text+"','"+cmbMahocKy.SelectedValue.ToString()+"','"+cmbMaKhoiLop.SelectedValue.ToString()+"'";
41 business.Insert("KeHoachGiangDay",sql);
42 FormKHGD_Load(sender, e);
43 }
44 else
45 {
46 MessageBox.Show("Mã KHGD đã tồn tại rồi");
47 }
48 }
49 }
File name: FormKhoiLop.cs
Copy
43 private void btnThem_Click(object sender, EventArgs e)
44 {
45 if(txtMaKhoiLop.Text!="")
46 {
47 if(business.Proc_Insert("Insert_KhoiLop",txtMaKhoiLop.Text))
48 {
49 string sql = "'" + txtMaKhoiLop.Text + "','" + txtTenKhoiLop.Text + "','" + cmbMaHeDT.SelectedValue.ToString() + "','" + cmbMaHeDT.SelectedValue.ToString() + "'";
50 business.Insert("KhoiLop", sql);
51 FormKhoiLop_Load(sender, e);
52 }
53 else
54 {
55 MessageBox.Show("Mã Khối Lớp đã tồn tại rồi");
56 }
57 }
58 }
File name: FormLop.cs
Copy
63 private void btnThem_Click(object sender, EventArgs e)
64 {
65 if (txtMaLop.Text != "")
66 {
67 if (business.Proc_Insert("Insert_Lop", txtMaLop.Text))
68 {
69 string sql = "'"+txtMaLop.Text+"','"+txtTenLop.Text+"','"+cmbMaKhoiLop.SelectedValue.ToString()+"','"+cmbMaGV.SelectedValue.ToString()+"'";
70 business.Insert("Lop",sql);
71 FormLop_Load(sender,e);
72 }
73 else
74 {
75 MessageBox.Show("Mã Lớp đã tồn tại");
76 }
77 }
78 }
File name: FormNhomHocPhan.cs
Copy
41 private void btnThem_Click(object sender, EventArgs e)
42 {
43 if (txtMaNhomHP.Text != "")
44 {
45 if (business.Proc_Insert("Insert_NhomHocPhan", txtMaNhomHP.Text))
46 {
47 string sql = "'"+txtMaNhomHP.Text+"','"+txtTenNhomHP.Text+"','"+cmbMaHP.SelectedValue.ToString()+"','"+cmbMaKHGD.SelectedValue.ToString()+"','"+cmbMaGV.SelectedValue.ToString()+"'";
48 business.Insert("NhomHocPhan", sql);
49 FormNhomHocPhan_Load(sender, e);
50 }
51 else
52 {
53 MessageBox.Show("Mã SV đã tồn tại");
54 }
55 }
56 }
File name: FormPhanQuyen.cs
Copy
45 private void btnThem_Click(object sender, EventArgs e)
46 {
47
48 if(txtTenDangNhap.Text!="")
49 {
50 if(business.Proc_Insert("Insert_Users",txtTenDangNhap.Text))
51 {
52 string sql = "'" + txtTenDangNhap.Text + "','" + txtMatKhau.Text + "','" + cmbQuyen.SelectedItem.ToString() + "'";
53 business.Insert("Users",sql);
54 FormPhanQuyen_Load(sender, e);
55 }
56 else
57 {
58 MessageBox.Show("Username này đã tồn tại");
59 }
60 }
61 }
Download file with original file name:Pro
Pro 142 lượt xem
Gõ tìm kiếm nhanh...