private void orderEdit_Click(object sender, EventArgs e) { var form = new EditOrderForm(); Order order = ((Order)this.orderDataGridView.CurrentRow.DataBoundItem); form.OrderId = order.OrderId; form.ShowDialog(); }
private void ShowEditForm(int?orderID) { using (EditOrderForm form = new EditOrderForm(orderID)) { form.ShowDialog(this); if (form.OrderID.HasValue) { Reload(); OrdersGridView.FocusedRowHandle = OrdersGridView.LocateByValue("Oid", form.OrderID.Value, rowHandle => OrdersGridView.FocusedRowHandle = (int)rowHandle); } } }
private void brnAdd_Click(object sender, EventArgs e) { var record = new Record(); var result = new EditOrderForm(record).ShowDialog(); if (result == DialogResult.OK) { record.EmployeeID = Settings.CurrentUser.ID; _empService.AddOrder(Settings.CurrentUser.ID, record); MetroMessageBox.Show(this, "Заказ успешно добавлен", "Справка", MessageBoxButtons.OK, MessageBoxIcon.Information); UpdateOrdersDtg(); UpdateCounter(); } }
private void btnEdit_Click(object sender, EventArgs e) { var record = _items.FirstOrDefault(x => x.ID == Convert.ToInt32(dtgOrders.SelectedRows[0].Cells[0].FormattedValue)); if (record != null) { var result = new EditOrderForm(record).ShowDialog(); if (result == DialogResult.OK) { record.EmployeeID = Settings.CurrentUser.ID; _empService.Update(Settings.CurrentUser.ID, record); MetroMessageBox.Show(this, "Заказ успешно изменен", "Справка", MessageBoxButtons.OK, MessageBoxIcon.Information); UpdateOrdersDtg(); } } }
private void ShowEditForm(int?orderID) { var form = new EditOrderForm(orderID); form.FormClosed += EditFormClosed; var documentManager = DocumentManager.FromControl(MdiParent); if (documentManager != null) { documentManager.View.AddDocument(form); } else { try { form.ShowDialog(); } finally { form.Dispose(); } } }