コード例 #1
0
ファイル: AboutMagazine.xaml.cs プロジェクト: pavelkaps/store
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            EditMagazine form = new EditMagazine(magazine, main);

            form.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            if (form.ShowDialog() == true)
            {
                magazine = form.GetMagazine();
                SetMagazine();
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: pavelkaps/store
 private void MagazineGrid_MouseUp(object sender, MouseButtonEventArgs e)
 {
     try
     {
         Magazine      path = MagazineGrid.SelectedItem as Magazine;
         AboutMagazine frm  = new AboutMagazine(this, path);
         frm.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
         frm.ShowDialog();
         UpdateDataGrid();
     }
     catch (Exception)
     {
         MessageBox.Show("Выберите журнал", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
コード例 #3
0
ファイル: AddMagazine.xaml.cs プロジェクト: pavelkaps/store
        private void Ok_Click(object sender, RoutedEventArgs e)
        {
            newMagazine = new Magazine();
            if (TitleBox.Text == "")
            {
                newMagazine.Title = "N/A";
            }
            else
            {
                newMagazine.Title = TitleBox.Text;
            };
            if (PublisherBox.Text == "")
            {
                newMagazine.Publisher = "N/A";
            }
            else
            {
                newMagazine.Publisher = PublisherBox.Text;
            };
            if (DescriptionBox.Text == "")
            {
                newMagazine.Description = "N/A";
            }
            else
            {
                newMagazine.Description = DescriptionBox.Text;
            };
            if (EditionBox.Text == "")
            {
                newMagazine.Edition = 0;
            }
            else
            {
                newMagazine.Edition = int.Parse(EditionBox.Text);
            }
            if (CirculationBox.Text == "")
            {
                newMagazine.Сirculation = 0;
            }
            else
            {
                newMagazine.Сirculation = int.Parse(CirculationBox.Text);
            }
            if (AvailabilityCheck.IsChecked == true)
            {
                newMagazine.Availability = true;
            }
            else
            {
                newMagazine.Availability = false;
            };

            newMagazine.Rating = int.Parse(Rate.Text);
            newMagazine.SetAvailability();


            newMagazine.MagazineType = (MagazineType)TypeBox.SelectedItem;
            Main.GetMagazineDB().Insert(newMagazine);

            this.DialogResult = true;
            Close();
        }