public Manager Get(int id) { ManagerFactory managerFactory = new ManagerFactory(); ManagerTable <Manager> instanceManager = (ManagerTable <Manager>)managerFactory.GetManagerInstance(); return(instanceManager.Select(id)); }
public Collection <T> Select() { DispatcherFactory dispatcherFactory = new DispatcherFactory(); DispatcherTable <Dispatcher> instanceDispatcher = (DispatcherTable <Dispatcher>)dispatcherFactory.GetDispatcherInstance(); ManagerFactory managerFactory = new ManagerFactory(); ManagerTable <Manager> instanceManager = (ManagerTable <Manager>)managerFactory.GetManagerInstance(); XDocument xDoc = XDocument.Load(Configuration.XMLFILEPATH); Collection <T> messages = new Collection <T>(); List <XElement> elements = xDoc.Descendants("Messages").Descendants("Message").ToList(); foreach (var element in elements) { Message message = new Message(); message.id = int.Parse(element.Attribute("id").Value); message.created = DateTime.Parse(element.Attribute("created").Value); message.text = element.Attribute("text").Value; message.isRead = bool.Parse(element.Attribute("isRead").Value); message.dispatcher = instanceDispatcher.Select(int.Parse(element.Attribute("dispatcherId").Value)); message.manager = instanceManager.Select(int.Parse(element.Attribute("managerId").Value)); messages.Add((T)message); } return(messages); }
public IEnumerable <Manager> Get() { ManagerFactory managerFactory = new ManagerFactory(); ManagerTable <Manager> instanceManager = (ManagerTable <Manager>)managerFactory.GetManagerInstance(); return(instanceManager.Select()); }