Example #1
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            var selectedTable = ShceduleItems.SelectedItem as LibraryOfClasses.TimeTable;

            if (selectedTable == null)
            {
                MessageBox.Show("Select the item");
                return;
            }
            else
            {
                if (_repo.RemoveItem(selectedTable))
                {
                    TimeTable Tablewindow = new TimeTable();
                    Tablewindow.Show();
                    MessageBox.Show("The line was deleted");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("There is information about this line in other tables");
                }
            }
        }
Example #2
0
        private void ChangeFilmInformation_Click(object sender, RoutedEventArgs e)
        {
            DateTime start;
            string   hall;
            string   film;
            string   worker;

            if (Tabling == null)
            {
                if (DateTime.TryParse(Start.Text, out start))
                {
                    if (HallName.Text.Trim() != "")
                    {
                        hall = HallName.Text.Trim();
                        if (FilmName.Text.Trim() != "")
                        {
                            film = FilmName.Text.Trim();
                            if (WorkerName.Text.Trim() != "")
                            {
                                worker = WorkerName.Text.Trim();
                                var Filming = _repo.GetFilm(film);
                                if (Filming != null)
                                {
                                    var Halling = _repo.GetHall(hall);
                                    if (Halling != null)
                                    {
                                        var Working = _repo.GetWorker(worker);
                                        if (Working != null)
                                        {
                                            LibraryOfClasses.TimeTable timeTable = new LibraryOfClasses.TimeTable
                                            {
                                                Datetime = start,
                                                Film     = Filming,
                                                FilmID   = Filming.FilmID,
                                                Hall     = Halling,
                                                HallID   = Halling.HallID,
                                                Worker   = Working,
                                                WorkerID = Working.WorkerID
                                            };
                                            _repo.AddItem(timeTable);
                                            TimeTable tablewindow = new TimeTable();
                                            tablewindow.Show();
                                            MessageBox.Show("The line was added");
                                            this.Close();
                                        }
                                        else
                                        {
                                            MessageBox.Show("There is no worker with this name");
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("There is no hall with this name");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("There in no film with this name");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Enter the worker");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Enter the film");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Enter the hall");
                    }
                }
                else
                {
                    MessageBox.Show("Enter the date in the fillowing format YYYY-MM-DD HH:MM:SS");
                }
            }
            else
            {
                if (DateTime.TryParse(Start.Text, out start))
                {
                    if (HallName.Text.Trim() != "")
                    {
                        hall = HallName.Text.Trim();
                        if (FilmName.Text.Trim() != "")
                        {
                            film = FilmName.Text.Trim();
                            if (WorkerName.Text.Trim() != "")
                            {
                                worker = WorkerName.Text.Trim();
                                var Filming = _repo.GetFilm(film);
                                if (Filming != null)
                                {
                                    var Halling = _repo.GetHall(hall);
                                    if (Halling != null)
                                    {
                                        var Working = _repo.GetWorker(worker);
                                        if (Working != null)
                                        {
                                            if (!(Working.WorkerID == Tabling.WorkerID & Filming.FilmID == Tabling.FilmID & Halling.HallID == Tabling.HallID & start == Tabling.Datetime))
                                            {
                                                LibraryOfClasses.TimeTable timeTable = new LibraryOfClasses.TimeTable
                                                {
                                                    Datetime = start,
                                                    Film     = Filming,
                                                    FilmID   = Filming.FilmID,
                                                    Hall     = Halling,
                                                    HallID   = Halling.HallID,
                                                    Worker   = Working,
                                                    WorkerID = Working.WorkerID
                                                };
                                                _repo.UpdateItem(Tabling, timeTable);
                                                TimeTable tablewindow = new TimeTable();
                                                tablewindow.Show();
                                                MessageBox.Show("The line was changed");
                                                this.Close();
                                            }
                                            else
                                            {
                                                MessageBox.Show("You haven't changed anything");
                                            }
                                        }
                                        else
                                        {
                                            MessageBox.Show("There is no worker with this name");
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("There is no hall with this name");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("There in no film with this name");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Enter the worker");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Enter the film");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Enter the hall");
                    }
                }
                else
                {
                    MessageBox.Show("Enter the date in the fillowing format YYYY-MM-DD HH:MM:SS");
                }
            }
        }
Example #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");
     }
 }