private void _toolStripMenuItemEdit_Click(object sender, EventArgs e) { if (_directivesViewer.SelectedItem == null) { return; } if (_directivesViewer.SelectedItem is InitialOrder) { var editForm = new InitialOrderFormNew(_directivesViewer.SelectedItem as InitialOrder); if (editForm.ShowDialog() == DialogResult.OK) { AnimatedThreadWorker.RunWorkerAsync(); } } else if (_directivesViewer.SelectedItem is RequestForQuotation) { var editForm = new QuatationOrderFormNew(_directivesViewer.SelectedItem as RequestForQuotation); if (editForm.ShowDialog() == DialogResult.OK) { AnimatedThreadWorker.RunWorkerAsync(); } } else { var editForm = new PurchaseOrderForm(_directivesViewer.SelectedItem as PurchaseOrder); if (editForm.ShowDialog() == DialogResult.OK) { AnimatedThreadWorker.RunWorkerAsync(); } } }
/// <summary> /// Реагирует на двойной щелчок в списке элементов /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void RadGridView1_DoubleClick(object sender, EventArgs e) { if (SelectedItem == null) { return; } var editForm = new PurchaseOrderForm(SelectedItem); if (editForm.ShowDialog() == DialogResult.OK) { var subs = GetListViewSubItems(SelectedItem); for (int i = 0; i < subs.Count; i++) { radGridView1.SelectedRows[0].Cells[i].Value = subs[i].Text; } } }
protected override void RadGridView1_DoubleClick(object sender, EventArgs e) { if (SelectedItem == null) { return; } if (SelectedItem is InitialOrder) { var editForm = new InitialOrderFormNew(SelectedItem as InitialOrder); if (editForm.ShowDialog() == DialogResult.OK) { var subs = GetListViewSubItems(SelectedItem); for (int i = 0; i < subs.Count; i++) { radGridView1.SelectedRows[0].Cells[i].Value = subs[i].Text; } } } else if (SelectedItem is RequestForQuotation) { var editForm = new QuatationOrderFormNew(SelectedItem as RequestForQuotation); if (editForm.ShowDialog() == DialogResult.OK) { var subs = GetListViewSubItems(SelectedItem); for (int i = 0; i < subs.Count; i++) { radGridView1.SelectedRows[0].Cells[i].Value = subs[i].Text; } } } else { var editForm = new PurchaseOrderForm(SelectedItem as PurchaseOrder); if (editForm.ShowDialog() == DialogResult.OK) { var subs = GetListViewSubItems(SelectedItem); for (int i = 0; i < subs.Count; i++) { radGridView1.SelectedRows[0].Cells[i].Value = subs[i].Text; } } } }
private void InitForm(string mode) { Form newForm; DataGridViewRow selectedRow = new DataGridViewRow(); if (mode.Equals("Edit")) { try { selectedRow = DgvGeneric.SelectedRows[0]; } catch (Exception ex) { Console.WriteLine(ex.Message); MessageBox.Show( text: "Debes seleccionar una fila", caption: "Error", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error); return; } } switch (activeGrid) { case 0: newForm = new EmployeeForm(mode, selectedRow); newForm.ShowDialog(); break; case 1: newForm = new DepartmentForm(mode, selectedRow); newForm.ShowDialog(); break; case 2: newForm = new ItemForm(mode, selectedRow); newForm.ShowDialog(); break; case 3: newForm = new BrandForm(mode, selectedRow); newForm.ShowDialog(); break; case 4: newForm = new UnitForm(mode, selectedRow); newForm.ShowDialog(); break; case 5: newForm = new ProviderForm(mode, selectedRow); newForm.ShowDialog(); break; case 6: newForm = new ItemRequestForm(mode, selectedRow); newForm.ShowDialog(); break; case 7: newForm = new PurchaseOrderForm(mode, selectedRow); newForm.ShowDialog(); break; case 8: newForm = new UserForm(mode, selectedRow); newForm.ShowDialog(); break; } }