Esempio n. 1
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         string     mahp  = textBox1.Text;
         string     tenhp = textBox2.Text;
         int        sotc  = int.Parse(textBox3.Text);
         tblHocPhan hp    = new tblHocPhan(mahp, tenhp, sotc);
         busHocPhan.DeleteHocPhan(mahp);
         MessageBox.Show("ban da xoa " + tenhp + " thanh cong");
         dgvHocPhan.DataSource = busHocPhan.getHocPhan();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 2
0
        public static void UpdateHP(tblHocPhan hp)
        {
            SqlConnection Conn    = dbConnectionData.ketnoi();
            SqlCommand    command = new SqlCommand("pr_HocPhan_Update", Conn);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add("@MaHP", SqlDbType.NVarChar, 10);
            command.Parameters.Add("@TenHP", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@SoTC", SqlDbType.Int, 10);
            command.Parameters["@MaHp"].Value  = hp.MaHP1;
            command.Parameters["@TenHP"].Value = hp.TenHP1;
            command.Parameters["@SoTC"].Value  = hp.SoTC1;

            Conn.Open();
            command.ExecuteNonQuery();
            Conn.Close();
        }
Esempio n. 3
0
 private void btnThem_Click(object sender, EventArgs e)
 {
     try
     {
         string     mahp  = textBox1.Text;
         string     tenhp = textBox2.Text;
         int        sotc  = int.Parse(textBox3.Text);
         tblHocPhan hp    = new tblHocPhan(mahp, tenhp, sotc);
         busHocPhan.InsertHocPhan(hp);
         MessageBox.Show("ban da them " + tenhp + " thanh cong");
         dgvHocPhan.DataSource = busHocPhan.getHocPhan();
     }
     catch
     {
         MessageBox.Show("ban kiem tra lai ma hoc phan");
     }
 }
Esempio n. 4
0
 public static void UpdateHocPhan(tblHocPhan hp)
 {
     dalHocPhan.UpdateHP(hp);
 }
Esempio n. 5
0
 public static void InsertHocPhan(tblHocPhan hp)
 {
     dalHocPhan.InsertHP(hp);
 }