예제 #1
0
 public BookingController(PaymentController paymentController, CustomerController customerController)
 {
     dataAccessFacade = DataAccessFacade.GetInstance();
     bookingCollection = new BookingCollection(dataAccessFacade);
     this.paymentController = paymentController;
     this.customerController = customerController;
 }
예제 #2
0
        internal void CreatePayments(Booking booking, PaymentController paymentController)
        {
            Supplier supplier = (Supplier)booking.Supplier;
            Customer customer = (Customer)booking.Customer;
            BookingType bookingType = booking.Type;

            List<IPaymentRule> paymentRules = findMatchingPaymentRules(supplier, customer, bookingType);

            foreach (IPaymentRule paymentRule in paymentRules)
            {
                DateTime dueDate;

                if (paymentRule.BaseDate == BaseDate.StartDate)
                {
                    dueDate = booking.StartDate.AddDays(paymentRule.DaysOffset);
                }
                else
                {
                    dueDate = booking.EndDate.AddDays(paymentRule.DaysOffset);
                }

                booking.CalculateAmounts();
                decimal dueAmount = booking.TransferAmount * paymentRule.Percentage / 100;

                Customer lonelyTree = customerController.findLonelyTree();

                IPayment payment = paymentController.CreatePayment(dueDate, dueAmount, lonelyTree, booking.Supplier,
                    paymentRule.PaymentType, booking.Sale, booking.BookingNumber);

                paymentController.UpdatePayment(payment);
            }
        }
예제 #3
0
 /// <summary>
 /// For testing against a specified DataAccessFacade
 /// </summary>
 /// <param name="dataAccessFacade"></param>
 public BookingController(PaymentController paymentController, CustomerController customerController,
     IDataAccessFacade dataAccessFacade)
 {
     this.dataAccessFacade = dataAccessFacade;
     bookingCollection = new BookingCollection(dataAccessFacade);
     this.paymentController = paymentController;
     this.customerController = customerController;
 }
        public ArchivedPaymentsUserControl(PaymentController paymentController)
        {
            InitializeComponent();

            this.paymentController = paymentController;

            RefreshPaymentDataGrid();
        }
 public DetailsUserControl(PaymentController controller)
 {
     InitializeComponent();
     paymentController = controller;
     attachments =  new List<string>();
     culture = MainWindow.GetCulture();
     paymentTypeComboBox.ItemsSource = Enum.GetValues(typeof(PaymentType));
     paymentTypeComboBox.SelectedIndex = 0;
     autoCompleteEntries = new HashSet<string>();
 }
예제 #6
0
        public void Initialize()
        {
            culture = new CultureInfo("en-US"); // Used for comparing decimals with strings

            dataAccessFacade = new DataAccessFacadeStub();
            customerController = new CustomerController(dataAccessFacade);
            supplierController = new SupplierController(dataAccessFacade);
            paymentController = new PaymentController(dataAccessFacade);
            bookingController = new BookingController(paymentController, customerController, dataAccessFacade);

            ICustomer lonelyTree = customerController.CreateCustomer(CustomerType.Bureau, "", "Lonely Tree");
        }
예제 #7
0
        public MainWindow()
        {
            InitializeComponent();
            SupplierController supplierController = new SupplierController();
            CustomerController customerController = new CustomerController();
            PaymentController paymentController = new PaymentController();
            BookingController bookingController = new BookingController(paymentController, customerController);

            accountingControl = new AccountingUserControl(paymentController, supplierController, customerController);
            accountingUserControl.Content = accountingControl;
            suppliersUserControl.Content = new SuppliersUserControl(supplierController, customerController);
            customersUserControl.Content = new CustomersUserControl(customerController);
            bookingsUserControl.Content = new BookingsUserControl(bookingController, supplierController,
                customerController);

            currentTabIndex = 0;
        }
        public IncomingPaymentsUserControl(PaymentController paymentController,
            CustomerController customerController, SupplierController supplierController)
        {
            InitializeComponent();

            this.paymentController = paymentController;
            this.customerController = customerController;
            this.supplierController = supplierController;

            details = new DetailsUserControl(paymentController);
            details.payeeTextBox.Text = "Lonely Tree";
            details.payeeTextBox.IsEnabled = false;
            detailsUserControl.Content = details;
            collapsePlusImage = new BitmapImage(new Uri("/Images/collapse-plus.png", UriKind.Relative));
            collapseMinImage = new BitmapImage(new Uri("/Images/collapse-min.png", UriKind.Relative));

            RefreshPaymentDataGrid();
        }
        public AccountingUserControl(PaymentController paymentController, SupplierController supplierController,
            CustomerController customerController)
        {
            InitializeComponent();
            this.paymentController = paymentController;
            this.supplierController = supplierController;
            this.customerController = customerController;

            incomingPaymentsControl = new IncomingPaymentsUserControl(paymentController,
                customerController, supplierController);
            outgoingPaymentsControl = new OutgoingPaymentsUserControl(paymentController,
                customerController, supplierController);
            archivedPaymentsControl = new ArchivedPaymentsUserControl(paymentController);

            incomingPaymentsUserControl.Content = incomingPaymentsControl;
            outgoingPaymentsUserControl.Content = outgoingPaymentsControl;
            archiveUserControl.Content = archivedPaymentsControl;

            currentTabIndex = mainTabNavigation.SelectedIndex;
        }