Example #1
0
        private void gridViewOrders_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                MDataSet.OrdersRow _ordsRow = this.gridViewOrders.GetDataRow(this.gridViewOrders.FocusedRowHandle) as MDataSet.OrdersRow;



                if (_ordsRow == null)
                {
                    return;
                }

                if (_ordsRow.Reserved > 0)
                {
                    MessageBox.Show("Этот товар уже для вас зарезервирован: " + _ordsRow.Reserved.ToString());

                    return;
                }

                if (_ordsRow.QuantityNow > 0)
                {
                    MessageBox.Show("Этот товар вам уже отгружен! ");

                    return;
                }


                if (_ordsRow.isClose)
                {
                    MessageBox.Show("Заявка была закрыта : " + _ordsRow.AuthorLastModif);

                    return;
                }


                DialogQuantityOrder _DialogQuantityOrder = new DialogQuantityOrder(_ordsRow.ProductRow, _ordsRow);

                if (_DialogQuantityOrder.ShowDialog(this) == DialogResult.OK)
                {
                    this.SaveOrdersRow(_ordsRow);
                }
                else
                {
                    _ordsRow.RejectChanges();
                }
            }
            catch (Exception err)

            {
                MessageBox.Show(err.Message);

                MainForm.Log("gridViewOrders_DoubleClick" + err.Message);
            }
        }
Example #2
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            MDataSet.ProductRow _prod = this.gridViewProd.GetDataRow(this.gridViewProd.FocusedRowHandle) as MDataSet.ProductRow;

            if (_prod != null)
            {
                try
                {
                    MDataSet.OrdersRow _ord = (this.ordersBindingSource.AddNew() as DataRowView).Row as MDataSet.OrdersRow;

                    DialogQuantityOrder _DialogQuantityOrder = new DialogQuantityOrder(_prod, _ord);

                    if (_DialogQuantityOrder.ShowDialog(this) == DialogResult.OK)
                    {
                        try
                        {
                            this.ordersBindingSource.EndEdit();

                            this.ordersBindingSource.ResetBindings(false);

                            MainForm.Log(" this.ordersBindingSource.EndEdit успешно");
                        }
                        catch (Exception err)
                        {
                            MessageBox.Show(err.Message);

                            MainForm.Log(err.Message);
                        }
                    }
                    else
                    {
                        this.ordersBindingSource.CancelEdit();
                    }
                }
                catch (Exception err)

                {
                    MessageBox.Show(err.Message);

                    MainForm.Log("btAdd_Click" + err.Message);
                }
            }
        }
Example #3
0
        private void gridViewOrders_DoubleClick(object sender, EventArgs e)
        {

            try
            {
                MDataSet.OrdersRow _ordsRow = this.gridViewOrders.GetDataRow(this.gridViewOrders.FocusedRowHandle) as MDataSet.OrdersRow;



                if (_ordsRow == null) return;

                if (_ordsRow.Reserved > 0)
                {
                    MessageBox.Show("Этот товар уже для вас зарезервирован: " + _ordsRow.Reserved.ToString());

                    return;
                }

                if (_ordsRow.QuantityNow > 0)
                {
                    MessageBox.Show("Этот товар вам уже отгружен! ");

                    return;
                }


                if (_ordsRow.isClose)
                {
                    MessageBox.Show("Заявка была закрыта : " + _ordsRow.AuthorLastModif);

                    return;
                }


                DialogQuantityOrder _DialogQuantityOrder = new DialogQuantityOrder(_ordsRow.ProductRow, _ordsRow);

                if (_DialogQuantityOrder.ShowDialog(this) == DialogResult.OK)
                {

                    this.SaveOrdersRow(_ordsRow);

                }
                else
                    _ordsRow.RejectChanges();
            }
            catch (Exception err)

            {
            MessageBox.Show (err.Message);

                MainForm.Log ("gridViewOrders_DoubleClick" + err.Message);
            }
                
        }
Example #4
0
        private void btAdd_Click(object sender, EventArgs e)
        {

           
            MDataSet.ProductRow _prod = this.gridViewProd.GetDataRow(this.gridViewProd.FocusedRowHandle) as MDataSet.ProductRow;

            if (_prod != null)
            {
                try
                {

                    MDataSet.OrdersRow _ord = (this.ordersBindingSource.AddNew() as DataRowView).Row as MDataSet.OrdersRow;

                    DialogQuantityOrder _DialogQuantityOrder = new DialogQuantityOrder(_prod, _ord);

                    if (_DialogQuantityOrder.ShowDialog(this) == DialogResult.OK)
                    {
                        try
                        {

                            this.ordersBindingSource.EndEdit();

                            this.ordersBindingSource.ResetBindings(false);
                        
                            MainForm.Log(" this.ordersBindingSource.EndEdit успешно");
                        }
                        catch (Exception err)
                        {

                            MessageBox.Show(err.Message);

                            MainForm.Log(err.Message);
                        
                        }
                    }
                    else
                    {
                        this.ordersBindingSource.CancelEdit();
                    }
                }
                catch (Exception err)

                {
                    MessageBox.Show(err.Message);

                    MainForm.Log("btAdd_Click" + err.Message);
                }


            }
           

        
        }