Exemplo n.º 1
0
        private void SaveHotel(object sender, RoutedEventArgs e)
        {
            M120Entities         m120Entities    = new M120Entities();
            List <Land>          countriesList   = m120Entities.Lands.ToList();
            HotelRepository      hotelRepository = new HotelRepository();
            HotelImageRepository imageRepository = new HotelImageRepository();

            hotelRepository.addHotel(hotelNametxtbox.Text, hotelPlacetxtbox.Text, countriesList.Find(x => x.Name == hotelCountrycombobox.SelectedValue).Name, Int16.Parse(hotelRatingtxtbox.Text), hotelManagertxtbox.Text, Int16.Parse(hotelAmountofRoomstxtbox.Text), Int16.Parse(hotelPricePerDaytxtbox.Text), hotelPhonetxtbox.Text, hotelEmailtxtbox.Text, hotelWebtxtbox.Text, imageRepository.SaveImageToByte(HotelImage), ImageDescription.Text);
        }
        private void loadHotelContent(object sender, MouseButtonEventArgs e)
        {
            this.TabIndex = 1;
            List <Hotel>         allHotels       = M120Entities.Hotels.ToList();
            HotelImageRepository imageRepository = new HotelImageRepository();

            foreach (var hotel in allHotels)
            {
                PurchaseForm purchaseForm = new PurchaseForm();
                purchaseForm.Name = hotel.Name;
                purchaseForm.HotelImage.Source       = imageRepository.BitmapImageFromBytes(M120Entities.HotelBilds.Find(hotel)?.Bild);
                purchaseForm.Startdtpck.DisplayDate  = DateTime.Now.Date;
                purchaseForm.Enddtdtpck.DisplayDate  = DateTime.Now.Date;
                purchaseForm.HotelDescriptiontb.Text = "Email:" + hotel.Email + "Anzahl Zimmer: " + hotel.AnzahlZimmer.ToString("F") + "Manager: " + hotel.Manager + "Telefon: " +
                                                       hotel.Telefon + "Ort: " + hotel.Ort + "Website: " + hotel.Web;

                hotelGrid.Children.Add(purchaseForm);
            }
        }
Exemplo n.º 3
0
        private void LoadHotels(object sender, MouseButtonEventArgs e)
        {
            M120Entities         m120Entities   = new M120Entities();
            HotelImageRepository HotelImageRepo = new HotelImageRepository();
            List <Hotel>         hotels         = m120Entities.Hotels.ToList();

            foreach (var hotel in hotels)
            {
                PurchaseForm purchaseForm = new PurchaseForm();
                purchaseForm.Name = hotel.Name;
                purchaseForm.HotelImage.Source       = HotelImageRepo.BitmapImageFromBytes(m120Entities.HotelBilds.Find(hotel)?.Bild);
                purchaseForm.Startdtpck.DisplayDate  = DateTime.Now.Date;
                purchaseForm.Enddtdtpck.DisplayDate  = DateTime.Now.Date;
                purchaseForm.HotelDescriptiontb.Text = "Email:" + hotel.Email + "Anzahl Zimmer: " + hotel.AnzahlZimmer.ToString("F") + "Manager: " + hotel.Manager + "Telefon: " +
                                                       hotel.Telefon + "Ort: " + hotel.Ort + "Website: " + hotel.Web;
                purchaseForm.DeleteBtn.Visibility = Visibility.Hidden;
                HotelStackPanel.Children.Add(purchaseForm);
                //Load Data into CustomControl
                //Load all CustomControls into Panel
            }
        }