Exemplo n.º 1
0
 public AddMessageActivityCommand(string userId, string message, Location location, VenueDTO venue)
 {
     UserId   = userId ?? throw new ArgumentNullException(nameof(userId));
     Message  = message ?? throw new ArgumentNullException(nameof(message));
     Location = location;
     Venue    = venue;
 }
Exemplo n.º 2
0
 public AddVenueActivityDTO(string userId, VenueDTO venue, VenueAction action)
 {
     this.UserId   = userId ?? throw new ArgumentNullException(nameof(userId));
     this.Venue    = venue ?? throw new ArgumentNullException(nameof(venue));
     this.Location = venue.Location;
     this.Action   = action;
 }
Exemplo n.º 3
0
        public void Update(VenueDTO obj)
        {
            if (!IsNameUnique(obj))
            {
                throw new FaultException <NotUniqueNameException>(new NotUniqueNameException("name must be unique"), new FaultReason("name must be unique"));
            }

            venueService.Update(FromVenueDTOToBLLStandardVenueDTO(obj));
        }
Exemplo n.º 4
0
        private VenueDTO CreateModelDTO(VenueViewModel venueView)
        {
            var venueDTO = new VenueDTO
            {
                Name    = venueView.Name,
                Address = venueView.Address,
                CityId  = venueView.CityId
            };

            return(venueDTO);
        }
Exemplo n.º 5
0
 public AddDrinkActivityCommand(string userId, string drinkId, DrinkType drinkType, string drinkName, double alcPrc, double volume, Location location, VenueDTO venue)
 {
     UserId    = userId ?? throw new ArgumentNullException(nameof(userId));
     DrinkId   = drinkId ?? throw new ArgumentNullException(nameof(drinkId));
     DrinkType = drinkType;
     DrinkName = drinkName ?? throw new ArgumentNullException(nameof(drinkName));
     AlcPrc    = alcPrc;
     Volume    = volume;
     Location  = location;
     Venue     = venue;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="VenueCI"/> class
        /// </summary>
        /// <param name="venue">A <see cref="VenueDTO"/> containing information about a venue</param>
        /// <param name="culture">A <see cref="CultureInfo"/> specifying the language of the <code>dto</code></param>
        internal VenueCI(VenueDTO venue, CultureInfo culture)
            : base(venue)
        {
            Guard.Argument(venue, nameof(venue)).NotNull();
            Guard.Argument(culture, nameof(culture)).NotNull();

            _names        = new Dictionary <CultureInfo, string>();
            _countryNames = new Dictionary <CultureInfo, string>();
            _cityNames    = new Dictionary <CultureInfo, string>();
            Merge(venue, culture);
        }
Exemplo n.º 7
0
 private BLLStandard.DTO.VenueDTO FromVenueDTOToBLLStandardVenueDTO(VenueDTO venueDTO)
 {
     return(new BLLStandard.DTO.VenueDTO
     {
         Id = venueDTO.Id,
         Name = venueDTO.Name,
         Description = venueDTO.Description,
         Address = venueDTO.Address,
         Phone = venueDTO.Phone
     });
 }
Exemplo n.º 8
0
        public void Update(VenueDTO obj)
        {
            if (!IsNameUnique(obj))
            {
                throw new NotUniqueNameException();
            }

            repository.Update(new Venue {
                Id = obj.Id, Name = obj.Name, Description = obj.Description, Address = obj.Address, Phone = obj.Phone
            });
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VenueCI"/> class
        /// </summary>
        /// <param name="venue">A <see cref="VenueDTO"/> containing information about a venue</param>
        /// <param name="culture">A <see cref="CultureInfo"/> specifying the language of the <code>dto</code></param>
        internal VenueCI(VenueDTO venue, CultureInfo culture)
            : base(venue)
        {
            Contract.Requires(venue != null);
            Contract.Requires(culture != null);

            _names        = new Dictionary <CultureInfo, string>();
            _countryNames = new Dictionary <CultureInfo, string>();
            _cityNames    = new Dictionary <CultureInfo, string>();
            Merge(venue, culture);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Merges information from the provided <see cref="VenueDTO"/> into the current instance
        /// </summary>
        /// <param name="venue">A <see cref="VenueDTO"/> containing information about a venue</param>
        /// <param name="culture">A <see cref="CultureInfo"/> specifying the language of the input <see cref="VenueDTO"/></param>
        internal void Merge(VenueDTO venue, CultureInfo culture)
        {
            Guard.Argument(venue, nameof(venue)).NotNull();
            Guard.Argument(culture, nameof(culture)).NotNull();

            Capacity               = venue.Capacity;
            Coordinates            = venue.Coordinates;
            _names[culture]        = venue.Name;
            _countryNames[culture] = venue.Country;
            _cityNames[culture]    = venue.City;
            CountryCode            = venue.CountryCode;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Merges information from the provided <see cref="VenueDTO"/> into the current instance
        /// </summary>
        /// <param name="venue">A <see cref="VenueDTO"/> containing information about a venue</param>
        /// <param name="culture">A <see cref="CultureInfo"/> specifying the language of the input <see cref="VenueDTO"/></param>
        internal void Merge(VenueDTO venue, CultureInfo culture)
        {
            Contract.Requires(venue != null);
            Contract.Requires(culture != null);

            Capacity               = venue.Capacity;
            Coordinates            = venue.Coordinates;
            _names[culture]        = venue.Name;
            _countryNames[culture] = venue.Country;
            _cityNames[culture]    = venue.City;
            CountryCode            = venue.CountryCode;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Merges information from the provided <see cref="VenueDTO"/> into the current instance
        /// </summary>
        /// <param name="venue">A <see cref="VenueDTO"/> containing information about a venue</param>
        /// <param name="culture">A <see cref="CultureInfo"/> specifying the language of the input <see cref="VenueDTO"/></param>
        internal void Merge(VenueDTO venue, CultureInfo culture)
        {
            Guard.Argument(venue, nameof(venue)).NotNull();
            Guard.Argument(culture, nameof(culture)).NotNull();

            Capacity               = venue.Capacity;
            Coordinates            = venue.Coordinates;
            _names[culture]        = venue.Name;
            _countryNames[culture] = venue.Country;
            _cityNames[culture]    = venue.City;
            CountryCode            = venue.CountryCode;
            State  = venue.State;
            Course = venue.Course?.Select(s => new HoleCI(s));
        }
Exemplo n.º 13
0
 public static bool InsertarDatos(VenueDTO item)
 {
     try
     {
         var db = new SQLiteConnection(dbPath);
         db.Insert(item, typeof(VenueDTO));
         db.Close();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 14
0
        public void Create_Correct_Venue()
        {
            //Arrange
            var venueDTO = new VenueDTO {
                Name = "one", Description = "o", Address = "ads", Phone = "123"
            };

            //Act
            service.Create(venueDTO);
            var res = service.GetByName("one");

            //Assert
            Assert.AreEqual(res.Name, "one");
        }
Exemplo n.º 15
0
        public List <HourDTO> addHour(VenueDTO v)
        {
            HourDTO h = new HourDTO();

            h = v.hours.Last();



            using (var db = new GG.Models.GGModelContainer())
            {
                Hours HourTbl = new Hours();

                HourDTO newHour = new HourDTO();

                HourTbl = new Hours
                {
                    Text    = h.hourText,
                    VenueId = (int)v.id
                };

                db.Hours.Add(HourTbl);

                db.SaveChanges();

                newHour    = h;
                newHour.id = HourTbl.Id;

                var existingHour = (from x in db.Hours where x.Id == newHour.id select x).FirstOrDefault();


                var existingVenue = (from x in db.Venues where x.Id == v.id select x).FirstOrDefault();

                existingVenue.Hours.Add(existingHour);

                db.SaveChanges();

                var l = (from x in existingVenue.Hours
                         .Select(b => new HourDTO
                {
                    id = b.Id,
                    hourText = b.Text
                })

                         select x).ToList();


                return(l);
            }
        }
Exemplo n.º 16
0
        public List <VideoDTO> addVideo(VenueDTO v)
        {
            VideoDTO i = new VideoDTO();

            i = v.videos.Last();



            using (var db = new GG.Models.GGModelContainer())
            {
                Video VideoTbl = new Video();

                VideoDTO newVideo = new VideoDTO();

                VideoTbl = new Video
                {
                    url     = i.url,
                    VenueId = (int)v.id
                };

                db.Videos.Add(VideoTbl);

                db.SaveChanges();

                newVideo    = i;
                newVideo.id = VideoTbl.Id;

                var existingVideo = (from x in db.Videos where x.Id == newVideo.id select x).FirstOrDefault();


                var existingVenue = (from x in db.Venues where x.Id == v.id select x).FirstOrDefault();

                existingVenue.Videos.Add(existingVideo);

                db.SaveChanges();

                var l = (from x in existingVenue.Videos
                         .Select(b => new VideoDTO
                {
                    id = b.Id,
                    url = b.url
                })

                         select x).ToList();


                return(l);
            }
        }
Exemplo n.º 17
0
        public List <ImageDTO> addImage(VenueDTO v)
        {
            ImageDTO i = new ImageDTO();

            i = v.images.Last();



            using (var db = new GG.Models.GGModelContainer())
            {
                Image ImageTbl = new Image();

                ImageDTO newImage = new ImageDTO();

                ImageTbl = new Image
                {
                    url     = i.url,
                    VenueId = (int)v.id
                };

                db.Images.Add(ImageTbl);

                db.SaveChanges();

                newImage    = i;
                newImage.id = ImageTbl.Id;

                var existingImage = (from x in db.Images where x.Id == newImage.id select x).FirstOrDefault();


                var existingVenue = (from x in db.Venues where x.Id == v.id select x).FirstOrDefault();

                existingVenue.Images.Add(existingImage);

                db.SaveChanges();

                var l = (from x in existingVenue.Images
                         .Select(b => new ImageDTO
                {
                    id = b.Id,
                    url = b.url
                })

                         select x).ToList();


                return(l);
            }
        }
Exemplo n.º 18
0
        public bool IsNameUnique(VenueDTO obj)
        {
            var venueFromDb = repository.GetByName(obj.Name);

            if (venueFromDb != null)
            {
                if ((!venueFromDb.Description.Equals(obj.Description) || !venueFromDb.Address.Equals(obj.Address) || !venueFromDb.Phone.Equals(obj.Phone)) ||
                    (venueFromDb.Description.Equals(obj.Description) && venueFromDb.Address.Equals(obj.Address) && venueFromDb.Phone.Equals(obj.Phone)))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 19
0
        public void GetByName()
        {
            //Arrange
            var venueDTO = new VenueDTO()
            {
                Name = "name", Description = "test", Address = "asd", Phone = "123"
            };

            service.Create(venueDTO);

            //Assert
            Assert.AreEqual(service.GetByName("name").Name, "name");

            service.Delete(service.GetByName("name").Id);
        }
Exemplo n.º 20
0
        public void Try_To_Update_With_Incorrect_Venue()
        {
            //Arrange
            var venueDTO = new VenueDTO {
                Name = "test", Description = "test", Address = "asd", Phone = "123"
            };

            //Act
            service.Create(venueDTO);
            var incorrectVenueDTOForUpdate = new VenueDTO {
                Name = "test", Description = "test", Address = "asd", Phone = "123"
            };

            //Assert
            Assert.Throws <NotUniqueNameException>(() => service.Update(incorrectVenueDTOForUpdate));
        }
Exemplo n.º 21
0
        public void Try_To_Create_Incorrect_Venue()
        {
            //Arrange
            var venueDTO = new VenueDTO {
                Name = "one", Description = "o", Address = "ads", Phone = "123"
            };
            var incorrectVenueDTO = new VenueDTO {
                Name = "one", Description = "o", Address = "ads", Phone = "123"
            };

            //Act
            service.Create(venueDTO);

            //Assert
            Assert.Throws <NotUniqueNameException>(() => service.Create(incorrectVenueDTO));
        }
Exemplo n.º 22
0
        public void Create_Correct_Venue()
        {
            //Arrange
            var venueDTO = new VenueDTO()
            {
                Name = "name", Description = "test", Address = "asd", Phone = "123"
            };

            //Act
            service.Create(venueDTO);
            var res = service.GetByName("name");

            //Assert
            Assert.AreEqual(venueDTO.Name, res.Name);

            service.Delete(res.Id);
        }
Exemplo n.º 23
0
        public VenueDTO SearchVenue(VenueSearch input)
        {
            var venueData = SearchVenueByName(input);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Entity, EntityDTO>();
                cfg.CreateMap <Entities.Location, LocationDTO>();
                cfg.CreateMap <Venue, VenueDTO>();
            });

            IMapper mapper = config.CreateMapper();
            var     result = new VenueDTO();

            result = mapper.Map <Venue, VenueDTO>(venueData);
            return(result);
        }
Exemplo n.º 24
0
        public void Delete()
        {
            //Arrange
            var venueDTO = new VenueDTO()
            {
                Name = "name", Description = "test", Address = "asd", Phone = "123"
            };

            service.Create(venueDTO);
            int id = service.GetByName("name").Id;

            //Act
            service.Delete(id);
            var res = service.GetByName("name");

            //Assert
            Assert.AreEqual(res, null);
        }
Exemplo n.º 25
0
        public void Update_With_Correct_Venue()
        {
            //Arrange
            var venueDTO = new VenueDTO {
                Name = "test", Description = "test", Address = "asd", Phone = "123"
            };

            //Act
            service.Create(venueDTO);
            var venueDTOForUpdate = new VenueDTO {
                Id = 0, Name = "update", Description = "update", Address = "rrr", Phone = "1234"
            };

            service.Update(venueDTOForUpdate);

            //Assert
            Assert.AreEqual(service.GetById(0).Name, "update");
        }
Exemplo n.º 26
0
        public void GetAll()
        {
            //Arrange
            var venueDTO = new VenueDTO()
            {
                Name = "test", Description = "test", Address = "asd", Phone = "123"
            };

            service.Create(venueDTO);

            //Act
            var res = service.GetAll().ToList();

            //Assert
            Assert.AreEqual(res.Count, 2);

            service.Delete(service.GetByName("test").Id);
        }
Exemplo n.º 27
0
        public void Try_To_Create_Incorrect_Venue()
        {
            //Arrange
            var venueDTO = new VenueDTO()
            {
                Name = "name", Description = "test", Address = "asd", Phone = "123"
            };
            var incorrectVenueDTO = new VenueDTO()
            {
                Name = "name", Description = "test", Address = "asd", Phone = "123"
            };

            //Act
            service.Create(venueDTO);

            //Assert
            Assert.Throws <NotUniqueNameException>(() => service.Create(incorrectVenueDTO));

            service.Delete(service.GetByName("name").Id);
        }
Exemplo n.º 28
0
        public void VenueMergeTest()
        {
            var venue1 = new venue
            {
                id                = SR.Urn("venue").ToString(),
                capacity          = 5,
                capacitySpecified = true,
                city_name         = "my city",
                country_name      = "eng country name",
                state             = "state",
                map_coordinates   = "coordinates",
                name              = "eng name"
            };
            var venue2 = new venue
            {
                id                = SR.Urn("venue").ToString(),
                capacity          = 5,
                capacitySpecified = true,
                city_name         = "my city",
                country_name      = "de country name",
                state             = "state",
                map_coordinates   = "coordinates",
                name              = "eng name"
            };
            var venueDTO1 = new VenueDTO(venue1);
            var venueDTO2 = new VenueDTO(venue2);
            var venueCI   = new VenueCI(venueDTO1, _cultureFirst);

            venueCI.Merge(venueDTO2, _cultureSecond);

            Assert.IsNotNull(venueCI);
            Assert.AreEqual(venue1.id, venueCI.Id.ToString());
            Assert.AreEqual(venue1.name, venueCI.GetName(_cultureFirst));
            Assert.AreEqual(venue1.capacity, venueCI.Capacity);
            Assert.AreEqual(venue1.map_coordinates, venueCI.Coordinates);
            Assert.AreEqual(venue1.state, venueCI.State);
            Assert.AreEqual(venue1.city_name, venueCI.GetCity(_cultureFirst));
            Assert.AreEqual(venue1.country_name, venueCI.GetCountry(_cultureFirst));
            Assert.AreEqual(venue2.country_name, venueCI.GetCountry(_cultureSecond));
            Assert.AreNotEqual(venueCI.GetCountry(_cultureFirst), venueCI.GetCountry(_cultureSecond));
        }
Exemplo n.º 29
0
        public Boolean deleteVenue(VenueDTO v)
        {
            using (var db = new GG.Models.GGModelContainer())
            {
                Venue VenueTbl = new Venue();


                var existingVenue = (from x in db.Venues where x.Id == v.id select x).FirstOrDefault();



                foreach (var x in db.Types.ToList())
                {
                    x.Venues.Remove(existingVenue);
                }

                foreach (var x in db.Tags.ToList())
                {
                    x.Venues.Remove(existingVenue);
                }

                foreach (var x in db.Times.ToList())
                {
                    x.Venues.Remove(existingVenue);
                }

                foreach (var x in db.Prices1.ToList())
                {
                    x.Venues.Remove(existingVenue);
                }


                db.Venues.Remove(existingVenue);


                db.SaveChanges();

                return(true);
            }
        }
Exemplo n.º 30
0
        public List <VideoDTO> removeVideo(VenueDTO v)
        {
            VideoDTO i = new VideoDTO();

            i = v.videos.Last();



            using (var db = new GG.Models.GGModelContainer())
            {
                Venue VenueTbl = new Venue();

                var existingVideo = (from x in db.Videos where x.Id == i.id select x).FirstOrDefault();


                var existingVenue = (from x in db.Venues where x.Id == v.id select x).FirstOrDefault();


                db.Videos.Remove(existingVideo);


                existingVenue.Videos.Remove(existingVideo);


                db.SaveChanges();

                var l = (from x in existingVenue.Videos
                         .Select(b => new VideoDTO
                {
                    id = b.Id,
                    url = b.url
                })

                         select x).ToList();


                return(l);
            }
        }
Exemplo n.º 31
0
 public void GivenIHaveAVenue(string venueName)
 {
     using (var uow = container.Resolve<IAmAUnitOfWorkFactory>().CreateUnitOfWork())
     {
         venueId = new Id(Guid.NewGuid());
         var venue = new VenueDTO(
             venueId,
             new Version(),
             new VenueName("The American Bar, The Savoy Hotel"),
             new Address(new Street("The Strand"), new City("London"), new PostCode("WC2R 0EU")),
             new VenueMap(new Uri("http://www.fairmont.com/savoy/MapAndDirections.htm")),
             new VenueContact(new ContactName("Athena Cripps"), new EmailAddress("*****@*****.**"), new PhoneNumber(" +44 (0)20 7420 2492")));
         uow.Add(venue);
         uow.Commit();
     }
     scheduleMeetingCommand.VenueId = venueId;
 }