Example #1
0
 /// <summary>
 /// Add new genre to event.
 /// </summary>
 /// <param name="genre"></param>
 public void AddGenre(GenreEnum genre)
 {
     if (!this.Genres.Any(x => x == genre))
     {
         this.Genres.Add(genre);
     }
 }
Example #2
0
 public Movie(string title, GenreEnum genre, int yearOfRelease, int runningTimeInMinutes)
 {
     Title                = title;
     Genre                = genre;
     YearOfRelease        = yearOfRelease;
     RunningTimeInMinutes = runningTimeInMinutes;
 }
        // Custom function to get Genres from Object
        private static string GetGenre(GenreEnum genre)
        {
            switch (genre)
            {
            case GenreEnum.Action:
                return("Action");

            case GenreEnum.Crime:
                return("Cripe");

            case GenreEnum.Detective:
                return("Detective");

            case GenreEnum.Documentary:
                return("Documentary");

            case GenreEnum.Drama:
                return("Drama");

            case GenreEnum.Fantasy:
                return("Fantasy");

            case GenreEnum.Science_Fiction:
                return("Science Fiction");

            default: return("Unknown");
            }
        }
Example #4
0
        // --------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Calls the CTOR of PAPIGame and creates a new game with the given genre and the current player as game master
        /// </summary>
        /// <param name="genre"></param>
        public static void CreateNewGame(GenreEnum genre, string id)
        {
            _runningGame = new PAPIGame(genre, PAPIApplication.GetPlayer(), null, DateTime.Now, DateTime.Now, null, id);
            SaveFileManager.Save(_runningGame);

            WfLogger.Log("PAPIApplication.CreateNewGame", LogLevel.DEBUG, "Created new Game");
        }
Example #5
0
        // Functionality removed, but code is still there for reference

        /* private void addPlayerButton_Click(object sender, EventArgs e)
         * {
         *   WfLogger.Log(this, LogLevel.DEBUG, "Add new Player Button was clicked, open the Player Search Popup");
         *   ViewController.playerSearchPopup.Popup(this);
         *
         * }*/

        private void genreDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (genreDropdown.SelectedIndex)
            {
            case 0:
                _cachedGenre = GenreEnum.NUCLEAR_FALLOUT;
                break;

            case 1:
                _cachedGenre = GenreEnum.MEDIEVAL_FANTASY;
                break;

            case 2:
                _cachedGenre = GenreEnum.MAGICAL_WORLD;
                break;

            case 3:
                _cachedGenre = GenreEnum.SPACE_OPERA;
                break;

            default:
                _cachedGenre = GenreEnum.NOT_VALID;
                break;
            }
            if (_cachedGenre != GenreEnum.NOT_VALID)
            {
                create_and_start_button.Enabled = true;
            }
            genre_description.Text = _genreDescriptions[_cachedGenre];

            WfLogger.Log(this, LogLevel.DEBUG, "Genre " + _cachedGenre + " was selected in dropdown");
        }
Example #6
0
 public Book(string title, int publishYear, string author, GenreEnum genre)
 {
     Title       = title;
     PublishYear = publishYear;
     Author      = author;
     Genre       = genre;
 }
Example #7
0
 public JsonGetBeatmap(ApprovedEnum approved, DateTime approvedDate, DateTime lastUpdate, string artist,
                       int beatmapId, int beatmapsetId, int bPM, string creator, float difficultRating,
                       float diffSize, float diffOverall, float diffApproach, float diffDrain, int hitLength,
                       string source, GenreEnum genreId, LanguageIDEnum languageId, string title, int totalLength,
                       string version, string fileMD5, GameModeEnum gameMode, string tags, int favouriteCount,
                       int playCount, int passCount, int maxCombo)
 {
     Approved        = approved;
     ApprovedDate    = approvedDate;
     LastUpdate      = lastUpdate;
     Artist          = artist;
     BeatmapId       = beatmapId;
     BeatmapsetId    = beatmapsetId;
     BPM             = bPM;
     Creator         = creator;
     DifficultRating = difficultRating;
     DiffSize        = diffSize;
     DiffOverall     = diffOverall;
     DiffApproach    = diffApproach;
     DiffDrain       = diffDrain;
     HitLength       = hitLength;
     Source          = source;
     GenreId         = genreId;
     LanguageId      = languageId;
     Title           = title;
     TotalLength     = totalLength;
     Version         = version;
     FileMD5         = fileMD5;
     GameMode        = gameMode;
     Tags            = tags;
     FavouriteCount  = favouriteCount;
     PlayCount       = playCount;
     PassCount       = passCount;
     MaxCombo        = maxCombo;
 }
Example #8
0
 public Book(string isbn, string name, GenreEnum genre, int pages, int quantity)
 {
     Isbn     = isbn;
     Name     = name;
     Genre    = genre;
     Pages    = pages;
     Quantity = quantity;
 }
 public SongsEntity(string name, string interpret, string albumName, DateTime releaseDate, GenreEnum genre)
 {
     Name        = name;
     Interpret   = interpret;
     AlbumName   = albumName;
     ReleaseDate = releaseDate;
     Genre       = genre;
 }
Example #10
0
        public IEnumerable <Book> RetrieveAllBooksGroupedByGenre(GenreEnum genre)
        {
            IEnumerable <Book> bookList =
                from book in BookList

                select book;

            return(bookList);
        }
Example #11
0
 public void SetGenre()
 {
     switch (GameEnum)
     {
     case GameEnum.COD:
         this.Genre = GenreEnum.FPS;
         break;
     }
 }
Example #12
0
        public async Task <IActionResult> GetProductsByGenre(GenreEnum genre, int pageSize = 10, int page = 1)
        {
            int recordCount = 0;
            var list        = _productServiceAsync.GetProductsByGenre(genre, pageSize, page, out recordCount);

            Response.AddPagination(page, pageSize, recordCount);

            return(Ok(list));
        }
        /// <summary>
        /// Get the current Cashback
        /// </summary>
        /// <param name="companyId">Company Id</param>
        /// <param name="genre">Genre</param>
        /// <param name="dayOfWeek">Day of the week</param>
        /// <returns></returns>
        public CashbackSettings GetCashbackByGenreAndDay(Guid companyId, GenreEnum genre, DayOfWeek dayOfWeek)
        {
            var result = FindBy(p =>
                                p.Active &&
                                p.CompanyId == companyId &&
                                p.DayOfWeek == dayOfWeek &&
                                p.Genre == genre).FirstOrDefault();

            return(result);
        }
Example #14
0
 public Book(int id, string isbn, string name, GenreEnum genre, Author author, int pages, int quantity)
 {
     Id       = id;
     Isbn     = isbn;
     Name     = name;
     Genre    = genre;
     Author   = author;
     Pages    = pages;
     Quantity = quantity;
 }
Example #15
0
        public Person(string firstName, string lastName, int age, GenreEnum favoriteMusicType, List <Song> favoriteSongs)
        {
            Random rnd = new Random();

            Id                = rnd.Next(0, int.MaxValue);
            FirstName         = firstName;
            LastName          = lastName;
            Age               = age;
            FavoriteMusicType = favoriteMusicType;
            FavoriteSongs     = favoriteSongs;
        }
Example #16
0
 public Books(string id1, string isbn, string author, string title, GenreEnum genre, string publisher, DateTime publishDate, string description, DateTime registrationDate)
 {
     id                = id1;
     Isbn              = isbn;
     Author            = author;
     Title             = title;
     Genre             = genre;
     Publisher         = publisher;
     Publish_Date      = publishDate;
     Description       = description;
     Registration_Date = registrationDate;
 }
Example #17
0
        public PAPIGame(GenreEnum _genre, Player _gameMaster, Dictionary <Player, PlayerCharacter> _playerParty, DateTime _dateOfCreation, DateTime _dateOfLastSession,
                        List <UniqueRival> _knownNPCs, string _id)
        {
            this._gameMaster        = (_gameMaster == null) ? PAPIApplication.GetPlayer() : _gameMaster;
            this._genre             = _genre;
            this._playerParty       = (_playerParty == null) ? new Dictionary <Player, PlayerCharacter>() : _playerParty;
            this._dateOfCreation    = (_dateOfCreation == null) ? DateTime.Now : _dateOfCreation;
            this._dateOfLastSession = (_dateOfLastSession == null) ? DateTime.Now : _dateOfLastSession;
            this._knownNPCs         = (_knownNPCs == null) ? new List <UniqueRival>() : _knownNPCs;

            WfLogger.Log(this, LogLevel.DETAILED, "Created new Game (GameMaster " + _gameMaster._name + ", Genre " + _genre + ")");
        }
Example #18
0
        /// <summary>
        /// Get a list of products (disks)
        /// </summary>
        /// <param name="genre">Genre of Disk</param>
        /// <param name="pageSize">Number of items by page</param>
        /// <param name="page">Current Page</param>
        /// <param name="recordCount">Total of records</param>
        /// <returns>List of disks</returns>
        public List <Product> GetProductsByGenre(GenreEnum genre, int pageSize, int page, out int recordCount)
        {
            var query = _context.Set <Product>().Where(p => p.Genre == genre);

            //total of records
            recordCount = query.Count();

            //paginate result
            return(query.OrderBy(o => o.Name)
                   .Skip(pageSize * (page - 1))
                   .Take(pageSize)
                   .ToList());
        }
Example #19
0
        public static Book Create(int bookId, String title, int year, int price, GenreEnum genre)
        {
            CheckParam(title);

            return(new Book()
            {
                BookId = bookId,
                Title = title,
                Year = year,
                Price = price,
                Genre = genre
            });
        }
Example #20
0
        /// <summary>
        /// This method connect on the SpotyFy API and Get a list of Disks by Genre
        /// </summary>
        /// <param name="numberOfDisks">Number of disks</param>
        /// <param name="genre">With genre</param>
        /// <returns>List of products</returns>
        public List <Product> GetDisksByGenre(int numberOfDisks, GenreEnum genre)
        {
            var api = GetTokenAuth();

            //Make a search on the Spotify Service
            SearchItem search = api.SearchItems(genre.ToString(), SearchType.Album, numberOfDisks);

            return(search.Albums.Items.Select(s => new Product
            {
                Id = Guid.NewGuid(),
                Genre = genre,
                Name = $"{s.Name} - (Date: {s.ReleaseDate})",
                Price = Math.Round(new Random().NextDouble() * 50d, 2)
            }).ToList());
        }
Example #21
0
        public static Book ToModel(this EditBookViewModel model)
        {
            var       author = .FirstOrDefault(x => x.Id.ToString() == model.Author);
            GenreEnum genre  = (GenreEnum)Enum.Parse(typeof(GenreEnum), model.Genre);

            Book newBook = new Book();

            newBook.Id       = model.Id;
            newBook.Isbn     = model.Isbn;
            newBook.Name     = model.Name;
            newBook.Pages    = model.Pages;
            newBook.Author   = author;
            newBook.Quantity = model.Quantity;
            newBook.Genre    = genre;

            return(newBook);
        }
Example #22
0
        public void Create(EditBookViewModel model)
        {
            int       nextId = Storage.Books.Last().Id + 1;
            var       author = Storage.Authors.FirstOrDefault(x => x.Id == int.Parse(model.Author));
            GenreEnum genre  = (GenreEnum)Enum.Parse(typeof(GenreEnum), model.Genre);

            Book newBook = new Book();

            newBook.Id       = nextId;
            newBook.Isbn     = model.Isbn;
            newBook.Name     = model.Name;
            newBook.Pages    = model.Pages;
            newBook.Author   = author;
            newBook.Quantity = model.Quantity;
            newBook.Genre    = genre;

            _bookRepository.CreateNew(newBook);
        }
Example #23
0
        // --------------------------------------------------------------------------------------------------------------------------------
        // --------------------------------------------------------------------------------------------------------------------------------

        /// <param name="genre"></param>
        /// <returns>returns true, if the species is available for the given setting</returns>
        public bool AvailableForGenre(GenreEnum genre)
        {
            return(_availableGenres.Contains(genre));
        }
Example #24
0
        private static void AddBook(List <Book> allBooks)
        {
            string title = ""; int publishYear = 0; string author = ""; GenreEnum genre = GenreEnum.DRAMA;
            bool   error;

            do
            {
                error = false;
                try
                {
                    Console.WriteLine("Enter title of the book:");
                    title = Console.ReadLine();
                    Console.WriteLine("Enter publishing year of the book:");
                    publishYear = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter author of the book:");
                    author = Console.ReadLine();
                    PrintGenres();
                    genre = (GenreEnum)int.Parse(Console.ReadLine());
                }
                catch (Exception)
                {
                    error = true;
                }
                if (!Enum.IsDefined(typeof(GenreEnum), genre))
                {
                    error = true;
                }
                if (error)
                {
                    Console.WriteLine("Error! Wrong entry.");
                    FileLogger.Error("Error! Wrong entry.");
                }
            } while (error);

            Book book = new Book(title, publishYear, author, genre);

            allBooks.Add(book);

            /* string title; int publishYear; string author; GenreEnum genre;
             * try
             * {
             *  Console.WriteLine("Enter title of the book:");
             *  title = Console.ReadLine();
             *  Console.WriteLine("Enter publishing year of the book:");
             *  publishYear = int.Parse(Console.ReadLine());
             *  Console.WriteLine("Enter author of the book:");
             *  author = Console.ReadLine();
             *
             *  Book book = new Book(title, publishYear, author);
             *
             *  PrintGenres();
             *  genre = (GenreEnum)int.Parse(Console.ReadLine());
             *
             *  genre = int.Parse(Console.ReadLine());
             *  switch(genre)
             *  {
             *      case 1:
             *          book.Genre = GenreEnum.DRAMA;
             *          break;
             *      case 2:
             *          book.Genre = GenreEnum.TRAGEDY;
             *          break;
             *      case 3:
             *          book.Genre = GenreEnum.FANTASY;
             *          break;
             *      case 4:
             *          book.Genre = GenreEnum.HORROR;
             *          break;
             *      case 5:
             *          book.Genre = GenreEnum.MYSTERY;
             *          break;
             *  }
             *
             *  allBooks.Add(book);
             * }
             * catch (Exception e)
             * {
             *  Console.WriteLine(e);
             *  FileLogger.Error("Error! Wrong entry.");
             * } */
        }
Example #25
0
 public Genre(GenreEnum @enum)
 {
     Id   = (int)@enum;
     Name = @enum.ToString();
 }
Example #26
0
 public Movie(int movieId, string title, GenreEnum genre, int yearOfRelease, int runningTimeInMinutes)
     : this(title, genre, yearOfRelease, runningTimeInMinutes)
 {
     MovieId = movieId;
 }
Example #27
0
 public IEnumerable <SongsEntity> GetByGenre(GenreEnum genre)
 {
     // LINQ TO SQL ZÁPIS
     return(Context.Set <SongsEntity>().Where(song => song.Genre == genre));
 }
Example #28
0
 public Song(string title, int length, GenreEnum genre)
 {
     Title  = title;
     Length = length;
     Genre  = genre;
 }
Example #29
0
 public GenreIsSpecification(GenreEnum?genre)
 {
     _genre = genre.Value;
 }
Example #30
0
        public IEnumerable <Book> RetrieveAllBooksGroupedByGenreMethodSyntax(GenreEnum genre)
        {
            IEnumerable <Book> bookList = BookList.Where(book => book.Genre == genre);

            return(bookList);
        }