Beispiel #1
0
        public bool UpdateShowDAL(ShowEntity updateShow)
        {
            bool showUpdated = false;

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                var objShow = new Show();
                objShow = ObjContext.Shows.Find(updateShow.ShowId);

                if (objShow != null)
                {
                    objShow.ShowDate = updateShow.ShowDate;
                    objShow.ShowTime = updateShow.ShowTime;
                    objShow.MovieId  = updateShow.MovieId;
                    objShow.Price    = updateShow.Price;
                    objShow.ScreenId = updateShow.ScreenId;

                    int NoOfRowsAffected = ObjContext.SaveChanges();
                    showUpdated = NoOfRowsAffected > 0;
                }
                else
                {
                    showUpdated = false;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading data", ex);
            }
            return(showUpdated);
        }
Beispiel #2
0
        public bool AddMovieDAL(MovyEntity newMovie)
        {
            try
            {
                bool isAdded    = false;
                var  ObjContext = new CinestarEntitiesDAL();
                var  objMovie   = new Movy();
                objMovie.MovieId          = newMovie.MovieId;
                objMovie.MovieName        = newMovie.MovieName;
                objMovie.MovieUrl         = newMovie.MovieUrl;
                objMovie.ReleaseDate      = newMovie.ReleaseDate;
                objMovie.GenreId          = newMovie.GenreId;
                objMovie.LanguageId       = newMovie.LanguageId;
                objMovie.MovieDescription = newMovie.MovieDescription;

                ObjContext.Movies.Add(objMovie);
                int NoOfrowsAffected = ObjContext.SaveChanges();
                if (NoOfrowsAffected > 0)
                {
                    isAdded = true;
                }

                return(isAdded);
            }
            catch (Exception Ex)
            {
                return(false);
            }
        }
Beispiel #3
0
        public bool DeleteShowDAL(int deleteShowID)
        {
            bool showDeleted = false;

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                var objShow = new Show();
                objShow = ObjContext.Shows.Find(deleteShowID);

                if (objShow != null)
                {
                    ObjContext.Shows.Remove(objShow);
                    int NoOfRowsAffected = ObjContext.SaveChanges();
                    showDeleted = NoOfRowsAffected > 0;
                }
                else
                {
                    showDeleted = false;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading data", ex);
            }
            return(showDeleted);
        }
Beispiel #4
0
        public bool AddShowDAL(ShowEntity newShow)
        {
            bool showAdded = false;

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                var Objshow = new Show();
                Objshow.ShowDate = newShow.ShowDate;
                Objshow.ShowTime = newShow.ShowTime;
                Objshow.MovieId  = newShow.MovieId;
                Objshow.Price    = newShow.Price;
                Objshow.ScreenId = newShow.ScreenId;
                ObjContext.Shows.Add(Objshow);
                int  NoOfRowsAffected = ObjContext.SaveChanges();
                bool showLayoutAdded  = ShowSeatLayoutDAL.AddScreenLayout(Objshow.ShowId);

                if (NoOfRowsAffected > 0 && showLayoutAdded)
                {
                    showAdded = true;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading data", ex);
            }
            return(showAdded);
        }
Beispiel #5
0
        public bool SignUpUserDAL(UserEntity newUser)
        {
            bool userAdded = false;

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                var ObjUser = new User();

                ObjUser.UserName = newUser.UserName;
                ObjUser.Password = newUser.Password;
                ObjContext.Users.Add(ObjUser);
                int NoOfRowsAffected = ObjContext.SaveChanges();
                if (NoOfRowsAffected > 0)
                {
                    newUser.UserName = ObjUser.UserName;
                    userAdded        = true;
                }
                else
                {
                    userAdded = false;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading data", ex);
            }
            return(userAdded);
        }
Beispiel #6
0
        public bool GiveFeedbackDAL(FeedbackEntity newFeedback)
        {
            try
            {
                bool isAdded     = false;
                var  ObjContext  = new CinestarEntitiesDAL();
                var  objFeedback = new Feedback();
                objFeedback.FeedbackId      = newFeedback.FeedbackId;
                objFeedback.FeedbackDetails = newFeedback.FeedbackDetails;
                objFeedback.ViewersId       = newFeedback.ViewersId;

                ObjContext.Feedbacks.Add(objFeedback);
                int NoOfrowsAffected = ObjContext.SaveChanges();
                if (NoOfrowsAffected > 0)
                {
                    isAdded = true;
                }

                return(isAdded);
            }
            catch (Exception Ex)
            {
                return(false);
            }
        }
Beispiel #7
0
        public bool CreateTicketDAL(TicketEntity newTicket)
        {
            bool ticketAdded = false;

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                Ticket ObjTicket = new Ticket();
                ObjTicket.NoOfTickets     = newTicket.NoOfTickets;
                ObjTicket.ShowId          = newTicket.ShowId;
                ObjTicket.Price           = newTicket.Price;
                ObjTicket.ViewersId       = newTicket.ViewersId;
                ObjTicket.TransactionDate = newTicket.TransactionDate;
                ObjTicket.MovieId         = newTicket.MovieId;
                ObjTicket.Seats           = newTicket.Seats;


                ObjContext.Tickets.Add(ObjTicket);
                int NoOfRowsAffected = ObjContext.SaveChanges();
                if (NoOfRowsAffected > 0)
                {
                    ticketAdded = true;
                }
                else
                {
                    ticketAdded = false;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading data", ex);
            }
            return(ticketAdded);
        }
        public static bool AddViewerProfilesDAL(ViewerProfileEntity newViewerProfile)
        {
            bool viewerProfileAdded = false;

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                var ObjViewerProfile           = new ViewerProfile();


                ObjViewerProfile.FirstName = newViewerProfile.FirstName;
                ObjViewerProfile.LastName  = newViewerProfile.LastName;
                ObjViewerProfile.MobileNo  = newViewerProfile.MobileNo;
                ObjViewerProfile.EmailId   = newViewerProfile.EmailId;
                ObjViewerProfile.UserName  = newViewerProfile.UserName;

                ObjContext.ViewerProfiles.Add(ObjViewerProfile);
                int NoOfRowsAffected = ObjContext.SaveChanges();
                if (NoOfRowsAffected > 0)
                {
                    newViewerProfile.ViewersId = ObjViewerProfile.ViewersId;
                    viewerProfileAdded         = true;
                }
                else
                {
                    viewerProfileAdded = false;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions(ex.Message);
            }
            return(viewerProfileAdded);
        }
        public static bool AddScreenLayout(int showId)
        {
            bool layoutAdded = false;

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                var objSeatLayout = new ShowSeatLayout();
                objSeatLayout.ShowId   = showId;
                objSeatLayout.LayoutId = showId;

                objSeatLayout.UnavailableSeats = string.Empty;

                ObjContext.ShowSeatLayouts.Add(objSeatLayout);
                int NoOfRowsAffected = ObjContext.SaveChanges();
                if (NoOfRowsAffected > 0)
                {
                    layoutAdded = true;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading data", ex);
            }
            return(layoutAdded);
        }
Beispiel #10
0
        public bool DeleteMovieDAL(int movieId)
        {
            bool isDeleted  = false;
            var  objContext = new CinestarEntitiesDAL();
            var  objMovie   = objContext.Movies.Find(movieId);

            if (objMovie != null)
            {
                objContext.Movies.Remove(objMovie);
                int NoofRowsAffected = objContext.SaveChanges();
                isDeleted = (NoofRowsAffected > 0);
            }
            else
            {
                isDeleted = false;
            }
            return(isDeleted);
        }
Beispiel #11
0
        public bool UpdateMovieDAL(MovyEntity updateMovie)
        {
            bool movieUpdated = false;
            var  ObjContext   = new CinestarEntitiesDAL();
            var  objMovie     = ObjContext.Movies.Find(updateMovie.MovieId);

            if (objMovie != null)
            {
                objMovie.MovieId          = updateMovie.MovieId;
                objMovie.MovieName        = updateMovie.MovieName;
                objMovie.MovieUrl         = updateMovie.MovieUrl;
                objMovie.ReleaseDate      = updateMovie.ReleaseDate;
                objMovie.GenreId          = updateMovie.GenreId;
                objMovie.LanguageId       = updateMovie.LanguageId;
                objMovie.MovieDescription = updateMovie.MovieDescription;
                int NoofRowsAffected = ObjContext.SaveChanges();
                movieUpdated = (NoofRowsAffected > 0);
            }
            return(movieUpdated);
        }
        public static bool UpdateLayoutDAL(ShowSeatLayoutEntity layout)
        {
            CinestarEntitiesDAL cinestar   = new CinestarEntitiesDAL();
            ShowSeatLayout      seatLayout = new ShowSeatLayout();

            seatLayout.LayoutId              = layout.LayoutId;
            seatLayout.ShowId                = layout.ShowId;
            seatLayout.UnavailableSeats      = layout.UnavailableSeats;
            cinestar.Entry(seatLayout).State = EntityState.Modified;
            int rowsaffected = cinestar.SaveChanges();

            if (rowsaffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #13
0
        public bool AddGenreDAL(GenreEntity newGenre)
        {
            try
            {
                bool isAdded    = false;
                var  ObjContext = new CinestarEntitiesDAL();
                var  objGenre   = new Genre();
                objGenre.GenreId   = newGenre.GenreId;
                objGenre.GenreName = newGenre.GenreName;

                ObjContext.Genres.Add(objGenre);
                int NoOfrowsAffected = ObjContext.SaveChanges();
                if (NoOfrowsAffected > 0)
                {
                    isAdded = true;
                }

                return(isAdded);
            }
            catch (Exception Ex)
            {
                return(false);
            }
        }