예제 #1
0
        public void Dequeue(Data.Person dPerson)
        {
            if (dPerson == null)
            {
                throw new Exception.DequeueException(Exception.DequeueException.ResponseCodes.InvalidPerson);
            }

            lock ( ms_oSync )
            {
                System.Xml.Linq.XElement xWaitList = m_oXmlFilePersister.Load(mc_sStorageName) ?? new System.Xml.Linq.XElement("Waitlist");

                System.Xml.Linq.XElement xPersons = GetPersons(xWaitList);

                System.Xml.Linq.XElement xPerson = xPersons
                                                   .Elements("Person")
                                                   .Where(xPersonSearch => xPersonSearch.Attribute("Id").GetValue(Guid.Empty, s => new Guid(s)) == dPerson.Id)
                                                   .FirstOrDefault( );

                if (xPerson == null)
                {
                    throw new Exception.DequeueException(Exception.DequeueException.ResponseCodes.PersonNotFound);
                }
                else
                {
                    xPerson.Remove( );
                    m_oXmlFilePersister.Save(mc_sStorageName, xWaitList);
                }
            }
        }