private void gridViewInvRem_DoubleClick(object sender, EventArgs e) { MDataSet.RemainsRow _rem = this.gridViewInvRem.GetDataRow(this.gridViewInvRem.FocusedRowHandle) as MDataSet.RemainsRow; if (_rem != null) { MDataSet.InvoiceDetailRow _newRow = (this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow; InvoiceDetailAdd _invoceDetailAdd = new InvoiceDetailAdd(_newRow, _rem, _mainForm); FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить строку"; formDialog.AcceptButton = null; formDialog.panel.Controls.Add(_invoceDetailAdd); if (DialogResult.OK == formDialog.ShowDialog(this)) { this.invoiceDetailBindingSource.EndEdit(); this.SaleInvoiceDetail(_newRow); } else { this.invoiceDetailBindingSource.CancelEdit(); this.mDataSet.ReceiptRemains.RejectChanges(); } } }
private void gridViewInvRem_DoubleClick(object sender, EventArgs e) { MDataSet.RemainsRow _rem = this.gridViewInvRem.GetDataRow(this.gridViewInvRem.FocusedRowHandle) as MDataSet.RemainsRow; if (_rem != null) { MDataSet.InvoiceDetailRow _newRow = (this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow; InvoiceDetailAdd _invoceDetailAdd = new InvoiceDetailAdd(_newRow, _rem,_mainForm); FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить строку"; formDialog.AcceptButton = null; formDialog.panel.Controls.Add(_invoceDetailAdd); if (DialogResult.OK == formDialog.ShowDialog(this)) { this.invoiceDetailBindingSource.EndEdit(); this.SaleInvoiceDetail(_newRow); } else { this.invoiceDetailBindingSource.CancelEdit(); this.mDataSet.ReceiptRemains.RejectChanges(); } } }
private void gridControl1_DoubleClick(object sender, EventArgs e) { try { int focused = this.gridViewInvRem.FocusedRowHandle; MDataSet.RemainsRow _rem = this.gridViewInvRem.GetDataRow(this.gridViewInvRem.FocusedRowHandle) as MDataSet.RemainsRow; _mainForm.RefreshData(_rem); if (_rem != null) { MDataSet.InvoiceDetailRow _newRow = (this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow; InvoiceDetailAdd _invoceDetailAdd = new InvoiceDetailAdd(_newRow, _rem, _mainForm); FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить строку"; formDialog.panel.Controls.Add(_invoceDetailAdd); if (DialogResult.OK == formDialog.ShowDialog(this)) { this.invoiceDetailBindingSource.EndEdit(); this.SaleInvoiceDetail(_newRow); _mainForm.RefreshData(_newRow); } else { this.gridViewInvRem.BeginDataUpdate(); this.invoiceDetailBindingSource.CancelEdit(); _rem.RejectChanges(); this.gridViewInvRem.EndDataUpdate(); this.gridRem.Focus(); this.gridViewInvRem.FocusedRowHandle = focused; return; } _invoceDetailAdd.Dispose(); GC.Collect(); } } catch (Exception err) { MessageBox.Show(err.Message); MainForm.Log("gridControl1_DoubleClick " + err.Message); } }