void UserList_Control_UCMain_Edit_Clicked(object sender, EventArgs e) { if (bandedGridView1.FocusedRowHandle < 0) { return; } try { Objects.User user = (Objects.User)bandedGridView1.GetRow(bandedGridView1.FocusedRowHandle); if (user == null) { MessageBox.Show("Chưa chọn nhân viên", "Thông báo lỗi"); return; } using (var uow = new UnitOfWork()) { //Object.NhanVien getRecords = new XPCollection<Object.NhanVien>(uow, CriteriaOperator.Parse("Oid = ?", employee_id)).FirstOrDefault(); Objects.User getRecords = uow.GetObjectByKey <Objects.User>(user.Oid); if (getRecords == null) { return; } FrmUserDetail f = new FrmUserDetail(getRecords); f.ShowDialog(); } } catch (Exception ex) { MessageBox.Show("Đã có lỗi không mong muốn sảy ra/n" + ex.ToString(), "Thông báo lỗi"); } }
void ucMainControl1_UCMain_Add_Clicked(object sender, EventArgs e) { FrmUserDetail frm = new FrmUserDetail(); frm.Show(); }