コード例 #1
0
 public RepositoryWorkUnit(CollectionsDatabaseEntities context)
 {
     _context          = context;
     Albums            = new AlbumRepository(_context);
     AlbumCollections  = new AlbumCollectionRepository(_context);
     Authors           = new AuthorRepository(_context);
     CollectionRecords = new CollectionRecordRepository(_context);
     Formats           = new FormatRepository(_context);
     Genres            = new GenreRepository(_context);
 }
コード例 #2
0
        public static Task CreateInvalidFormat()
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context = new BookOrganizer2DbContext(connectionString);
            var repository = new FormatRepository(context);
            var formatService = new FormatService(repository);

            var formatId = new FormatId(SequentialGuid.NewSequentialGuid());
            var command = new Commands.Create { Id = formatId };

            return formatService.Handle(command);
        }
コード例 #3
0
        // DELETE
        public static Task RemoveFormat(FormatId id)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context = new BookOrganizer2DbContext(connectionString);
            var repository = new FormatRepository(context);

            var formatService = new FormatService(repository);
            var command = new Commands.Delete
            {
                Id = id,
            };

            return formatService.Handle(command);
        }
コード例 #4
0
        internal static Task UpdateFormat(Format sut)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context = new BookOrganizer2DbContext(connectionString);
            var repository = new FormatRepository(context);

            var formatService = new FormatService(repository);
            var command = new Commands.Update
            {
                Id = sut.Id,
                Name = sut.Name
            };

            return formatService.Handle(command);
        }
コード例 #5
0
        public async Task Remove_Format()
        {
            var format = await FormatHelpers.CreateValidFormat();

            var repository = new FormatRepository(_fixture.Context);

            (await repository.ExistsAsync(format.Id)).Should().BeTrue();

            await FormatHelpers.RemoveFormat(format.Id);

            var sut = await repository.GetAsync(format.Id);

            await _fixture.Context.Entry(sut).ReloadAsync();

            (await repository.ExistsAsync(format.Id)).Should().BeFalse();
        }
コード例 #6
0
        public static async Task<Format> CreateValidFormat()
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context = new BookOrganizer2DbContext(connectionString);
            var repository = new FormatRepository(context);

            var formatService = new FormatService(repository);

            var command = new Commands.Create
            {
                Id = new FormatId(SequentialGuid.NewSequentialGuid()),
                Name = "paperback"
            };

            await formatService.Handle(command);
            return await repository.GetAsync(command.Id);
        }
コード例 #7
0
        public TitleDataService()
        {
            var context = new ImdbContext();

            _castInfo        = new CastInfoRepository(context);
            _titles          = new TitleRepository(context);
            _casts           = new CastsRepository(context);
            _genre           = new GenreRepository(context);
            _format          = new FormatRepository(context);
            _userRating      = new UserRatingRepository(context);
            _titleFormat     = new TitleFormatRepository(context);
            _titleGenre      = new TitleGenreRepository(context);
            _titleAlias      = new TitleAliasRepository(context);
            _titleInfo       = new TitleInfoRepository(context);
            _episodes        = new GenericRepository <Episodes>(context);
            _comments        = new CommentsRepository(context);
            _bookmarks       = new BookmarkRepository(context);
            _flaggedComments = new FlaggedCommentsRepository(context);
        }
コード例 #8
0
        private int?CreateDefaultFormat(BllObject bllObject, bool isReplayAction)
        {
            var template = PageTemplateRepository.GetPageTemplatePropertiesById(bllObject.PageTemplateId);
            var format   = ObjectFormat.Create(bllObject.Id, bllObject.PageOrTemplate, template.SiteIsDotNet);

            format.Name = "default";
            if (template.SiteIsDotNet)
            {
                format.NetFormatName = "default";
            }

            else

            {
                format.NetLanguageId = template.NetLanguageId;
            }

            var netLanguagePrefix = GetLangPrefix(template.NetLanguageId);

            var pathToCopy = SitePathRepository.GetDirectoryPathToCopy() + "\\default\\";

            if (template.NetLanguageId != null && !isReplayAction)
            {
                if (bllObject.IsGenericType)
                {
                    format.CodeBehind = ReadFileAsString(string.Format("{0}generic_code_{1}.txt", pathToCopy, netLanguagePrefix));
                }

                else if (bllObject.IsObjectContainerType)
                {
                    format.CodeBehind = ReadFileAsString(string.Format("{0}container_code_{1}.txt", pathToCopy, netLanguagePrefix));
                    format.FormatBody = ReadFileAsString(string.Format("{0}container_presentation.txt", pathToCopy));
                }
            }
            format = FormatRepository.SaveObjectFormatProperties(format);

            bllObject.DefaultFormatId = format.Id;
            ObjectRepository.UpdateDefaultFormatId(bllObject.Id, format.Id);

            return(format.Id);
        }
コード例 #9
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Initialize();

            if (MovieInstance != null)
            {
                txtTitulo.Text           = MovieInstance.Title;
                txtSinopse.Text          = MovieInstance.Sinopse;
                txtCapa.Text             = MovieInstance.Capa;
                txtUri.Text              = MovieInstance.Uri;
                ckAssistido.IsChecked    = (MovieInstance.Status == "Assistido" ? true : false);
                cmbType.SelectedValue    = MovieTypeRepository.GetMovieTypeId(MovieInstance.Type);
                cmbFormats.SelectedValue = FormatRepository.GetFormatId(MovieInstance.Format);

                List <Category> listCategories    = MovieRepository.GetMovieCategories(MovieInstance.Id);
                List <Category> listAllCategories = CategoryRepository.LoadAll();
                Category        nova = new Category();
                nova.Description = "Aventura";
                nova.Id          = "3";
                listAllCategories.Remove(nova);
                if (listCategories.Count > 0)
                {
                    foreach (var category in listCategories)
                    {
                        lsbCategoriesAdd.Items.Add(category);
                        listAllCategories.RemoveAll(x => x.Id == category.Id);
                    }

                    lsbCategories.Items.Clear();
                    foreach (Category item in listAllCategories)
                    {
                        lsbCategories.Items.Add(item);
                    }
                }
            }
        }
コード例 #10
0
ファイル: PageCopyHelper.cs プロジェクト: AuthorProxy/QP
        private int CopyObjectFormats(int newObjId, BllObject oldObj)
        {
            var result  = 0;
            var formats = ObjectFormatRepository.GetFormatsByObjectId(oldObj.Id);

            foreach (var frmt in formats)
            {
                frmt.Id       = 0;
                frmt.ObjectId = newObjId;
                frmt.LockedBy = 0;

                if (frmt.Id == oldObj.DefaultFormatId)
                {
                    result = FormatRepository.SaveObjectFormatProperties(frmt).Id;
                }

                else
                {
                    FormatRepository.SaveObjectFormatProperties(frmt);
                }
            }

            return(result);
        }
コード例 #11
0
        public FormMain()
        {
            InitializeComponent();

            _formats = new FormatRepository();
        }
コード例 #12
0
ファイル: BookService.cs プロジェクト: zynori/BookStore
 public BookService(BookRepository bookRepository, QualityRepository qualityRepository, FormatRepository formatRepository)
 {
     this.bookRepository    = bookRepository;
     this.qualityRepository = qualityRepository;
     this.formatRepository  = formatRepository;
 }