private void _btnAdd_Click(object sender, EventArgs e) { using (var dlg = new AddWorkerForm()) { if (dlg.ShowDialog() == DialogResult.OK) { Query(); } } }
private void _riOperation_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Index == 0) { MdiService.JumpTo <ProduceDetailView>(); } else if (e.Button.Index == 1) { var worker = GetFocusedWorker(); if (worker == null) { MessageBoxHelper.Warn("没有找到工人。"); return; } using (var dlg = new AddWorkerForm(worker.Id)) { if (dlg.ShowDialog() == DialogResult.OK) { Query(); } } } else if (e.Button.Index == 2) { var worker = GetFocusedWorker(); if (worker == null) { MessageBoxHelper.Warn("没有找到工人。"); return; } if (MessageBoxHelper.Question(string.Format("您确定要删除工人“{0}”吗?", worker.GetDisplayText()))) { _service.DeleteWorker(worker.Id); } } }