예제 #1
0
        public Manager Get(int id)
        {
            ManagerFactory         managerFactory  = new ManagerFactory();
            ManagerTable <Manager> instanceManager = (ManagerTable <Manager>)managerFactory.GetManagerInstance();

            return(instanceManager.Select(id));
        }
예제 #2
0
        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);
        }
예제 #3
0
        public IEnumerable <Manager> Get()
        {
            ManagerFactory         managerFactory  = new ManagerFactory();
            ManagerTable <Manager> instanceManager = (ManagerTable <Manager>)managerFactory.GetManagerInstance();

            return(instanceManager.Select());
        }