Ejemplo n.º 1
0
        static void InitApplication()
        {
            Repository repository = new Repository(new MSSQLRepositoryFactory());

            if (repository.BookRepository.GetItems().Count() == 0)
            {
                InitData(repository);
            }

            library = new LibraryClass(repository);

            userSession = new ConsoleUserSession(library);
        }
        static void Main(string[] args)
        {
            SetupListeners();

            // Testing
            //-------------------------------------------------------------------------

            // This still shows up in the output window in VS...
            Trace.WriteLine("This is a trace from the application, we want to see this.");

            // ...but the library function that calls trace no longer shows up.
            LibraryClass.MethodThatCallsTrace();

            // Now check the output window, the trace calls from that library will not be present.
        }
        public LibraryClassTest()
        {
            repository = new Repository(new ObjectRepositoryFactory());

            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);

            library = new LibraryClass(repository);
        }
Ejemplo n.º 4
0
        public List <ListBook> LoadBooks(LibraryClass library)
        {
            List <ListBook> result = new List <ListBook>();

            foreach (Book book in library.GetBooks())
            {
                result.Add(new ListBook()
                {
                    ID     = book.GetId(),
                    Title  = book.GetTitle(),
                    Author = book.GetAuthor()
                });
            }
            return(result);
        }
Ejemplo n.º 5
0
        public List <ListClient> LoadClients(LibraryClass library)
        {
            List <ListClient> res = new List <ListClient>();

            foreach (Client client in library.GetClients())
            {
                res.Add(new ListClient()
                {
                    ID        = client.GetId(),
                    FirstName = client.GetFirstName(),
                    LastName  = client.GetLastName(),
                    Books     = string.Join(",", client.GetAllBooks().Select(x => x.GetTitle()))
                });
            }
            return(res);
        }
        public LibraryClassTest()
        {
            repository = new Repository(new MSSQLRepositoryFactory());

            reader = new Reader("First Reader", "Brest");
            repository.ReaderRepository.Save(reader);
            department = new LibraryDepartment("Abonement", true);
            repository.LibraryDepartmentRepository.Save(department);
            librarian = new Librarian("First Librarian ", department);
            repository.LibrarianRepository.Save(librarian);
            book = new Book("First Author", "Title", 2002, department);
            repository.BookRepository.Save(book);
            book2 = new Book("Second Author", "Title", 2000, department);
            repository.BookRepository.Save(book2);

            library = new LibraryClass(repository);
        }
Ejemplo n.º 7
0
        public List <ListEvent> LoadEvents(LibraryClass library)
        {
            List <ListEvent> res = new List <ListEvent>();

            foreach (Event e in library.GetEvents())
            {
                res.Add(new ListEvent()
                {
                    Type            = e.Type,
                    CreatedAt       = e.CreatedAt,
                    ClientFirstName = e.Client.GetFirstName(),
                    ClientLastName  = e.Client.GetLastName(),
                    Title           = e.Book == null ? "n/a" : e.Book.GetTitle(),
                    Author          = e.Book == null ? "n/a" : e.Book.GetAuthor()
                });
            }
            return(res);
        }
Ejemplo n.º 8
0
        public MainWindow()
        {
            SimpleBookDao bookDao = new SimpleBookDao();

            bookDao.AddBook(new Book("Book 1", "Author 1", 0));
            bookDao.AddBook(new Book("Book 2", "Author 2", 1));
            bookDao.AddBook(new Book("Book 3", "Author 3", 2));
            bookDao.AddBook(new Book("Book 4", "Author 4", 3));
            bookDao.AddBook(new Book("Book 5", "Author 5", 4));
            library = new LibraryClass(bookDao);
            library.AddClient("Cli", "Ent");
            library.AddClient("Tne", "Ilc");
            library.BorrowBook(1, 1); //todo debug - KILL ME PLEASE
            InitializeComponent();
            BooksLw.ItemsSource   = LoadBooks(library);
            ClientsLw.ItemsSource = LoadClients(library);
            EventsLw.ItemsSource  = LoadEvents(library);
        }
Ejemplo n.º 9
0
    public static void MenuSetUpFixture()
    {
        // display warning messages
        Console.WriteLine("\nThis test MUST be run as an administrator.");
        Console.WriteLine("Otherwise the WinLdtpService will not work.");
        Console.WriteLine("And an \"Unable to connect...\" exception will be thrown.");
        Console.WriteLine("Do NOT use the mouse while this test is running.\n");

        //  create ldtp
        // failure does not throw a catchable object
        // it will fail at ldtp.LaunchApp() in LaunchAStyleWxLdtp()
        Console.WriteLine("Creating ldtp object");
        ldtp = new Ldtp.Ldtp("*AStyleWx");

        // compile astylewx
        Console.WriteLine("Compiling astylewx");
        LibraryClass.CompileWindowsAStyleWxExe("DLL Debug");
    }
Ejemplo n.º 10
0
        public void ShowMessage(string text)
        {
            try
            {
                LibraryClass cls = new LibraryClass();
                //cls.ShowMessage(text);
                //cls.OpenView(AndroidGlobal.glCtx, text);
                //cls.OpenView(text);
                //ShowView view = new ShowView();
                //view.Show
                var x = AndroidGlobal.glCtx;
                var t = cls.ReturnMessage(text);
                //cls.OpenGallery(x);
                //cls.OpenView(x, "Testing");

                //cls.OpenView(x);
            }
            catch (Exception ex)
            { }
        }
Ejemplo n.º 11
0
        public static void Main(string[] args)
        {
            var x = new LibraryClass();

            x.LibraryMethod();

            var config = new ConfigurationBuilder()
                         .AddCommandLine(args)
                         .AddEnvironmentVariables(prefix: "ASPNETCORE_")
                         .Build();

            var host = new WebHostBuilder()
                       .UseConfiguration(config)
                       .UseKestrel()
                       .UseContentRoot(Directory.GetCurrentDirectory())
                       .UseIISIntegration()
                       .UseStartup <Startup>()
                       .Build();

            host.Run();
        }
Ejemplo n.º 12
0
        public void LoadLibraries(string directory)
        {
            return;

            //Loop through each file in the given directory
            foreach (FileInfo fi in new DirectoryInfo(directory).GetFiles())
            {
                //Initialize our reflection assembly
                Assembly asm;
                //Attempt to load the file.
                try
                {
                    asm = Assembly.LoadFile(fi.FullName);
                }
                catch { continue; }
                //Get our types in our assembly
                foreach (Type t in asm.GetTypes())
                {
                    //If theres the type of AlterationLibrary...
                    if (t.BaseType == typeof(AlterationLibrary))
                    {
                        //Initialize our LibraryClass
                        LibraryClass Library_Class = new LibraryClass();
                        //Set our library instance
                        Library_Class.Library = (AlterationLibrary)Activator.CreateInstance(t);
                        //Set our FileName instance
                        Library_Class.FileName = fi.FullName;
                        //Add it to the list
                        Libraries.Add(Library_Class);
                    }
                }
            }
            //Loop through the directories
            foreach (DirectoryInfo di in new DirectoryInfo(directory).GetDirectories())
            {
                //Load any libraries recursively
                LoadLibraries(di.FullName);
            }
        }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            #region databank vullen
            //databank vullen met de csv.
            //  DatabankInitialiseer db = new DatabankInitialiseer();
            // db.InitialiseerDatabank();
            #endregion

            //Spelers gemaakt van de gegeven .csv bestand, heeft id's 9 tot 16 (8 spelers dus)
            //Bestaande stamnummers : 3, 7, 35

            LibraryClass voetbalLib = new LibraryClass();


            //nu zijn er 9 spelers
            #region spelerToevoegen test
            // Speler spelerNieuw = new Speler("Luc Vervoort", 99, 4000000, 7);
            // voetbalLib.VoegSpelerToe(spelerNieuw);
            // Speler spelerNieuwGeselecteerd = voetbalLib.SelecteerSpeler(17);
            #endregion

            #region teamToevoegen Test
            //Team nieuweTeam = new Team(16, "LeerkrachtenClub", "Tom VDW");
            // voetbalLib.VoegTeamToe(nieuweTeam);
            #endregion

            #region TransferToevoegen
            // Transfer trans = new Transfer(17, 50000000, 16);
            // voetbalLib.VoegTransferToe(trans);

            Transfer ToonTransfer = voetbalLib.SelecteerTransfer(1);
            #endregion


            Console.ReadLine();
        }
Ejemplo n.º 14
0
 public static void Main(string[] args)
 {
     LibraryClass test = new LibraryClass();
 }
Ejemplo n.º 15
0
 public static void LibraryClassTest1()
 {
     Assert.AreEqual(LibraryClass.Sum(0, 1), 1);
     Assert.AreEqual(LibraryClass.Sum(0, 2), 2);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Uses a DLL.
 /// </summary>
 public static void Main(string[] args)
 {
     Console.WriteLine(LibraryClass.square(15));
     Console.ReadLine();
 }
Ejemplo n.º 17
0
 public void MenuTearDown()
 {
     LibraryClass.CloseAStyleWxLdtp(ldtp);
 }
 public ConsoleUserSession(LibraryClass library)
 {
     this.library = library;
 }
Ejemplo n.º 19
0
        public void ComplexOperation()
        {
            LibraryClass l = new LibraryClass();

            l.PerformSimpleOperation();
        }
Ejemplo n.º 20
0
 public void MenuSetUp()
 {
     ldtp = LibraryClass.GetLdtpObject();
     LibraryClass.LaunchAStyleWxLdtp();
 }
Ejemplo n.º 21
0
 public static void LibraryClassTest1()
 {
     Assert.AreEqual(LibraryClass.Sum(0, 3), 3);
     Assert.AreEqual(LibraryClass.Sum(0, 4), 4);
 }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            var lib = new LibraryClass();

            System.Console.WriteLine(lib.Hello());
        }