コード例 #1
0
        public static SongInEntertainment[] GetSongInEntertainmentByEntertainment(Entertainment entertainment)
        {
            Logger.Info("SongInEntertainment.GetSongInEntertainmentByEntertainment", "Спроба взяти з БД записи SongInEntertainment за Entertainment.");

            List <SongInEntertainment> result = new List <SongInEntertainment>();

            _dataAdapter.SelectCommand.CommandText = "SELECT * FROM " + _tableName + " WHERE EntertainmentId=@id";

            if (!_dataAdapter.SelectCommand.Parameters.Contains("@id"))
            {
                _dataAdapter.SelectCommand.Parameters.Add(new SqlParameter("@id", entertainment.Id));
            }
            else
            {
                _dataAdapter.SelectCommand.Parameters["@id"].Value = entertainment.Id;
            }

            _dataAdapter.Fill(_dataTable);
            var selectedRows = from row in _dataTable.AsEnumerable().AsParallel()
                               where (Guid)row["EntertainmentId"] == entertainment.Id
                               select row;

            foreach (DataRow dr in selectedRows)
            {
                result.Add(new SongInEntertainment(dr));
            }

            Logger.Info("SongInEntertainment.GetSongInEntertainmentByEntertainment", "Зчитано з БД записи SongInEntertainment за Entertainment.");

            if (result.Count != 0)
            {
                return(result.ToArray());
            }
            return(null);
        }
コード例 #2
0
        public GenreInEntertainment(Entertainment entertainment, Genre genre) : base()
        {
            EntertainmentId = entertainment.Id;
            GenreId         = genre.Id;

            Logger.Info("GenreInEntertainment.GenreInEntertainment", "Створено екземпляр GenreInEntertainment.");
        }
コード例 #3
0
        public SongInEntertainment(Song song, Entertainment entertainment) : base()
        {
            SongId          = song.Id;
            EntertainmentId = entertainment.Id;

            Logger.Info("SongInEntertainment.SongInEntertainment", "Створено екземпляр SongInEntertainment.");
        }
コード例 #4
0
ファイル: Performer.cs プロジェクト: fcdk/MaxCriticWPF
        public static Performer[] GetAlbumAuthorsByAlbum(Entertainment entertainment)
        {
            Logger.Info("Performer.GetAlbumAuthorsByAlbum", "Спроба взяти з БД записи альбомів за виконавцем.");

            if (entertainment.EntertainmentType != Entertainment.Type.Album)
            {
                return(null);
            }

            PerformerInEntertainment[] performerInEntertainments = PerformerInEntertainment.GetAlbumAuthorsPerformerInEntertainmentsByEntertainment(entertainment);
            if (performerInEntertainments == null)
            {
                return(null);
            }
            List <Guid> ids = new List <Guid>();

            foreach (var performerInEntertainment in performerInEntertainments)
            {
                ids.Add(performerInEntertainment.PerformerId);
            }

            Logger.Info("Performer.GetAlbumAuthorsByAlbum", "Зчитано з БД записи альбомів за виконавцем.");

            return(Performer.GetByIds(ids.ToArray()));
        }
コード例 #5
0
        public Award(Performer performer, Entertainment entertainment, string name, string nomination, DateTime date,
                     byte[] image) : base()
        {
            if (performer == null)
            {
                PerformerId = default(Guid?);
            }
            else
            {
                PerformerId = performer.Id;
            }
            if (entertainment == null)
            {
                EntertainmentId = default(Guid?);
            }
            else
            {
                EntertainmentId = entertainment.Id;
            }
            Name       = name;
            Nomination = nomination;
            Date       = date;
            Image      = image;

            Logger.Info("Award.Award", "Екземпляр Award створений.");
        }
コード例 #6
0
        public PerformerInEntertainment(Performer performer, Entertainment entertainment, PerformerInEntertainment.Role performerRole) : base()
        {
            PerformerId     = performer.Id;
            EntertainmentId = entertainment.Id;
            PerformerRole   = performerRole;

            Logger.Info("PerformerInEntertainment.PerformerInEntertainment", "Створено екземпляр PerformerInEntertainment.");
        }
コード例 #7
0
        public Review(UserCritic userCritic, Entertainment entertainment, byte point, string opinion, DateTimeOffset time,
                      string link, string publication, int helpful, int unhelpful, bool checkedByAdmin) : base()
        {
            UserId          = userCritic.Id;
            EntertainmentId = entertainment.Id;
            Point           = point;
            Opinion         = opinion;
            Time            = time;
            Link            = link;
            Publication     = publication;
            Helpful         = helpful;
            Unhelpful       = unhelpful;
            CheckedByAdmin  = checkedByAdmin;

            Logger.Info("Review.Review", "Створено екземпляр Review.");
        }
コード例 #8
0
        public static PerformerInEntertainment[] GetAlbumAuthorsPerformerInEntertainmentsByEntertainment(Entertainment entertainment)
        {
            Logger.Info("PerformerInEntertainment.GetAlbumAuthorsPerformerInEntertainmentsByEntertainment", "Спроба взяти з БД записи PerformerInEntertainment авторів альбому за Entertainment.");

            List <PerformerInEntertainment> result = new List <PerformerInEntertainment>();

            _dataAdapter.SelectCommand.CommandText = "SELECT * FROM " + _tableName + " WHERE EntertainmentId=@id AND (PerformerRole='AlbumBand' OR PerformerRole='AlbumSinger')";

            if (!_dataAdapter.SelectCommand.Parameters.Contains("@id"))
            {
                _dataAdapter.SelectCommand.Parameters.Add(new SqlParameter("@id", entertainment.Id));
            }
            else
            {
                _dataAdapter.SelectCommand.Parameters["@id"].Value = entertainment.Id;
            }

            _dataAdapter.Fill(_dataTable);
            var selectedRows = from row in _dataTable.AsEnumerable().AsParallel()
                               where ((Guid)row["EntertainmentId"] == entertainment.Id) &&
                               (((PerformerInEntertainment.Role)Enum.Parse(typeof(PerformerInEntertainment.Role), row["PerformerRole"].ToString()) == PerformerInEntertainment.Role.AlbumSinger) ||
                                ((PerformerInEntertainment.Role)Enum.Parse(typeof(PerformerInEntertainment.Role), row["PerformerRole"].ToString()) == PerformerInEntertainment.Role.AlbumBand))
                               select row;

            foreach (DataRow dr in selectedRows)
            {
                result.Add(new PerformerInEntertainment(dr));
            }

            Logger.Info("PerformerInEntertainment.GetPerformerInEntertainmentByEntertainmentAndRole", "Зчитано з БД записи PerformerInEntertainment авторів альбому за Entertainment.");

            if (result.Count != 0)
            {
                return(result.ToArray());
            }
            return(null);
        }