Exemplo n.º 1
0
        public HallViewModel GetHallDetails(int id)
        {
            try
            {
                Halls halls = _context.Halls
                              .Where(x => x.HallId == id)
                              .Include(x => x.Student)
                              .FirstOrDefault();

                HallViewModel model = new HallViewModel
                {
                    HallID      = halls.HallId,
                    HallName    = halls.HallName,
                    KeyReturned = halls.KeyReturned,
                    IsOwing     = halls.IsOwing,
                    StudentID   = halls.StudentId,
                    FullName    = halls.Student.FullName,

                    StudentIndexList = new SelectList(_studentService.GetStudents(), "StudentID", "FullName", halls.HallId),
                    // StudentDepartList = new SelectList(_studentService.GetStudents(), "StudentID", "StudentId", fees.FeeId)
                };

                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public ActionResult ChangeSeatsNumber()
        {
            HallViewModel vm = new HallViewModel();

            vm.Hall = new Hall();
            HallDal dal           = new HallDal();
            string  HallNameValue = Request.Form["txtHallName"];
            int     _SeatsNumber  = 0;

            if (Request.Form["HallSeatsNumber"] != null)
            {
                _SeatsNumber = int.Parse(Request.Form["HallSeatsNumber"]);
            }

            if (HallNameValue != null)
            {
                Hall addHall = dal.Halls.First(h => h.HallName == HallNameValue);
                addHall.SeatsNumber = _SeatsNumber;
                dal.SaveChanges();
                vm.Halls = dal.Halls.ToList <Hall>();
                return(View(vm));
            }

            vm.Halls = dal.Halls.ToList <Hall>();
            return(View(vm));
        }
Exemplo n.º 3
0
 public async Task RemoveAsync(HallViewModel hallIn)
 {
     if (hallIn.Photo?.Id != null)
     {
         await _gridFS.DeleteAsync(ObjectId.Parse(hallIn.Photo.Id));
     }
     foreach (var stand in hallIn.Stands)
     {
         if (stand.Photo?.Id != null)
         {
             await _gridFS.DeleteAsync(ObjectId.Parse(stand.Photo.Id));
         }
         foreach (var exhibit in stand.Exhibits)
         {
             if (exhibit.Photos != null && exhibit.Photos?.Count != 0)
             {
                 foreach (var photo in exhibit.Photos)
                 {
                     if (photo?.Id != null)
                     {
                         await _gridFS.DeleteAsync(ObjectId.Parse(photo.Id));
                     }
                 }
             }
         }
     }
     await _halls.DeleteOneAsync(hall => hall.Id.Equals(hallIn.Id));
 }
Exemplo n.º 4
0
        public ActionResult SubmitHall()
        {
            HallViewModel vm     = new HallViewModel();
            Hall          MyHall = new Hall()
            {
                ID          = Request.Form["Hall.ID"],
                HallName    = Request.Form["Hall.HallName"],
                SeatsNumber = int.Parse(Request.Form["Hall.SeatsNumber"])
            };

            HallDal dal = new HallDal();

            if (ModelState.IsValid)
            {
                dal.Halls.Add(MyHall);
                dal.SaveChanges();
                vm.Hall = new Hall();
            }

            else
            {
                vm.Hall = MyHall;
            }

            vm.Halls = dal.Halls.ToList <Hall>();
            return(View("AddHall", vm));
        }
Exemplo n.º 5
0
 public ActionResult CreateHall(HallViewModel hallView, HttpPostedFileBase Image)
 {
     if (ModelState.IsValid & Image != null)
     {
         byte[] imageData = null;
         using (var binaryReader = new BinaryReader(Image.InputStream))
         {
             imageData = binaryReader.ReadBytes(Image.ContentLength);
         }
         var hall = new BanquetingHall
         {
             Id          = Guid.NewGuid().ToString(),
             CountPlace  = int.Parse(hallView.CountPlace),
             Price       = hallView.Price,
             Name        = hallView.Name,
             Hotel       = db.Hotels.Find(hallView.HotelId),
             ImageData   = imageData,
             Status      = hallView.Status,
             Description = hallView.Description
         };
         db.BanquetingHall.Add(hall);
         db.SaveChanges();
         TempData["Message"] = "Зал успешно добавлен.";
         return(RedirectToAction("Index", "Admin"));
     }
     TempData["Message"] = "Ошибка добавления.";
     return(RedirectToAction("Index", "Admin"));
 }
        public ActionResult EditHall()
        {
            HallViewModel hvm = new HallViewModel();
            HallsDal      dal = new HallsDal();

            hvm.Halls = dal.Halls.ToList <Hall>();
            return(View("ShowDetails", hvm));
        }
Exemplo n.º 7
0
        public ActionResult EditHall(string Id)
        {
            var model = new HallViewModel();

            model.Hall = HallService.GetHallById(Id);

            return(PartialView(model));
        }
Exemplo n.º 8
0
        public ActionResult CreateHall([FromBody] HallViewModel model)
        {
            // model.Purpose=m
            var hallmanager = new Hallmanager(uow);

            hallmanager.CreateHall(model);
            return(Ok());
        }
Exemplo n.º 9
0
        public HallViewModel Create()
        {
            HallViewModel model = new HallViewModel();

            model.StudentIndexList = new SelectList(_studentService.GetStudents(), "StudentID", "FullName");

            return(model);
        }
Exemplo n.º 10
0
 public async Task <string> Create(HallViewModel hall, IFormFile file)
 {
     if (file != null)
     {
         await _formFileToByteConverterService.ConvertAsync(file, hall);
     }
     hall.Stands = new List <StandViewModel>();
     return(await _hallsRepository.CreateAsync(hall));
 }
Exemplo n.º 11
0
        public ActionResult HallGallery(MovieViewModel model)
        {
            HallDal       Halldal = new HallDal();
            HallViewModel mvm     = new HallViewModel();
            List <Hall>   HALLS   = Halldal.Halls.ToList();

            mvm.Hall  = new Hall();
            mvm.Halls = HALLS;
            return(View(mvm));
        }
Exemplo n.º 12
0
        public ActionResult AddHall()
        {
            HallDal       dal   = new HallDal();
            HallViewModel vm    = new HallViewModel();
            List <Hall>   Halls = dal.Halls.ToList <Hall>();

            vm.Hall  = new Hall();
            vm.Halls = Halls;
            return(View(vm));
        }
Exemplo n.º 13
0
        public ActionResult Edit([Bind(Include = "Id,Name,RowAmount,ColumnAmoun,CinemaId")] HallViewModel hallViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(hallViewModel));
            }
            HallDomainModel hallDomainModel = Mapper.Map <HallViewModel, HallDomainModel>(hallViewModel);

            _hallService.Update(hallDomainModel);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 14
0
        public ActionResult Create([FromJson] HallViewModel hallViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(hallViewModel));
            }
            HallDomainModel hallDomainModel = Mapper.Map <HallViewModel, HallDomainModel>(hallViewModel);

            _hallService.Add(hallDomainModel);
            return(RedirectToAction("Details", "Cinema", new { id = hallDomainModel.CinemaId }));
        }
Exemplo n.º 15
0
        public async Task ConvertAsync(IFormFile file, HallViewModel hall)
        {
            using (var memoryStream = new MemoryStream())
            {
                await file.CopyToAsync(memoryStream);

                if (hall.Photo == null)
                {
                    hall.Photo = new PhotoInfo();
                }
                hall.Photo.Photo = memoryStream.ToArray();
            }
        }
Exemplo n.º 16
0
        public async Task <string> CreateAsync(HallViewModel hall)
        {
            if (hall.Photo?.Photo != null)
            {
                ObjectId id = await _gridFS.UploadFromBytesAsync(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff"), hall.Photo.Photo);

                hall.Photo.Id    = id.ToString();
                hall.Photo.Photo = null;
            }
            hall.Id = ObjectId.GenerateNewId().ToString();
            await _halls.InsertOneAsync(hall);

            return(hall.Id);
        }
Exemplo n.º 17
0
        public ViewResult Hall(int playId)
        {
            HallDTO       hallDTO    = theatreService.GetHall(playId);
            var           mapperHall = new MapperConfiguration(cfg => cfg.CreateMap <HallDTO, HallViewModel>()).CreateMapper();
            HallViewModel hallVM     = mapperHall.Map <HallDTO, HallViewModel>(hallDTO);

            IEnumerable <PlaceDTO> placeDTOs = orderService.GetPlaces(hallDTO.HallId);
            var mapperPlace = new MapperConfiguration(cfg => cfg.CreateMap <PlaceDTO, PlaceViewModel>()).CreateMapper();
            List <PlaceViewModel> placesVM = mapperPlace.Map <IEnumerable <PlaceDTO>, List <PlaceViewModel> >(placeDTOs);

            placesVM.Sort(new PlaceComparator());

            return(View((hallVM, placesVM as IEnumerable <PlaceViewModel>)));
        }
        public ActionResult ShowDetails(string hallName)
        {
            HallsDal      dal = new HallsDal();
            HallViewModel hvm = new HallViewModel();

            hvm.Hall  = dal.Halls.Find(hallName);
            hvm.Halls = dal.Halls.ToList <Hall>();
            //Hall editHall = dal.Halls.Find(hallName);
            if (Request.Form["HallName"] == null)
            {
                return(RedirectToAction("MyPage", "Home"));
            }
            return(View(hvm));
        }
Exemplo n.º 19
0
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HallDomainModel hallDomainModel = _hallService.ReadById(id);

            if (hallDomainModel == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }
            HallViewModel hallViewModel = Mapper.Map <HallDomainModel, HallViewModel>(hallDomainModel);

            return(View(hallViewModel));
        }
Exemplo n.º 20
0
 public ActionResult Create(HallViewModel model)
 {
     try
     {
         bool result = _hallService.AddHalls(model);
         if (result)
         {
             return(RedirectToAction(nameof(Index)));
         }
         throw new Exception();
     }
     catch
     {
         ModelState.AddModelError(string.Empty, "Ooops! Something went wrong!");
         return(View());
     }
 }
Exemplo n.º 21
0
        public static HallViewModel GetHallByScheduleId(int id)
        {
            var hall          = new HallViewModel();
            var sqlExpression = string.Format("SELECT id, count_row FROM halls WHERE id = (SELECT id_hall FROM schedule WHERE id_schedule = {0})", id);

            void addValues(NpgsqlDataReader reader)
            {
                var hallId   = (int)reader.GetValue(0);
                var rowCount = Convert.ToInt16(reader.GetValue(1));

                hall.HallNumber = hallId;
                hall.RowCount   = rowCount;
            }

            DAOFactory.ToHandleRequest(sqlExpression, addValues);
            hall.SeatsRowCount = GetSeatsRowCountByHallId(hall.HallNumber, hall.RowCount);
            return(hall);
        }
Exemplo n.º 22
0
        public ActionResult Delete(int id, HallViewModel model)
        {
            try
            {
                bool result = _hallsClear.DeleteHalls(id);

                if (result)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                throw new Exception();
            }
            catch
            {
                ModelState.AddModelError(string.Empty, "Ooops! Something went wrong!");
                return(View());
            }
        }
Exemplo n.º 23
0
        public async Task UpdateAsync(string id, HallViewModel hallIn)
        {
            hallIn.Id = id;
            if (!string.IsNullOrEmpty(hallIn.Photo?.Id))
            {
                await _gridFS.DeleteAsync(ObjectId.Parse(hallIn.Photo.Id));
            }
            if (hallIn.Photo?.Photo != null)
            {
                ObjectId photoId = await _gridFS.UploadFromBytesAsync(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff"), hallIn.Photo.Photo);

                hallIn.Photo.Id    = photoId.ToString();
                hallIn.Photo.Photo = null;
            }
            else
            {
                hallIn.Photo = null;
            }
            await _halls.ReplaceOneAsync(hall => hall.Id.Equals(id), hallIn);
        }
        public ViewResult NewHall(HallViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View("NewHall", model));
            }

            var hall = new Hall {
                Color = model.Color, Name = model.Name
            };

            // TODO: process google entries

            this.hallsRepository.Add(hall);
            this.hallsRepository.Save();

            var response = new NewHallSuccess {
            };

            return(this.View("NewHallSuccess", response));
        }
Exemplo n.º 25
0
        public async Task Edit(HallViewModel hall, byte[] photo, IFormFile file)
        {
            var initialHall = await _hallsRepository.GetAsync(hall.Id);

            hall.Stands = initialHall.Stands;

            if (initialHall.Photo != null)
            {
                hall.Photo = initialHall.Photo;
                if (photo == null)
                {
                    hall.Photo.Photo = null;
                }
            }

            if (file != null)
            {
                await _formFileToByteConverterService.ConvertAsync(file, hall);
            }

            await _hallsRepository.UpdateAsync(hall.Id, hall);
        }
        public void CreateHall(HallViewModel model)
        {
            var hall = uow.Halls.FindByName(model.Hallname);

            if (hall != null)
            {
                throw new Exception("Hall with this name already exist");
            }
            var entity = model.Create();

            //context.Halls.AddOrUpdate(entity);
            //context.SaveChanges();
            uow.Halls.Add(entity);
            uow.commit();

            //var deptId = result.Result;
            //var result1 = _db.SaveChanges();
            //if (result1.Succeeded == false)
            //{
            //    throw new Exception(result1.Message);
            //}
        }
Exemplo n.º 27
0
        public bool UpdateHalls(HallViewModel model)
        {
            try
            {
                Halls halls = _context.Halls.Where(x => x.HallId == model.HallID).FirstOrDefault();

                halls.HallId      = model.HallID;
                halls.HallName    = model.HallName;
                halls.KeyReturned = model.KeyReturned;
                halls.IsOwing     = model.IsOwing;
                halls.StudentId   = model.StudentID;

                _context.Halls.Update(halls);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 28
0
        public bool AddHalls(HallViewModel model)
        {
            try
            {
                Halls halls = new Halls
                {
                    HallId      = model.HallID,
                    HallName    = model.HallName,
                    KeyReturned = model.KeyReturned,
                    IsOwing     = model.IsOwing,
                    StudentId   = model.StudentID
                };

                _context.Halls.Add(halls);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 29
0
        public HallViewModel GetSeats(int MovieId)
        {
            MovieDal temp  = new MovieDal();
            Movie    movie = (from x in temp.Movies where x.id.Equals(MovieId) select x).ToList <Movie>()[0];

            HallDal halldal = new HallDal();
            string  num     = (from x in halldal.Halls where x.HallId.Equals(movie.HallId) select x.NumSeats).ToList <string>()[0];

            TicketDal     dal   = new TicketDal();
            HallViewModel cvm   = new HallViewModel();
            List <string> halls = (from x in dal.Tickets
                                   where x.HallId.Equals(movie.HallId) && x.date.Equals(movie.date) && x.time.Equals(movie.time)
                                   select x.seat).ToList <string>();

            cvm.halls            = halls;
            Session["MovieName"] = movie.MovieName;
            TempData["date"]     = movie.date;
            TempData["time"]     = movie.time;
            TempData["HallId"]   = movie.HallId;
            TempData["price"]    = movie.price;
            TempData["MovieId"]  = movie.id;
            TempData["NumSeats"] = num;
            return(cvm);
        }
Exemplo n.º 30
0
        public ActionResult Platform(int id)
        {
            using (var db = new EventeamContext())
            {
                var platform = db.Platforms.FirstOrDefault(p => p.PlatformID == id);

                if (platform != null)
                {
                    var photos         = _imagesService.GetPlatformPhotos(platform.FolderName, platform.Name);
                    var mainPhoto      = _imagesService.FilterPlatformMainPhoto(photos);
                    var platformPhotos = _imagesService.FilterPlatformPhotos(photos);

                    var content = new PlatformViewModel
                    {
                        PlatformId              = platform.PlatformID,
                        Name                    = platform.Name,
                        CityName                = platform.City.Name,
                        LevelName               = platform.Level.Name,
                        LocationName            = platform.Location.Name,
                        Geography               = platform.Geography,
                        Address                 = platform.Address,
                        Subway                  = platform.Subway,
                        DistanceRailwayStation  = platform.DistanceRailwayStation,
                        DistanceAirportBorispil = platform.DistanceAirportBorispil,
                        DistanceAirportZhulyany = platform.DistanceAirportZhulyany,
                        Site                    = platform.Site,
                        HallsCount              = platform.HallsCount,
                        HallCapacity            = platform.HallCapacity,
                        RestaurantsCount        = platform.RestaurantsCount,
                        BanquetCapacity         = platform.BanquetCapacity,
                        BuffetCapacity          = platform.BuffetCapacity,
                        MainPhoto               = mainPhoto,
                        PlatformPhotos          = platformPhotos,
                    };

                    var hotel = db.Hotels.FirstOrDefault(h => h.PlatformID == id);
                    if (hotel != null)
                    {
                        content.Hotel = new HotelViewModel
                        {
                            HotelId        = hotel.HotelID,
                            CategoryName   = hotel.HotelCategory.Name,
                            Name           = hotel.Name,
                            Site           = hotel.Site,
                            RoomCount      = hotel.RoomCount,
                            Capacity       = hotel.Capacity,
                            Entertainment  = hotel.Entertainment,
                            Rehabilitation = hotel.Rehabilitation,
                            Parking        = hotel.Parking,
                            Internet       = hotel.Internet,
                            Other          = hotel.Other
                        };

                        if (hotel.Rooms.Any())
                        {
                            content.Hotel.Rooms = new List <RoomViewModel>();

                            foreach (var r in hotel.Rooms)
                            {
                                var c = new RoomViewModel
                                {
                                    RoomId           = r.RoomID,
                                    Name             = r.Name,
                                    RoomCategoryName = r.RoomCategory.Name,
                                    RoomTypeName     = r.RoomType.Name,
                                    Quantity         = r.Quantity
                                };

                                content.Hotel.Rooms.Add(c);
                            }
                        }
                    }

                    var restaurants = db.Restaurants.Where(p => p.PlatformID == id);
                    if (restaurants.Any())
                    {
                        content.Restaurants = new List <RestaurantViewModel>();

                        foreach (var r in restaurants)
                        {
                            var c = new RestaurantViewModel
                            {
                                RestaurantId       = r.RestaurantID,
                                Name               = r.Name,
                                Type               = r.RestaurantType.Name,
                                ClassificationName = r.Classification.Name,
                                KitchenName        = r.Kitchen.Name,
                                Banquet            = r.Banquet,
                                Buffet             = r.Buffet,
                                TotalSquare        = r.TotalSquare,
                                Seating            = r.Seating
                            };

                            content.Restaurants.Add(c);
                        }
                    }

                    var halls = db.Halls.Where(p => p.PlatformID == id);
                    if (halls.Any())
                    {
                        content.Halls = new List <HallViewModel>();

                        foreach (var h in halls)
                        {
                            var c = new HallViewModel
                            {
                                HallId      = h.HallID,
                                Name        = h.Name,
                                TotalSquare = h.TotalSquare,
                                Theater     = h.Theater,
                                Class       = h.Class,
                                PPlanting   = h.PPlanting,
                                MeetingRoom = h.MeetingRoom,
                                Banquet     = h.Banquet,
                                Buffet      = h.Buffet,
                                Equipment   = h.Equipment
                            };

                            content.Halls.Add(c);
                        }
                    }

                    return(View(content));
                }

                return(HttpNotFound());
            }
        }