예제 #1
0
 public CasesController(INews news, IModule module, IPhoto photo, ICacheManager cache)
 {
     _news   = news;
     _module = module;
     _cache  = cache;
     _photo  = photo;
 }
        public async Task <ActionResult> NewsDetail(string NewsId)
        {
            return(await Task.Run(() =>
            {
                var newsInstance = InterNewsBL.Instance;
                INews news = null;
                try
                {
                    var result = newsInstance.Select(NewsId);
                    news = new News
                    {
                        NewsID = result.NewsID,
                        DisplayOrder = result.DisplayOrder,
                        Heading = result.Heading,
                        ImageUrl = result.ImageUrl,
                        ImageCaption = result.ImageCaption,
                        ShortDesc = result.ShortDescription,
                        NewsDesc = result.NewsDescription,
                        EditorID = " ",
                        EditorName = " ",
                        DttmCreated = result.DttmCreated
                    };
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    newsInstance.Dispose();
                }

                return View(news);
            }));
        }
예제 #3
0
        public void Apply(INews news)
        {
            var lang = news.Data.GetOrDefault <string>("Language");
            var path = System.IO.Path.Combine("News", lang) + "/";

            news.Data.Set("DestinationFolder", path);
        }
예제 #4
0
 public void NewsInitialize()
 {
     _newsRepository        = new NewsRepository(new Core.Base.Data.SqlServer.Factory.BaseContextFactory <HCRGUniversity.Core.Data.SqlServer.HCRGUniversityDBContext>());
     _eventRepository       = new EventRepository(new Core.Base.Data.SqlServer.Factory.BaseContextFactory <HCRGUniversity.Core.Data.SqlServer.HCRGUniversityDBContext>());
     _oganizationRepository = new OrganizationRepository(new Core.Base.Data.SqlServer.Factory.BaseContextFactory <HCRGUniversity.Core.Data.SqlServer.HCRGUniversityDBContext>());
     _newsBL = new NewsImpl(_newsRepository, _eventRepository, _oganizationRepository);
 }
 public void Apply(INews news)
 {
     var factory = new RankedLanguageIdentifierFactory();
     var identifier = factory.Load(RecognitionFile);
     var lang = identifier.Identify(news.Content);
     news.Data.Set("Language", lang.First().Item1.Iso639_3);
 }
예제 #6
0
        public INews NewsDetail(string NewsId)
        {
            var   newsInstance = TopNewsBL.Instance;
            INews news         = null;

            try
            {
                var result = newsInstance.Select(NewsId).Result;

                if (result.IsActive == 1 && result.IsApproved == 1)
                {
                    news = new News
                    {
                        NewsID       = result.TopNewsID,
                        DisplayOrder = result.DisplayOrder,
                        Heading      = result.Heading,
                        ImageUrl     = result.ImageUrl,
                        ImageCaption = result.ImageCaption,
                        ShortDesc    = result.ShortDescription,
                        NewsDesc     = result.NewsDescription,
                        DttmCreated  = result.DttmCreated
                    };
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                newsInstance.Dispose();
            }

            return(news);
        }
예제 #7
0
 public HomeController()
 {
     repo          = new ContactUsRepo();
     repoAns       = new AnswerRepo();
     slideshowRepo = new SlideshowRepo();
     newsRepo      = new NewsRepo();
 }
예제 #8
0
 public ProductsController(INews news, IModule module, IPhoto photo, ICacheManager cache)
 {
     _news = news;
     _module = module;
     _cache = cache;
     _photo = photo;
 }
예제 #9
0
 public NewsController(UserContext UserContext, IAuthorization authorization, ILogger <NewsController> logger, INews news)
 {
     this.UserContext   = UserContext;
     this._logger       = logger;
     this._news         = news;
     this.authorization = authorization;
 }
예제 #10
0
 public DataController(IWeather weather, IToDoList toDoList, IEngWord engword, ITranslate translate, INews news)
 {
     _Weather   = weather;
     _ToDoList  = toDoList;
     _EngWord   = engword;
     _Translate = translate;
     _News      = news;
 }
예제 #11
0
        public void Apply(INews news)
        {
            var factory    = new RankedLanguageIdentifierFactory();
            var identifier = factory.Load(RecognitionFile);
            var lang       = identifier.Identify(news.Content);

            news.Data.Set("Language", lang.First().Item1.Iso639_3);
        }
예제 #12
0
 public AdminController(ICategory Category, IProfile Profile, IArticle Article, ITag Tag, INews News)
 {
     _Category = Category;
     _Profile  = Profile;
     _Article  = Article;
     _Tag      = Tag;
     _News     = News;
 }
예제 #13
0
 public void Apply(INews news)
 {
     Console.WriteLine("--------");
     Console.WriteLine(news.Address);
     Console.WriteLine(news.Data.GetOrDefault <string>("Language"));
     Console.WriteLine(news.Content.Length);
     Console.WriteLine(news.Content);
     Console.WriteLine("--------");
 }
예제 #14
0
        private void GetPage()
        {
            INews news = DataAccess.Createnews();
            int   count;

            Repeater1.DataSource = news.pager("tbl_NewsBulletin", "News_ID Like '%'", "News_Time", "desc", AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out count);
            Repeater1.DataBind();
            AspNetPager1.RecordCount = count;  //这个也是必须的
        }
예제 #15
0
 public void Apply(INews news)
 {
     Console.WriteLine("--------");
     Console.WriteLine(news.Address);
     Console.WriteLine(news.Data.GetOrDefault<string>("Language"));
     Console.WriteLine(news.Content.Length);
     Console.WriteLine(news.Content);
     Console.WriteLine("--------");
 }
예제 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string   id    = Request.QueryString["id"];
            INews    news  = DataAccess.Createnews();
            NewsBean newsb = news.getNews(id);

            Titletext.Text = newsb.NewsName;
            Time.Text      = newsb.NewsTime.ToString();
            Content.Text   = Server.HtmlDecode(Encoding.Unicode.GetString(System.Text.Encoding.Unicode.GetBytes(newsb.NewsContent)));
        }
예제 #17
0
        public async Task ExportAsync_WhenNewsIsWithoutAuthor_ReturnsDashboardItemExportModelWithoutAuthor()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            INews news = BuildNews();
            DashboardItemExportModel result = await sut.ExportAsync(news);

            Assert.IsNotNull(result);
            Assert.IsNull(result.Author);
        }
예제 #18
0
        public async Task ExportAsync_WhenCalled_ReturnsDashboardItemExportModelWithoutImageUrl()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            INews news = BuildNews();
            DashboardItemExportModel result = await sut.ExportAsync(news);

            Assert.IsNotNull(result);
            Assert.IsNull(result.ImageUrl);
        }
예제 #19
0
        public async Task ExportAsync_WhenCalled_AssertHandleAsyncWasNotCalledOnExceptionHandler()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            INews news = BuildNews();
            await sut.ExportAsync(news);

            _exceptionHandlerMock.Verify(m => m.HandleAsync(It.IsAny <AggregateException>()), Times.Never);
            _exceptionHandlerMock.Verify(m => m.HandleAsync(It.IsAny <Exception>()), Times.Never);
        }
예제 #20
0
        public async Task ExportAsync_WhenNewsIsWithoutProvider_AssertNameWasNotCalledOnProvider()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            Mock <INewsProvider> newsProviderMock = BuildNewsProviderMock();
            INews news = BuildNews();
            await sut.ExportAsync(news);

            newsProviderMock.Verify(m => m.Name, Times.Never);
        }
 public NewsService(INewsSection newsSection, INews news, INewsVideo newsVideo, INewsPhoto newsPhoto, IResource resource, IFAQ faq, ICarouselSetUp carouselSetUp)
 {
     _newsSection   = newsSection;
     _news          = news;
     _newsVideo     = newsVideo;
     _newsPhoto     = newsPhoto;
     _resource      = resource;
     _faq           = faq;
     _carouselSetUp = carouselSetUp;
 }
예제 #22
0
        public async Task ExportAsync_WhenNewsIsWithAuthor_AssertNameWasCalledOnAuthor()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            Mock <IAuthor> authorMock = BuildAuthorMock();
            INews          news       = BuildNews(author: authorMock.Object);
            await sut.ExportAsync(news);

            authorMock.Verify(m => m.Name, Times.Once);
        }
        private void CreateUpdateCommandTextAndIdParameter(IDbCommand command, INews news)
        {
            var parameterNames = GetParameterNames(command.Parameters.OfType <IDbDataParameter>().ToList());

            var idParameter = CreateIdParameter(command, $"@{nameof(news.Id)}", news.Id);

            command.Parameters.Add(idParameter);

            command.CommandText = $"update News set {CreateUpdateStatementParts(parameterNames)} where Id = {idParameter.ParameterName}";
        }
예제 #24
0
        public async Task BuildAsync_WhenCalledWhereNewsHasAuthor_AssertNameWasCalledOnAuthor()
        {
            Mock <IAuthor> authorMock = CreateAuthorMock();
            INews          news       = CreateNews(author: authorMock.Object);

            IViewModelBuilder <InformationViewModel, INews> sut = CreateSut();

            await sut.BuildAsync(news);

            authorMock.Verify(m => m.Name, Times.Once);
        }
예제 #25
0
        public async Task ExportAsync_WhenNewsIsWithLink_ReturnsDashboardItemExportModelWithSourceUrlFromNews()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            Uri   link = new Uri($"http://localhost/{Guid.NewGuid().ToString("D")}/{Guid.NewGuid().ToString("D")}");
            INews news = BuildNews(link: link);
            DashboardItemExportModel result = await sut.ExportAsync(news);

            Assert.IsNotNull(result);
            Assert.AreEqual(link.AbsoluteUri, result.SourceUrl);
        }
예제 #26
0
파일: B_News.cs 프로젝트: radtek/CoinsPro
 public B_News()
 {
     if (CacheRedis.RedisHelper.Ping())
     {
         dal = new C_News();
     }
     else
     {
         dal = new D_News();
     }
 }
예제 #27
0
        public async Task BuildAsync_WhenCalled_AssertNameWasCalledOnProvider()
        {
            Mock <INewsProvider> provider = CreateNewsProviderMock();
            INews news = CreateNews(provider: provider.Object);

            IViewModelBuilder <InformationViewModel, INews> sut = CreateSut();

            await sut.BuildAsync(news);

            provider.Verify(m => m.Name, Times.Once);
        }
예제 #28
0
        public async Task BuildAsync_WhenCalled_AssertConvertWasCalledOnHtmlHelperWithInformation()
        {
            string information = Guid.NewGuid().ToString("D");
            INews  news        = CreateNews(information: information);

            IViewModelBuilder <InformationViewModel, INews> sut = CreateSut();

            await sut.BuildAsync(news);

            _htmlHelperMock.Verify(m => m.Convert(It.Is <string>(value => value == information), It.Is <bool>(value => value == false), It.Is <bool>(value => value == true)), Times.Once);
        }
예제 #29
0
        public async Task ExportAsync_WhenCalled_ReturnsDashboardItemExportModelWithTimestampFromNews()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            DateTime timestamp = DateTime.Now.AddSeconds(_random.Next(300, 3600) * -1);
            INews    news      = BuildNews(timestamp: timestamp);
            DashboardItemExportModel result = await sut.ExportAsync(news);

            Assert.IsNotNull(result);
            Assert.AreEqual(timestamp, result.Timestamp);
        }
예제 #30
0
        public async Task ExportAsync_WhenNewsIsWithDetails_ReturnsDashboardItemExportModelWithDetailsFromNews()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            string details = Guid.NewGuid().ToString("D");
            INews  news    = BuildNews(details: details);
            DashboardItemExportModel result = await sut.ExportAsync(news);

            Assert.IsNotNull(result);
            Assert.AreEqual(details, result.Details);
        }
예제 #31
0
        public async Task ExportAsync_WhenCalled_ReturnsDashboardItemExportModelWithInformationFromNews()
        {
            IModelExporter <DashboardItemExportModel, INews> sut = CreateSut();

            string information = Guid.NewGuid().ToString("D");
            INews  news        = BuildNews(information: information);
            DashboardItemExportModel result = await sut.ExportAsync(news);

            Assert.IsNotNull(result);
            Assert.AreEqual(information, result.Information);
        }
예제 #32
0
        public async Task BuildAsync_WhenCalled_AssertConvertNewLinesWasCalledOnHtmlHelperWithNameOfProvider()
        {
            string        providerName = Guid.NewGuid().ToString("D");
            INewsProvider provider     = CreateNewsProvider(providerName);
            INews         news         = CreateNews(provider: provider);

            IViewModelBuilder <InformationViewModel, INews> sut = CreateSut();

            await sut.BuildAsync(news);

            _htmlHelperMock.Verify(m => m.ConvertNewLines(It.Is <string>(value => value == providerName)), Times.Once);
        }
예제 #33
0
        public async Task BuildAsync_WhenCalledWhereNewsHasAuthor_AssertConvertNewLinesWasCalledOnHtmlHelperWithNameOfAuthor()
        {
            string  authorName = Guid.NewGuid().ToString("D");
            IAuthor author     = CreateAuthor(authorName);
            INews   news       = CreateNews(author: author);

            IViewModelBuilder <InformationViewModel, INews> sut = CreateSut();

            await sut.BuildAsync(news);

            _htmlHelperMock.Verify(m => m.ConvertNewLines(It.Is <string>(value => value == authorName)), Times.Once);
        }
 public void Apply(INews news)
 {
     var req = new DownloadClient(news.Address);
     news.Content = req.Download();
 }
예제 #35
0
 public AboutController(INews news, IModule module, ICacheManager cache)
 {
     _news = news;
     _module = module;
     _cache = cache;
 }
 public void ApplyTo(INews news)
 {
     // TODO
 }
예제 #37
0
 public virtual void AssignNews(INews news)
 {
     News = news;
 }
 public void Apply(INews news)
 {
     var lang = news.Data.GetOrDefault<string>("Language");
     var path = System.IO.Path.Combine("News", lang) + "/";
     news.Data.Set("DestinationFolder", path);
 }
예제 #39
0
 public void Apply(INews news)
 {
     news.Data.Set("Raw", news.Content);
     news.Content = ArticleExtractor.INSTANCE.getText(news.Content);
 }
예제 #40
0
 public virtual void AssignNews(INews news)
 {
     news.Category = this;
     News.Add(news);
 }