Exemplo n.º 1
0
        private void btnSuaSinhVien_Click(object sender, EventArgs e)
        {
            string diachi = txtDiaChi.Text.Trim();
            string tensv  = txtTenSV.Text.Trim();
            string mssv   = txtMSSV.Text.Trim();
            string malop;
            string gioitinh;

            if (radNam.Checked)
            {
                gioitinh = "Nam";
            }
            else
            {
                gioitinh = "Nu";
            }
            if (cboMaLop2.SelectedIndex == -1)
            {
                MessageBox.Show("Vui long chon ma lop them sinh vien");
            }
            else
            {
                malop = cboMaLop2.SelectedItem.ToString().Trim();
                if (KiemTraThongTinSinhVienCoThieuKhong(mssv, tensv, diachi) == false)
                {
                    st.CapNhatThongTinSinhVien(new Student(malop, mssv, tensv, gioitinh, diachi));
                    MessageBox.Show("Cap nhat thanh cong");
                    lvSinhVien.Items.Clear();
                    HienThiDanhSachSinhVien();
                    cboMaLop2.Text = "";
                    txtDiaChi.Text = "";
                    txtMSSV.Text   = "";
                    txtTenSV.Text  = "";
                }
                else
                {
                    MessageBox.Show("Cap nhat that bai");
                    lvSinhVien.Items.Clear();
                    HienThiDanhSachSinhVien();
                    cboMaLop2.Text = "";
                    txtDiaChi.Text = "";
                    txtMSSV.Text   = "";
                    txtTenSV.Text  = "";
                }
            }
        }