Exemplo n.º 1
0
        public static RecordingService CreateRecordingService(string backupPath, MBFileService mbfileService = null)
        {
            var contextFactory      = new VoiceNotesContextFactory(backupPath);
            var voiceNoteContext    = contextFactory.CreateDbContext();
            var recordingRepository = new RecordingRepository(voiceNoteContext);

            return(new RecordingService(recordingRepository, mbfileService));
        }
 public void RecordingRepositoryTestMethod()
 {
     RecordingRepository _rpo = new RecordingRepository();
       IConsumerBinding _nb = _rpo.GetConsumerBinding(String.Empty, DataRepository.name, new UATypeInfo(BuiltInType.String));
       Assert.IsNotNull(_nb);
       Assert.IsNotNull(_nb.Encoding);
       _nb.Converter = new DateFormatter();
       Assert.AreEqual<BuiltInType>(BuiltInType.String, _nb.Encoding.BuiltInType);
       DateTime _dt = new DateTime(2008, 2, 5);
       Recording _testValue = new Recording("Chris Sells", "Chris Sells Live", _dt);
       _nb.Assign2Repository(_testValue);
       Assert.AreEqual<string>(_dt.ToString(CultureInfo.InvariantCulture), _rpo.Buffer);
 }
        public void RecordingRepositoryTestMethod()
        {
            RecordingRepository _rpo = new RecordingRepository();
            IConsumerBinding    _nb  = _rpo.GetConsumerBinding(String.Empty, DataRepository.name, new UATypeInfo(BuiltInType.String));

            Assert.IsNotNull(_nb);
            Assert.IsNotNull(_nb.Encoding);
            _nb.Converter = new DateFormatter();
            Assert.AreEqual <BuiltInType>(BuiltInType.String, _nb.Encoding.BuiltInType);
            DateTime  _dt        = new DateTime(2008, 2, 5);
            Recording _testValue = new Recording("Chris Sells", "Chris Sells Live", _dt);

            _nb.Assign2Repository(_testValue);
            Assert.AreEqual <string>(_dt.ToString(CultureInfo.InvariantCulture), _rpo.Buffer);
        }
Exemplo n.º 4
0
        public List <Recording> GetAllRecordings()
        {
            var recordings = RecordingRepository.GetAll();

            if (MBFileService == null)
            {
                return(recordings);
            }

            foreach (Recording recording in recordings)
            {
                recording.MBFile = (MBFile)MBFileService.GetByRelativePath(recording.RelativePath);
            }

            return(recordings);
        }
Exemplo n.º 5
0
 public RecordingController(IRepository <Recording> repository)
 {
     _repository = (RecordingRepository)repository;
 }
Exemplo n.º 6
0
        public static IList<Recording> GeneralSqlQuery(string command)
        {
            using (IRecordingRepository recordingRepository = new RecordingRepository(true))
            {
                IEnumerable<Mediaportal.TV.Server.TVDatabase.Entities.Recording> allqueryRecordings = recordingRepository.ObjectContext.ExecuteStoreQuery<Mediaportal.TV.Server.TVDatabase.Entities.Recording>(command);
                recordingRepository.UnitOfWork.SaveChanges();

                IList<Recording> myrecordings = new List<Recording>();
                foreach (Mediaportal.TV.Server.TVDatabase.Entities.Recording myrecording in allqueryRecordings)
                {
                    Recording newrecording = new Recording();
                    newrecording.IdRecording = myrecording.IdRecording;
                    newrecording.Title = myrecording.Title;
                    newrecording.FileName = myrecording.FileName;
                    if (myrecording.IdChannel != null)
                    {
                        newrecording.IdChannel = (int)myrecording.IdChannel;
                    }
                    else
                    {
                        newrecording.IdChannel = -1;
                    }
                    newrecording.StartTime = myrecording.StartTime;
                    newrecording.EndTime = myrecording.EndTime;
                    newrecording.Description = myrecording.Description;
                    newrecording.EpisodeName = myrecording.EpisodeName;
                    newrecording.EpisodeNum = myrecording.EpisodeNum;
                    newrecording.EpisodePart = myrecording.EpisodePart;
                    if (myrecording.ProgramCategory != null)
                        newrecording.Genre = myrecording.ProgramCategory.Category;
                    else
                        newrecording.Genre = string.Empty;
                    if (myrecording.IdSchedule != null)
                    {
                        newrecording.Idschedule = (int)myrecording.IdSchedule;
                    }
                    else
                    {
                        newrecording.Idschedule = -1;
                    }
                    newrecording.KeepUntil = myrecording.KeepUntil;
                    if (myrecording.KeepUntilDate != null)
                    {
                        newrecording.KeepUntilDate = (DateTime)myrecording.KeepUntilDate;
                    }
                    else
                    {
                        newrecording.KeepUntilDate = DateTime.ParseExact("2999-01-30_00:00", "yyyy-MM-dd_HH:mm", System.Globalization.CultureInfo.InvariantCulture);
                    }
                    newrecording.SeriesNum = myrecording.SeriesNum;
                    newrecording.StopTime = myrecording.StopTime;
                    newrecording.TimesWatched = myrecording.TimesWatched;
                    //add whatever you need here

                    myrecordings.Add(newrecording);
                }
                return myrecordings;
            }
        }