コード例 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
               //setup
            IMemberDAO memberDAO = new MemberDAO(new MemberHelper());
            IBookDAO bookDAO = new BookDAO(new BookHelper());
            ILoanDAO loanDAO = new LoanDAO(new LoanHelper());

            IMember mem = memberDAO.AddMember("John", "Smith", "*****@*****.**", "02 622 94753");

            IBook book1 = bookDAO.AddBook("Robert Heinlein", "Space Cadet", "HEI 3.645");
            IBook book2 = bookDAO.AddBook("Charles Stross", "The Laundry Files", "STR 7.593");
            IBook book3 = bookDAO.AddBook("James Cambias", "A Darkling Sea", "CAM 5.657");
            IBook book4 = bookDAO.AddBook("John Steinbeck", "Cannery Row", "STE 9.531");
            IBook book5 = bookDAO.AddBook("Terry Pratchett", "Raising Steam", "PRA 1.739");
            IBook book6 = bookDAO.AddBook("Vernor Vinge", "Fire Upon the Deep", "VIN 8.927");
            /*
            IBook b = bookDAO.GetBookByID(1);
            b = bookDAO.GetBookByID(2);
            b = bookDAO.GetBookByID(3);
            b = bookDAO.GetBookByID(4);

            DateTime borrowDate = DateTime.Now;
            TimeSpan loanPeriod = new TimeSpan(LoanConstants.LOAN_PERIOD, 0, 0, 0);
            DateTime dueDate = borrowDate.Add(loanPeriod);

            loanDAO.CreateNewPendingList(mem);
            loanDAO.CreatePendingLoan(mem, book1, borrowDate, dueDate);
            loanDAO.CreatePendingLoan(mem, book2, borrowDate, dueDate);
            loanDAO.CreatePendingLoan(mem, book3, borrowDate, dueDate);
            loanDAO.CreatePendingLoan(mem, book4, borrowDate, dueDate);
            loanDAO.CreatePendingLoan(mem, book5, borrowDate, dueDate);
            loanDAO.CommitPendingLoans(mem);

            DateTime checkDate = dueDate.Add(new TimeSpan(1, 0, 0, 0));
            loanDAO.UpdateOverDueStatus(checkDate);

            mem.AddFine(10.00f);
            */
            BorrowBookUI gui = new BorrowBookUI();
            BorrowBookCTL ctl = new BorrowBookCTL(bookDAO, memberDAO,loanDAO, gui);

            ctl.Initialise();
            Application.Run(gui);
        }
コード例 #2
0
        public ConfirmCompleteDialog( BorrowBookUI owner, List<ILoan> loanList)
        {
            this.owner = owner;
            this.loanList = loanList;

            InitializeComponent();

            this.ControlBox = false;
            this.MinimizeBox = false;
            this.MaximizeBox = false;

            StringBuilder bld = new StringBuilder();
            string cr = Environment.NewLine;
            foreach (ILoan loan in loanList)
            {
                bld.Append(loan.ToString()).Append(cr).Append(cr);
            }
            currentLoan_TB.Text = bld.ToString();
            currentLoan_TB.Select(0, 0);
        }
コード例 #3
0
        public PrintLoanSlipDialog(BorrowBookUI owner, List<ILoan> loanList)
        {
            this.owner = owner;
            this.loanList = loanList;

            InitializeComponent();

            this.ControlBox = false;
            this.MinimizeBox = false;
            this.MaximizeBox = false;

            string cr = Environment.NewLine;
            IMember mem = loanList[0].Borrower;
            StringBuilder bld = new StringBuilder();
            bld.Append(mem.ToString()).Append(cr).Append(cr);

            foreach (ILoan loan in loanList)
            {
                bld.Append(loan.ToString()).Append(cr).Append(cr);
            }
            loanSlip_TB.Text = bld.ToString();
            loanSlip_TB.Select(0, 0);
            loanSlip_TB.ReadOnly = true;
        }