Esempio n. 1
0
        // GET: Tickets/Details/5

        public ActionResult CreateTicket()
        {
            int    nooftickets = int.Parse(Request.QueryString["noofseats"]);
            int    viewerId    = int.Parse(Request.QueryString["viewerid"]);
            int    showId      = int.Parse(Request.QueryString["showid"]);
            int    movieId     = int.Parse(Request.QueryString["movieId"]);
            string seatnos     = Request.QueryString["seatnumbers"];


            ViewerProfileEntity viewer = ViewrProfilesBL.SearchViewerProfileByIdBL(viewerId);
            ShowEntity          show   = ShowsBL.SearchShowByIdBL(showId);
            MovyEntity          movie  = MovieBL.SearchMovieByIdBL(movieId);
            ScreenEntity        screen = ScreenBL.SearchScreenByIdBL(show.ScreenId);

            ViewBag.ShowDate       = show.ShowDate.ToShortDateString();
            ViewBag.ShowId         = show.ShowId;
            ViewBag.ViewerId       = viewer.ViewersId;
            ViewBag.MovieName      = movie.MovieName;
            ViewBag.Price          = show.Price * nooftickets;
            ViewBag.NameOfCustomer = viewer.FirstName + " " + viewer.LastName;
            ViewBag.ScreenName     = screen.ScreenName;

            ViewBag.noOfTickets = nooftickets;
            ViewBag.seatNos     = seatnos;

            return(View());
        }
Esempio n. 2
0
        public ActionResult ViewTicket(int id)
        {
            TicketEntity createTicket = new TicketEntity();

            createTicket = TicketsBL.SearchTicketByIdBL(id);

            ViewerProfileEntity viewer = ViewrProfilesBL.SearchViewerProfileByIdBL(createTicket.ViewersId);
            ShowEntity          show   = ShowsBL.SearchShowByIdBL(createTicket.ShowId);
            MovyEntity          movie  = MovieBL.SearchMovieByIdBL(createTicket.MovieId);
            ScreenEntity        screen = ScreenBL.SearchScreenByIdBL(show.ScreenId);


            ViewBag.ShowDate       = show.ShowDate.ToShortDateString();
            ViewBag.ShowId         = show.ShowId;
            ViewBag.ViewerId       = viewer.ViewersId;
            ViewBag.MovieName      = movie.MovieName;
            ViewBag.Price          = show.Price * createTicket.NoOfTickets;
            ViewBag.NameOfCustomer = viewer.FirstName + " " + viewer.LastName;
            ViewBag.ScreenName     = screen.ScreenName;

            ViewBag.noOfTickets = createTicket.NoOfTickets;
            ViewBag.seatNos     = createTicket.Seats;


            if (createTicket != null)
            {
                return(View());
            }
            else
            {
                return(Redirect(string.Format("/Movies/ListAllMovies")));
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public static ViewerProfileEntity SearchViewerProfileByIdDAL(int id)
        {
            ViewerProfileEntity searchViewerProfile = new ViewerProfileEntity();

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();

                var ObjViewerProfile = ObjContext.ViewerProfiles.Find(id);
                if (ObjViewerProfile != null)
                {
                    searchViewerProfile.ViewersId = ObjViewerProfile.ViewersId;
                    searchViewerProfile.FirstName = ObjViewerProfile.FirstName;
                    searchViewerProfile.LastName  = ObjViewerProfile.LastName;
                    searchViewerProfile.MobileNo  = ObjViewerProfile.MobileNo;
                    searchViewerProfile.EmailId   = ObjViewerProfile.EmailId;
                    searchViewerProfile.UserName  = ObjViewerProfile.UserName;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading searching data", ex);
            }
            return(searchViewerProfile);
        }
Esempio n. 5
0
        //public static List<ViewerProfile> GetAllViewerProfilesDAL()
        //{
        //    List<ViewerProfile> ObjViewerProfileList = new List<ViewerProfile>();


        //    try
        //    {
        //        CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
        //        var Query = from ViewerProfile in ObjContext.ViewerProfiles
        //                    select ViewerProfile;
        //        ViewerProfile ObjTempViewerProfile = null;
        //        foreach (var obj in Query)
        //        {
        //            ObjTempViewerProfile = new ViewerProfile();
        //            ObjTempViewerProfile.ViewersId = obj.ViewersId;
        //            ObjTempViewerProfile.FirstName = obj.FirstName;
        //            ObjTempViewerProfile.LastName = obj.LastName;
        //            ObjTempViewerProfile.MobileNo = obj.MobileNo;
        //            ObjTempViewerProfile.EmailId = obj.EmailId;
        //            ObjTempViewerProfile.UserName = obj.UserName;

        //            ObjViewerProfileList.Add(ObjTempViewerProfile);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new MovieExceptions("Error : Reading data", ex);
        //    }

        //    return ObjViewerProfileList;
        //}


        //public static bool UpdateViewerProfileDAL(ViewerProfile updateViewerProfile)
        //{
        //    bool viewerProfileUpdated = false;
        //    try
        //    {
        //        CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
        //        var ObjViewerProfile = ObjContext.ViewerProfiles.Find(updateViewerProfile.ViewersId);
        //        if (ObjViewerProfile != null)
        //        {
        //            ObjViewerProfile.FirstName = updateViewerProfile.FirstName;
        //            ObjViewerProfile.LastName = updateViewerProfile.LastName;
        //            ObjViewerProfile.MobileNo = updateViewerProfile.MobileNo;
        //            ObjViewerProfile.EmailId = updateViewerProfile.EmailId;
        //            ObjViewerProfile.UserName = updateViewerProfile.UserName;


        //            int NoOfRowsAffected = ObjContext.SaveChanges();
        //            viewerProfileUpdated = NoOfRowsAffected > 0;
        //        }
        //        else
        //        {
        //            viewerProfileUpdated = false;
        //        }


        //    }
        //    catch (Exception ex)
        //    {
        //        throw new MovieExceptions(ex.Message);
        //    }
        //    return viewerProfileUpdated;
        //}
        public static ViewerProfileEntity SearchViewerProfileByUsernameDAL(string id)
        {
            ViewerProfileEntity searchViewerProfile = new ViewerProfileEntity();

            try
            {
                CinestarEntitiesDAL ObjContext = new CinestarEntitiesDAL();
                var query = from item in ObjContext.ViewerProfiles
                            where item.UserName.Equals(id)
                            select item;
                ViewerProfile profile          = query.FirstOrDefault();
                int           Viewerid         = profile.ViewersId;
                var           ObjViewerProfile = ObjContext.ViewerProfiles.Find(Viewerid);
                if (ObjViewerProfile != null)
                {
                    searchViewerProfile.ViewersId = ObjViewerProfile.ViewersId;
                    searchViewerProfile.FirstName = ObjViewerProfile.FirstName;
                    searchViewerProfile.LastName  = ObjViewerProfile.LastName;
                    searchViewerProfile.MobileNo  = ObjViewerProfile.MobileNo;
                    searchViewerProfile.EmailId   = ObjViewerProfile.EmailId;
                    searchViewerProfile.UserName  = ObjViewerProfile.UserName;
                }
            }
            catch (Exception ex)
            {
                throw new MovieExceptions("Error : Reading searching data", ex);
            }
            return(searchViewerProfile);
        }
Esempio n. 6
0
        public ActionResult CreateProfile(ViewerProfileEntity objNewViewerProfiles)
        {
            objNewViewerProfiles.UserName = Request.QueryString["username"];
            var IsAdded = ViewrProfilesBL.AddViewerProfileBL(objNewViewerProfiles);

            if (IsAdded)
            {
                string url = string.Format("/ViewerProfiles/ProfileDetails?username={0}", Request.QueryString["username"]);
                return(Redirect(url));
            }

            else
            {
                return(View(objNewViewerProfiles));
            }
        }
Esempio n. 7
0
        public static ViewerProfileEntity SearchViewerProfileByIdBL(int viewerId)
        {
            ViewerProfileEntity searchViewerProfile = null;

            try
            {
                searchViewerProfile = ViewerProfilesDAL.SearchViewerProfileByIdDAL(viewerId);
            }
            catch (MovieExceptions ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchViewerProfile);
        }
Esempio n. 8
0
        //public static List<ViewerProfile> GetAllViewerProfilesBL()
        //{
        //    List<ViewerProfile> viewerProfileList = null;
        //    try
        //    {
        //        viewerProfileList = ViewerProfilesDAL.GetAllViewerProfilesDAL();
        //    }
        //    catch (MovieExceptions ex)
        //    {
        //        throw ex;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    return viewerProfileList;
        //}



        //public static bool UpdateViewerProfileBL(ViewerProfile updateViewerProfile)
        //{
        //    bool viewerProfileUpdated = false;
        //    try
        //    {
        //        if (ValidateViewerProfile(updateViewerProfile))
        //        {
        //            viewerProfileUpdated = ViewerProfilesDAL.UpdateViewerProfileDAL(updateViewerProfile);
        //        }
        //    }
        //    catch (MovieExceptions)
        //    {
        //        throw;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    return viewerProfileUpdated;

        //}
        public static ViewerProfileEntity SearchViewerProfileByUsernameBL(string searchViewerusername)
        {
            ViewerProfileEntity searchViewerProfile = null;

            try
            {
                searchViewerProfile = ViewerProfilesDAL.SearchViewerProfileByUsernameDAL(searchViewerusername);
            }
            catch (MovieExceptions ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchViewerProfile);
        }
Esempio n. 9
0
        public ActionResult CreateTicket(TicketEntity ticket)
        {
            int    nooftickets = int.Parse(Request.QueryString["noofseats"]);
            int    viewerId    = int.Parse(Request.QueryString["viewerid"]);
            int    showId      = int.Parse(Request.QueryString["showid"]);
            int    movieId     = int.Parse(Request.QueryString["movieId"]);
            string seatnos     = Request.QueryString["seatnumbers"];

            ViewerProfileEntity viewer = ViewrProfilesBL.SearchViewerProfileByIdBL(viewerId);
            ShowEntity          show   = ShowsBL.SearchShowByIdBL(showId);
            MovyEntity          movie  = MovieBL.SearchMovieByIdBL(movieId);
            ScreenEntity        screen = ScreenBL.SearchScreenByIdBL(show.ScreenId);

            TicketEntity createTicket = new TicketEntity();

            createTicket.NoOfTickets     = nooftickets;
            createTicket.ShowId          = showId;
            ViewBag.MovieName            = movie.MovieName;
            createTicket.Price           = show.Price * nooftickets;
            createTicket.ViewersId       = viewer.ViewersId;
            createTicket.TransactionDate = DateTime.Now.Date;
            createTicket.MovieId         = movie.MovieId;
            createTicket.Seats           = seatnos;

            if (ModelState.IsValid)
            {
                var IsAdded = TicketsBL.CreateTicketBL(createTicket);
                if (IsAdded)
                {
                    return(Redirect(string.Format("/Payments/CompletePayment")));
                }
                else
                {
                    return(Redirect(string.Format("/SeatLayout/SelectSeatsView")));
                }
            }
            else
            {
                return(Redirect(string.Format("/SeatLayout/SelectSeatsView")));
            }
        }
Esempio n. 10
0
        public static bool AddViewerProfileBL(ViewerProfileEntity newViewerProfile)
        {
            bool viewerProfileAdded = false;

            try
            {
                if (ValidateViewerProfile(newViewerProfile))
                {
                    viewerProfileAdded = ViewerProfilesDAL.AddViewerProfilesDAL(newViewerProfile);
                }
            }
            catch (MovieExceptions)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(viewerProfileAdded);
        }
Esempio n. 11
0
        private static bool ValidateViewerProfile(ViewerProfileEntity viewerProfile)
        {
            StringBuilder sb = new StringBuilder();
            bool          validViewerProfile = true;

            //if(guest.GuestID <= 0)
            //{
            //    validGuest = false;
            //    sb.Append(Environment.NewLine + "Invalid Guest ID");
            //}
            if (viewerProfile.FirstName == string.Empty)
            {
                validViewerProfile = false;
                sb.Append(Environment.NewLine + "User Name Required");//it is equivalent to \n , i.e, take the cursor to new line
            }
            if (viewerProfile.LastName == string.Empty)
            {
                validViewerProfile = false;
                sb.Append(Environment.NewLine + "User LastName Required");//it is equivalent to \n , i.e, take the cursor to new line
            }
            if (viewerProfile.EmailId == string.Empty)
            {
                validViewerProfile = false;
                sb.Append(Environment.NewLine + "User EmailId Required");//it is equivalent to \n , i.e, take the cursor to new line
            }
            if (viewerProfile.MobileNo == string.Empty)
            {
                validViewerProfile = false;
                sb.Append(Environment.NewLine + "User MobileNo Required");//it is equivalent to \n , i.e, take the cursor to new line
            }

            if (validViewerProfile == false)
            {
                throw new MovieExceptions(sb.ToString());
            }
            return(validViewerProfile);
        }