Example #1
0
        public MedEquipmentItem AddMedEquipmentItem(MedEquipmentType medEquipmentType, Room room)
        {
            medEquipmentType.Number += 1;
            medEquipmentType         = MedEquipmentTypeRepository.GetInstance().Update(medEquipmentType);
            MedEquipmentItem mei  = MedEquipmentItemRepository.GetInstance().Create(new MedEquipmentItem(medEquipmentType.GetId(), room.GetId(), medEquipmentType));
            ItemCount        temp = null;

            foreach (ItemCount ic in room.ItemCount)
            {
                if (mei.TypeId == ic.ItemId)
                {
                    temp = ic;
                    break;
                }
            }
            if (temp == null)
            {
                List <MedEquipmentItem> meiList = new List <MedEquipmentItem>();
                meiList.Add(mei);
                ItemCount ic = ItemCountRepository.GetInstance().Create(new ItemCount(1, medEquipmentType.GetId(), meiList.ToArray()));
                room.ItemCount.Add(ic);
                RoomRepository.GetInstance().Update(room);
            }
            else
            {
                temp.Number += 1;
                ItemCountRepository.GetInstance().Update(temp);
            }
            return(mei);
        }
 public MedEquipmentItem Update(MedEquipmentItem item)
 {
     string[] data = new string[3];
     data[0] = item.GetId().ToString();
     data[1] = item.TypeId.ToString();
     data[2] = item.RoomId.ToString();
     if (Persistence.EditEntry(path, data))
     {
         return(item);
     }
     else
     {
         return(null);
     }
 }
 public MedEquipmentItem Create(MedEquipmentItem item)
 {
     string[] data = new string[3];
     item.SetId(Persistence.GetNewId(path));
     data[0] = item.GetId().ToString();
     data[1] = item.TypeId.ToString();
     data[2] = item.RoomId.ToString();
     if (Persistence.WriteEntry(path, data))
     {
         return(item);
     }
     else
     {
         return(null);
     }
 }
Example #4
0
 public bool DeleteMedEquipmentitem(MedEquipmentItem medEquipmentItem)
 {
     return(MedEquipmentItemRepository.GetInstance().Delete(medEquipmentItem.GetId()));
 }
 public bool DeleteMedEquipmentitem(MedEquipmentItem medEquipmentItem)
 {
     return(iRoomAndInventoryService.DeleteMedEquipmentitem(medEquipmentItem));
 }