コード例 #1
0
        public List <KeyValueOption <int> > GetTheatre(int locationID, int theatreID, DateTime schedulingdate)
        {
            using (var context = new OMSTContext())
            {
                var scheduled = (from row in context.ShowTimes
                                 where row.Theatre.LocationID == locationID &&
                                 row.TheatreID == theatreID &&
                                 schedulingdate.Year == row.StartDate.Year &&
                                 schedulingdate.Month == row.StartDate.Month &&
                                 schedulingdate.Day == row.StartDate.Day
                                 select row).FirstOrDefault();
                if (scheduled == null)
                {
                    var result = from row in context.Theatres
                                 where row.LocationID == locationID &&
                                 row.TheatreID == theatreID
                                 select new KeyValueOption <int>
                    {
                        DisplayText = row.TheatreNumber.ToString(),
                        Key         = row.TheatreID
                    };

                    return(result.ToList());
                }
                else
                {
                    return(new List <KeyValueOption <int> >());
                }
            }
        }
コード例 #2
0
 public decimal Movies_GetTicketPrices(int movieid)
 {
     using (var context = new OMSTContext())
     {
         var premiuminfo = (from x in context.Movies
                            where x.MovieID == movieid
                            select x.ScreenType).FirstOrDefault();
         decimal premiumticket = 0.00m;
         if (premiuminfo == null)
         {
             throw new Exception("Movie screentype info missing");
         }
         if (premiuminfo.Premium)
         {
             if (premiuminfo.ScreenTypeID == 2)
             {
                 premiumticket = 3.00m;
             }
             else
             {
                 premiumticket = 5.00m;
             }
         }
         return(premiumticket);
     }
 }
コード例 #3
0
 public List <Category> TicketCategory_List()
 {
     using (var context = new OMSTContext())
     {
         return(context.TicketCategories.Select(x => new Category {
             Description = x.Description, TicketPrice = x.TicketPrice
         }).ToList());
     }
 }
コード例 #4
0
 public List <KeyValueOption <int> > Locations_List()
 {
     using (var context = new OMSTContext())
     {
         return(context.Locations.Select(x => new KeyValueOption <int> {
             Key = x.LocationID, DisplayText = x.Description
         }).ToList());
     }
 }
コード例 #5
0
 public List <KeyValueOption <int> > ListAllLocations()
 {
     using (var context = new OMSTContext())
     {
         var result = from row in context.Locations
                      select new KeyValueOption <int>
         {
             DisplayText = row.Description,
             Key         = row.LocationID
         };
         return(result.ToList());
     }
 }
コード例 #6
0
 public List <KeyValueOption <int> > ListMovies()
 {
     using (var context = new OMSTContext())
     {
         var result = from row in context.Movies
                      orderby row.Title
                      select new KeyValueOption <int>
         {
             DisplayText = row.Title + " (" + row.Length.ToString() + ")",
             Key         = row.MovieID
         };
         return(result.ToList());
     }
 }
コード例 #7
0
        public List <KeyValueOption <int> > ListTheatres(int locationID)
        {
            using (var context = new OMSTContext())
            {
                var result = from row in context.Theatres
                             where row.LocationID == locationID

                             select new KeyValueOption <int>
                {
                    DisplayText = row.TheatreNumber.ToString(),
                    Key         = row.TheatreID
                };
                return(result.ToList());
            }
        }
コード例 #8
0
 public List <RecentTickets> Tickets_NewlyAddedTickets()
 {
     using (var context = new OMSTContext())
     {
         return(context.Tickets
                .Where(x => x.TicketID > (context.Tickets.Max(y => y.TicketID) - 25))
                .OrderByDescending(x => x.TicketID)
                .Select(x => new RecentTickets
         {
             TicketID = x.TicketID,
             ShowTimeID = x.ShowTimeID,
             TicketCategoryID = x.TicketCategoryID,
             TicketPrice = x.TicketPrice,
             TicketPremium = x.TicketPremium
         })
                .ToList());
     }
 }
コード例 #9
0
 public List <ShowTimesAssessment> ShowTimes_ListByStartTimes()
 {
     using (var context = new OMSTContext())
     {
         var results = (from x in context.ShowTimes
                        orderby x.StartDate descending
                        select new ShowTimesAssessment
         {
             ShowTimeID = x.ShowTimeID,
             MovieIDTitle = x.MovieID.ToString() +
                            " (" + x.Movie.Title + ")",
             StartDate = x.StartDate,
             TheatreIDTheatreNumber = x.TheatreID.ToString() +
                                      " (Number:" + x.Theatre.TheatreNumber
                                      + ")"
         }).Take(30);
         return(results.ToList());
     }
 }
コード例 #10
0
        public List <KeyValueOption <int> > ShowTimes_MoviesByLocations(int locationid)
        {
            DateTime fakeDate = DateTime.Parse("2017-12-28");

            using (var context = new OMSTContext())
            {
                var results = (from x in context.ShowTimes
                               where x.StartDate.Year == 2017 &&
                               x.StartDate.Month == 12 &&
                               x.StartDate.Day == 28 &&
                               x.Theatre.LocationID == locationid
                               select new KeyValueOption <int>
                {
                    Key = x.MovieID,
                    DisplayText = x.Movie.Title
                }).Distinct().OrderBy(x => x.DisplayText);
                return(results.ToList());
            }
        }
コード例 #11
0
        public List <MovieShowTimes> ShowTimes_ShowTimesByMoviesByLocations(int locationid, int movieid)
        {
            DateTime fakeDate = DateTime.Parse("2017-12-28");

            using (var context = new OMSTContext())
            {
                var results = (from x in context.ShowTimes
                               where x.StartDate.Year == 2017 &&
                               x.StartDate.Month == 12 &&
                               x.StartDate.Day == 28 &&
                               x.Theatre.LocationID == locationid &&
                               x.MovieID == movieid
                               select new MovieShowTimes
                {
                    TheatreNumber = x.Theatre.TheatreNumber,
                    ShowTimeID = x.ShowTimeID,
                    Times = x.StartDate
                }).Distinct().OrderBy(x => x.Times);
                return(results.ToList());
            }
        }