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); })); }
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); }
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); }
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); }
public HomeController() { repo = new ContactUsRepo(); repoAns = new AnswerRepo(); slideshowRepo = new SlideshowRepo(); newsRepo = new NewsRepo(); }
public ProductsController(INews news, IModule module, IPhoto photo, ICacheManager cache) { _news = news; _module = module; _cache = cache; _photo = photo; }
public NewsController(UserContext UserContext, IAuthorization authorization, ILogger <NewsController> logger, INews news) { this.UserContext = UserContext; this._logger = logger; this._news = news; this.authorization = authorization; }
public DataController(IWeather weather, IToDoList toDoList, IEngWord engword, ITranslate translate, INews news) { _Weather = weather; _ToDoList = toDoList; _EngWord = engword; _Translate = translate; _News = news; }
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); }
public AdminController(ICategory Category, IProfile Profile, IArticle Article, ITag Tag, INews News) { _Category = Category; _Profile = Profile; _Article = Article; _Tag = Tag; _News = News; }
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("--------"); }
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; //这个也是必须的 }
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("--------"); }
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))); }
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); }
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); }
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); }
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; }
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}"; }
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); }
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); }
public B_News() { if (CacheRedis.RedisHelper.Ping()) { dal = new C_News(); } else { dal = new D_News(); } }
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); }
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); }
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); }
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); }
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); }
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); }
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(); }
public AboutController(INews news, IModule module, ICacheManager cache) { _news = news; _module = module; _cache = cache; }
public void ApplyTo(INews news) { // TODO }
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); }
public void Apply(INews news) { news.Data.Set("Raw", news.Content); news.Content = ArticleExtractor.INSTANCE.getText(news.Content); }
public virtual void AssignNews(INews news) { news.Category = this; News.Add(news); }