Ejemplo n.º 1
0
        private void buttonEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (listView.SelectedItem != null)
                {
                    AdminAdd wnd = new AdminAdd();
                    wnd.Show();
                    this.Close();

                    foreach (var item in lr.Res)
                    {
                        if (listView.SelectedItem.ToString() == item.Show())
                        {
                            wnd.textBoxName.Text      = item.Name;
                            wnd.comboBoxCountry.Text  = item.Country;
                            wnd.textBoxKm.Text        = item.Km.ToString();
                            wnd.textBoxPeak.Text      = item.Highest_Peak.ToString();
                            wnd.textBoxSlope.Text     = item.Longest_Slope.ToString();
                            wnd.textBoxLifts.Text     = item.Ski_Lifts.ToString();
                            wnd.textBoxSnowparks.Text = item.Snowparks.ToString();
                            wnd.textBoxSkipass.Text   = item.Skipass.ToString();
                            wnd.textBoxPhoto.Text     = item.Photo.ToString();
                            if (item.Rink == 1)
                            {
                                wnd.checkBoxRink.IsChecked = true;
                            }
                            wnd.ski = item;
                        }
                    }
                    wnd.buttonAllHotels.Visibility = Visibility.Visible;
                    wnd.buttonEdit.Visibility      = Visibility.Visible;
                    //wnd.buttonHotel.Visibility = Visibility.Hidden;
                    wnd.buttonAdd.Visibility = Visibility.Hidden;
                }
                else
                {
                    MessageBox.Show("Выберите курорт!", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.ToString());
            }
        }
Ejemplo n.º 2
0
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                AdminAdd wnd = new AdminAdd();
                wnd.Show();
                this.Close();


                //wnd.buttonHotel.Visibility = Visibility.Visible;
                wnd.buttonAdd.Visibility       = Visibility.Visible;
                wnd.buttonAllHotels.Visibility = Visibility.Hidden;
                wnd.buttonEdit.Visibility      = Visibility.Hidden;
            }
            catch (Exception er)
            {
                MessageBox.Show(er.ToString());
            }
        }