Esempio n. 1
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (!CheckUpdate())
                {
                    return;
                }
                Books books = new Books();
                books.BookId      = Convert.ToInt32(this.textUpdateBookId.Text.Trim());
                books.BookName    = this.textUpdateBookName.Text.Trim();
                books.BookType    = this.cboUpdateBookType.Text.Trim();
                books.BookAuthor  = this.textUpdateBookAuthor.Text.Trim();
                books.BookPublish = this.textUpdatebookPublish.Text.Trim();

                int ret = new BookManager().UpdateBook(books);
                if (ret > 0)
                {
                    MessageBox.Show(UPDATESUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    BookDataBind();
                }
                else
                {
                    MessageBox.Show(UPDATEFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (!CheckInputNotEmpty())
                {
                    return;
                }
                Books books = new Books();
                books.BookId      = Convert.ToInt32(this.textBookId.Text.Trim());
                books.BookName    = this.textBookName.Text.Trim();
                books.BookType    = this.comboBookType.Text.Trim();
                books.BookAuthor  = this.textBookAuthor.Text.Trim();
                books.BookPublish = this.textBookPublish.Text.Trim();

                int ret = new BookManager().AddBook(books);
                if (ret > 0)
                {
                    MessageBox.Show(INSERTSUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(INSERTFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, OPERATIONFAILED, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Book b1 = new Book("In Search of Lost Time", "Marcel Proust", 2010, 34);
            Book b2 = new Book("Ulysses", "James Joyce", 1994, 27);
            Book b3 = new Book("Atonement", "Ian McEwan", 2000, 35);
            Book b4 = new Book("White Teeth", "Zadie Smith", 2005, 40);
            Book b5 = new Book("Mortals", "Norman Rush", 1998, 25);
            Book b6 = new Book("The Flamethrowers: A Novel", "Rachel Kushner", 2013, 30);

            BookManager.GetBooksAfter2000();
            BookManager.GetAveragePrice();
        }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            AdminManager  adminModel   = new AdminManager();
            BookManager   booksModel   = new BookManager();
            ReaderManager readersModel = new ReaderManager();
            RentalManager rentalModel  = new RentalManager();

            rental = new RentalController("server=localhost;port=3306;uid=root;pwd=root;database=Library", booksModel, rentalModel, readersModel, adminModel);
            while (true)
            {
                PrintStartInfo();
            }
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            IAisleManager aisleManager = new AisleManager();

            aisleManager.AddAisle(1); //A-F
            aisleManager.AddAisle(2); //G-L
            aisleManager.AddAisle(3); //M-R
            aisleManager.AddAisle(4); //S-Y
            aisleManager.AddAisle(5); //Z-Ö

            IShelfManager shelfManager = new ShelfManager();
            var           shelf1       = shelfManager.AddShelf(1, 1); //A-B

            shelfManager.AddShelf(2, 1);                              //C-D
            shelfManager.AddShelf(3, 1);                              //E-F
            var shelf4 = shelfManager.AddShelf(1, 2);                 //G-H
            var shelf5 = shelfManager.AddShelf(2, 2);                 //I-J
            var shelf6 = shelfManager.AddShelf(3, 2);                 //K-L
            var shelf7 = shelfManager.AddShelf(1, 3);                 //M-N

            shelfManager.AddShelf(2, 3);                              //O-P
            shelfManager.AddShelf(3, 3);                              //Q-R
            var shelf10 = shelfManager.AddShelf(1, 4);                //S-T
            var shelf11 = shelfManager.AddShelf(2, 4);                //U-VW

            shelfManager.AddShelf(3, 4);                              //X-Y
            shelfManager.AddShelf(1, 5);                              //Z-Å
            shelfManager.AddShelf(2, 5);                              //Ä-Ö

            IBorrowManager borrowManager = new BorrowManager();
            var            borrow1       = borrowManager.AddBorrow(000001, "Circe", new DateTime(2019 - 11 - 01), new DateTime(2019 - 12 - 30));
            var            borrow2       = borrowManager.AddBorrow(000002, "Flights", new DateTime(2019 - 10 - 30), new DateTime(2019 - 11 - 29));

            IBookManager bookManager = new BookManager();

            bookManager.AddBook("9781526610140", "Circe", "Madeline Miller", 2019, 199, 4, shelf7, true, borrow1);
            bookManager.AddBook("9780525534204", "Flights", "Olga Tokarczuk", 2019, 120, 5, shelf10, true, borrow1);
            bookManager.AddBook("9781782118640", "How to Stop Time", "Matt Haig", 2017, 80, 3, shelf4, false, new Borrow());
            bookManager.AddBook("9789129690835", "Trollkarlen från Övärälden", "Ursula K. Le Guin", 2014, 60, 1, shelf6, false, new Borrow());
            bookManager.AddBook("9780356508191", "The Fifth Season", "N. K. Jemisin", 2016, 70, 3, shelf5, true, new Borrow());
            bookManager.AddBook("9789100170851", "De tre följeslagarna", "Stephen King", 2017, 80, 4, shelf6, true, new Borrow());
            var bookNeverwhere1 = bookManager.AddBook("9780747266686", "Neverwhere", "Neil Gaiman", 2013, 50, 1, shelf4, false, new Borrow());
            var bookNeverwhere2 = bookManager.AddBook("9780747266686", "Neverwhere", "Neil Gaiman", 2015, 50, 4, shelf4, false, new Borrow());

            bookManager.AddBook("9789188945532", "Dödsviskaren", "Lovisa Wistrand", 2019, 60, 4, shelf11, false, new Borrow());
            bookManager.AddBook("9781409150763", "King's Cage", "Victoria Aveyard", 2017, 70, 3, shelf1, true, new Borrow());
            bookManager.AddBook("9780099740919", "Handmaid's Tale", "Margaret Atwood", 2003, 40, 2, shelf1, true, new Borrow());

            ICustomerManager customerManager = new CustomerManager();

            customerManager.AddCustomer(000001, "Fanny Uhr", "1996-07-22", "Peppargatan 13", 0, null, false);
            customerManager.AddCustomer(000002, "Patrik Palmér", "1995-05-30", "Peppargatan 13", 0, null, false);
            customerManager.AddCustomer(000003, "Leif Eriksson", "1966-04-18", "Logvägen 16", 0, null, false);
            customerManager.AddCustomer(000004, "Greta Larsson", "1953-09-14", "Storgatan 14", 60, null, false);
            var guardian1 = customerManager.AddCustomer(000005, "Peter Andersson", "1973-07-14", "Linfrögatan 22", 0, null, true);

            customerManager.AddCustomer(000006, "Maja Bergman", "2000-07-30", "Drottninggatan 29B", 0, null, false);
            customerManager.AddCustomer(000007, "Lisa Norén", "1983-04-24", "Bergslagsgatan 13", 0, null, false);
            customerManager.AddCustomer(000008, "Pontus Andersson", "2008-02-16", "Linfrögatan 22", 0, guardian1, false);
            var guardian2 = customerManager.AddCustomer(000009, "Sara Magnusson", "1987-12-03", "Lägervägen 12", 0, null, true);

            customerManager.AddCustomer(000010, "Tindra Magnusson", "2010-03-01", "Lägervägen 12", 0, guardian2, false);
            customerManager.AddCustomer(000011, "Siri Larsson", "1991-06-30", "Paprikagatan 24", 30, null, false);
            customerManager.AddCustomer(000012, "Richard Svensson", "1994-11-15", "Anders Wedbergsgatan 3", 0, null, false);
            customerManager.AddCustomer(000013, "Ingrid Malm", "1954-01-03", "Storsjögatan 14B", 0, null, false);
            customerManager.AddCustomer(000014, "Hans Hammar", "1952-04-30", "Malmgatan 4C", 0, null, false);
            customerManager.AddCustomer(000015, "Lovisa Carlsson", "1993-05-06", "Stenbäcksvägen 24", 0, null, false);
            var guardian3 = customerManager.AddCustomer(000016, "Fredrik Malmberg", "1982-02-16", "Bergslagsgatan 11", 0, null, true);

            customerManager.AddCustomer(000017, "Emil Malmberg", "2011-04-17", "Bergslagsgatan 11", 0, guardian3, false);
            customerManager.AddCustomer(000018, "Birgitta Lindén", "1965-08-22", "Hellmansgatan 26", 0, null, false);
            customerManager.AddCustomer(000019, "Anders Lindén", "1963-09-28", "Hellmansgatan 26", 0, null, false);
            customerManager.AddCustomer(000020, "Maja Svensson", "1996-10-24", "Kamomillvägen 13", 0, null, false);

            Console.WriteLine("Klart");
            Console.ReadLine();
        }
Esempio n. 6
0
 public Library()
 {
     _manager = new BookManager();
 }
        static void Main(string[] args)
        {
            IPathManager pathManager = new PathManager();

            pathManager.AddPath(1);
            pathManager.AddPath(2);
            pathManager.AddPath(3);

            IShelfManager shelfManager = new ShelfManager();
            var           shelf1       = shelfManager.AddShelf(1, 1);
            var           shelf2       = shelfManager.AddShelf(2, 1);
            var           shelf3       = shelfManager.AddShelf(3, 1);
            var           shelf4       = shelfManager.AddShelf(1, 2);
            var           shelf5       = shelfManager.AddShelf(2, 2);
            var           shelf6       = shelfManager.AddShelf(3, 2);
            var           shelf7       = shelfManager.AddShelf(1, 3);
            var           shelf8       = shelfManager.AddShelf(2, 3);
            var           shelf9       = shelfManager.AddShelf(3, 3);

            IBookManager bookManager = new BookManager();

            bookManager.AddBook("Boken om Blå fåglar", "Bo Fink", "9789178130948", 2001, 1, 995, 1, false, 1, 1);
            bookManager.AddBook("Boken om Röda fåglar", "Bo Fink", " 9789113086972", 2002, 2, 25, 2, false, 1, 1);
            bookManager.AddBook("Boken om Gröna bilar", "Bosse Bildoktorn", "9780777772348", 2003, 2, 33, 3, false, 2, 1);
            bookManager.AddBook("Boken om Lila bilar", "Bosse Bildoktorn", "7891742479472", 2004, 2, 56, 4, false, 2, 1);
            bookManager.AddBook("Boken om Gråa blommor", "Ernst", "9789174247220", 2005, 2, 65, 5, false, 3, 2);
            bookManager.AddBook("Boken om Rosa blommor", "Ernst", "9789174249613", 2006, 3, 70, 6, false, 3, 2);
            bookManager.AddBook("Boken om gröna buskar", "Laila", "9789174249958", 2007, 5, 88, 7, false, 1, 2);
            bookManager.AddBook("Boken om Turkosa buskar", "Laila", "9789129710687", 2008, 3, 45, 8, false, 1, 2);
            bookManager.AddBook("Boken om Små hundar", "Kalle", "9789127155589", 2009, 1, 860, 9, false, 2, 3);
            bookManager.AddBook("Boken om Stora hundar", "Kalle", "9789127164345", 2010, 2, 56, 10, false, 2, 3);
            bookManager.AddBook("Boken om Tjocka katter", "Ullis", "9789127155282", 2011, 3, 2500, 11, false, 3, 4);
            bookManager.AddBook("Boken om lagom-stora katter", "Ullis", "9789174235616", 2012, 4, 95, 12, false, 3, 3);
            bookManager.AddBook("Boken om fula fiskar", "Anna", "9789172096738", 2013, 2, 190, 13, false, 1, 3);
            bookManager.AddBook("Boken om fina fiskar", "Anna", "9789178033553", 2014, 4, 220, 14, false, 1, 3);
            bookManager.AddBook("Boken om snälla människor", "Lotta", "9789129714036", 2015, 5, 330, 15, false, 2, 3);
            bookManager.AddBook("Boken om dumma människor ", "Lotta", "9789129716689", 2016, 2, 480, 16, false, 2, 3);
            bookManager.AddBook("Boken om tårtor", "Gunni", "9789129706406", 2017, 1, 510, 17, false, 3, 3);
            bookManager.AddBook("Boken om kakor", "Gunni", "9789127154377", 2018, 3, 80, 18, false, 3, 3);

            ICustomerManager customerManager = new CustomerManager();

            customerManager.AddCustomer("Anna Karlsson", "SvansGatan 5", "1995-04-17", 0, false);
            customerManager.AddCustomer("Anders Svensson", "FågelGatan 6", "1980-04-15", 20, false);
            customerManager.AddCustomer("Mimmi Andersson", "TårtVägen 7", "1970-06-22", 3, false);
            customerManager.AddCustomer("Kenny Kvist", "VolvoVägen 8", "2001-07-13", 0, false);

            IMinorCustomerManager minorCustomerManager = new MinorCustomerManager();

            minorCustomerManager.AddMinorCustomer("Klara Karlsson", "SvansGatan 5", "2010-06-03", 0, 1);
            minorCustomerManager.AddMinorCustomer("Max Karlsson", "SvansGatab 5", "2009-06-01", 0, 1);
            minorCustomerManager.AddMinorCustomer("Håkan Bråkan", "TårtVägen 7", "2007-03-13", 20, 4);


            /*ILoanManager loanManager = new LoanManager();
             * loanManager.AddLoan(1, 1,loanStart,l);
             * loanManager.AddLoan(2, 2);*/

            /*IMinorCustomerLoanManager minorCustomerLoanManager = new MinorCustomerLoanManager();
             * minorCustomerLoanManager.AddMinorCustomerLoan(1, 3);
             * minorCustomerLoanManager.AddMinorCustomerLoan(2, 4);*/
        }