예제 #1
0
        //Method that gets Performances by Theater
        public IList <UserPerformanceDTO> GetPerformancesByTheaterIDandMovieID(Guid TheaterID, int movieID)
        {
            IList <UserPerformanceDTO> ListOfPerformances = new List <UserPerformanceDTO>();

            using (var context = new CinemaEntities())
            {
                var results = (from pr in context.Perfomances.Include("Movie").Include("Theater")
                               where pr.TheaterID == TheaterID && pr.MovieID == movieID
                               select pr);
                if (results != null)
                {
                    foreach (var item in results)
                    {
                        UserPerformanceDTO row = new UserPerformanceDTO();
                        row.performanceID = item.PerfomanceID;
                        row.MovieTitle    = item.Movie.Title;
                        row.roomNumber    = item.Room.RoomNumber;
                        row.Date          = item.Date.ToString("yyyy/MM/dd");
                        string hours = item.StartingTime.Hours.ToString();
                        if (hours.Length < 2)
                        {
                            hours = string.Format("{0}{1}", "0", hours);
                        }
                        string minutes = item.StartingTime.Minutes.ToString();
                        row.StartingTime = string.Format("{0}:{1}", hours, minutes);
                        row.Duration     = item.Duration;
                        row.price        = item.Price;
                        ListOfPerformances.Add(row);
                    }
                }
            }
            return(ListOfPerformances);
        }
예제 #2
0
        //Method that gets Performance info by its ID
        public UserPerformanceDTO GetPerformanceByID(int performanceID)
        {
            UserPerformanceDTO CurrentPerformance = new UserPerformanceDTO();

            using (var context = new CinemaEntities())
            {
                var results = (from pr in context.Perfomances.Include("Theater").Include("Movie").Include("Room")
                               where pr.PerfomanceID == performanceID
                               join ad in context.Addresses
                               on pr.TheaterID equals ad.ObjectID
                               where ad.ObjectType.Description == "Theater"
                               select new
                {
                    PerformanceOut = pr,
                    AddressOut = ad
                });
                if (results != null)
                {
                    foreach (var item in results)
                    {
                        CurrentPerformance = new UserPerformanceDTO();
                        CurrentPerformance.performanceID = performanceID;
                        CurrentPerformance.TheaterName   = item.PerformanceOut.Theater.Name;
                        CurrentPerformance.Date          = item.PerformanceOut.Date.ToString("yyy/MM/dd");
                        CurrentPerformance.Duration      = item.PerformanceOut.Duration;
                        string hour = item.PerformanceOut.StartingTime.Hours.ToString();
                        if (hour.Length < 2)
                        {
                            hour = string.Format("{0}{1}", "0", hour);
                        }
                        string minutes = item.PerformanceOut.StartingTime.Minutes.ToString();
                        CurrentPerformance.StartingTime = string.Format("{0}:{1}", hour, minutes);
                        CurrentPerformance.price        = item.PerformanceOut.Price;
                        CurrentPerformance.MovieTitle   = item.PerformanceOut.Movie.Title;
                        CurrentPerformance.roomNumber   = item.PerformanceOut.Room.RoomNumber;
                        string street = item.AddressOut.AddressLine1;
                        if (item.AddressOut.AddressLine2 != null)
                        {
                            street = string.Format("{0}, {1}", item.AddressOut.AddressLine1, item.AddressOut.AddressLine2);
                        }
                        string phone = item.AddressOut.Phone;
                        CurrentPerformance.TheaterAddress = string.Format("{0}, Phone: {1}", street, phone);
                    }
                }
            }

            return(CurrentPerformance);
        }
예제 #3
0
        private void LoadData(PerformanceDataArgs pda)
        {
            String PerformanceID = pda.PerformanceID;
            IUser  UserServices  = new UserServices();
            int    performanceID;
            bool   isInt = int.TryParse(PerformanceID, out performanceID);

            if (isInt)
            {
                UserPerformanceDTO CurrentPerformance = new UserPerformanceDTO();
                CurrentPerformance = UserServices.GetPerformanceByID(performanceID);
                this.PaymentView.Model.MovieTitle = CurrentPerformance.MovieTitle;
                string theaterDetails = string.Format("{0}, {1}.", CurrentPerformance.TheaterName, CurrentPerformance.TheaterAddress);
                this.PaymentView.Model.TheaterDetails = theaterDetails;
                string performance = string.Format("Date: {0}, Starting Time: {1}, Duration: {2}, Hall: {3}.",
                                                   CurrentPerformance.Date,
                                                   CurrentPerformance.StartingTime,
                                                   CurrentPerformance.Duration,
                                                   CurrentPerformance.roomNumber);
                this.PaymentView.Model.PerformanceDetails = performance;
                this.PaymentView.Model.Price = CurrentPerformance.price.ToString();
            }
        }
예제 #4
0
        private void LoadData(PerformanceDataArgs pda)
        {
            String PerformanceID = pda.PerformanceID;
            IUser UserServices = new UserServices();
            int performanceID;
            bool isInt = int.TryParse(PerformanceID, out performanceID);
            if (isInt)
            {
                UserPerformanceDTO CurrentPerformance = new UserPerformanceDTO();
                CurrentPerformance = UserServices.GetPerformanceByID(performanceID);
                this.PaymentView.Model.MovieTitle = CurrentPerformance.MovieTitle;
                string theaterDetails = string.Format("{0}, {1}.", CurrentPerformance.TheaterName, CurrentPerformance.TheaterAddress);
                this.PaymentView.Model.TheaterDetails = theaterDetails;
                string performance = string.Format("Date: {0}, Starting Time: {1}, Duration: {2}, Hall: {3}.",
                    CurrentPerformance.Date,
                    CurrentPerformance.StartingTime,
                    CurrentPerformance.Duration,
                    CurrentPerformance.roomNumber);
                this.PaymentView.Model.PerformanceDetails = performance;
                this.PaymentView.Model.Price = CurrentPerformance.price.ToString();

            }
        }
예제 #5
0
 //Method that gets Performances by Theater
 public IList<UserPerformanceDTO> GetPerformancesByTheaterIDandMovieID(Guid TheaterID, int movieID)
 {
     IList<UserPerformanceDTO> ListOfPerformances = new List<UserPerformanceDTO>();
     using (var context = new CinemaEntities())
     {
         var results = (from pr in context.Perfomances.Include("Movie").Include("Theater")
                        where pr.TheaterID == TheaterID && pr.MovieID == movieID
                        select pr);
         if (results != null)
         {
             foreach (var item in results)
             {
                 UserPerformanceDTO row = new UserPerformanceDTO();
                 row.performanceID = item.PerfomanceID;
                 row.MovieTitle = item.Movie.Title;
                 row.roomNumber = item.Room.RoomNumber;
                 row.Date = item.Date.ToString("yyyy/MM/dd");
                 string hours = item.StartingTime.Hours.ToString();
                 if (hours.Length < 2)
                 {
                     hours = string.Format("{0}{1}", "0", hours);
                 }
                 string minutes = item.StartingTime.Minutes.ToString();
                 row.StartingTime = string.Format("{0}:{1}", hours, minutes);
                 row.Duration = item.Duration;
                 row.price = item.Price;
                 ListOfPerformances.Add(row);
             }
         }
     }
     return ListOfPerformances;
 }
예제 #6
0
        //Method that gets Performance info by its ID
        public UserPerformanceDTO GetPerformanceByID(int performanceID)
        {
            UserPerformanceDTO CurrentPerformance = new UserPerformanceDTO();

            using (var context = new CinemaEntities())
            {
                var results = (from pr in context.Perfomances.Include("Theater").Include("Movie").Include("Room")
                               where pr.PerfomanceID == performanceID
                               join ad in context.Addresses
                               on pr.TheaterID equals ad.ObjectID
                               where ad.ObjectType.Description == "Theater"
                               select new
                               {
                                   PerformanceOut = pr,
                                   AddressOut = ad
                               });
                if (results != null)
                {
                    foreach (var item in results)
                    {
                        CurrentPerformance = new UserPerformanceDTO();
                        CurrentPerformance.performanceID = performanceID;
                        CurrentPerformance.TheaterName = item.PerformanceOut.Theater.Name;
                        CurrentPerformance.Date = item.PerformanceOut.Date.ToString("yyy/MM/dd");
                        CurrentPerformance.Duration = item.PerformanceOut.Duration;
                        string hour = item.PerformanceOut.StartingTime.Hours.ToString();
                        if (hour.Length < 2)
                        {
                            hour = string.Format("{0}{1}", "0", hour);
                        }
                        string minutes = item.PerformanceOut.StartingTime.Minutes.ToString();
                        CurrentPerformance.StartingTime = string.Format("{0}:{1}", hour, minutes);
                        CurrentPerformance.price = item.PerformanceOut.Price;
                        CurrentPerformance.MovieTitle = item.PerformanceOut.Movie.Title;
                        CurrentPerformance.roomNumber = item.PerformanceOut.Room.RoomNumber;
                        string street = item.AddressOut.AddressLine1;
                        if (item.AddressOut.AddressLine2 != null)
                        {
                            street = string.Format("{0}, {1}", item.AddressOut.AddressLine1, item.AddressOut.AddressLine2);
                        }
                        string phone = item.AddressOut.Phone;
                        CurrentPerformance.TheaterAddress = string.Format("{0}, Phone: {1}", street, phone);

                    }
                }
            }

            return CurrentPerformance;
        }