コード例 #1
0
        public ArticleViewModel(ArticleDom article, Newspaper newspaper, INewspaperService newspaperService, PagingParam pagingParam)
        {
            Info           = new NewspaperInfoViewModel(newspaper, newspaperService);
            CurrencySymbol = Persistent.Countries.GetCountryCurrency(newspaper.CountryID).Symbol;

            ID               = article.ArticleID;
            Score            = parseScore(article.VoteScore);
            Title            = article.Title;
            Content          = article.Content;
            HasPayContent    = article.Price.HasValue;
            PayOnlyContent   = article.PaidContent;
            Price            = (double?)article.Price;
            CanSeePayContent = article.UnlockedContent;
            CanVote          = SessionHelper.CurrentEntity.GetEntityType() == Entities.enums.EntityTypeEnum.Citizen;

            foreach (var comment in article.Comments.OrderBy(comment => comment.CreationDate))
            {
                Comments.Add(new ArticleCommentViewModel(comment));
            }

            PagingParam = pagingParam;

            VoteScore = newspaperService.GetVoteScore(ID, SessionHelper.CurrentEntity);

            if (Price != null)
            {
                var policy = newspaper.Country.CountryPolicy;
                var tax    = 1 + (double)policy.ArticleTax;

                Price *= tax;
            }
        }
コード例 #2
0
 public NewspaperIndexViewModel(List <Newspaper> newspapers, INewspaperService newspaperService)
 {
     foreach (var newspaper in newspapers)
     {
         Newspapers.Add(new NewspaperInfoViewModel(newspaper, newspaperService));
     }
 }
コード例 #3
0
        public ManageJournalistsViewModel(Newspaper newspaper, INewspaperService newspaperService) : this()
        {
            Info = new NewspaperInfoViewModel(newspaper, newspaperService);

            foreach (var journalist in newspaper.NewspaperJournalists.ToList())
            {
                Journalists.Add(new JournalistForManageViewModel(journalist));
            }
        }
コード例 #4
0
 public ViewNewspaperViewModel(Newspaper newspaper, INewspaperService newspaperService)
 {
     Info = new NewspaperInfoViewModel(newspaper, newspaperService);
     foreach (var article in newspaper.Articles
              .OrderByDescending(a => a.ID)
              .Where(a => a.Published)
              .Take(10)
              .ToList())
     {
         LastArticles.Add(new ArticleShortViewModel(article));
     }
 }
コード例 #5
0
 public WriteArticleViewModel(Newspaper newspaper, Article article, INewspaperService newspaperService)
     : this(newspaper, newspaperService)
 {
     Content          = article.Content;
     Title            = article.Title;
     PayOnlyContent   = article.PayOnlyContent;
     ShortDescription = article.ShortDescription;
     EnablePayOnly    = article.Price.HasValue;
     Price            = (double?)article.Price;
     ImgUrl           = article.ImgURL;
     Edit             = true;
     ID      = article.ID;
     Publish = article.Published;
 }
コード例 #6
0
 public NewspaperController(INewspaperService newspaperService, INewspaperRepository newspaperRepository, IArticleRepository articleRepository, ICitizenRepository citizenRepository,
                            IUploadService uploadService, IWalletService walletService, IEquipmentRepository equipmentRepository, IConfigurationRepository configurationRepository
                            , IPopupService popupService, IEntityRepository entityRepository) : base(popupService)
 {
     this.newspaperService        = newspaperService;
     this.newspaperRepository     = newspaperRepository;
     this.articleRepository       = articleRepository;
     this.citizenRepository       = citizenRepository;
     this.uploadService           = uploadService;
     this.walletService           = walletService;
     this.equipmentRepository     = equipmentRepository;
     this.configurationRepository = configurationRepository;
     this.entityRepository        = entityRepository;
 }
コード例 #7
0
        public NewspaperInfoViewModel(Newspaper newspaper, INewspaperService newspaperService) : base(newspaper.Entity)
        {
            CountryName = newspaper.Country.Entity.Name;
            CountryID   = newspaper.CountryID;

            NewspaperRights = newspaperService.GetNewspaperRights(newspaper, SessionHelper.CurrentEntity, SessionHelper.LoggedCitizen);

            var productRepository = DependencyResolver.Current.GetService <IProductRepository>();

            InventoryCapacity = newspaper.Entity.Equipment.ItemCapacity;
            PaperCount        = newspaper.Entity.GetEquipmentItem(ProductTypeEnum.Paper, 1, productRepository).Amount;

            var owner = newspaper.Owner;

            OwnerID   = owner.EntityID;
            OwnerName = owner.Name;

            CanSwitch = NewspaperRights == NewspaperRightsEnum.Full;

            createMenu();

            AvatarChange = new AvatarChangeViewModel(newspaper.ID);
        }
コード例 #8
0
 public UploadAvatarService(IUploadRepository uploadRepository, ICompanyService companyService, INewspaperService newspaperService, IPartyService partyService) : base(uploadRepository)
 {
     this.companyService   = companyService;
     this.newspaperService = newspaperService;
     this.partyService     = partyService;
 }
コード例 #9
0
 public WriteArticleViewModel(Newspaper newspaper, INewspaperService newspaperService)
 {
     Info = new NewspaperInfoViewModel(newspaper, newspaperService);
     PriceCurrencySymbol = Persistent.Countries.GetById(newspaper.CountryID).Currency.Symbol;
     NewspaperTax        = (double)newspaper.Country.CountryPolicy.ArticleTax * 100.0;
 }
コード例 #10
0
 public ChangeNewspaperOwnerViewModel(Newspaper newspaper, INewspaperService newspaperService) : this()
 {
     Info = new NewspaperInfoViewModel(newspaper, newspaperService);
 }
コード例 #11
0
        public ManageArticlesViewModel(Newspaper newspaper, IList <Article> articles, INewspaperService newspaperService, PagingParam pagingParam)
        {
            Info = new NewspaperInfoViewModel(newspaper, newspaperService);

            foreach (var article in articles)
            {
                Articles.Add(new ArticleForManagementViewModel(article));
            }

            PagingParam = pagingParam;
        }