private PAP.GenericResponse ReadPapXml() { try { var response = new PAP.GenericResponse(); var xmlDoc = XDocument.Load(@"Files\ReceivePAP.xml"); var packxmldata = new Packs(); var packlistxmldata = new PackLists(); var settings = new XmlReaderSettings { IgnoreWhitespace = true }; var buffer = Encoding.ASCII.GetBytes(xmlDoc.ToString()); var xmlStream = new MemoryStream(buffer); using (var xmlReader = XmlReader.Create(xmlStream, settings)) { var packXmlSerializer = new XmlSerializer(packxmldata.GetType()); var packlistXmlSerializer = new XmlSerializer(packlistxmldata.GetType()); packxmldata = (Packs)packXmlSerializer.Deserialize(xmlReader); packlistxmldata = (PackLists)packlistXmlSerializer.Deserialize(xmlReader); response.FailureInformation = CreatePacksFromXml(packxmldata.PackCollection).FailureInformation; response.FailureInformation += CreatePackListsFromXml(packlistxmldata.PackListCollection); } return(response); } catch (Exception ex) { LoggingMediator.Log("ReadPapXml"); LoggingMediator.Log(ex); throw; } }
internal void DeleteTask(PackTask task) { var list = PackLists.Where(p => p.PackListId == p.PackListId).FirstOrDefault(); list.Tasks.Remove(task); }
public void AddItemToPackList(PackList packList, PackItem item) { var list = PackLists.Where(p => p.PackListId == packList.PackListId).FirstOrDefault(); list.PackItems.Add(item); }
public void DeleteItem(PackItem item) { var list = PackLists.Where(p => p.PackListId == item.PackListId).FirstOrDefault(); list.PackItems.Remove(item); }
public void AddPackList(PackList packList) { PackLists.Add(packList); }