Esempio n. 1
0
        public Room Read(uint id)
        {
            List <string[]> temp = Persistence.ReadEntryByPrimaryKey(path, id.ToString());

            string[]         icids = temp[0][3].Split(' ');
            List <ItemCount> ics   = new List <ItemCount>();

            foreach (string s in icids)
            {
                if (!s.Equals(""))
                {
                    ics.Add(ItemCountRepository.GetInstance().Read(uint.Parse(s)));
                }
            }
            Room room = new Room(uint.Parse(temp[0][0]), (RoomType)int.Parse(temp[0][1]), temp[0][2], ics);

            if ((RoomType)int.Parse(temp[0][1]) == RoomType.stationary)
            {
                string[]       pids = temp[0][5].Split(' ');
                List <Patient> p    = new List <Patient>();
                foreach (string s in pids)
                {
                    if (!s.Equals(""))
                    {
                        p.Add(PeopleRepository.GetInstance().Read(uint.Parse(s)) as Patient);
                    }
                }
                return(new StationaryRoom(room, int.Parse(temp[0][4]), p, StationaryRoomPatientsStateRepository.GetInstance().Read(uint.Parse(temp[0][6]))));
            }
            else
            {
                return(room);
            }
        }
Esempio n. 2
0
 public static ItemCountRepository GetInstance()
 {
     if (instance == null)
     {
         instance = new ItemCountRepository();
     }
     return(instance);
 }