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 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);
 }
        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);
        }
示例#4
0
        public static Cinema GetCinema(int cinemaNum, List <Cinema> cinemas)
        {
            Cinema cinema = cinemas.ElementAt(cinemaNum - 1);

            return(cinema);
        }
示例#5
0
        public void AddFromArr()
        {
            Cinema c     = null;
            Hall   h     = null;
            Film   f     = null;
            int    wrong = 0;

            for (int i = 1; i <= iLastRow; i++)
            {
                try
                {
                    bool ok = false;
                    foreach (Cinema x in db.CinemaSet)
                    {
                        if ((x.Name == dataArr[i, 1] as string) && (!x.Deleted))
                        {
                            ok = true;
                            c  = x;
                            break;
                        }
                    }
                    if (!ok)
                    {
                        wrong++;
                    }
                    else
                    {
                        ok = false;
                        foreach (Hall x in c.Hall)
                        {
                            if ((x.Num == (byte)Convert.ChangeType(dataArr[i, 2], typeof(byte))) && (!x.Deleted))
                            {
                                h  = x;
                                ok = true;
                                break;
                            }
                        }
                        if (!ok)
                        {
                            wrong++;
                            break;
                        }
                        else
                        {
                            ok = false;
                            foreach (Film x in db.FilmSet)
                            {
                                if (x.Name == dataArr[i, 3] as string)
                                {
                                    f  = x;
                                    ok = true;
                                    break;
                                }
                            }
                            if (!ok)
                            {
                                wrong++;
                                break;
                            }
                            else
                            {
                                short    p = (short)Convert.ChangeType(dataArr[i, 4], typeof(short));
                                DateTime t = new DateTime();
                                t = (DateTime)Convert.ChangeType(dataArr[i, 5], typeof(DateTime));
                                SessionWork.Add(h, t, f, p);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    wrong++;
                    MessageBox.Show("Ошибка при чтении информации о сеансе! Данный сеанс не буде добавлен");
                }
            }
        }
        static Cinema CreateCinema()
        {
            Cinema newCinema = new Cinema();

            return(newCinema = null);
        }