Exemplo n.º 1
0
        public AddWindow(ToursRepository toursRepository)
        {
            InitializeComponent();

            this.toursRepository = toursRepository;

            for (int i = 0; i < 31; i++)
            {
                if (i < 12)
                {
                    months[i] = i + 1;
                }
                if (i < 28)
                {
                    twentyEightDays[i] = i + 1;
                }
                if (i < 30)
                {
                    thirtyDays[i] = i + 1;
                }
                thirtyOneDays[i] = i + 1;
            }

            dayToComboBox.ItemsSource     = thirtyOneDays;
            monthToComboBox.ItemsSource   = months;
            yearToComboBox.ItemsSource    = years;
            dayFromComboBox.ItemsSource   = thirtyOneDays;
            monthFromComboBox.ItemsSource = months;
            yearFromComboBox.ItemsSource  = years;
            ratingComboBox.ItemsSource    = ratings;
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            toursRepository = new ToursRepository();

            toursGrid.ItemsSource = toursRepository.GetTours();
        }
Exemplo n.º 3
0
        public UpdateWindow(ToursRepository toursRepository, Tour selectedTour)
        {
            InitializeComponent();

            this.toursRepository = toursRepository;
            this.selectedTour    = selectedTour;

            for (int i = 0; i < 31; i++)
            {
                if (i < 12)
                {
                    months[i] = i + 1;
                }
                if (i < 28)
                {
                    twentyEightDays[i] = i + 1;
                }
                if (i < 30)
                {
                    thirtyDays[i] = i + 1;
                }
                thirtyOneDays[i] = i + 1;
            }

            dayToComboBox.ItemsSource     = thirtyOneDays;
            monthToComboBox.ItemsSource   = months;
            yearToComboBox.ItemsSource    = years;
            dayFromComboBox.ItemsSource   = thirtyOneDays;
            monthFromComboBox.ItemsSource = months;
            yearFromComboBox.ItemsSource  = years;
            ratingComboBox.ItemsSource    = ratings;

            directionTextBox.Text           = selectedTour.Direction;
            dayToComboBox.SelectedValue     = selectedTour.ToDate.Day;
            monthToComboBox.SelectedValue   = selectedTour.ToDate.Month;
            yearToComboBox.SelectedValue    = selectedTour.ToDate.Year;
            dayFromComboBox.SelectedValue   = selectedTour.FromDate.Day;
            monthFromComboBox.SelectedValue = selectedTour.FromDate.Month;
            yearFromComboBox.SelectedValue  = selectedTour.FromDate.Year;
            hotelTextBox.Text            = selectedTour.Hotel;
            ratingComboBox.SelectedValue = selectedTour.Rating;
            priceTextBox.Text            = selectedTour.Price.ToString();
        }
Exemplo n.º 4
0
 public ToursController()
 {
     //todo: migrate to DI container
     repository = ToursRepository.Create().Result;
 }