private void btnLuu_Click(object sender, EventArgs e) { var dtChucVu = grcChucVu.DataSource as DataTable; if (dtChucVu == null || dtChucVu.GetChanges() == null) { return; } if (ChucVuService.SaveChanges(dtChucVu)) { XtraMessageBox.Show("Lưu thành công", "Lưu", MessageBoxButtons.OK, MessageBoxIcon.Information); grcChucVu.DataSource = ChucVuService.LoadDataTable(); } else { XtraMessageBox.Show("Lưu thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void frmNhanVienThemSua_Load(object sender, EventArgs e) { if (mode == MODE_ADDNEW) { initThem(); } else { initSua(); } cbbGioiTinh.Properties.Items.Add("Nam"); cbbGioiTinh.Properties.Items.Add("Nữ"); cbbGioiTinh.Properties.Items.Add("Khác"); lueChucVu.Properties.ValueMember = "MaChucVu"; lueChucVu.Properties.DisplayMember = "TenChucVu"; lueChucVu.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("TenChucVu", 200, "Tên Chức Vụ")); lueChucVu.Properties.DataSource = ChucVuService.LoadDataTable(); }
private void FrmChucVu_Load(object sender, EventArgs e) { var dt = ChucVuService.LoadDataTable(); grcChucVu.DataSource = dt; }