コード例 #1
0
 public TimeTableInformation(LibraryOfClasses.TimeTable thetable)
 {
     InitializeComponent();
     if (thetable != null)
     {
         Start.Text      = thetable.Datetime.ToString();
         HallName.Text   = thetable.Hall.HallName;
         FilmName.Text   = thetable.Film.Name;
         WorkerName.Text = thetable.Worker.Name;
     }
     Tabling = thetable;
 }
コード例 #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");
                }
            }
        }