Пример #1
0
        public BookingViewWindow(HardwareStoreContext context, Booking booking, ListBox bookingListBox)
        {
            InitializeComponent();

            _context        = context;
            _booking        = booking;
            _bookingListBox = bookingListBox;

            // Set datacontext of this window.
            DataContext = booking;

            // Adds text to the timeperiod binded label.
            // The text depends on the number of days.
            if (booking.TimePeriod == 1)
            {
                TimePeriod.Content = booking.TimePeriod + " dag";
            }
            else
            {
                TimePeriod.Content = booking.TimePeriod + " dage";
            }

            // Fill the listbox with the tools of this booking.
            ToolsListBox.ItemsSource = _context.GetBooking(booking.Id).Tools;
        }
Пример #2
0
 public CreateCustomer(Button button, HardwareStoreContext dbContext)
 {
     _button           = button;
     _button.IsEnabled = false;
     _dbContext        = dbContext;
     InitializeComponent();
     this._viewModel  = new CreateCustomerViewModel();
     this.DataContext = _viewModel;
 }
        public AddCustomerWindow(MainWindow mainWindow, TextBox TxtBoxCustomerId, Label searchErrorLabel, Grid customerGrid, Button editButton, ListBox bookingListBox)
        {
            InitializeComponent();

            _context             = new HardwareStoreContext();
            _mainWin             = mainWindow;
            _mainWinTxtBox       = TxtBoxCustomerId;
            _mainWinLbl          = searchErrorLabel;
            _mainWinGrid         = customerGrid;
            _mainWinEditButton   = editButton;
            _mainWinBookingsList = bookingListBox;
        }
 public MainWindow()
 {
     InitializeComponent();
     _dbContext = new HardwareStoreContext();
     _dbContext.Customers.Include(c => c.Bookings
                                  //.Where(b => b.Status != Booking.BookingStatus.Returned)
                                  .Select(b => b.Tool)).Load();
     //TODO: Set up search filter
     //var view = CollectionViewSource.GetDefaultView(_dbContext.Customers);
     this._viewModel = new MainWindowViewModel
     {
         Customers = _dbContext.Customers.Local
     };
     this.DataContext = _viewModel;
 }
Пример #5
0
        public MainWindow()
        {
            InitializeComponent();

            _context = new HardwareStoreContext();

            // Set datacontext of this window.
            DataContext = _context;

            // Collection of textboxes to edit a customer.
            _editTextBoxes = new List <TextBox>()
            {
                TxtBoxCustomerName,
                TxtBoxCustomerAddress,
                TxtBoxCustomerEmail,
                TxtBoxCustomerUsername
            };
        }
Пример #6
0
 public UserController(HardwareStoreContext hardwareStoreContext)
 {
     this._db = hardwareStoreContext;
 }
Пример #7
0
 public ModuleController(HardwareStoreContext hardwareStoreContext)
 {
     this._db = hardwareStoreContext;
 }
Пример #8
0
 public ItemsController(HardwareStoreContext hardwareStoreContext)
 {
     this._db = hardwareStoreContext;
 }