Пример #1
0
        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();
        }
Пример #2
0
 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);
         }
     }
 }
Пример #3
0
        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();
            }
        }
Пример #4
0
        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();
                }
            }
        }
Пример #5
0
        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();
                }
            }
        }