Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string mamh, tenmh, sotinchi, sotiet, manganh;

            mamh     = txtmamh.Text.Trim();
            tenmh    = txttenmh.Text.Trim();
            sotinchi = txtsotinchi.Text.Trim();
            sotiet   = txtsotiet.Text.Trim();
            manganh  = txtmn.Text.Trim();


            MonHoc MH = new MonHoc(mamh, tenmh, sotinchi, sotiet, manganh);

            try
            {
                int i = new MonHocBus().SuaMH(MH);
                if (i == -2)
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            dgvMH.DataSource = GetMH();
        }
Esempio n. 2
0
 public List <MonHoc> GetMH()
 {
     try
     {
         string    sql = "select * from MonHoc";
         MonHocBus mh  = new MonHocBus();
         return(mh.GetMH(sql));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
Esempio n. 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            string mamh;

            mamh = txtmamh.Text.Trim();
            try
            {
                int i = new MonHocBus().XoaMH(mamh);
                if (i == -2)
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            dgvMH.DataSource = GetMH();
        }