Example #1
0
        public async Task <HttpResult> Put(int id, [FromBody] VenueViewModel vVm)
        {
            try
            {
                var v = await _repoVenues.Get(vVm.Id);

                v.Address      = vVm.Address;
                v.Rows         = vVm.Rows;
                v.RowLabelType = vVm.RowLabelType;
                v.Cols         = vVm.Cols;
                v.ColLabelType = vVm.ColLabelType;

                await _repoVenues.Update(v);

                return(new HttpResult()
                {
                    Status = 200
                });
            }
            catch (Exception ex)
            {
                return(new HttpResult()
                {
                    Status = 500, Data = ex.Message
                });
            }
        }
Example #2
0
        public async Task <HttpResult> Post([FromBody] VenueViewModel vVm)
        {
            try
            {
                var entity = new Venue()
                {
                    Address      = vVm.Address,
                    Rows         = vVm.Rows,
                    RowLabelType = vVm.RowLabelType,
                    Cols         = vVm.Cols,
                    ColLabelType = vVm.ColLabelType
                };
                await _repoVenues.Insert(entity);

                return(new HttpResult()
                {
                    Status = 200
                });
            }
            catch (Exception ex)
            {
                return(new HttpResult()
                {
                    Status = 500, Data = ex.Message
                });
            }
        }
        public ActionResult UpdateData(VenueViewModel vvm)
        {
            using (EventDBEntities db = new EventDBEntities())
            {
                if (vvm.imageFile != null)
                {
                    vvm.imageFile.SaveAs(Server.MapPath("~/UploadImage/" + vvm.imageFile.FileName));
                }
                Venue v = new Venue();
                v.VenueCost = vvm.VenueCost;

                v.VenueID   = vvm.VenueID;
                v.VenueName = vvm.VenueName;
                if (vvm.imageFile != null)
                {
                    v.VenueFilePath   = vvm.imageFile.FileName.ToString();
                    v.VenueFilename   = vvm.VenueFilename;
                    db.Entry(v).State = EntityState.Modified;
                }
                else
                {
                    db.Venues.Attach(v);                                      // No Need to Add during Update ..this is only used when we want update specific propery
                    db.Entry(v).Property(x => x.VenueCost).IsModified = true; //this is only used when we want update specific propery
                    db.Entry(v).Property(x => x.VenueName).IsModified = true;
                }
                //db.Venues.Attach(v);// No Need to Add during Update
                db.SaveChanges();


                return(RedirectToAction("List"));
            }
        }
        public int Save(VenueViewModel obj)
        {
            Venue item = new Venue();

            if (obj.Id > 0)
            {
                item = entities.Venues.FirstOrDefault(e => e.Id == obj.Id);
            }
            item.Nombre         = obj.Nombre;
            item.Direccion      = obj.Direccion;
            item.Ciudad_id      = obj.Ciudad_id;
            item.Telefono       = obj.Telefono;
            item.Email          = obj.E_mail;
            item.Foto           = obj.Foto;
            item.Foto           = obj.Foto;
            item.Aforo          = obj.Aforo;
            item.Latitud        = obj.Latitud;
            item.Longitud       = obj.Longitud;
            item.CityName       = obj.CityName;
            item.DepartametName = obj.DepartametName;
            item.CountryName    = obj.CountryName;
            item.PostalCode     = obj.PostalCode;
            item.GeoCode        = obj.GeoCode;
            if (obj.Id <= 0)
            {
                obj.FechaCreacion = DateTime.Now;
                entities.Add(item);
            }
            entities.SaveChanges();
            return(item.Id);
        }
        public async Task <IActionResult> CheckOut(VenueCheckOutViewModel checkOut)
        {
            var venueViewModel = new VenueViewModel();

            try
            {
                var userVisits = this._venueService.FindVisitsByVenueIdAndUser(checkOut.VenueId, await GetUserIdAsync());

                foreach (var visit in userVisits)
                {
                    if (visit.CheckOut == DateTime.MinValue || visit.CheckOut == null)
                    {
                        visit.CheckOut     = DateTime.Now;
                        visit.UserComments = checkOut.Comments;

                        this._venueService.CheckOutVisitor(visit);

                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                _logger.LogError("Error", ex.Message);
                ModelState.AddModelError("Error", ex.Message);
                return(View(checkOut));
            }

            return(RedirectToAction("Index"));
        }
        public IActionResult CheckIn(Guid venueId)
        {
            var venueCheckInViewModel = new VenueCheckInViewModel();

            try
            {
                var venueDb = this._venueService.GetVenueById(venueId);

                if (venueDb == null)
                {
                    throw new Exception("venue was not found");
                }

                venueCheckInViewModel.VenueId = venueDb.Id;

                var venueViewModel = new VenueViewModel {
                    Name      = venueDb.Name,
                    Email     = venueDb.Email,
                    Telephone = venueDb.Telephone,
                    Address   = venueDb.Address,
                    Capacity  = venueDb.Capacity
                };

                venueCheckInViewModel.VenueDetails = venueViewModel;
            }
            catch (System.Exception ex)
            {
                _logger.LogError("Error", ex.Message);
                ModelState.AddModelError("Error", ex.Message);
            }

            return(View(venueCheckInViewModel));
        }
Example #7
0
        public PerformanceViewModel(VenueViewModel venueVm, ArtistViewModel artistVm, DateTime day, IManager manager)
        {
            this.manager = manager;
            this.performance = new Performance();

            this.performance.Start = day;

            var artist = manager.GetArtistByName(artistVm.Name);
            if (artist != null && artist.Count > 0)
                this.performance.Artist = artist.ElementAt(0);
            else
                this.performance.Artist = new Artist();

            var venue = manager.GetVenueById(venueVm.Id);
            if (venue != null)
                this.performance.Venue = venue;

            this.venueVm = venueVm;
            this.artistVm = artistVm;
            this.day = day;
            this.artists = new List<ArtistViewModel>();
            this.venues = new List<VenueViewModel>();

            SaveCommand = new RelayCommand(o => manager.UpdatePerformance(performance));
            RemoveCommand = new RelayCommand(o => manager.RemovePerformance(performance));
        }
Example #8
0
        public async Task <IActionResult> Create(VenueViewModel model)
        {
            if (ModelState.IsValid)
            {
                string uniqueFileName = null;
                if (model.Photo != null)
                {
                    string uploadsFolder = Path.Combine(HostingEnviromnet.WebRootPath, "images");
                    uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Photo.FileName;
                    string filePath = Path.Combine(uploadsFolder, uniqueFileName);
                    model.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
                }

                Venue newshop = new Venue
                {
                    Name       = model.Name,
                    Address    = model.Address,
                    CityId     = model.CityId,
                    PostalCode = model.PostalCode,
                    Phone      = model.Phone,
                    UserId     = userManager.GetUserId(HttpContext.User),
                    imgUrl     = uniqueFileName
                };
                _context.Add(newshop);
                await _context.SaveChangesAsync();

                return(RedirectToAction("details", new { id = newshop.Id }));
            }
            ViewBag.Error = string.Format("Something Went Wrong");
            return(View("Error"));
        }
Example #9
0
 public VenuesViewModel(IManager manager)
 {
     this.manager = manager;
     Venues = new List<VenueViewModel>();
     CurrentVenue = new VenueViewModel(new Venue(), manager);
     CurrentVenue.NotifyUpdate += () => LoadVenues();
 }
        public async Task Create_stores_Venue_with_correct_Contacts()
        {
            var v = new Venue
            {
                VenueId = 7,
                Name    = "Venue7",
                Info    = "TBD",
            };
            var contacts = await Context.Contacts.ToListAsync();

            var venueView = new VenueViewModel(contacts)
            {
                Venue = v
            };

            venueView.Venue.Contact1           = new Contact();
            venueView.Venue.Contact2           = new Contact();
            venueView.Venue.Contact1.ContactId = Int32.Parse(venueView.ContactList[1].Value);
            venueView.Venue.Contact2.ContactId = Int32.Parse(venueView.ContactList[3].Value);

            await Controller.Create(venueView);

            var result = Context.Venues.FirstOrDefault(x => x.VenueId == 7);

            result?.Contact1.Name.Should().Match("Contact3");
            result?.Contact2.Name.Should().Match("Contact1");
        }
Example #11
0
        internal void Modificar(VenueViewModel viewModel, ApplicationDbContext db)
        {
            var escenarioContexto = new Repositorio <Escenario>(db);

            ModificarArchivos(viewModel.ArchivosId, db);

            Nombre     = viewModel.Nombre;
            Direccion  = viewModel.Direccion;
            Localidad  = viewModel.Localidad;
            Latitud    = viewModel.Latitud;
            Longitud   = viewModel.Longitud;
            Habilitado = viewModel.Habilitado;

            var escenariosIdRemover = Escenarios.Select(x => x.Id).ToList();

            foreach (var escenarioId in escenariosIdRemover)
            {
                Escenarios.Remove(escenarioContexto.Traer(escenarioId));
            }

            if (viewModel.EscenariosId != null)
            {
                foreach (var escenarioIdNuevo in viewModel.EscenariosId)
                {
                    Escenarios.Add(escenarioContexto.Traer(escenarioIdNuevo));
                }
            }
        }
Example #12
0
 public void InitializePreset(VenueViewModel venue, ArtistViewModel artist, DateTimeViewModel dateTime)
 {
     CurrentVenueViewModel = venue;
     CurrentArtistViewModel = artist;
     DateTimeViewModel = dateTime;
     IsNew = false;
 }
Example #13
0
 public void ResetData()
 {
     CurrentVenueViewModel = new VenueViewModel();
     CurrentArtistViewModel = new ArtistViewModel();
     DateTimeViewModel = DateTime.Now;
     IsNew = true;
 }
        public void CreateVenue(VenueViewModel venueViewModel)
        {
            var venue = new Venue
            {
                IsActive = true,
                Name     = venueViewModel.Venue.Name,
                ImageUrl = venueViewModel.Venue.ImageUrl,

                Address = new Address
                {
                    StreetAddress = venueViewModel.Venue.AddressDto.StreetAddress,
                    City          = venueViewModel.Venue.AddressDto.City,
                    State         = venueViewModel.Venue.AddressDto.State,
                    ZipCode       = venueViewModel.Venue.AddressDto.ZipCode,
                }
            };

            if (string.IsNullOrWhiteSpace(venue.ImageUrl))
            {
                venue.ImageUrl = DefaultImgSrc;
            }

            _repository.Insert(venue);
            _repository.Commit();

            var budget   = venueViewModel.SeatCapacity.Budget;
            var moderate = venueViewModel.SeatCapacity.Moderate;
            var premier  = venueViewModel.SeatCapacity.Premier;

            _seatRepository.BulkInsertSeats(budget, SeatType.Budget, venue.Id);
            _seatRepository.BulkInsertSeats(moderate, SeatType.Moderate, venue.Id);
            _seatRepository.BulkInsertSeats(premier, SeatType.Premier, venue.Id);
        }
Example #15
0
        // GET: Venue/Edit/5
        public async Task <IActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var venueDb = await _context.Venues.FindAsync(id);

            if (venueDb == null)
            {
                return(NotFound());
            }

            var venueViewModel = new VenueViewModel {
                Id        = venueDb.Id,
                Name      = venueDb.Name,
                Address   = venueDb.Address,
                Telephone = venueDb.Telephone,
                Email     = venueDb.Email,
                City      = venueDb.City,
                Capacity  = venueDb.Capacity,
                Open      = venueDb.TimeOpens,
                Close     = venueDb.TimeCloses
            };

            return(View(venueViewModel));
        }
        public void EditVenue(VenueViewModel venueViewModel, int id)
        {
            Venue venueToEdit = CheckVenueNullValue(id);

            venueToEdit.AddressId             = venueViewModel.Venue.AddressId;
            venueToEdit.Name                  = venueViewModel.Venue.Name;
            venueToEdit.ImageUrl              = venueViewModel.Venue.ImageUrl;
            venueToEdit.Address.StreetAddress = venueViewModel.Venue.AddressDto.StreetAddress;
            venueToEdit.Address.City          = venueViewModel.Venue.AddressDto.City;
            venueToEdit.Address.State         = venueViewModel.Venue.AddressDto.State;
            venueToEdit.Address.ZipCode       = venueViewModel.Venue.AddressDto.ZipCode;
            venueToEdit.IsActive              = true;

            var capacity = seatService.GetSeatCapacities(id);
            var budget   = venueViewModel.SeatCapacity.Budget;
            var moderate = venueViewModel.SeatCapacity.Moderate;
            var premier  = venueViewModel.SeatCapacity.Premier;

            var budgetNew   = budget - capacity.Budget;
            var moderateNew = moderate - capacity.Moderate;
            var premierNew  = premier - capacity.Premier;

            seatService.ChangeAmountOfSeatsInContext(budgetNew, moderateNew, premierNew, venueToEdit.Id);

            _repository.Commit();
            _addressRepository.Commit();
        }
Example #17
0
        public async Task <IActionResult> Create(VenueViewModel venue)
        {
            ModelState.Remove("Id");

            if (ModelState.IsValid)
            {
                var dbVenue = new Venue();
                dbVenue.Id         = Guid.NewGuid();
                dbVenue.Name       = venue.Name;
                dbVenue.Address    = venue.Address;
                dbVenue.City       = venue.City;
                dbVenue.Email      = venue.Email;
                dbVenue.Telephone  = venue.Telephone;
                dbVenue.Capacity   = venue.Capacity;
                dbVenue.TimeOpens  = venue.Open;
                dbVenue.TimeCloses = venue.Close;

                try {
                    var userDetails = await GetUserIdAsync();

                    dbVenue.OwnerUserId = userDetails.Id;

                    _venueService.CreateVenue(dbVenue);

                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception ex) {
                    this._logger.LogError(ex.StackTrace);
                    ModelState.AddModelError("GeneralError", ex.Message);
                    return(View(venue));
                }
            }
            return(View(venue));
        }
        public async Task <IActionResult> CreateVenue(VenueViewModel venueViewModel)
        {
            //TODO validation of null
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var venueDTO = CreateModelDTO(venueViewModel);

            var operationDetails = await _action.Create(venueDTO);

            if (operationDetails.Succeeded)
            {
                venueViewModel.Id   = _venueService.GetVenueIdByName(venueDTO.Name);
                venueViewModel.City = await _cityService.GetCityBuId(venueViewModel.CityId);

                return(CreatedAtAction("GetVenue", new { id = venueViewModel.Id }, venueViewModel));
            }
            else
            {
                ModelState.AddModelError(operationDetails.Property, operationDetails.Message);
                return(BadRequest(ModelState));
            }
        }
        public ActionResult EventSave()
        {
            try
            {
                //ESto es una puta prueba que no me quiere funcionar sabra el putas poir que
                HttpRequest request = HttpContext.ApplicationInstance.Context.Request;

                int                             empresarioId    = JsonConvert.DeserializeObject <int>(request["Empresario"]);
                EventoViewModel                 evento          = JsonConvert.DeserializeObject <EventoViewModel>(request["EventData"]);
                VenueViewModel                  venue           = JsonConvert.DeserializeObject <VenueViewModel>(request["VenueData"]);
                List <LocalidadViewModel>       stages          = JsonConvert.DeserializeObject <List <LocalidadViewModel> >(request["StagesData"]);
                List <FuncionesEventoViewModel> functions       = JsonConvert.DeserializeObject <List <FuncionesEventoViewModel> >(request["FunctionsData"]);
                List <EtapasViewModel>          steps           = JsonConvert.DeserializeObject <List <EtapasViewModel> >(request["StepsData"]);
                string                          mapa            = request["__Mapa"].ToString();
                string                          ticket          = request["__TicketData"].ToString();
                string                          htmlDescription = request["__EventDescription"].ToString();

                evento.Empresario_id = empresarioId;
                evento.Venue         = venue;
                evento.Localidades   = stages;
                evento.Funciones     = functions;
                evento.Etapas        = steps;

                ServicioEvento eventoStorage = new ServicioEvento();
                eventoStorage.SaveComplete(evento, ticket, htmlDescription, mapa);



                return(Json(new { status = HttpStatusCode.OK, message = "Evento almacenado correctamente" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { status = HttpStatusCode.InternalServerError, message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Example #20
0
        [Authorize(Roles = "Admin")]//TODO: Re-enable authorization for deployment
        public ActionResult EditVenue(VenueViewModel vm, HttpPostedFileBase file)
        {
            var repo    = RepositoryFactory.CreateRepository();
            var contact = new ContactInfo
            {
                ContactId     = vm.ContactId,
                StreetAddress = vm.StreetAddress,
                City          = vm.City,
                State         = vm.State,
                Zip           = vm.Zip,
                Email         = vm.Email,
                Phone         = vm.Phone
            };
            var venue = new Venue
            {
                Name    = vm.Name,
                VenueId = vm.VenueId,
                Contact = contact
            };

            venue.ImgPath = file == null ? vm.ImgPath : UploadImage(file);

            repo.EditContact(contact);
            repo.EditVenue(venue);
            return(RedirectToAction("ManageVenues", "Admin"));
        }
Example #21
0
 public VenuePage(string venueId, ObservableCollection <VenueDto> venues)
 {
     _venueId = venueId;
     InitializeComponent();
     _vm            = App.IOC.Venue;
     _vm.Venues     = venues;
     BindingContext = _vm;
 }
Example #22
0
        [Authorize(Roles = "Admin")]//TODO: Re-enable authorization for deployment
        public ActionResult EditVenue(int id)
        {
            var repo  = RepositoryFactory.CreateRepository();
            var venue = repo.GetVenueById(id);
            var vm    = new VenueViewModel(venue);

            return(View(vm));
        }
Example #23
0
        // GET: Venue
        public async Task <IActionResult> Index()
        {
            var venues = new List <VenueViewModel>();

            IEnumerable <Venue> venuesDb = null;

            try
            {
                if (User.IsInRole("Admin"))
                {
                    venuesDb = this._venueService.GetAllVenues().ToList();
                }
                else if (User.IsInRole("VenueOwner"))
                {
                    var user = await this.GetUserIdAsync();

                    venuesDb = this._venueService.GetVenuesOwnedByUser(user.Id.ToString()).ToList();
                }

                if (venuesDb != null)
                {
                    Action <Venue> mapToViewModel = venue => {
                        var venueItem = new VenueViewModel {
                            Name = venue.Name, Id = venue.Id
                        };

                        var relatedApplication = _venueRegService.FindApplicationByVenueId(venue.Id);

                        if (relatedApplication != null)
                        {
                            if (relatedApplication.ApprovedBy != null)
                            {
                                venueItem.IsApproved = true;
                            }
                            else
                            {
                                venueItem.IsApproved = false;
                            }
                        }
                        else
                        {
                            venueItem.IsApproved = null;
                        }

                        venues.Add(venueItem);
                    };

                    venuesDb.ToList().ForEach(mapToViewModel);
                }
            }
            catch (System.Exception ex)
            {
                _logger.LogError(ex.StackTrace);
                ModelState.AddModelError("Error", ex.Message);
            }

            return(View(venues));
        }
Example #24
0
        public IActionResult GetVenueList()
        {
            var vvm = new VenueViewModel
            {
                Venues = venueService.GetVenues().ToArray()
            };

            return(View("Venue/GetVenueList", vvm));
        }
Example #25
0
        public async Task UpdateVenueAsync(VenueViewModel model)
        {
            var con1 = _context.Contacts.FirstOrDefault(x => x.ContactId == model.Venue.Contact1.ContactId);
            var con2 = _context.Contacts.FirstOrDefault(x => x.ContactId == model.Venue.Contact2.ContactId);

            model.Venue.Contact1 = con1;
            model.Venue.Contact2 = con2;

            await UpdateAsync(model.Venue);
        }
Example #26
0
        public void GivenAVenueNamedNAME(string name)
        {
            var model = new VenueViewModel
            {
                Code        = name,
                DisplayName = name
            };

            VenuesController.Create(model);
        }
Example #27
0
        public async Task <IActionResult> Create(VenueViewModel model)
        {
            if (ModelState.IsValid)
            {
                await _db.AddVenueAsync(model);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Example #28
0
        public IActionResult Edit(VenueViewModel viewModel)
        {
            var venue = _gamesService.Item(new SpecificVenue(viewModel.Id));

            _mapper.Map(viewModel, venue);

            _gamesService.Save(venue);

            return(RedirectToAction("Index"));
        }
 /// <summary>
 /// Convert Venue Entity  into Venue Object
 /// </summary>
 ///<param name="model">VenueViewModel</param>
 ///<param name="VenueEntity">DataAccess.Venue</param>
 ///<returns>VenueViewModel</returns>
 public static VenueViewModel ToViewModel(
     this DataAccess.Venue entity,
     VenueViewModel model)
 {
     model.Id        = entity.Id;
     model.Name      = entity.Name;
     model.Latitude  = entity.Latitude;
     model.Longitude = entity.Longitude;
     model.IsActive  = entity.IsActive;
     return(model);
 }
        // GET: Venues/Create
        public ActionResult Create()
        {
            VenueViewModel vvm = new VenueViewModel()
            {
                VenueAttributes = db.VenueAttributes.ToList(),
                VenueTypes      = db.VenueTypes.ToList(),
                VenuePrices     = db.VenuePrices.ToList()
            };

            return(View(vvm));
        }
Example #31
0
        public async Task <IActionResult> Edit(VenueViewModel model)
        {
            Venue venue = _context.Venue.SingleOrDefault(v => v.ApplicationUser.Id == userManager.GetUserId(HttpContext.User));

            if (model == null || venue == null)
            {
                ViewBag.Error = string.Format("You dont have a Venue yet or something went wrong on your edit");
                return(View("Error"));
            }
            if (ModelState.IsValid)
            {
                string uniqueFileName = null;
                try
                {
                    if (model.Photo == null)
                    {
                        uniqueFileName = _context.Venue.SingleOrDefault(s => s.Id == venue.Id).imgUrl;
                    }
                    else
                    {
                        string uploadsFolder = Path.Combine(HostingEnviromnet.WebRootPath, "images");
                        uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Photo.FileName;
                        string filePath = Path.Combine(uploadsFolder, uniqueFileName);
                        model.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
                    }

                    venue.Name       = model.Name;
                    venue.Phone      = model.Phone;
                    venue.PostalCode = model.PostalCode;
                    if (uniqueFileName != null)
                    {
                        venue.imgUrl = uniqueFileName;
                    }
                    var t = model.CityId;
                    venue.CityId  = model.CityId;
                    venue.Address = model.Address;

                    _context.Update(venue);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VenueExists(venue.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(RedirectToAction("details", new { id = venue.Id }));
        }
        private VenueDTO CreateModelDTO(VenueViewModel venueView)
        {
            var venueDTO = new VenueDTO
            {
                Name    = venueView.Name,
                Address = venueView.Address,
                CityId  = venueView.CityId
            };

            return(venueDTO);
        }
        public async Task Edit_returns_NotFound_if_Id_changes()
        {
            var v = Context.Venues.FirstOrDefault(x => x.VenueId == 1);

            var venueView = new VenueViewModel {
                Venue = v, ContactList = new List <SelectListItem>()
            };

            var result = await Controller.Edit(8, venueView);

            result.Should().BeOfType <NotFoundResult>();
        }
Example #34
0
        // GET: Venue/Details/5
        public async Task <IActionResult> Details(Guid?id)
        {
            try {
                var dbVenueItem = this._venueService.GetVenueById(id.Value);

                if (dbVenueItem == null)
                {
                    return(NotFound());
                }

                var currentUser = await GetUserIdAsync();

                if (currentUser != null)
                {
                    ViewBag.UserHasCheckedIn = this._venueService.UserHasCheckedIn(dbVenueItem, currentUser);

                    ViewBag.UserHasCheckedOut = this._venueService.UserHasCheckedOut(dbVenueItem, currentUser);
                }

                var venueImages = this._venueService.GetVenueImages(id.Value);

                var venueImagesVM = new List <VenueImageViewModel>();

                foreach (var img in venueImages)
                {
                    venueImagesVM.Add(new VenueImageViewModel {
                        Title    = img.Name,
                        FilePath = img.ImagePath,
                        Id       = img.Id
                    }
                                      );
                }
                VenueViewModel venueVM = new VenueViewModel {
                    Id        = dbVenueItem.Id,
                    Name      = dbVenueItem.Name,
                    Address   = dbVenueItem.Address,
                    City      = dbVenueItem.City,
                    Telephone = dbVenueItem.Telephone,
                    Email     = dbVenueItem.Email,
                    Capacity  = dbVenueItem.Capacity,
                    Open      = dbVenueItem.TimeOpens,
                    Close     = dbVenueItem.TimeCloses,
                    Logo      = dbVenueItem.Logo,
                    Images    = venueImagesVM
                };

                return(View(venueVM));
            }
            catch (Exception ex) {
                ModelState.AddModelError("CouldNotGetDetails", ex.Message);
                return(View(null));
            }
        }
Example #35
0
        public PerformanceViewModel(IManager manager)
        {
            this.manager = manager;
            this.performance = new Performance();
            this.venueVm = new VenueViewModel(manager);
            this.artistVm = new ArtistViewModel(manager);
            this.day = new DateTime(2000, 01, 01);
            this.artists = new List<ArtistViewModel>();
            this.venues = new List<VenueViewModel>();

            SaveCommand = new RelayCommand(o => manager.UpdatePerformance(performance));
            RemoveCommand = new RelayCommand(o => manager.RemovePerformance(performance));
        }
Example #36
0
        public PerformanceViewModel(Performance performance, IManager manager)
        {
            this.manager = manager;
            this.performance = performance;
            this.venueVm = new VenueViewModel(performance.Venue, manager);
            this.artistVm = new ArtistViewModel(performance.Artist, (manager));
            this.day = new DateTime(performance.Start.Year, performance.Start.Month, performance.Start.Day,
                                    performance.Start.Hour, performance.Start.Minute, performance.Start.Second);
            this.artists = new List<ArtistViewModel>();
            this.venues = new List<VenueViewModel>();

            SaveCommand = new RelayCommand(o => manager.UpdatePerformance(performance));
            RemoveCommand = new RelayCommand(o => manager.RemovePerformance(performance));
        }
Example #37
0
 public void SetSelectedItem(object item)
 {
     var venueViewModel = item as VenueViewModel;
     if (venueViewModel != null)
     {
         CurrentVenueViewModel = venueViewModel;
         Messenger.Default.Send(new ShowVenueOverviewContentMessage(Locator.VenueEditViewModel));
     }
     var locationTreeItem = item as LoctionTreeItemViewModel;
     if (locationTreeItem != null)
     {
         CurrentLocationTreeItem = locationTreeItem;
         Messenger.Default.Send(new ShowVenueOverviewContentMessage(Locator.LocationEditViewModel));
     }
 }
Example #38
0
        private void InitializeCommands()
        {
            SaveVenueCommand = new RelayCommand(async () =>
            {
                await Dispatcher.CurrentDispatcher.InvokeAsync(() =>
                {
                    foreach (var treeItemViewModel in LocationTreeViewModel)
                    {
                        if (!treeItemViewModel.Venues.Contains(CurrentVenueViewModel)
                        && treeItemViewModel.LocationViewModel.LocationId == CurrentVenueViewModel.LocationViewModel.LocationId)
                        {
                            treeItemViewModel.Venues.Add(CurrentVenueViewModel);
                            Messenger.Default.Send(new HideDialogMessage(Locator.VenueDialogViewModel));
                            break;
                        }
                    }
                });
                if (DebugHelper.IsReleaseMode)
                    await _adminAccessBll.ModifyVenueAsync(BllAccessHandler.SessionToken,
                        CurrentVenueViewModel.ToDomainObject<Venue>());
                Locator.LocationEditViewModel.IsNew = new object();
            });

            DeleteVenueCommand = new RelayCommand(async () =>
            {
                await Dispatcher.CurrentDispatcher.InvokeAsync(() =>
                {
                    foreach (var treeItemViewModel in LocationTreeViewModel)
                    {
                        if (treeItemViewModel.Venues.Contains(CurrentVenueViewModel))
                            treeItemViewModel.Venues.Remove(CurrentVenueViewModel);
                    }
                });
                if (DebugHelper.IsReleaseMode)
                    await _adminAccessBll.RemoveVenueAsync(BllAccessHandler.SessionToken,
                        CurrentVenueViewModel.ToDomainObject<Venue>());
                Locator.LocationEditViewModel.IsNew = new object();
            });

            SaveLocationCommand = new RelayCommand(async () =>
            {
                await Dispatcher.CurrentDispatcher.InvokeAsync(() =>
                {
                    if (!LocationTreeViewModel.Contains(CurrentLocationTreeItem))
                    {
                        Locations.Add(CurrentLocationTreeItem.LocationViewModel);
                        LocationTreeViewModel.Add(CurrentLocationTreeItem);
                        Messenger.Default.Send(new HideDialogMessage(Locator.LocationDialogViewModel));
                    }
                });
                if (DebugHelper.IsReleaseMode)
                    await _adminAccessBll.ModifyLocationAsync(BllAccessHandler.SessionToken,
                        CurrentLocationTreeItem.LocationViewModel.ToDomainObject<Location>());
                Locator.LocationEditViewModel.IsNew = new object();
            });

            DeleteLocationCommand = new RelayCommand(async () =>
            {
                await Dispatcher.CurrentDispatcher.InvokeAsync(async () =>
                {
                    var curLocationItem = CurrentLocationTreeItem;
                    foreach (var venue in curLocationItem.Venues)
                    {
                        if (DebugHelper.IsReleaseMode)
                            await _adminAccessBll.RemoveVenueAsync(BllAccessHandler.SessionToken,
                                venue.ToDomainObject<Venue>());
                    }
                    curLocationItem.Venues.Clear();
                    LocationTreeViewModel.Remove(curLocationItem);
                    if (DebugHelper.IsReleaseMode)
                        await _adminAccessBll.RemoveLocationAsync(BllAccessHandler.SessionToken,
                            curLocationItem.LocationViewModel.ToDomainObject<Location>());
                    Locator.LocationEditViewModel.IsNew = new object();
                });
            });

            NewLocationCommand = new RelayCommand(() =>
            {
                CurrentLocationTreeItem = new LoctionTreeItemViewModel(new List<VenueViewModel>())
                {
                    LocationViewModel = new LocationViewModel()
                };
                Locator.LocationEditViewModel.IsNew = null;
                Messenger.Default.Send(new ShowDialogMessage(Locator.LocationDialogViewModel));
            });
            NewVenueCommand = new RelayCommand(() =>
            {
                CurrentVenueViewModel = new VenueViewModel();
                Locator.LocationEditViewModel.IsNew = null;
                Messenger.Default.Send(new ShowDialogMessage(Locator.VenueDialogViewModel));
            });
        }
Example #39
0
        private void VenueVmToVenue(VenueViewModel vm)
        {
            int capacity;
            if (!int.TryParse(vm.Capacity, out capacity))
                capacity = 0;

            performance.Venue = new Venue()
            {
                Id = (int)Char.GetNumericValue(vm.Id[1]),
                Label = vm.Name,
                MaxSpectators = capacity,
                Location = new Location(vm.Location.Identifier, vm.Location.Name)
            };
        }
 public void UpdateVenues()
 {
     CurrentVenue = null;
     Venues.Clear();
     Task.Run(() => {
         List<Venue> venues = venueService.GetAllVenues();
         foreach (var venue in venues) {
             VenueViewModel vm = new VenueViewModel(venueService, venue);
             PlatformService.Instance.RunByUiThread(() => {
                 Venues.Add(vm);
             });
         }
     });
 }