private void btnSearch_Click(object sender, EventArgs e) { eSinhVien sv = new eSinhVien(); sv = svBLL.GetSinhVienByID(txtID.Text.Trim()); if (sv != null) { txtTen.Text = sv.HoVaTen; txtAddress.Text = sv.DiaChi; txtMail.Text = sv.Mail; txtPhone.Text = sv.SDT; txtLopNC.Text = new LopNienCheBLL().GetLopNienCheByID(sv.ID_LopNienChe).TenLop.Trim(); if (sv.HinhAnh != null) { picHinhAnh.Image = ByteToImg(Convert.ToBase64String(sv.HinhAnh)); } frmDangKyHocPhanPN frm = new frmDangKyHocPhanPN(sv); frm.TopLevel = false; frm.Visible = true; frm.FormBorderStyle = FormBorderStyle.None; frm.Dock = DockStyle.Fill; panel.Controls.Clear(); panel.Controls.Add(frm); } else { MessageBox.Show("Sai mã số sinh viên"); } }
public frmDangKyHocPhan(object tk) { InitializeComponent(); this.taiKhoan = tk; if (tk is eSinhVien) { btnSearch.Visible = false; txtID.ReadOnly = true; frmDangKyHocPhanPN frm = new frmDangKyHocPhanPN((eSinhVien)tk); frm.TopLevel = false; frm.Visible = true; frm.FormBorderStyle = FormBorderStyle.None; frm.Dock = DockStyle.Fill; panel.Controls.Clear(); panel.Controls.Add(frm); eSinhVien sv = (eSinhVien)tk; txtID.Text = sv.ID_SinhVien; txtTen.Text = sv.HoVaTen; txtAddress.Text = sv.DiaChi; txtMail.Text = sv.Mail; txtPhone.Text = sv.SDT; txtLopNC.Text = new LopNienCheBLL().GetLopNienCheByID(sv.ID_LopNienChe).TenLop.Trim(); if (sv.HinhAnh != null) { picHinhAnh.Image = ByteToImg(Convert.ToBase64String(sv.HinhAnh)); } } else { btnSearch.Visible = true; txtID.ReadOnly = false; } }