Exemplo n.º 1
0
        public OrderTextRepository(ReaderRepository readerRepository, BookRepository bookRepository,
                                   LibraryDepartmentRepository libraryDepartmentRepository, LibrarianRepository librarianRepository)
        {
            this.readerRepository            = readerRepository;
            this.bookRepository              = bookRepository;
            this.libraryDepartmentRepository = libraryDepartmentRepository;
            this.librarianRepository         = librarianRepository;

            if (!Directory.GetParent(FileName).Exists)
            {
                Directory.GetParent(FileName).Create();
            }
            if (!File.Exists(FileName))
            {
                File.Create(FileName).Close();
            }
        }
 public OrderObjectRepository(ReaderRepository readerRepository, BookRepository bookRepository,
                              LibraryDepartmentRepository libraryDepartmentRepository, LibrarianRepository librarianRepository)
 {
     this.readerRepository            = readerRepository;
     this.bookRepository              = bookRepository;
     this.libraryDepartmentRepository = libraryDepartmentRepository;
     this.librarianRepository         = librarianRepository;
     orders = new List <Order>();
 }
 public OrderRepository CreateOrderRepository(ReaderRepository readerRepository, BookRepository bookRepository,
                                              LibraryDepartmentRepository libraryDepartmentRepository, LibrarianRepository librarianRepository)
 {
     return(new OrderTextRepository(readerRepository, bookRepository, libraryDepartmentRepository, librarianRepository));
 }
        public OrderXMLRepository(ReaderRepository readerRepository, BookRepository BookRepository,
                                  LibraryDepartmentRepository libraryDepartmentRepository, LibrarianRepository librarianRepository)
        {
            this.readerRepository            = readerRepository;
            this.bookRepository              = BookRepository;
            this.libraryDepartmentRepository = libraryDepartmentRepository;
            this.librarianRepository         = librarianRepository;

            if (!Directory.GetParent(FileName).Exists)
            {
                Directory.GetParent(FileName).Create();
            }
            if (File.Exists(FileName))
            {
                document = XDocument.Load(FileName);
            }
            else
            {
                document = new XDocument(
                    new XDeclaration("1.0", "utf-8", "yes"),
                    new XElement("Orders", null));
                document.Save(FileName);
            }
        }