private void ExcuteAddNewItemBorrowCommand() { if (SelectedWarehouse != null && SelectedWarehouse.Id != -1) { SelectedItemBorrow = new ItemBorrowDTO { ItemBorrowDate = DateTime.Now, WarehouseId = SelectedWarehouse.Id, Quantity = 1 }; SelectedItemQuantity = null; SelectedWarehouseForItem = SelectedWarehouse; } }
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); }
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); }
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); } }
public bool ObjectExists(ItemBorrowDTO itemBorrow) { return(false); }