コード例 #1
0
ファイル: SongVM.cs プロジェクト: WillVandergrift/Carputer
        /// <summary>
        /// Get a list of songs by the genre
        /// </summary>
        /// <param name="genre"></param>
        /// <returns></returns>
        public List<CarPC.Song> GetSongsByGenre(GenreType genre)
        {
            var songs = from s in db.Songs
                        where s.Genre.ToUpper() == genre.ToString()
                        select s;

            if (songs.Count() > 0)
            {
                return songs.ToList<CarPC.Song>();
            }
            else
            {
                return new List<Song>();
            }
        }
コード例 #2
0
 public StreamingContent(string title, string description, string maturityRating, double starRating, bool isFamilyFriendly, GenreType genre)
 {
     Title            = title;
     Description      = description;
     MaturityRating   = maturityRating;
     StarRating       = starRating;
     IsFamilyFriendly = isFamilyFriendly;
     TypeOfGenre      = genre;
 }
コード例 #3
0
 public Movie(string title, string description, float starRating, string mRating, bool isFamFriendly, GenreType tOG, double runTime)
     : base(title, description, starRating, mRating, isFamFriendly, tOG)
 {
     RunTime = runTime;
 }
コード例 #4
0
 public StreamingContent(string title, string description, MaturityRating maturityRating, int starRating, GenreType typeOfGenre)
 {
     Title          = title;
     Description    = description;
     MaturityRating = maturityRating;
     StarRating     = starRating;
     TypeOfGenre    = typeOfGenre;
 }
コード例 #5
0
        public StreamingContent(string title, string desc, MaturityType maturity, double stars, GenreType genre)
        {
            Title    = title;
            Desc     = desc;
            Maturity = maturity;
            Stars    = stars;

            Genre = genre;
        }
コード例 #6
0
 public Show(string title, string description, float starRating, MaturityRating mRating, GenreType tOG)
     : base(title, description, starRating, mRating, tOG)
 {
 }
コード例 #7
0
        public void StreamingContentRepository_GetGenreFromInt_ShouldReturnCorrectGenreType(int input, GenreType genre)
        {
            var actual   = _contentRepoTest.GetGenreFromInt(input);
            var expected = genre;

            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
ファイル: GenreType.cs プロジェクト: bbeckwi2/Constellation
 public static Color getColor(this GenreType t)
 {
     return(colors[(int)t]);
 }
コード例 #9
0
ファイル: GenreType.cs プロジェクト: bbeckwi2/Constellation
 public static string getDescription(this GenreType t)
 {
     return(descriptions[(int)t]);
 }
コード例 #10
0
 public Movies(string name, GenreType type)
 {
     Name = name;
     Type = type;
 }
コード例 #11
0
ファイル: Genre.cs プロジェクト: PedroGomes15/Karaoke
 public Genre(GenreType genre, string color)
 {
     this.genre = genre;
     this.color = color;
 }
コード例 #12
0
 public StreamingContent(string title, string description, MaturityRating maturityRating, double starRating, int releaseYear, GenreType genre)
 {
     Title          = title;
     Description    = description;
     MaturityRating = maturityRating;
     StarRating     = starRating;
     ReleaseYear    = releaseYear;
     Genre          = genre;
 }
コード例 #13
0
        }                                                                                                                                           //empty constructor

        public StreamingContent(string title, string description, string maturityRating, double starRating, bool isFamilyFriendly, GenreType genre) // constructor - (list of parameters for constructor) - also called constructor method
        {
            Title            = title;                                                                                                               // assign properties to parameters
            Description      = description;
            MaturityRating   = maturityRating;
            StarRating       = starRating;
            IsFamilyFriendly = isFamilyFriendly;
            TypeOfGenre      = genre;
        }
コード例 #14
0
        public async Task <GenreDto> GetSingleAsync(GenreType name)
        {
            var genre = await _genreRepository.GetSingleAsync(name);

            return(_mapper.Map <Genre, GenreDto>(genre));
        }
コード例 #15
0
        /// <summary>
        /// Add items to the genre page
        /// </summary>
        public void FindSongs(GenreType genre)
        {
            //clear the gener home page
            songs.Clear();

            songs = vmSong.GetSongsByGenre(genre);

            //Update the genre list source
            lstSongs.ItemsSource = null;
            lstSongs.ItemsSource = songs;
        }
コード例 #16
0
ファイル: GenreType.cs プロジェクト: bbeckwi2/Constellation
 public static string getName(this GenreType t)
 {
     return(names[(int)t]);
 }
コード例 #17
0
        public IActionResult Index(GenreType genre, string name)
        {
            var model = _boardGameData.GetAllGenreName(genre, name);

            return(View("Index", model));
        }
コード例 #18
0
        private bool Menu()
        {
            Console.WriteLine("What would you like to do?" +
                              "\n1. Add content to streaming library " +
                              "\n2. Check out the streaming library" +
                              "\n3. Delete an entry from the streaming library" +
                              "\n4. Exit" +
                              "\n5. Find streaming content by title");
            string userInput = Console.ReadLine();

            switch (userInput)
            {
            case "1":
                Console.WriteLine("What's the title?");
                string title = Console.ReadLine();

                Console.WriteLine("What genre is it? The options are: ");
                GenreType userGenre = new GenreType();
                foreach (GenreType genre in Enum.GetValues(typeof(GenreType)))
                {
                    Console.WriteLine(genre);
                }
                string genreTypeString = Console.ReadLine();
                foreach (GenreType genre in Enum.GetValues(typeof(GenreType)))
                {
                    if (genre.ToString().ToLower() == genreTypeString.ToLower())
                    {
                        userGenre = genre;
                    }
                }


                Console.WriteLine("What's the Description?");
                string description = Console.ReadLine().ToLower();

                Console.WriteLine("What's the Runtime(in minutes)?");
                string runTime        = Console.ReadLine();
                double runTimeMinutes = int.Parse(runTime);

                Console.WriteLine("What's the Star Rating?");
                string starRatingString = Console.ReadLine();
                double starRating       = double.Parse(starRatingString);

                Console.WriteLine("What's the Maturity Rating?");
                string maturityRating = Console.ReadLine();

                Console.WriteLine("Is the video family friendly (Y/N)?");
                bool   familyFriendly       = false;
                string familyFriendlyString = Console.ReadLine().ToLower();
                switch (familyFriendlyString)
                {
                case "y":
                    familyFriendly = true;
                    break;

                case "n":
                    familyFriendly = false;
                    break;
                }

                StreamingContent contentAdded = new StreamingContent(title, userGenre, description, runTimeMinutes,
                                                                     starRating, maturityRating, familyFriendly);
                int initCount = _contentRepo.GetStreamingContentList().Count;
                _contentRepo.AddContentToList(contentAdded);
                if (_contentRepo.GetStreamingContentList().Count > initCount)
                {
                    Console.WriteLine("Awesome! Put that content in for ya.");
                }
                else
                {
                    Console.WriteLine("Please try to add that item again.");
                }
                break;

            case "2":
                foreach (StreamingContent item in _contentRepo.GetStreamingContentList())
                {
                    Console.WriteLine("Title: " + item.Title);
                    Console.WriteLine("Genre: " + item.TypeOfGenre);
                    Console.WriteLine("Description: " + item.Description);
                    Console.WriteLine("Runtime: " + item.RunTimeInMinutes);
                    Console.WriteLine("Star rating: " + item.StarRating);
                    Console.WriteLine("Maturity Rating: " + item.MaturityRating);
                    if (item.IsFamilyFriendly)
                    {
                        Console.WriteLine("Family Friendly: Yes");
                    }
                    else
                    {
                        Console.WriteLine("Family Friendly: No");
                    }
                    Console.WriteLine("----------------------");
                }
                break;

            case "3":
                Console.WriteLine("What's the name of the content you'd like to remove?");
                string           contentToRemove       = Console.ReadLine();
                StreamingContent contentToRemoveObject = new StreamingContent();
                foreach (StreamingContent content in _contentRepo.GetStreamingContentList())
                {
                    if (content.ToString() == contentToRemove)
                    {
                        contentToRemoveObject = content;
                    }
                }
                _contentRepo.RemoveContentFromList(contentToRemoveObject);
                if (_contentRepo.RemoveContentFromList(contentToRemoveObject))
                {
                    Console.WriteLine("I removed it for you!");
                }
                else
                {
                    Console.WriteLine("Operation failed :( please try again.");
                }
                break;

            case "4":
                return(false);

                //Environment.Exit(-1);
                break;

            case "5":
                Console.WriteLine("What's the title of the content you'd like to find?");
                string           titleToFind  = Console.ReadLine();
                StreamingContent contentFound = _contentRepo.GetContentByTitle(titleToFind);
                Console.WriteLine("----------------------");
                foreach (PropertyInfo prop in contentFound.GetType().GetProperties())
                {
                    Console.WriteLine(prop.GetValue(contentFound));
                }
                break;

            default:
                Console.WriteLine("Please re-type your answer");
                break;
            }
            Console.WriteLine("");
            return(true);
        }
コード例 #19
0
        public void StreamingContent_GetGenreFromInt_ShouldReturnCorrectEnumValue(int x, GenreType y)
        {
            // Arrange
            StreamingContentRepository _contentRepo = new StreamingContentRepository();

            // Act
            var actual = _contentRepo.GetGenreFromInt(x);

            // Assert
            Assert.AreEqual(y, actual);
        }
コード例 #20
0
ファイル: Movie.cs プロジェクト: sgsettle/CSharpFundamentals
 public Movie(string title, string description, MaturityRating maturityRating, double starRating, int releaseYear, GenreType genre, double runTime) : base(title, description, maturityRating, starRating, releaseYear, genre)
     //pulling in properties from overloaded constructor in StreamingContent class to be able to use in this class without having to double the code (putting same properties in both StreamingContent and Movie classes)
     // base(...) saying "I want to utilize the code in the constructor that is already written"
 {
     RunTime = runTime;
 }
コード例 #21
0
        /// <summary>
        /// Кнопка поиска
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonFind_Click(object sender, EventArgs e)
        {
            DiskInfo[] diskInfos = this.mFilmotecClass.DiskInfo;
            FilmInfo[] filmInfos = this.mFilmotecClass.GetFilmInfo(0, string.Empty, string.Empty);
            dataGridViewFindFilms.Rows.Clear();

            //
            // Создание полного списка фильмов и дисков
            //
            var result = new List <AllInfo>();

            for (int i = 0; i < filmInfos.Length; i++)
            {
                var temp = new AllInfo
                {
                    DiskNumber = filmInfos[i].Number,
                    DiskInfo   = GetDiskInfo(diskInfos, filmInfos[i].Number),
                    FilmInfo   = filmInfos[i].Info,
                    FilmName   = filmInfos[i].Name,
                    Genre      = filmInfos[i].Genre
                };
                result.Add(temp);
            }

            //
            // Выбрасывание фильмов с неподходящим номером диска
            //
            if (!string.IsNullOrEmpty(textBoxDiskNumber.Text))
            {
                string[] diskNumbers = Helper.ConvertDiskNumbersStringToArray(textBoxDiskNumber.Text);
                for (int i = 0; i < result.Count; i++)
                {
                    bool isNeedRemove = true;
                    foreach (string diskNumber in diskNumbers)
                    {
                        if (result[i].DiskNumber.ToString() == diskNumber)
                        {
                            isNeedRemove = false;
                            break;
                        }
                    }

                    if (isNeedRemove)
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим типом диска
            //
            if (comboBoxDiskInfo.SelectedIndex > 0)
            {
                for (int i = 0; i < result.Count; i++)
                {
                    if (!DiskInfoCompare(result[i].DiskInfo, comboBoxDiskInfo.Text))
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим названием фильма
            //
            if (!string.IsNullOrEmpty(textBoxFilmName.Text))
            {
                for (int i = 0; i < result.Count; i++)
                {
                    if (IsRemoveFilm(result[i].FilmName, textBoxFilmName.Text, checkBoxNameAll.Checked, checkBoxNameRegistry.Checked))
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим информацией о фильме
            //
            if (!string.IsNullOrEmpty(textBoxFilmInfo.Text))
            {
                for (int i = 0; i < result.Count; i++)
                {
                    if (IsRemoveFilm(result[i].FilmInfo, textBoxFilmInfo.Text, checkBoxInfoAll.Checked, checkBoxInfoRegistry.Checked))
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим жанром
            //
            if (comboBoxFilterGenre.Text != "Все жанры")
            {
                GenreType genreType = Helper.StringToGenre(comboBoxFilterGenre.Text);
                for (int i = 0; i < result.Count; i++)
                {
                    if (result[i].Genre != genreType)
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            for (int i = 0; i < result.Count; i++)
            {
                var addParams = new[]
                {
                    result[i].DiskNumber.ToString(),
                    DiskTypeToString(result[i].DiskInfo),
                    result[i].FilmName,
                    result[i].FilmInfo
                };
                dataGridViewFindFilms.Rows.Add(addParams);
            }

            labelFindResult.Text = "Результат поиска: " + GetRightNumberCount(result.Count);
        }
コード例 #22
0
ファイル: Genres.cs プロジェクト: MarkTiffan/MarksMovies
 public Genre(GenreType g)
 {
     genre = g;
 }
コード例 #23
0
 public void SetGenre(GenreType genreType)
 {
     Console.WriteLine($"Genre set to {genreType.ToString()}");
     genre = genreType;
 }
コード例 #24
0
 public async Task <Genre> GetSingleAsync(GenreType name)
 => await _context.Genres.SingleOrDefaultAsync(x => x.Name == name);
コード例 #25
0
 public Movie(string title, string description, MaturityRating maturityRating, int starRating, GenreType typeOfGenre, double runTime)
     : base(title, description, maturityRating, starRating, typeOfGenre)
 {
     RunTime = runTime;
 }
コード例 #26
0
        public StreamingContent(string title, string description, Maturity maturityRating, double stars, GenreType genre)

        {
            Title          = title;
            Description    = description;
            MaturityRating = maturityRating;
            StarRating     = stars;
            GenreType      = genre;
        }
コード例 #27
0
 public Song(bool?like, Artist artist, Album album, int duration = 0, string title = "", string path = "", string lirics = "unknown", GenreType genre = GenreType.UNKNOWN)
 {
     Duration = duration;
     Title    = title;
     Path     = path;
     Lirics   = lirics;
     Genre    = genre;
     Artist   = artist;
     Album    = album;
     Like     = like;
 }
コード例 #28
0
 public Games(string name, GenreType genres, WorldType size)
 {
     Name      = name ?? throw new ArgumentNullException(paramName: nameof(name));
     genre     = genres;
     worldtype = size;
 }
コード例 #29
0
 public async Task <IList <Movie> > OnGetAsync(string SearchTitle, GenreType SearchGenre)
 {
     return(await _dbAccess.GetMovieListAsync(SearchTitle, SearchGenre));
 }
コード例 #30
0
 public static IEnumerable <Games> FilterByGenreAndWorldType(IEnumerable <Games> games, WorldType size, GenreType genres)
 {
     foreach (var p in games)
     {
         if (p.worldtype == size && p.genre == genres)
         {
             yield return(p);
         }
     }
 }
コード例 #31
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public MusicGenre(GenreType genre)
        {
            InitializeComponent();

            FindSongs(genre);
        }
コード例 #32
0
 public GenreSpecification(GenreType genre)
 {
     this.genre = genre;
 }
コード例 #33
0
ファイル: Class1.cs プロジェクト: orthimnas/ID3Parse
        internal ID3v1(FileStream fSource)
        {
            //Move to end of file
            fSource.Seek(-128, SeekOrigin.End);

            //Begin parsing
            if (Helper.ReadFromStream(fSource, 3) == "TAG")
            {
                //Valid ID3 tag starting header found, parse out remaining data.
                this._title = Helper.ReadFromStream(fSource, 30).Trim();
                this._artist = Helper.ReadFromStream(fSource, 30).Trim();
                this._album = Helper.ReadFromStream(fSource, 30).Trim();
                int.TryParse(Helper.ReadFromStream(fSource, 4), out this._year);
                this._comment = Helper.ReadFromStream(fSource, 30).Trim();
                if (this._comment.Length <= 28)
                {
                    //Room for a track number to be stored
                    int.TryParse(Helper.ReadFromStream(fSource, 2), out _track);
                }

                //If something goes wrong parsing the Genre Type, assign it an Unknown value.
                try
                {
                    this._genreNumber = int.Parse(Helper.ReadFromStream(fSource, 1));
                    this._genre = (GenreType)this._genreNumber;
                }
                catch
                {
                    this._genreNumber = -1;
                    this._genre = GenreType.Unknown;
                }
            }
        }
コード例 #34
0
 public Genre(GenreType name)
 {
     Id    = Guid.NewGuid();
     Name  = name;
     Books = new List <Book>();
 }