Пример #1
0
 public Librarian(Guid id, string fullName, LibraryDepartment department)
     : this()
 {
     Id         = id;
     FullName   = fullName;
     Department = department;
 }
 public Librarian(string fullName, LibraryDepartment department)
     : this()
 {
     Id = Guid.NewGuid();
     FullName = fullName;
     Department = department;
 }
Пример #3
0
 public Librarian(string fullName, LibraryDepartment department)
     : this()
 {
     Id         = Guid.NewGuid();
     FullName   = fullName;
     Department = department;
 }
 public Librarian(Guid id, string fullName, LibraryDepartment department)
     : this()
 {
     Id = id;
     FullName = fullName;
     Department = department;
 }
        static void InitData(Repository repository)
        {
            LibraryDepartment abonement = new LibraryDepartment("Абонемент", true);
            LibraryDepartment readingRoom = new LibraryDepartment("Читальный зал", false);
            repository.LibraryDepartmentRepository.Save(abonement);
            repository.LibraryDepartmentRepository.Save(readingRoom);

            repository.LibrarianRepository.Save(new Librarian("Мария Иванова", abonement));
            repository.LibrarianRepository.Save(new Librarian("Татьяна Петрова", readingRoom));

            repository.ReaderRepository.Save(new Reader("Иван Иванов", "Брест"));
            repository.ReaderRepository.Save(new Reader("Петр Петров", "Брест"));
            repository.ReaderRepository.Save(new Reader("Сидор Сидоров", "Брест"));

            repository.BookRepository.Save(new Book("Бен Ватсон", "С# 4.0 на примерах", 2000, abonement));
            repository.BookRepository.Save(new Book("Кристиан Нейгел", "C# 4.0 и платформа .NET 4", 2001, abonement));
            repository.BookRepository.Save(new Book("Михаил Фленов", "Библия C#", 2002, abonement));
            repository.BookRepository.Save(new Book("Чарльз Петцольд", "Программирование в тональности C#", 2003, abonement));
            repository.BookRepository.Save(new Book("Герберт Шилдт", "C# 4.0 полное руководство", 2004, abonement));
            repository.BookRepository.Save(new Book("Трей Нэш", "C# 2010. Ускоренный курс ", 2005, readingRoom));
            repository.BookRepository.Save(new Book("Мэтью Мак-Дональд", "Microsoft ASP.NET 3.5 с примерами", 2006, readingRoom));
            repository.BookRepository.Save(new Book("Чарльз Петцольд", "Программирование с использованием Windows Forms", 2007, readingRoom));
            repository.BookRepository.Save(new Book("Фаронов В.В.", "Программирование на языке С#", 2008, readingRoom));
            repository.BookRepository.Save(new Book("Либерти Дж.", "Программирование на C#", 2009, readingRoom));
        }
		private static bool LibraryDepartmentCompare(LibraryDepartment a, LibraryDepartment b)
		{
			if (Object.ReferenceEquals(a, b))
			{
				return true;
			}
			return a.Id == b.Id && a.Name == b.Name;
		}
 private static bool LibraryDepartmentCompare(LibraryDepartment a, LibraryDepartment b)
 {
     if (Object.ReferenceEquals(a, b))
     {
         return true;
     }
     return a.Id == b.Id && a.Name == b.Name;
 }
Пример #8
0
 public Book(Guid id, string author, string title, int year, LibraryDepartment department)
     : this()
 {
     Id         = id;
     Author     = author;
     Title      = title;
     Year       = year;
     Department = department;
 }
 public override void Save(LibraryDepartment item)
 {
     LibraryDepartment department = GetItem(item.Id);
     if (department == null)
     {
         context.LibraryDepartments.InsertOnSubmit(item);
     }
     else
     {
         department.Name = item.Name;
         department.IsAbonement = item.IsAbonement;
     }
     context.SubmitChanges();
 }
        public LibraryClassTest()
        {
            repository = new Repository(new MSSQLRepositoryFactory());

            reader = new Reader("Иван Иванов", "Брест");
            repository.ReaderRepository.Save(reader);
            department = new LibraryDepartment("Абонемент", true);
            repository.LibraryDepartmentRepository.Save(department);
            librarian = new Librarian("Мария Иванова", department);
            repository.LibrarianRepository.Save(librarian);
            book = new Book("Михаил Фленов", "Библия C#", 2002, department);
            repository.BookRepository.Save(book);
            book2 = new Book("Бен Ватсон", "С# 4.0 на примерах", 2000, department);
            repository.BookRepository.Save(book2);

            library = new LibraryClass(repository);
        }
 partial void UpdateLibraryDepartment(LibraryDepartment instance);
 partial void InsertLibraryDepartment(LibraryDepartment instance);
 public override IEnumerable<Book> GetBooksByDepartment(LibraryDepartment department)
 {
     return context.Books.Where(book => book.Department.Id == department.Id);
 }
 public override void Remove(LibraryDepartment item)
 {
     Remove(item.Id);
 }
Пример #15
0
 partial void DeleteLibraryDepartment(LibraryDepartment instance);
Пример #16
0
 partial void UpdateLibraryDepartment(LibraryDepartment instance);
Пример #17
0
 partial void InsertLibraryDepartment(LibraryDepartment instance);
 public LibraryDepartmentTest()
 {
     ld1 = new LibraryDepartment("Name1", true);
     ld2 = new LibraryDepartment("Name2", false);
     ld3 = new LibraryDepartment(ld1.Id, "Name1", true);
 }
 public IEnumerable<Book> GetBooksByDepartment(LibraryDepartment department)
 {
     return repository.BookRepository.GetBooksByDepartment(department);
 }
 partial void DeleteLibraryDepartment(LibraryDepartment instance);