Пример #1
0
        private void processPurchaseTransactionChild(PurchaseTransactionUC theUC)
        {
            if (theUC != null && theUC.SelectedItem != null)
            {
                if (this.items.Contains(theUC.SelectedItem))
                {
                    var dupIndex = this.items.IndexOf(theUC.SelectedItem);
                    var dupItem  = this.items[dupIndex];
                    var totalQty = dupItem.Quantity + theUC.SelectedItem.Quantity;
                    if (totalQty > theUC.SelectedItem.ReturnableQuantity)
                    {
                        ErrorHandler.DisplayErrorBox("Duplicate Item", "The selected item has already been added to the transaction.");
                    }
                    else
                    {
                        dupItem.Quantity += theUC.SelectedItem.Quantity;
                    }
                    return;
                }

                this.items.Add(theUC.SelectedItem);

                if (this.DataGrid.DataSource == null)
                {
                    this.DataGrid.DataSource = this.items;
                    var dataGridViewColumn = this.DataGrid.Columns["ReturnableQuantity"];
                    if (dataGridViewColumn != null)
                    {
                        dataGridViewColumn.Visible = false;
                    }
                }
            }
        }
Пример #2
0
        private void processPurchaseTransactionChild(PurchaseTransactionUC theUC)
        {
            if (theUC != null && theUC.SelectedItem != null)
            {
                if (this.items.Contains(theUC.SelectedItem))
                {
                    var dupIndex = this.items.IndexOf(theUC.SelectedItem);
                    var dupItem = this.items[dupIndex];
                    var totalQty = dupItem.Quantity + theUC.SelectedItem.Quantity;
                    if (totalQty > theUC.SelectedItem.ReturnableQuantity)
                    {
                        ErrorHandler.DisplayErrorBox("Duplicate Item", "The selected item has already been added to the transaction.");
                    }
                    else
                    {
                        dupItem.Quantity += theUC.SelectedItem.Quantity;
                    }
                    return;
                }

                this.items.Add(theUC.SelectedItem);

                if (this.DataGrid.DataSource == null)
                {
                    this.DataGrid.DataSource = this.items;
                    var dataGridViewColumn = this.DataGrid.Columns["ReturnableQuantity"];
                    if (dataGridViewColumn != null)
                    {
                        dataGridViewColumn.Visible = false;
                    }
                }
            }
        }