예제 #1
0
        public Item UpdateLegacyObject(Item item, IUoMService _uomService, IItemTypeService _itemTypeService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService,
                                       IBarringService _barringService, IContactService _contactService, IMachineService _machineService,
                                       IPriceMutationService _priceMutationService, IContactGroupService _contactGroupService)
        {
            Barring barring = _barringService.GetObjectById(item.Id);

            if (barring != null)
            {
                _barringService.UpdateObject(barring, _barringService, _uomService, this, _itemTypeService,
                                             _contactService, _machineService, _warehouseItemService, _warehouseService,
                                             _contactGroupService, _priceMutationService);
                return(barring);
            }

            if (_validator.ValidUpdateLegacyObject(item, _uomService, this, _itemTypeService))
            {
                ContactGroup  contactGroup     = _contactGroupService.GetObjectByIsLegacy(true);
                Item          olditem          = _repository.GetObjectById(item.Id); // Note: olditem might be pointing to the same memory with item (share the same contents)
                PriceMutation oldpriceMutation = _priceMutationService.GetObjectById(item.PriceMutationId);
                if (olditem.SellingPrice != item.SellingPrice)
                {
                    DateTime      priceMutationTimeStamp = DateTime.Now;
                    PriceMutation priceMutation          = _priceMutationService.CreateObject(item, /*contactGroup,*/ priceMutationTimeStamp);
                    item.PriceMutationId = priceMutation.Id;
                    _priceMutationService.DeactivateObject(oldpriceMutation, priceMutationTimeStamp);
                }
                item = _repository.UpdateObject(item);
            }
            return(item);
        }
예제 #2
0
        public Item UpdateLegacyObject(Item item, IUoMService _uomService, IItemTypeService _itemTypeService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService,
                                       IBarringService _barringService, IContactService _contactService, IMachineService _machineService)
        {
            Barring barring = _barringService.GetObjectById(item.Id);

            if (barring != null)
            {
                _barringService.UpdateObject(barring, _barringService, _uomService, this, _itemTypeService,
                                             _contactService, _machineService, _warehouseItemService, _warehouseService);
                return(barring);
            }

            return(item = _validator.ValidUpdateLegacyObject(item, _uomService, this, _itemTypeService) ? _repository.UpdateObject(item) : item);
        }