private void AdjustInventory()
        {
            if (!dxValidationProvider1.Validate())
            {
                return;
            }

            int qty        = Int32.Parse(adjustmentQtyEdit.Value.ToString());
            var sourceType = sourceTypeLookUp.EditValue as AdjustmentTransactionType;

            var success = false;

            if (InventoryType == "Consumable")
            {
                success = MaterialService.AdjustMaterialConsumableItem(m_part, m_sfl, qty, commentsText.Text, sourceType, m_messages);
            }
            else
            {
                success = MaterialService.AdjustMaterialWarehouseItem(m_part, m_domain, m_rackLocation, qty,
                                                                      commentsText.Text, sourceType, m_messages);
            }

            if (success)
            {
                Scout.Core.UserInteraction.Dialog.ShowMessage("Material Qty Adjusted.", UserMessageType.Information);
                Reset();
            }
        }
        public bool Undo(RepairComponent rc, Transaction transaction)
        {
            var part = m_repo.Get <Part>(p => p.Id == transaction.Part.Id);
            var sfl  = m_repo.Get <Shopfloorline>(s => s.Label == transaction.DepartLocation);

            var transType = new AdjustmentTransactionType("MATLUNDO", "Service part consumption reversed", "IN");

            ExecutionHelpers.ThrowIfNull(() => rc, "Cannot find repair record for this transaction.");

            rc.ConsumptionId = default(int);

            return(MaterialService.AdjustMaterialConsumableItem
                       (part, sfl, transaction.Qty, "Service part consumption reversed.", transType, null));
        }