Exemplo n.º 1
0
        public void ParameterlessConstructor_MustNotSetName_OnInit()
        {
            // Arrange & Act
            var type = new VenueType();

            // Assert
            Assert.IsNull(type.Name);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            VenueType venueType = db.VenueTypes.Find(id);

            db.VenueTypes.Remove(venueType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public void ParameterlessConstructor_MustNotSetId_OnInit()
        {
            // Arrange & Act
            var type = new VenueType();

            // Assert
            Assert.AreEqual(0, type.Id);
        }
Exemplo n.º 4
0
        public void ParameterlessConstructor_MustCreateVenueCollection_OnInit()
        {
            // Arrange & Act
            var type = new VenueType();

            // Assert
            Assert.IsNotNull(type.Venues);
        }
Exemplo n.º 5
0
        public void ParameterlessConstructor_MustSetIsHiddenToFalse_OnInit()
        {
            // Arrange & Act
            var type = new VenueType();

            // Assert
            Assert.IsFalse(type.IsHidden);
        }
Exemplo n.º 6
0
 internal Venue(string name, IPEndPoint endPoint, VenueType venueType, Image icon)
 {
     identifier    = null;
     this.name     = name;
     this.endPoint = endPoint;
     this.type     = venueType;
     this.icon     = icon;
 }
Exemplo n.º 7
0
        public void ParameterlessConstructor_MustCreateVenueType()
        {
            // Arrange & Act
            var type = new VenueType();

            // Assert
            Assert.IsInstanceOf <VenueType>(type);
        }
Exemplo n.º 8
0
 internal Venue( string name, IPEndPoint endPoint, VenueType venueType, Image icon)
 {
     identifier = null;
     this.name = name;
     this.endPoint = endPoint;
     this.type = venueType;
     this.icon = icon;
 }
Exemplo n.º 9
0
 public void Insert(VenueType type)
 {
     if (type == null)
     {
         return;
     }
     db.VenueTypes.Add(type);
     db.SaveChanges();
 }
Exemplo n.º 10
0
 internal Venue(VenueData venueData)
 {
     identifier = null;
     this.name = venueData.Name;
     this.endPoint = venueData.IPEndPoint;
     this.ttl = venueData.TTL;
     this.type = venueData.VenueType;
     this.icon = venueData.Icon;
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            VenueType venueType = await db.VenueTypes.FindAsync(id);

            db.VenueTypes.Remove(venueType);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 12
0
 /// <summary>
 /// Constructs a new venue.
 /// </summary>
 /// <param name="identifier">the identifier of the venue</param>
 /// <param name="ipAddress">the ipaddress of the venue</param>
 /// <param name="port">the port the venue is active on</param>
 /// <param name="name">the name of the venue</param>
 /// <param name="isPublic">is this a public venue</param>
 /// <param name="icon">the venue's icon</param>
 public Venue(string identifier, string ipAddress, int port, string name, byte[] icon, SecurityPatterns accessList)
 {
     this.Identifier = identifier;
     this.Name       = name;
     this.IPAddress  = ipAddress;
     this.Port       = port;
     this.Icon       = icon;
     this.AccessList = accessList;
     this.VenueType  = VenueType.STATIC_SINGLE_GROUP;
 }
Exemplo n.º 13
0
 public VenueData(string name, IPEndPoint ipEndPoint, ushort ttl, VenueType venueType, Image icon, IPEndPoint reflectorService, IPEndPoint archiveService)
 {
     Name             = name;
     IPEndPoint       = ipEndPoint;
     TTL              = ttl;
     VenueType        = venueType;
     Icon             = icon;
     ReflectorService = reflectorService;
     ArchiveService   = archiveService;
 }
 public ActionResult Edit([Bind(Include = "Id,Name")] VenueType venueType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(venueType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(venueType));
 }
        public ActionResult Create([Bind(Include = "Id,Name")] VenueType venueType)
        {
            if (ModelState.IsValid)
            {
                db.VenueTypes.Add(venueType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(venueType));
        }
Exemplo n.º 16
0
        public void VenueTypePropertyId_MustBeSetCorectly()
        {
            // Arrange
            var type = new VenueType();
            var id   = 0;

            // Act
            type.Id = id;

            // Assert
            Assert.AreEqual(id, type.Id);
        }
Exemplo n.º 17
0
 public VenueType Update(VenueType item)
 {
     try
     {
         _context.VenueTypes.Update(item);
         return(item);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 18
0
 public bool Delete(VenueType item)
 {
     try
     {
         _context.VenueTypes.Remove(item);
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 19
0
 public int Add(VenueType item)
 {
     try
     {
         var result = _context.VenueTypes.Add(item);
         return(result.Entity.Id);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public async Task <ActionResult> Create([Bind(Include = "Id,Description")] VenueType venueType)
        {
            if (ModelState.IsValid)
            {
                db.VenueTypes.Add(venueType);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(venueType));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,Description")] VenueType venueType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(venueType).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            //model state is invalid
            return(View(venueType));
        }
Exemplo n.º 22
0
        public void VenueTypePropertyVenues_MustBeSetCorectly()
        {
            // Arrange
            var type   = new VenueType();
            var venues = new List <Venue>();

            // Act
            type.Venues = venues;

            // Assert
            Assert.AreEqual(venues, type.Venues);
        }
Exemplo n.º 23
0
 public VenueType EditVenueType(VenueType request)
 {
     try
     {
         _unitOfWork.VenueTypeRepository.Update(request);
         _unitOfWork.Save();
         return(request);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 24
0
        public bool DeleteVenueType(VenueType request)
        {
            try
            {
                _unitOfWork.VenueTypeRepository.Delete(request);
                _unitOfWork.Save();

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        // GET: VenueTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VenueType venueType = db.VenueTypes.Find(id);

            if (venueType == null)
            {
                return(HttpNotFound());
            }
            return(View(venueType));
        }
Exemplo n.º 26
0
        public int CreateVenueType(VenueType request)
        {
            try
            {
                var VenueTypeId = _unitOfWork.VenueTypeRepository.Add(request);
                _unitOfWork.Save();

                return(VenueTypeId);
            }
            catch (Exception)
            {
                throw;
            }
        }
        // GET: Admin/VenueType/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VenueType venueType = await db.VenueTypes.FindAsync(id);

            if (venueType == null)
            {
                return(HttpNotFound());
            }
            return(View(venueType));
        }
Exemplo n.º 28
0
        public void SaveVenueType_SaveNewVenueType_ShouldSaveSuccessfully(string name, string description)
        {
            using (var scope = _iContainer.BeginLifetimeScope(AppContextType.UnitTest.ToString()))
            {
                _iVenueTypeDal = scope.Resolve <IVenueTypeDal>();

                var venueType = new VenueType {
                    Name = name, Description = description
                };

                var venueTypeResult = _iVenueTypeDal.SaveVenueType(venueType);

                Assert.True(venueTypeResult != null);
            }
        }
Exemplo n.º 29
0
 public VenueData( string name, IPEndPoint ipEndPoint, ushort ttl, VenueType venueType, Image icon, IPEndPoint reflectorService, IPEndPoint archiveService )
 {
     Name = name;
     IPEndPoint = ipEndPoint;
     TTL = ttl;
     VenueType = venueType;
     Icon = icon;
     ReflectorService = reflectorService;
     ArchiveService = archiveService;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Constructs a new venue.
 /// </summary>
 /// <param name="identifier">the identifier of the venue</param>
 /// <param name="ipAddress">the ipaddress of the venue</param>
 /// <param name="port">the port the venue is active on</param>
 /// <param name="name">the name of the venue</param>
 /// <param name="isPublic">is this a public venue</param>
 /// <param name="icon">the venue's icon</param>
 public Venue( string identifier,  string ipAddress, int port, string name, byte[] icon, SecurityPatterns accessList)
 {
     this.Identifier = identifier;
     this.Name = name;
     this.IPAddress = ipAddress;
     this.Port = port;
     this.Icon = icon;
     this.AccessList = accessList;
     this.VenueType = VenueType.STATIC_SINGLE_GROUP;
 }
Exemplo n.º 31
0
 //needed for serialisation
 public Venue() 
 {
     Port = 5004;
     this.PWStatus = PasswordStatus.NO_PASSWORD;
     this.VenueType = VenueType.STATIC_SINGLE_GROUP;
 }
        public async Task <ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl, string Gender)
        {
            if (User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Manage"));
            }

            if (ModelState.IsValid)
            {
                // Get the information about the user from the external login provider
                var info = await AuthenticationManager.GetExternalLoginInfoAsync();

                if (info == null)
                {
                    return(View("ExternalLoginFailure"));
                }
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    result = await UserManager.AddLoginAsync(user.Id, info.Login);

                    if (result.Succeeded)
                    {
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        await this.UserManager.AddToRoleAsync(user.Id, model.Role);

                        int GID = 0;
                        switch (Gender)
                        {
                        case "Male":
                            GID = 1;
                            break;

                        case "Female":
                            GID = 2;
                            break;

                        case "Non Binary":
                            GID = 3;
                            break;
                        }

                        User HarmonyUser = new User
                        {
                            FirstName        = model.FirstName,
                            LastName         = model.LastName,
                            Email            = user.Email,
                            City             = model.City,
                            State            = model.State,
                            Description      = model.Description,
                            ASPNetIdentityID = user.Id,
                            ProfilePictureID = GID
                        };
                        db.Users.Add(HarmonyUser);

                        if (model.Role == "VenueOwner")
                        {
                            VenueType venueType = new VenueType
                            {
                                TypeName = model.VenueType
                            };
                            Venue venue = new Venue
                            {
                                VenueName    = model.VenueName,
                                AddressLine1 = model.AddressLine1,
                                AddressLine2 = model.AddressLine2,
                                City         = model.VenueCity,
                                State        = model.VenueState,
                                ZipCode      = model.ZipCode,
                                UserID       = HarmonyUser.ID,
                                VenueTypeID  = venueType.ID
                            };
                            db.VenueTypes.Add(venueType);
                            db.Venues.Add(venue);
                        }
                        if (model.Role == "Musician")
                        {
                            List <Genre>  genres         = new List <Genre>();
                            List <string> genreList      = new List <string>();
                            List <string> instrumentList = new List <string>();
                            List <string> bandmemberList = new List <string>();
                            genreList = model.GenreName.Split(',').ToList();
                            for (int i = 0; i < genreList.Count(); i++)
                            {
                                genres.Add(new Genre
                                {
                                    GenreName = genreList[i]
                                });
                                db.Genres.Add(genres[i]);
                                HarmonyUser.Genres.Add(genres[i]);
                            }
                        }
                        await db.SaveChangesAsync();

                        return(RedirectToAction("Welcome", "Home"));
                    }
                }
                AddErrors(result);
            }
            return(View(model));
        }
Exemplo n.º 33
0
        public IList <Venue> ParseVenues()
        {
            var directory = "D:\\GitHub\\Team works\\SportSquare\\SportSquare";

            //var directory = "C:\\Academy\\WebForms\\SportSquareV2\\SportSquare\\SportSquare";

            using (var reader = XmlReader.Create(directory + FILE_PATH))
            {
                double   latitude     = 0.0;
                double   longitude    = 0.0;
                string   image        = "";
                string   name         = "";
                string   city         = "";
                string   address      = "";
                string   phone        = "";
                string   webAddress   = "";
                string[] venueType    = new string[1];
                bool     isInsideDiv  = false;
                bool     isInsideInfo = false;
                while (reader.Read())
                {
                    if (reader.AttributeCount > 0 && reader.GetAttribute(0) == "sp-club clearfix")
                    {
                        latitude  = double.Parse(reader.GetAttribute(1));
                        longitude = double.Parse(reader.GetAttribute(2));
                    }
                    if (reader.AttributeCount > 0 && reader.GetAttribute(0) == "image col-xs-4")
                    {
                        isInsideDiv = true;
                    }
                    if (reader.AttributeCount > 0 && reader.GetAttribute(0) == "info")
                    {
                        isInsideInfo = true;
                    }

                    if (isInsideDiv && reader.Name == "img")
                    {
                        image       = reader.GetAttribute(0);
                        isInsideDiv = false;
                    }
                    if (isInsideInfo && reader.Name == "h4" && reader.NodeType == XmlNodeType.Element)
                    {
                        reader.Read();
                        name = reader.Value;
                    }
                    if (isInsideInfo && reader.Name == "p" && reader.NodeType == XmlNodeType.Element && reader.GetAttribute(0) == "city")
                    {
                        reader.Read();
                        city = reader.Value;
                    }
                    if (isInsideInfo && reader.Name == "p" && reader.NodeType == XmlNodeType.Element && reader.GetAttribute(0) == "address")
                    {
                        reader.Read();
                        address = reader.Value;
                    }

                    if (isInsideInfo && reader.AttributeCount > 0 && reader.GetAttribute(0) == "phone")
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            reader.Read();
                        }
                        phone = reader.Value;
                    }
                    if (isInsideInfo && reader.AttributeCount > 0 && reader.GetAttribute(0) == "www")
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            reader.Read();
                        }
                        webAddress = reader.Value;
                    }
                    if (isInsideInfo && reader.AttributeCount > 0 && reader.GetAttribute(0) == "type")
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            reader.Read();
                        }
                        venueType    = reader.Value.Split(',');
                        isInsideInfo = false;
                    }
                    if (reader.AttributeCount > 0 && reader.GetAttribute(0) == "benefits")
                    {
                        var venue = new Venue(latitude, longitude, image, name, phone, webAddress, address, city);
                        foreach (var type in venueType)
                        {
                            if (this.VenueTypes.FirstOrDefault(x => x.Name == type) == null)
                            {
                                var newVenueType = new VenueType();
                                newVenueType.Name = type;
                                this.VenueTypes.Add(newVenueType);
                                venue.VenueTypes.Add(newVenueType);
                            }
                        }
                        this.Venues.Add(venue);
                    }
                }
            }
            return(Venues);
        }
Exemplo n.º 34
0
 public Guid CreateVenue(string name, VenueType type) => _competitionRepository.CreateVenue(name, VenueType.Lane);
Exemplo n.º 35
0
 //needed for serialisation
 public Venue()
 {
     Port           = 5004;
     this.PWStatus  = PasswordStatus.NO_PASSWORD;
     this.VenueType = VenueType.STATIC_SINGLE_GROUP;
 }