public static void Lister_Films()
        {
            Films films = new Films(ConnectionString);
            films.SelectAll("Parution");

            Console.WriteLine("Listes des films");
            /*
             while (films.Next())
            {
                Console.WriteLine("********************************");
                Console.WriteLine(films.film.Titre);
                Console.WriteLine(films.film.Parution.ToLongDateString());
                Console.WriteLine(films.film.Genre.ToString());
            }
            */

            List<Object> films_list = films.ToList();
            foreach(Film film in films_list)
            {
                Console.WriteLine("********************************");
                Console.WriteLine(film.Titre);
                Console.WriteLine(film.Parution.ToLongDateString());
                Console.WriteLine(film.Genre.ToString());
            }
            Console.WriteLine("********************************");
        }
 public static void Ajouter_Film(String titre, DateTime parution, Cinema.Genre genre)
 {
     Films films = new Films(ConnectionString);
     films.Titre = titre;
     films.Parution = parution;
     films.Genre = genre;
     films.Insert();
 }
 public ActionResult Editer(String Id)
 {
     Films films = new Films(Session["DB_CINEMA"]);
     if (films.SelectByID(Id))
         return View(films.film);
     else
         return RedirectToAction("Lister", "Films");
 }
示例#4
0
 /// <summary>
 /// Добавить новый фильм
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AddNewFilm(object sender, RoutedEventArgs e)
 {
     if (NewFilmNameTextBox.Text == "")
     {
         MessageBox.Show("Неверное название фильма", Error);
     }
     else if (NewFilmDateReleaseDatePicker.SelectedDate == null)
     {
         MessageBox.Show("Укажите дату релиза", Error);
     }
     else if (NewFilmDateEndDatePicker.SelectedDate == null)
     {
         MessageBox.Show("Укажите дату окончания проката", Error);
     }
     else if (NewFilmDateReleaseDatePicker.SelectedDate > NewFilmDateEndDatePicker.SelectedDate)
     {
         MessageBox.Show("Прокат фильма не может закончиться раньше, чем он начнется", Error);
     }
     else if (NewFilmDateEndDatePicker.SelectedDate < DateTime.Now)
     {
         MessageBox.Show("Фильм уже вышел из проката", Error);
     }
     else if (!(Regex.IsMatch(NewFilmDurationHourTextBox.Text, reg2) || Regex.IsMatch(NewFilmDurationHourTextBox.Text, reg1)) ||
              !(Regex.IsMatch(NewFilmDurationMinuteTextBox.Text, reg2) || Regex.IsMatch(NewFilmDurationMinuteTextBox.Text, reg1)) ||
              int.Parse(NewFilmDurationMinuteTextBox.Text) > 59 ||
              (int.Parse(NewFilmDurationMinuteTextBox.Text) == 0 &&
               int.Parse(NewFilmDurationHourTextBox.Text) == 0))
     {
         MessageBox.Show("Неверная длительность фильма", Error);
     }
     else if (NewFilmPosterLabel.Background == null)
     {
         MessageBox.Show("Ваберите постер", Error);
     }
     else
     {
         Films film = new Films()
         {
             Film_name    = NewFilmNameTextBox.Text,
             Date_release = (DateTime)NewFilmDateReleaseDatePicker.SelectedDate,
             Date_end     = NewFilmDateEndDatePicker.SelectedDate,
             Duration     = new TimeSpan(int.Parse(NewFilmDurationHourTextBox.Text), int.Parse(NewFilmDurationMinuteTextBox.Text), 0),
             Description  = NewFilmDescriptionTextBox.Text,
             Poster       = ImageWork.ImageToByteArray(System.Drawing.Image.FromFile(posterWay))
         };
         using (var db = new CinemaEntities())
         {
             db.Films.Add(film);
             db.SaveChanges();
             MessageBox.Show("Фильм добавлен");
         }
         LoadPosters();
         FromAddFilmToManu(null, null);
     }
 }
        public ActionResult Lister()
        {
            Films films = new Films(Session["DB_CINEMA"]);

            String orderBy = "";
            if (Session["Film_SortBy"] != null)
                orderBy = (String)Session["Film_SortBy"] + " " + (String)Session["Film_SortOrder"];

            films.SelectAll(orderBy);
            return View(films.ToList());
        }
 public ActionResult Ajouter(Cinema.Film film)
 {
     if (ModelState.IsValid)
     {
         Films films = new Films(Session["DB_CINEMA"]);
         films.film = film;
         films.film.Genre = (Cinema.Genre)int.Parse(Request["Genre"]);
         films.Insert();
         return RedirectToAction("Lister", "Films");
     }
     return View(film);
 }
示例#7
0
 /// <summary>
 /// На постер нажали правой кнопкой мыши
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Poster_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     film = new Films();
     foreach (var v in PostersList)
     {
         if (v.Poster == sender)
         {
             film = v.film;
             break;
         }
     }
     ListPosterGrid.Visibility      = Visibility.Hidden;
     FilmInformationGrid.Visibility = Visibility.Visible;
     DatePicker_SelectedDateChanged(DateSessionDataPicker, null);
 }
        public ActionResult Editer(Cinema.Film film)
        {
            Films films = new Films(Session["DB_CINEMA"]);
            if (ModelState.IsValid)
            {
                if (films.SelectByID(film.Id))
                {
                    films.film = film;
                    films.film.Genre = (Cinema.Genre)int.Parse(Request["Genre"]);

                    films.Update();
                    return RedirectToAction("Lister", "Films");
                }
            }
            return View(film);
        }
        public static void Ajouter_Acteur(String film_Titre, String nom, DateTime naissance, String nationalite)
        {
            Acteurs acteurs = new Acteurs(ConnectionString);
            acteurs.acteur.Nom = nom;
            acteurs.acteur.Naissance = naissance;
            acteurs.acteur.Nationalite = nationalite;
            acteurs.Insert();

            Films films = new Films(ConnectionString);
            if (films.SelectByFieldName("Titre", film_Titre))
            {
                Parutions parutions = new Parutions(ConnectionString);

                acteurs.SelectLast();
                parutions.parution.Acteur_Id = acteurs.acteur.Id;
                parutions.parution.Film_Id = films.film.Id;
                parutions.Insert();
            }
        }
 public static void Lister_Films()
 {
     Films films = new Films(ConnectionString);
     if (films.SelectAll("Parution"))
     {
         Console.WriteLine("Les des films");
         do
         {
             Console.WriteLine("********************************");
             Console.WriteLine(films.Titre);
             Console.WriteLine(films.Parution.ToLongDateString());
             Console.WriteLine(films.Genre.ToString());
         } while (films.Next());
         Console.WriteLine("********************************");
     }
 }
 public ActionResult Lister()
 {
     Films films = new Films(Session["DB_CINEMA"]);
     films.SelectAll();
     return View(films.ToList());
 }
 public ActionResult Effacer(String Id)
 {
     Films films = new Films(Session["DB_CINEMA"]);
     films.DeleteRecordByID(Id);
     return RedirectToAction("Lister", "Films");
 }