public DateSeancesControl(MainWindow main, Seancess seancess, Film film)
        {
            InitializeComponent();
            genres        = new List <Genre>();
            this.main     = main;
            this.seancess = seancess;
            this.film     = film;
            datesname     = new List <DateMy>();
            seancesname   = new List <SeanceMy>();
            currentdate   = new List <SeanceMy>();

            using (KinoContext db = new KinoContext())
            {
                List <int> datesids  = new List <int>();
                var        filmdates = db.FilmsDates.Where(x => x.FilmId == film.Id);

                foreach (var x in filmdates.ToList())
                {
                    datesids.Add((int)x.DateId);
                }

                foreach (var x in datesids.ToList())
                {
                    var newdate = db.Dates.First(d => d.Id == x).Title;
                    datesname.Add(new DateMy {
                        Title = newdate.ToString("d"), InFormat = newdate
                    });
                    datesGrid.ItemsSource = null;
                    datesGrid.ItemsSource = datesname;
                }


                foreach (var x in filmdates.ToList())
                {
                    int dateid   = (int)x.DateId;
                    var currdate = (DateTime)(db.Dates.Find(dateid).Title);

                    List <int> seancesids       = new List <int>();
                    var        filmdatesseances = db.FilmsDatesSeances.Where(f => f.FilmsDatesId == x.Id);

                    foreach (var f in filmdatesseances)
                    {
                        seancesids.Add((int)f.SeanceId);
                    }

                    foreach (var s in seancesids.ToList())
                    {
                        var newseance = db.Seances.First(d => d.Id == s).Title;
                        seancesname.Add(new SeanceMy {
                            Title = newseance.ToString("t"), InFormat = currdate, SeanceInFormat = newseance
                        });
                    }
                }
            }
        }
Esempio n. 2
0
        public ZalControl(Seancess seancess)
        {
            InitializeComponent();

            panels        = main.Children.OfType <StackPanel>();
            this.seancess = seancess;

            if (seancess.main.user == null)
            {
                order.Content = "Сохранить";
            }

            using (KinoContext db = new KinoContext())
            {
                if (seancess.main.user != null)
                {
                    firstf.IsReadOnly   = true;
                    secondf.IsReadOnly  = true;
                    thirdf.IsReadOnly   = true;
                    fourthf.IsReadOnly  = true;
                    fifthf.IsReadOnly   = true;
                    sixf.IsReadOnly     = true;
                    seventhf.IsReadOnly = true;
                    eighthf.IsReadOnly  = true;
                }

                firstf.Text   = db.Prices.First(x => x.Range == 1).Cost.ToString();
                secondf.Text  = db.Prices.First(x => x.Range == 2).Cost.ToString();
                thirdf.Text   = db.Prices.First(x => x.Range == 3).Cost.ToString();
                fourthf.Text  = db.Prices.First(x => x.Range == 4).Cost.ToString();
                fifthf.Text   = db.Prices.First(x => x.Range == 5).Cost.ToString();
                sixf.Text     = db.Prices.First(x => x.Range == 6).Cost.ToString();
                seventhf.Text = db.Prices.First(x => x.Range == 7).Cost.ToString();
                eighthf.Text  = db.Prices.First(x => x.Range == 8).Cost.ToString();
            }


            foreach (var x in panels)
            {
                var grids = x.Children.OfType <Grid>();

                foreach (var y in grids)
                {
                    var buttons = y.Children.OfType <Button>();

                    foreach (var z in buttons)
                    {
                        z.Style = (Style)FindResource("RoundCorner");
                    }
                }
            }
        }
        public NewFilmControl(MainWindow main, Seancess seancess, Film film, bool isEdit)
        {
            InitializeComponent();
            this.seancess = seancess;

            if (isEdit)
            {
                edit = true;
            }

            Start(film, main);

            filmIMDb.Visibility      = Visibility.Visible;
            filmKinopoisk.Visibility = Visibility.Visible;
            ratings_premier.Text     = "Рейтинги: ";
            filmrating.Visibility    = Visibility.Visible;
            filmpremier.Visibility   = Visibility.Collapsed;
            seancesedit.IsEnabled    = true;
        }
Esempio n. 4
0
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            using (KinoContext db = new KinoContext())
            {
                var image  = ImageToByte((BitmapImage)filmposter.Source);
                var filmid = db.Films.First(x => x.PosterByte == image).Id;

                main.GridPrincipal.Children.Clear();
                var filmmenu = new Seancess(main);
                filmmenu.profile         = this;
                filmmenu.back.Visibility = Visibility.Visible;
                foreach (var x in filmmenu.filmsGrid.Items)
                {
                    filmmenu.filmsGrid.SelectedItem = x;
                    Film f = (Film)filmmenu.filmsGrid.SelectedItem;
                    if (f.Id == filmid)
                    {
                        break;
                    }
                }

                main.GridPrincipal.Children.Add(filmmenu);
            }
        }