private void NhanSuBtn_Click(object sender, EventArgs e) { if (Application.OpenForms.OfType <NhanVienForm>().Count() == 1) { Application.OpenForms.OfType <NhanVienForm>().First().Focus(); } else { var form = new NhanVienForm(); form.Show(); } }
public SuaNhanVien(NhanVienForm form, int id) : this() { try { parentForm = form; NvId = id; var db = new CkpEntities(); var nv = (from n in db.NhanVien where n.Id == id select n).FirstOrDefault(); IdTBox.Text = nv.Id.ToString(); HtTBox.Text = nv.HoTen; CvTBox.Text = nv.ChucVu; SdtTBox.Text = nv.SoDienThoai; DcTBox.Text = nv.DiaChi; } catch (Exception ex) { MessageBox.Show(ex.GetBaseException().Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ThemNhanVien(NhanVienForm form) : this() { parentForm = form; }