Exemplo n.º 1
0
 private void ExcuteAddNewItemBorrowCommand()
 {
     if (SelectedWarehouse != null && SelectedWarehouse.Id != -1)
     {
         SelectedItemBorrow = new ItemBorrowDTO
         {
             ItemBorrowDate = DateTime.Now,
             WarehouseId    = SelectedWarehouse.Id,
             Quantity       = 1
         };
         SelectedItemQuantity     = null;
         SelectedWarehouseForItem = SelectedWarehouse;
     }
 }
Exemplo n.º 2
0
        public string Disable(ItemBorrowDTO itemBorrow)
        {
            if (itemBorrow == null)
            {
                return(GenericMessages.ObjectIsNull);
            }

            string stat;

            try
            {
                _itemBorrowRepository.Update(itemBorrow);
                _unitOfWork.Commit();
                stat = string.Empty;
            }
            catch (Exception exception)
            {
                stat = exception.Message;
            }
            return(stat);
        }
Exemplo n.º 3
0
        public string Validate(ItemBorrowDTO itemBorrow)
        {
            if (null == itemBorrow)
            {
                return(GenericMessages.ObjectIsNull);
            }

            if (String.IsNullOrEmpty(itemBorrow.PersonName))
            {
                return(itemBorrow.PersonName + " " + GenericMessages.StringIsNullOrEmpty);
            }

            if (String.IsNullOrEmpty(itemBorrow.ShopName))
            {
                return(itemBorrow.ShopName + " " + GenericMessages.StringIsNullOrEmpty);
            }

            if (itemBorrow.Quantity < 1 || itemBorrow.Quantity > 100000)
            {
                return(itemBorrow.Quantity + " Quantity is above allowed limit");
            }
            return(string.Empty);
        }
Exemplo n.º 4
0
        public string InsertOrUpdate(ItemBorrowDTO itemBorrow)
        {
            try
            {
                var validate = Validate(itemBorrow);
                if (!string.IsNullOrEmpty(validate))
                {
                    return(validate);
                }

                if (ObjectExists(itemBorrow))
                {
                    return(GenericMessages.DatabaseErrorRecordAlreadyExists);
                }

                _itemBorrowRepository.InsertUpdate(itemBorrow);
                _unitOfWork.Commit();
                return(string.Empty);
            }
            catch (Exception exception)
            {
                return(exception.Message);
            }
        }
Exemplo n.º 5
0
 public bool ObjectExists(ItemBorrowDTO itemBorrow)
 {
     return(false);
 }