Exemplo n.º 1
0
        public int RefreshFeeds()
        {
            FeedRepository fRep  = new FeedRepository();
            List <Feed>    feeds = fRep.GetAll().Where(f => f.Active).ToList();

            int        addedItems = 0;
            FeedReader reader     = new FeedReader();

            foreach (Feed feed in feeds)
            {
                List <FeedItem> feedItems = reader.Read(feed.URL);
                foreach (FeedItem newItem in feedItems)
                {
                    if (feed.Items.Where(fi => fi.Id == newItem.Id).Count() == 0)
                    {
                        feed.Items.Add(newItem);
                        addedItems++;
                    }
                }
                feed.LastReadTime = DateTime.Now;
                fRep.Update(feed);
            }

            return(addedItems);
        }
Exemplo n.º 2
0
        public FeedsController()
        {
            UserSettingsSection config = (UserSettingsSection)System.Configuration.ConfigurationManager.GetSection("userSettings");

            _repository = new FeedRepository(config.ConnectionString.Value);
            _services   = new FeedServices(_repository);
        }
Exemplo n.º 3
0
 public UnitOfWork(RssContext rssContext)
 {
     _rssContext        = rssContext;
     NewsPostRepository = new NewsPostRepository(rssContext);
     FeedList           = new FeedRepository(rssContext);
     ItemListRepository = new ItemListRepository(rssContext);
 }
Exemplo n.º 4
0
        public ActionResult CommentFeed(int id, string Comment)
        {
            User u = (User)(Session["User"]);

            string username = u.Username;

            try
            {
                FeedRepository fr = new FeedRepository();
                fr.Open();

                bool success = fr.UserCommentFeed(username, id, Comment);

                if (success == true)
                {
                    return(Redirect(Request.UrlReferrer.ToString()));
                }
                else
                {
                    return(View("Message",
                                new Message("Kommentar", "Fehler", "Irgendetwas ist schief gelaufen",
                                            "Versuche es später erneut!")));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 5
0
        // GET: Home

        public ActionResult Index(FeedItem feedItem)
        {
            if (Session["isAdmin"] != null)
            {
                if ((Convert.ToInt32(Session["isAdmin"]) == 0) || (Convert.ToInt32(Session["isAdmin"]) == 1))
                {
                    FeedRepository zr = new FeedRepository();
                    try
                    {
                        zr.Open();

                        return(View(zr.GetFeedItems()));
                    }
                    catch (MySqlException ex)
                    {
                        return(View("Message",
                                    new Message("Datenbankfehler", "", "Probleme mit der Datenbank.",
                                                "Versuchen Sie es später erneut.")));
                    }
                    finally
                    {
                        zr.Close();
                    }
                }
            }

            return(RedirectToAction("login", "user"));
        }
Exemplo n.º 6
0
        public OctopusAsyncRepository(IOctopusAsyncClient client, RepositoryScope repositoryScope = null)
        {
            Client                    = client;
            Scope                     = repositoryScope ?? RepositoryScope.Unspecified();
            Accounts                  = new AccountRepository(this);
            ActionTemplates           = new ActionTemplateRepository(this);
            Artifacts                 = new ArtifactRepository(this);
            Backups                   = new BackupRepository(this);
            BuiltInPackageRepository  = new BuiltInPackageRepositoryRepository(this);
            CertificateConfiguration  = new CertificateConfigurationRepository(this);
            Certificates              = new CertificateRepository(this);
            Channels                  = new ChannelRepository(this);
            CommunityActionTemplates  = new CommunityActionTemplateRepository(this);
            Configuration             = new ConfigurationRepository(this);
            DashboardConfigurations   = new DashboardConfigurationRepository(this);
            Dashboards                = new DashboardRepository(this);
            Defects                   = new DefectsRepository(this);
            DeploymentProcesses       = new DeploymentProcessRepository(this);
            Deployments               = new DeploymentRepository(this);
            Environments              = new EnvironmentRepository(this);
            Events                    = new EventRepository(this);
            FeaturesConfiguration     = new FeaturesConfigurationRepository(this);
            Feeds                     = new FeedRepository(this);
            Interruptions             = new InterruptionRepository(this);
            LibraryVariableSets       = new LibraryVariableSetRepository(this);
            Lifecycles                = new LifecyclesRepository(this);
            MachinePolicies           = new MachinePolicyRepository(this);
            MachineRoles              = new MachineRoleRepository(this);
            Machines                  = new MachineRepository(this);
            Migrations                = new MigrationRepository(this);
            OctopusServerNodes        = new OctopusServerNodeRepository(this);
            PerformanceConfiguration  = new PerformanceConfigurationRepository(this);
            PackageMetadataRepository = new PackageMetadataRepository(this);
            ProjectGroups             = new ProjectGroupRepository(this);
            Projects                  = new ProjectRepository(this);
            ProjectTriggers           = new ProjectTriggerRepository(this);
            Proxies                   = new ProxyRepository(this);
            Releases                  = new ReleaseRepository(this);
            RetentionPolicies         = new RetentionPolicyRepository(this);
            Schedulers                = new SchedulerRepository(this);
            ServerStatus              = new ServerStatusRepository(this);
            Spaces                    = new SpaceRepository(this);
            Subscriptions             = new SubscriptionRepository(this);
            TagSets                   = new TagSetRepository(this);
            Tasks                     = new TaskRepository(this);
            Teams                     = new TeamsRepository(this);
            Tenants                   = new TenantRepository(this);
            TenantVariables           = new TenantVariablesRepository(this);
            UserInvites               = new UserInvitesRepository(this);
            UserRoles                 = new UserRolesRepository(this);
            Users                     = new UserRepository(this);
            VariableSets              = new VariableSetRepository(this);
            Workers                   = new WorkerRepository(this);
            WorkerPools               = new WorkerPoolRepository(this);
            ScopedUserRoles           = new ScopedUserRoleRepository(this);
            UserPermissions           = new UserPermissionsRepository(this);

            loadRootResource      = new Lazy <Task <RootResource> >(LoadRootDocumentInner, true);
            loadSpaceRootResource = new Lazy <Task <SpaceRootResource> >(LoadSpaceRootDocumentInner, true);
        }
Exemplo n.º 7
0
 public FeedGenerator(SettingRepository settingRepository, FeedRepository feedRepository, LinkGenerator linkGenerator, IHttpContextAccessor contextAccessor)
 {
     this.settingRepository = settingRepository;
     this.feedRepository    = feedRepository;
     this.linkGenerator     = linkGenerator;
     this.contextAccessor   = contextAccessor;
 }
Exemplo n.º 8
0
 public PostController()
 {
     _context        = new SportboardDbContext();
     _unitOfWork     = new UnitOfWork(_context);
     _postRepository = new PostRepository(_context);
     _feedRepository = new FeedRepository(_context);
 }
        public void Given_a_new_rss_uri_should_add_feed_to_list_and_persist()
        {
            var persistence = new Mock <IPersistence>();
            var feedRepo    = new FeedRepository(persistence.Object);

            var rssUri = new Uri("protocol://host/uri.rss");

            Feed.Downloader = (u, cb) =>
            {
                if (u == rssUri)
                {
                    cb(false, null, @"<?xml version=""1.0"" encoding=""UTF-8""?>
<rss xmlns:itunes=""http://www.itunes.com/dtds/podcast-1.0.dtd"" xmlns:atom=""http://www.w3.org/2005/Atom"" version=""2.0"">
	<channel>
		<title>My New Feed</title>
		<item>
			<title>Whistle</title>
			<guid isPermaLink=""true"">item1</guid>
			<enclosure url=""http://blockedcontent/whistle.mp3"" type=""audio/mp3"" />
		</item>
	</channel>
</rss>");
                }
            };

            feedRepo.Add(rssUri);
            Assert.AreEqual(1, feedRepo.Feeds.Count);
            Assert.AreEqual("My New Feed", feedRepo.Feeds[0].Name);
            persistence.Verify(p => p.WriteTextFile(It.IsAny <string>(), It.Is <string>(contents => ContainsFeedDetails(contents, "My New Feed", "item1"))));
        }
Exemplo n.º 10
0
        public FeedItem GetDocument(string docId)
        {
            FeedRepository fRep     = new FeedRepository();
            FeedItem       document = fRep.GetDocument(docId);

            return(document);
        }
Exemplo n.º 11
0
 public FeedGenerator(FeedRepository feedRepository, SettingRepository settings, IHttpContextAccessor contextAccessor, IUrlHelperFactory urlHelperFactory, IActionContextAccessor actionContextAccesor)
 {
     this.feedRepository  = feedRepository;
     this.settings        = settings;
     this.contextAccessor = contextAccessor;
     this.urlHelper       = urlHelperFactory.GetUrlHelper(actionContextAccesor.ActionContext);
 }
Exemplo n.º 12
0
        public List <Feed> GetFeeds()
        {
            FeedRepository fRep  = new FeedRepository();
            List <Feed>    feeds = fRep.GetAll().Where(f => f.Active).ToList();

            return(feeds);
        }
Exemplo n.º 13
0
        public void Should_List_Available_Feeds()
        {
            var repository = new FeedRepository();
            var feeds = repository.List("http://feeds.feedburner.com/ddanzi");

            Assert.That(feeds.Count(), Is.GreaterThan(0));
        }
Exemplo n.º 14
0
 public FeedService(FeedRepository repository, RssReader rssReader, RssParser rssParser, ILogger <FeedService> logger)
 {
     _repository = repository;
     _rssReader  = rssReader;
     _rssParser  = rssParser;
     _logger     = logger;
 }
Exemplo n.º 15
0
        public ActionResult Delete(int id)
        {
            try
            {
                FeedRepository fr = new FeedRepository();
                fr.Open();

                bool success = fr.DeleteFeed(id);

                if (success == true)
                {
                    return(Redirect(Request.UrlReferrer.ToString()));
                }
                else
                {
                    return(View("Message",
                                new Message("Beitrag", "Fehler", "Irgendetwas ist schief gelaufen",
                                            "Versuche es später erneut!")));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 16
0
        public ActionResult LikeFeed(int id)
        {
            int userID = Convert.ToInt32(Session["UserID"]);

            try
            {
                FeedRepository fr = new FeedRepository();
                fr.Open();

                bool success = fr.UserLikeFeed(userID, id);

                if (success == true)
                {
                    return(Redirect(Request.UrlReferrer.ToString()));
                }
                else
                {
                    return(View("Message",
                                new Message("Beitrag", "Fehler", "Irgendetwas ist schief gelaufen",
                                            "Versuche es später erneut!")));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 17
0
        public static Feed FeedAdd(SourceType sourceType, int sourceId)
        {
            var feed = FeedTestHelper.FeedNew(sourceType, sourceId);

            feed = FeedRepository.FeedSave(feed);

            return(feed);
        }
Exemplo n.º 18
0
        public DefaultController()
        {
            UserSettingsSection config = (UserSettingsSection)System.Configuration.ConfigurationManager.GetSection("userSettings");

            _repository = new FeedRepository(config.ConnectionString.Value);
            _services   = new FeedServices(_repository);
            _builder    = new ViewModelBuilder(_repository);
        }
Exemplo n.º 19
0
        public void GetFeed()
        {
            var rep = new FeedRepository();

            var items = rep.ListByUrl("http://www.nu.nl/rss/Algemeen");

            items.Should().NotBeNullOrEmpty();
        }
Exemplo n.º 20
0
 public FeedController(UserRepository userRepository, FeedRepository feedRepository, ListController listController, UploadPackagesRequestRepository uploadPackagesRequestRepository, NuGetOrgFeed nuGetOrgFeed, SyndicationHelper syndicationHelper)
 {
     _userRepository = userRepository;
     _feedRepository = feedRepository;
     _listController = listController;
     _uploadPackagesRequestRepository = uploadPackagesRequestRepository;
     _nuGetOrgFeed = nuGetOrgFeed;
     _syndicationHelper = syndicationHelper;
 }
Exemplo n.º 21
0
 public FeedController(
     FeedRepository repository,
     IWebHostEnvironment webHostEnvironment,
     IHubContext <FeedHub> hub
     )
 {
     _feedRepository     = repository;
     _webHostEnvironment = webHostEnvironment;
     _hub = hub;
 }
Exemplo n.º 22
0
        public static Feed FeedNew(SourceType sourceType, int sourceId)
        {
            var feed = FeedRepository.FeedNew();

            feed.Action       = DataHelper.RandomString(30);
            feed.SourceTypeId = (int)sourceType;
            feed.SourceId     = sourceId;

            return(feed);
        }
Exemplo n.º 23
0
 public FeedService(FeedRepository feedRepository,
                    NotifyService notifyService,
                    UserManager <IdentityUser> userManager,
                    ILogger <FeedService> logger)
 {
     this._feedRepository = feedRepository;
     this._notifyService  = notifyService;
     this._userManager    = userManager;
     this._logger         = logger;
 }
Exemplo n.º 24
0
 public PostController()
 {
     _context           = new SportboardDbContext();
     _unitOfWork        = new UnitOfWork(_context);
     _imageRepository   = new ImageRepository(_context);
     _feedRepository    = new FeedRepository(_context);
     _postRepository    = new PostRepository(_context);
     _commentRepository = new CommentRepository(_context);
     _userRepository    = new UserRepository(_context);
 }
Exemplo n.º 25
0
        public void Feed_Add()
        {
            var project = ProjectTestHelper.ProjectAdd();
            var feed    = FeedTestHelper.FeedNew(project.SourceType, project.SourceId);

            Assert.IsTrue(feed.IsValid, "IsValid should be true");

            feed = FeedRepository.FeedSave(feed);

            Assert.IsTrue(feed.FeedId != 0, "FeedId should be a non-zero value");
        }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            var users = UserRepository.GetUsers(args[0]);

            if (users != null && users.Count > 0)
            {
                FeedRepository.GetFeed(args[1], users);
            }

            Console.ReadLine();
        }
Exemplo n.º 27
0
 public UserController(
     UserRepository userRepository,
     FeedRepository feedRepository,
     WallRepository wallRepository,
     PostRepository postRepository)
 {
     _userRepository = userRepository;
     _feedRepository = feedRepository;
     _wallRepository = wallRepository;
     _postRepository = postRepository;
 }
Exemplo n.º 28
0
 public FeedController()
 {
     _context                   = new SportboardDbContext();
     _unitOfWork                = new UnitOfWork(_context);
     _imageRepository           = new ImageRepository(_context);
     _feedRepository            = new FeedRepository(_context);
     _postRepository            = new PostRepository(_context);
     _userPreferenceRepository  = new UserPreferenceRepository(_context);
     _userRepository            = new UserRepository(_context);
     _deletionRequestRepository = new DeletionRequestRepository(_context);
 }
Exemplo n.º 29
0
 public UnitOfWork(SportboardDbContext context)
 {
     _context          = context;
     Feeds             = new FeedRepository(_context);
     Comments          = new CommentRepository(_context);
     Images            = new ImageRepository(_context);
     Posts             = new PostRepository(_context);
     Users             = new UserRepository(_context);
     UserPreferences   = new UserPreferenceRepository(_context);
     DeletionRequests  = new DeletionRequestRepository(_context);
     UserNotifications = new UserNotificationRepository(_context);
 }
Exemplo n.º 30
0
        public OctopusAsyncRepository(IOctopusAsyncClient client)
        {
            this.Client = client;

            Accounts                 = new AccountRepository(client);
            ActionTemplates          = new ActionTemplateRepository(client);
            Artifacts                = new ArtifactRepository(client);
            Backups                  = new BackupRepository(client);
            BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(client);
            CertificateConfiguration = new CertificateConfigurationRepository(client);
            Certificates             = new CertificateRepository(client);
            Channels                 = new ChannelRepository(client);
            CommunityActionTemplates = new CommunityActionTemplateRepository(client);
            Configuration            = new ConfigurationRepository(client);
            DashboardConfigurations  = new DashboardConfigurationRepository(client);
            Dashboards               = new DashboardRepository(client);
            Defects                  = new DefectsRepository(client);
            DeploymentProcesses      = new DeploymentProcessRepository(client);
            Deployments              = new DeploymentRepository(client);
            Environments             = new EnvironmentRepository(client);
            Events = new EventRepository(client);
            FeaturesConfiguration = new FeaturesConfigurationRepository(client);
            Feeds                    = new FeedRepository(client);
            Interruptions            = new InterruptionRepository(client);
            LibraryVariableSets      = new LibraryVariableSetRepository(client);
            Lifecycles               = new LifecyclesRepository(client);
            MachinePolicies          = new MachinePolicyRepository(client);
            MachineRoles             = new MachineRoleRepository(client);
            Machines                 = new MachineRepository(client);
            Migrations               = new MigrationRepository(client);
            OctopusServerNodes       = new OctopusServerNodeRepository(client);
            PerformanceConfiguration = new PerformanceConfigurationRepository(client);
            ProjectGroups            = new ProjectGroupRepository(client);
            Projects                 = new ProjectRepository(client);
            ProjectTriggers          = new ProjectTriggerRepository(client);
            Proxies                  = new ProxyRepository(client);
            Releases                 = new ReleaseRepository(client);
            RetentionPolicies        = new RetentionPolicyRepository(client);
            Schedulers               = new SchedulerRepository(client);
            ServerStatus             = new ServerStatusRepository(client);
            Subscriptions            = new SubscriptionRepository(client);
            TagSets                  = new TagSetRepository(client);
            Tasks                    = new TaskRepository(client);
            Teams                    = new TeamsRepository(client);
            Tenants                  = new TenantRepository(client);
            TenantVariables          = new TenantVariablesRepository(client);
            UserRoles                = new UserRolesRepository(client);
            Users                    = new UserRepository(client);
            VariableSets             = new VariableSetRepository(client);
            Workers                  = new WorkerRepository(client);
            WorkerPools              = new WorkerPoolRepository(client);
        }
Exemplo n.º 31
0
        public void Feed_Fetch_Info_List()
        {
            Project project;

            project = ProjectTestHelper.ProjectAdd();
            FeedTestHelper.FeedAdd(project.SourceType, project.SourceId);

            project = ProjectTestHelper.ProjectAdd();
            FeedTestHelper.FeedAdd(project.SourceType, project.SourceId);

            var feeds = FeedRepository.FeedFetchInfoList(new FeedDataCriteria());

            Assert.IsTrue(feeds.Count() > 1, "Row returned should be greater than one");
        }
Exemplo n.º 32
0
        public IHttpActionResult GetFeed(Guid?Id)
        {
            List <Feed>              Feed       = new List <Feed>();
            FeedRepository           db         = new FeedRepository();
            UserRepository           userRep    = new UserRepository();
            FeedDiscussionRepository FeedDisRep = new FeedDiscussionRepository();

            if (Id.HasValue)
            {
                Feed = db.GetUserFeed(Id.Value);
            }
            else
            {
                Feed.AddRange(db.GetTextFeed());
                Feed.AddRange(db.GetImageFeed());
                Feed.AddRange(db.GetVideoFeed());
            }

            Feed.OrderBy(x => x.CreatedAt);

            List <FeedViewModel> viewmodels = new List <FeedViewModel>();

            foreach (Feed feed in Feed)
            {
                List <FeedDiscussion>          comments          = FeedDisRep.GetFeedDiscussions(feed.Id);
                List <FeedDiscussionViewModel> commentsViewModel = new List <FeedDiscussionViewModel>();
                foreach (var comment in comments)
                {
                    User CommentUser = userRep.GetUser(comment.User_Id);
                    commentsViewModel.Add(new FeedDiscussionViewModel()
                    {
                        Id            = comment.Id,
                        UserId        = comment.User_Id,
                        CommentText   = comment.Text,
                        CreatedDate   = comment.CreatedAt,
                        FirstName     = CommentUser.FirstName,
                        LastName      = CommentUser.LastName,
                        ProfilePicUrl = CommentUser.ProfilePictureUrl
                    });
                }
                viewmodels.Add(new FeedViewModel()
                {
                    Feed     = feed,
                    Creator  = userRep.GetUser(feed.CreatorId),
                    Comments = commentsViewModel
                });
            }

            return(Ok(viewmodels));
        }
Exemplo n.º 33
0
 public OctopusRepository(IOctopusClient client)
 {
     this.Client = client;
     Feeds = new FeedRepository(client);
     Backups = new BackupRepository(client);
     Machines = new MachineRepository(client);
     MachineRoles = new MachineRoleRepository(client);
     MachinePolicies = new MachinePolicyRepository(client);
     Subscriptions = new SubscriptionRepository(client);
     Environments = new EnvironmentRepository(client);
     Events = new EventRepository(client);
     FeaturesConfiguration = new FeaturesConfigurationRepository(client);
     ProjectGroups = new ProjectGroupRepository(client);
     Projects = new ProjectRepository(client);
     Proxies = new ProxyRepository(client);
     Tasks = new TaskRepository(client);
     Users = new UserRepository(client);
     VariableSets = new VariableSetRepository(client);
     LibraryVariableSets = new LibraryVariableSetRepository(client);
     DeploymentProcesses = new DeploymentProcessRepository(client);
     Releases = new ReleaseRepository(client);
     Deployments = new DeploymentRepository(client);
     Certificates = new CertificateRepository(client);
     Dashboards = new DashboardRepository(client);
     DashboardConfigurations = new DashboardConfigurationRepository(client);
     Artifacts = new ArtifactRepository(client);
     Interruptions = new InterruptionRepository(client);
     ServerStatus = new ServerStatusRepository(client);
     UserRoles = new UserRolesRepository(client);
     Teams = new TeamsRepository(client);
     RetentionPolicies = new RetentionPolicyRepository(client);
     Accounts = new AccountRepository(client);
     Defects = new DefectsRepository(client);
     Lifecycles = new LifecyclesRepository(client);
     OctopusServerNodes = new OctopusServerNodeRepository(client);
     Channels = new ChannelRepository(client);
     ProjectTriggers = new ProjectTriggerRepository(client);
     Schedulers = new SchedulerRepository(client);
     Tenants = new TenantRepository(client);
     TagSets = new TagSetRepository(client);
     BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(client);
     ActionTemplates = new ActionTemplateRepository(client);
     CommunityActionTemplates = new CommunityActionTemplateRepository(client);
 }
Exemplo n.º 34
0
 public HomeController(FeedRepository feedRepository, NuGetOrgFeed nuGetOrgFeed)
 {
     _feedRepository = feedRepository;
     _nuGetOrgFeed = nuGetOrgFeed;
 }