Ejemplo n.º 1
0
        private void gridViewinvDet_DoubleClick(object sender, EventArgs e)
        {
            if (this.gridViewinvDet.IsValidRowHandle(this.gridViewinvDet.FocusedRowHandle) & this.gridViewinvDet.State == GridState.Normal & !this.gridViewinvDet.IsFilterRow(this.gridViewinvDet.FocusedRowHandle))
            {
                FormDialog _formDialog = new FormDialog();
                _formDialog.AcceptButton = null;
                _formDialog.Text         = "»зменить строку";

                MDataSet.InvoiceDetailRow sourceRow = ((this.invoiceDetailBindingSource.CurrencyManager.Current as DataRowView).Row as MDataSet.InvoiceDetailRow);

                if ((sourceRow != null))
                {
                    MDataSet.ProductRow productRow = (this.productBindingSource.DataSource as MDataSet.ProductDataTable).FindByID(sourceRow.ProductRef);

                    if (productRow == null)
                    {
                        MessageBox.Show("ќшибка поиска товара");
                        return;
                    }

                    InvoiceDetailRowAdd _invoiceDetailRowAdd = new InvoiceDetailRowAdd(sourceRow, sourceRow.RemainsRow, productRow);
                    _formDialog.panel.Controls.Add(_invoiceDetailRowAdd);

                    if (DialogResult.OK == _formDialog.ShowDialog(this))
                    {
                        this.invoiceDetailBindingSource.EndEdit();
                    }

                    else
                    {
                        this.invoiceDetailBindingSource.CancelEdit();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            /*создать новую строку, указатель на нее в  дл¤ редактировани¤*/
            MDataSet.RemainsRow _rems = this.gridViewRemainsInvDetEdt.GetDataRow(this.gridViewRemainsInvDetEdt.FocusedRowHandle) as MDataSet.RemainsRow;
            if (_rems == null)
            {
                return;
            }



            FormDialog _formDialog = new FormDialog();

            _formDialog.AcceptButton = _formDialog.btOk;
            _formDialog.Text         = "ƒобавить строку";

            MDataSet.InvoiceDetailRow sourceRow = ((this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow);

            MDataSet.RemainsRow remainsRow = ((this.RemainsBindingSource.CurrencyManager.Current as DataRowView).Row as  MDataSet.RemainsRow);

            MDataSet.ProductRow _productRow = (this.productBindingSource.DataSource as MDataSet.ProductDataTable).FindByID(remainsRow.ProductRef);


            if ((sourceRow != null) & (remainsRow != null))
            {
                InvoiceDetailRowAdd _invoiceDetailRowAdd = new InvoiceDetailRowAdd(sourceRow, remainsRow, _productRow);
                _formDialog.panel.Controls.Add(_invoiceDetailRowAdd);

                if (DialogResult.OK == _formDialog.ShowDialog(this))
                {
                    remainsRow.AcceptChanges();
                    this.invoiceDetailBindingSource.EndEdit();
                }
                else
                {
                    this.invoiceDetailBindingSource.CancelEdit();
                    remainsRow.RejectChanges();
                }
            }
        }
Ejemplo n.º 3
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            /*создать новую строку, указатель на нее в  дл¤ редактировани¤*/
            MDataSet.RemainsRow _rems = this.gridViewRemainsInvDetEdt.GetDataRow(this.gridViewRemainsInvDetEdt.FocusedRowHandle) as MDataSet.RemainsRow;
            if (_rems == null) return;

            

                    FormDialog _formDialog = new FormDialog();
                    _formDialog.AcceptButton = _formDialog.btOk;
                    _formDialog.Text = "ƒобавить строку";

                    MDataSet.InvoiceDetailRow sourceRow = ((this.invoiceDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.InvoiceDetailRow);
                 
                    MDataSet.RemainsRow remainsRow = ((this.RemainsBindingSource.CurrencyManager.Current as DataRowView).Row as  MDataSet.RemainsRow);

                    MDataSet.ProductRow _productRow = (this.productBindingSource.DataSource as MDataSet.ProductDataTable).FindByID(remainsRow.ProductRef);


                    if ((sourceRow != null) & (remainsRow != null))
                    {
                        InvoiceDetailRowAdd _invoiceDetailRowAdd = new InvoiceDetailRowAdd(sourceRow, remainsRow,_productRow);
                        _formDialog.panel.Controls.Add(_invoiceDetailRowAdd);

                        if (DialogResult.OK == _formDialog.ShowDialog(this))
                        {  
                            remainsRow.AcceptChanges();
                            this.invoiceDetailBindingSource.EndEdit();
                          
                        }
                        else
                        {
                            this.invoiceDetailBindingSource.CancelEdit();
                            remainsRow.RejectChanges();
                        }
                    }
       }
Ejemplo n.º 4
0
        private void gridViewinvDet_DoubleClick(object sender, EventArgs e)
        {

            if (this.gridViewinvDet.IsValidRowHandle(this.gridViewinvDet.FocusedRowHandle) & this.gridViewinvDet.State == GridState.Normal & !this.gridViewinvDet.IsFilterRow(this.gridViewinvDet.FocusedRowHandle))
            {
                FormDialog _formDialog = new FormDialog();
                _formDialog.AcceptButton = null;
                _formDialog.Text = "»зменить строку";

                MDataSet.InvoiceDetailRow sourceRow = ((this.invoiceDetailBindingSource.CurrencyManager.Current as DataRowView).Row as MDataSet.InvoiceDetailRow);
               
                if ((sourceRow != null) )
                {
                    MDataSet.ProductRow productRow = (this.productBindingSource.DataSource as MDataSet.ProductDataTable).FindByID(sourceRow.ProductRef);

                    if (productRow == null)
                    {
                        MessageBox.Show("ќшибка поиска товара");
                        return;
                    }

                    InvoiceDetailRowAdd _invoiceDetailRowAdd = new InvoiceDetailRowAdd(sourceRow, sourceRow.RemainsRow,productRow);
                    _formDialog.panel.Controls.Add(_invoiceDetailRowAdd);

                    if (DialogResult.OK == _formDialog.ShowDialog(this))

                        this.invoiceDetailBindingSource.EndEdit();

                    else

                        this.invoiceDetailBindingSource.CancelEdit();

                }
            }
        }