Ejemplo n.º 1
0
        public void addToUpdatableItemList(ItemDetailEditViewModel itemDetailModel)
        {
            foreach (var idm in UpdatableItemList)
            {
                var item    = idm.Item;
                var current = itemDetailModel.Item;

                if (item.Id == current.Id)
                {
                    // No need to add. Item is already in list.
                    return;
                }
            }

            UpdatableItemList.Add(itemDetailModel);
            updateLocationDetailsShownVariables();
        }
Ejemplo n.º 2
0
        private async Task AddItemByAsync(Item item)
        {
            var  qrId = item.QrId;
            bool isNewItemLocation = item.Domain.Name.Equals(Constants.locationDomainName);

            if (LocationMode)
            {
                if (isNewItemLocation && this.SelectedLocation == null)
                {
                    this.SelectedLocation = item;
                    var message = "Changed location by QrId: " + qrId;
                    FireViewModelMessageEvent(message);
                    return;
                }

                if (this.SelectedLocation != null && this.SelectedLocation.Id == item.Id)
                {
                    var message = "The item with QrId " + qrId + " has already been scanned. It is the active location.";
                    FireViewModelMessageEvent(message);
                    return;
                }
            }

            if (StatusMode)
            {
                if (isNewItemLocation)
                {
                    var message = "Status mode is only for inventory items. Location was scanned with qrid: " + qrId;
                    FireViewModelMessageEvent(message);
                    return;
                }
            }

            // Verify not already in list
            foreach (var ittrItem in UpdatableItemList)
            {
                var id = ittrItem.Item.Id;
                if (item.Id == id)
                {
                    var message = "The item with QrId " + qrId + " has already been scanned.";
                    FireViewModelMessageEvent(message);
                    return;
                }
            }

            var hasPemission = await itemApi.VerifyUserPermissionForItemAsync(item.Id);

            if (hasPemission != null && (bool)hasPemission)
            {
                //Add
                var editDetailModel = new ItemDetailEditViewModel(item);
                addToUpdatableItemList(editDetailModel);
                var message = "Added item with QrId: " + qrId;
                FireViewModelMessageEvent(message);
                return;
            }
            else
            {
                var message = "The user does not have sufficient privilages to update scanned item. QrId: " + qrId;
                FireViewModelMessageEvent(message);
                return;
            }
        }
Ejemplo n.º 3
0
 public void removeFromUpdatableItemList(ItemDetailEditViewModel itemDetailModel)
 {
     UpdatableItemList.Remove(itemDetailModel);
     updateLocationDetailsShownVariables();
 }