Exemple #1
0
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            Tarrifs tariffwindow = new Tarrifs();

            tariffwindow.Show();
            this.Close();
        }
Exemple #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            var selectedTariff = TarrifItems.SelectedItem as Tariff;

            if (selectedTariff == null)
            {
                MessageBox.Show("Select the item");
                return;
            }
            else
            {
                if (_repo.RemoveItem(selectedTariff))
                {
                    Tarrifs tariffwindow = new Tarrifs();
                    tariffwindow.Show();
                    MessageBox.Show("The tariff was deleted");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("There is information about this tariff in other tables");
                }
            }
        }
Exemple #3
0
 private void Choose_Click(object sender, RoutedEventArgs e)
 {
     if (Options.SelectedItem != null)
     {
         string selectedOption = Options.SelectedItem.ToString();
         if (selectedOption == "System.Windows.Controls.ListBoxItem: Settings")
         {
             Settings settingswindow = new Settings();
             settingswindow.Show();
             this.Close();
         }
         else
         {
             if (selectedOption == "System.Windows.Controls.ListBoxItem: Workers")
             {
                 Worker workerwindow = new Worker();
                 workerwindow.Show();
                 this.Close();
             }
             else
             {
                 if (selectedOption == "System.Windows.Controls.ListBoxItem: TimeTable")
                 {
                     TimeTable tablewindow = new TimeTable();
                     tablewindow.Show();
                     this.Close();
                 }
                 else
                 {
                     if (selectedOption == "System.Windows.Controls.ListBoxItem: Films")
                     {
                         Films filmwindow = new Films();
                         filmwindow.Show();
                         this.Close();
                     }
                     else
                     {
                         if (selectedOption == "System.Windows.Controls.ListBoxItem: Profit information")
                         {
                             Profit profitwindow = new Profit();
                             profitwindow.Show();
                             this.Close();
                         }
                         else
                         {
                             if (selectedOption == "System.Windows.Controls.ListBoxItem: Tariffs")
                             {
                                 Tarrifs tariffwindow = new Tarrifs();
                                 tariffwindow.Show();
                                 this.Close();
                             }
                         }
                     }
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Choose the option, please");
     }
 }
Exemple #4
0
        private void ChangeTariffInformation_Click(object sender, RoutedEventArgs e)
        {
            int    d;
            double price;
            bool   morning;
            bool   weekend;
            string name;

            if (Tariffing == null)
            {
                if (int.TryParse(Format.Text, out d))
                {
                    if (double.TryParse(Price.Text, out price))
                    {
                        if (Morning.IsChecked != null)
                        {
                            morning = Morning.IsChecked.Value;
                            if (Weekend.IsChecked != null)
                            {
                                weekend = Weekend.IsChecked.Value;
                                if (Name.Text.Trim() != "")
                                {
                                    name = Name.Text.Trim();
                                    Tariff tariff = new Tariff
                                    {
                                        D       = d,
                                        Price   = price,
                                        Morning = morning,
                                        Weekend = weekend,
                                        Name    = name
                                    };
                                    _repo.AddItem(tariff);
                                    Tarrifs filmswindow = new Tarrifs();
                                    filmswindow.Show();
                                    MessageBox.Show("The tariff was added");
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show("Enter the name");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Choose the option for weekend");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Choose the option for morning");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Price should the written with comma");
                    }
                }
                else
                {
                    MessageBox.Show("Enter the format in int");
                }
            }
            else
            {
                if (int.TryParse(Format.Text, out d))
                {
                    if (double.TryParse(Price.Text, out price))
                    {
                        if (Morning.IsChecked != null)
                        {
                            morning = Morning.IsChecked.Value;
                            if (Weekend.IsChecked != null)
                            {
                                weekend = Weekend.IsChecked.Value;
                                if (Name.Text.Trim() != "")
                                {
                                    name = Name.Text.Trim();
                                    if (!(name == Tariffing.Name & d == Tariffing.D & price == Tariffing.Price & morning == Tariffing.Morning & weekend == Tariffing.Weekend))
                                    {
                                        Tariff tariff = new Tariff
                                        {
                                            D       = d,
                                            Price   = price,
                                            Morning = morning,
                                            Weekend = weekend,
                                            Name    = name
                                        };
                                        _repo.UpdateItem(Tariffing, tariff);
                                        Tarrifs filmswindow = new Tarrifs();
                                        filmswindow.Show();
                                        MessageBox.Show("The tariff was changed");
                                        this.Close();
                                    }
                                    else
                                    {
                                        MessageBox.Show("You haven't changed anything");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Enter the name");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Choose the option for weekend");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Choose the option for morning");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Price should the written with comma");
                    }
                }
                else
                {
                    MessageBox.Show("Enter the format in int");
                }
            }
        }