private void btnAddRecord_Click(object sender, EventArgs e) { using (var page = new AddUserPage()) { page.ShowDialog(); } using (var db = new UnitOfWork()) { //var page=new SystemPartsPage(); //page.ShowDialog(); dgv.AutoGenerateColumns = false; dgv.DataSource = db.UserRepository.GetAll(); } }
private void EditRecord() { using (var page = new AddUserPage()) { if (dgv.CurrentRow != null) { page.UserId = (int)dgv.CurrentRow.Cells["clnId"].Value; page.ShowDialog(); } } using (var db = new UnitOfWork()) { //var page=new SystemPartsPage(); //page.ShowDialog(); dgv.AutoGenerateColumns = false; dgv.DataSource = db.UserRepository.GetAll(); } }