示例#1
0
        private void btnBack(object sender, RoutedEventArgs e)
        {
            ToursPage tr = new ToursPage();

            tr.Visibility = Visibility.Visible;
            this.Close();
        }
示例#2
0
        private void toursWindow(object sender, RoutedEventArgs e)
        {
            ToursPage tp = new ToursPage();

            if (WhatTheRole.role == Role.Client)
            {
                tp.BtnAdd.Visibility    = Visibility.Hidden;
                tp.BtnDelete.Visibility = Visibility.Hidden;
                tp.BtnChange.Visibility = Visibility.Hidden;
            }
            tp.Visibility = Visibility.Visible;
            this.Close();
        }
示例#3
0
        private void btnSave(object sender, RoutedEventArgs e)
        {
            var imageBuffer = BitmapSourceToByteArray((BitmapSource)Picture.Source);

            _currentTour.ImagePreview = imageBuffer;
            StringBuilder errors = new StringBuilder();

            if (string.IsNullOrWhiteSpace(_currentTour.TicketCount.ToString()))
            {
                errors.AppendLine("Укажите количество билетов у тура");
            }
            if (string.IsNullOrWhiteSpace(_currentTour.Name))
            {
                errors.AppendLine("Укажите наименование тура");
            }
            if (string.IsNullOrWhiteSpace(_currentTour.Price.ToString()))
            {
                errors.AppendLine("Укажите цену у тура");
            }



            if (errors.Length > 0)
            {
                MessageBox.Show(errors.ToString());
                return;
            }
            else
            {
                TourBaseEntitiesDB.GetContext().Tour.Add(_currentTour);
            }


            TourBaseEntitiesDB.GetContext().SaveChanges();
            MessageBox.Show("Запись успешно сохранена!");
            ToursPage tr = new ToursPage();

            tr.Visibility = Visibility.Visible;
            this.Close();
        }