Exemplo n.º 1
0
 public IndexModel(ILogger <IndexModel> logger, IPagesService pagesService, IArticlesService articlesService, ISiteConfigurationRepository configRepository)
 {
     _logger           = logger;
     _pagesService     = pagesService;
     _articlesService  = articlesService;
     _configRepository = configRepository;
 }
Exemplo n.º 2
0
 public CommentsController(IMapper mapper, IArticlesService articlesService, ILog logger)
     : base(logger)
 {
     _mapper          = mapper;
     _articlesService = articlesService;
     _logger          = logger;
 }
Exemplo n.º 3
0
 public HomeController(
     IArticlesService articleService,
     IUsersService usersService)
 {
     this.articleService = articleService;
     this.usersService   = usersService;
 }
Exemplo n.º 4
0
        public ActionResult EditArt(int id)
        {
            IArticlesService artSrv = IoC.Resolve <IArticlesService>();
            var model = artSrv.Getbykey(id);

            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult ViewAttachment(int id)
        {
            IArticlesService artSrv = IoC.Resolve <IArticlesService>();
            Articles         model  = artSrv.Getbykey(id);

            byte[] data = model.AttachData;
            if (data != null)
            {
                string typeData    = model.TypeData;
                string contentType = "";
                if (typeData.Equals(".pdf"))
                {
                    contentType = "application/pdf";
                }
                if (typeData.Equals(".doc"))
                {
                    contentType = "application/msword";
                }
                if (typeData.Equals(".docx"))
                {
                    contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                }
                return(File(data, contentType));
            }
            else
            {
                return(Redirect("/Article/ApproveIndex"));
            }
        }
Exemplo n.º 6
0
 public ArticlesController(
     IArticlesService articlesService,
     ICurrentUserService currentUser)
 {
     this.articlesService = articlesService;
     this.currentUser     = currentUser;
 }
Exemplo n.º 7
0
 public ArticlesController(
     IArticlesService articlesService,
     UserManager <ElectricTravelUser> userManager)
 {
     this.articlesService = articlesService;
     this.userManager     = userManager;
 }
Exemplo n.º 8
0
 public ArticleController(IArticlesService article, ILogsService logs, IHttpContextAccessor httpContext, IMemoryCache memcache)
 {
     _article     = article;
     _logs        = logs;
     _httpContext = httpContext;
     _memcache    = memcache;
 }
Exemplo n.º 9
0
 public HomeController(
     IArticlesService articleService,
     UserManager <ApplicationUser> userManager)
 {
     this.articleService = articleService;
     this.userManager    = userManager;
 }
Exemplo n.º 10
0
        private bool ProcessProductsFile(IServiceProvider serviceProvider, string fileName, string fileContent)
        {
            // Загружаем справочник стран
            AppDbContext db        = serviceProvider.GetService <AppDbContext>();
            var          countries = db.Countries.ToList();
            Dictionary <string, string> countryNameLookup = new Dictionary <string, string>();

            foreach (var country in countries)
            {
                countryNameLookup[country.Key] = country.Name;
            }

            // Загружаем текущий список продуктов из базы
            IArticlesService         articlesService = serviceProvider.GetService <IArticlesService>();
            IEnumerable <ArticleDto> currentProducts = articlesService.Search(new SearchFormDto {
                Take = int.MaxValue
            }).Items;

            // Получаем список продуктов из файла, обновляем имеющиеся продукты
            bool hasErrors;
            IEnumerable <ArticleDto> products = LoadProductsFromFile(fileName, fileContent, currentProducts, countryNameLookup, out hasErrors);

            if (!hasErrors)
            {
                // Сохраняем изменения в базу
                articlesService.Import(products);
            }

            return(!hasErrors);
        }
Exemplo n.º 11
0
        public List <ListArticle> AjaxQuery(ArticlesRequest request)
        {
            var data  = new List <ListArticle>();
            var query = IArticlesService.Query(request);

            if (query != null)
            {
                var roles = _securityHelper.GetCurrentUser().CurrentUser.Roles.ToList();
                data = query.ModelList.Select(x => new ListArticle(x)).ToList();
                foreach (var item in data)
                {
                    if (roles[0].IsSuper || roles[0].Permissions.Contains("EditArticles"))
                    {
                        item.boor += "<a href='#' onclick=OperatorThis('Edit','/Articles/Edit/" + item.articleId + "') class='tablelink'>编辑 &nbsp;</a> ";
                    }
                    if (roles[0].IsSuper || roles[0].Permissions.Contains("DeleteArticles"))
                    {
                        item.boor += "<a href='#' onclick=OperatorThis('Delete','/Articles/Delete/" + item.articleId + "') class='tablelink'>删除 </a> ";
                    }
                }
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount);
            }
            else
            {
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0);
            }
            return(data);
        }
Exemplo n.º 12
0
        public ActionResult Index(ArticleIndexModel model, int?page, bool isEn = false)
        {
            int defautPagesize           = 10;
            int total                    = 0;
            int currentPageIndex         = page.HasValue ? page.Value - 1 : 0;
            IArticlesService artSrv      = IoC.Resolve <IArticlesService>();
            ICategoryService categorySrv = IoC.Resolve <ICategoryService>();

            string kw = String.IsNullOrWhiteSpace(model.Keyword) ? null : model.Keyword.Trim();

            if (string.IsNullOrEmpty(model.CatID))
            {
                model.CatID = "0";
            }
            int cID  = int.Parse(model.CatID);
            var list = artSrv.GetBySearch(HttpContext.User.Identity.Name, kw, cID, currentPageIndex, defautPagesize, out total);

            model.Categories = categorySrv.Query.Where(p => p.Active).OrderBy(p => p.NameVNI).ToList();
            model.Articles   = new PagedList <Articles>(list, currentPageIndex, defautPagesize, total);
            if (isEn)
            {
                return(View("Indexen", model));
            }
            return(View(model));
        }
Exemplo n.º 13
0
 public HomeController(
     IArticlesService articles,
     ICategoriesService categories)
 {
     this.articles = articles;
     this.categories = categories;
 }
Exemplo n.º 14
0
 public ManageCategoriesController(IMapper mapper, IArticlesService articlesService, ILog logger)
     : base(logger)
 {
     _mapper          = mapper;
     _articlesService = articlesService;
     _logger          = logger;
 }
Exemplo n.º 15
0
 public ActionResult Delete(int id)
 {
     try
     {
         ICategoryService cateSrv = IoC.Resolve <ICategoryService>();
         IArticlesService artSrv  = IoC.Resolve <IArticlesService>();
         int c = artSrv.Query.Where(p => p.CategoryID == id).Count();
         if (c > 0)
         {
             Messages.AddErrorFlashMessage("Không được xóa chuyên mục đang sử dụng.");
             logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Category - Xóa :" + id, "Không được xóa chuyên mục đang sử dụng", LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser);
             return(RedirectToAction("Index"));
         }
         Category cate = cateSrv.Getbykey(id);
         cateSrv.Delete(cate);
         cateSrv.CommitChanges();
         Messages.AddFlashMessage("Xóa thành công.");
         logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Category - Delete :" + id, "Edit Category Success", LogType.Success, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser);
     }
     catch (Exception ex)
     {
         logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Category - Delete :" + id, "Delete Category Error: " + ex, LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser);
         Messages.AddErrorFlashMessage("Chưa xóa được, vui lòng thực hiện lại.");
     }
     return(RedirectToAction("Index"));
 }
 public FormListDocument(IWarehouseDocumentsService documentsService, IArticlesService articlesService)
 {
     _documentsService = documentsService;
     _articlesService  = articlesService;
     InitializeComponent();
     RefreshDataGridView();
 }
        public void TestsSetup()
        {
            AutoMapperConfig.RegisterMappings();

            this.articles         = ServicesObjectFactory.GetArticlesService();
            this.controller       = new ArticlesController(this.articles);
            this.controller.Cache = new HttpCacheService();
        }
 public ArticlesStatisticsController(IArticlesService articlesService
                                     , IStatisticsService statisticsService
                                     , IArticlesStatisticsService articlesStatisticsService)
 {
     this.articlesService           = articlesService;
     this.statisticsService         = statisticsService;
     this.articlesStatisticsService = articlesStatisticsService;
 }
 public HomeControllerTest()
 {
     ConfigureMappings();
     this._productsService = new ProductsService();
     this._reviewsService  = new ReviewsService();
     this._articlesService = new ArticlesService();
     this._controller      = new HomeController(this._productsService, this._reviewsService, this._articlesService);
 }
Exemplo n.º 20
0
 public HomeController(IArticlesService articlesService,
                       ILocationsService locationsService,
                       IUsersService usersService)
 {
     this.articlesService  = articlesService;
     this.locationsService = locationsService;
     this.usersService     = usersService;
 }
        public void TestsSetup()
        {
            AutoMapperConfig.RegisterMappings();

            this.articles = ServicesObjectFactory.GetArticlesService();
            this.controller = new ArticlesController(this.articles);
            this.controller.Cache = new HttpCacheService();
        }
Exemplo n.º 22
0
        public ActionResult ArticlesSearch(string searchText)
        {
            IArticlesService artSrv = IoC.Resolve <IArticlesService>();
            int total = 0;
            var v     = artSrv.GetbyFilter(searchText, 0, 10, out total).Select(c => new { c.NameVNI, c.NameENG, Url = URLManager.GetURL(c) }).ToList();

            return(Json(v, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 23
0
 public GetLocalLatestViewComponent(
     IArticlesService articleService,
     UserManager <ApplicationUser> userManager,
     IAddressesService addressesService)
 {
     this.articleService   = articleService;
     this.userManager      = userManager;
     this.addressesService = addressesService;
 }
Exemplo n.º 24
0
        public ActionResult Approve(int id)
        {
            IArticlesService artSrv = IoC.Resolve <IArticlesService>();
            Articles         model  = artSrv.Getbykey(id);

            model.Active = true;
            Messages.AddFlashMessage("Tin đã được chỉnh sửa thành công.");
            return(View(model));
        }
Exemplo n.º 25
0
 public ArticlesController(
     IArticlesService articlesService,
     IWebHostEnvironment webHostEnvironment,
     IUsersService usersService)
 {
     this.articlesService    = articlesService;
     this.webHostEnvironment = webHostEnvironment;
     this.usersService       = usersService;
 }
Exemplo n.º 26
0
 public FormAddArticle(ArticleViewModel article, IArticlesService articlesService) : this()
 {
     _articlesService = articlesService;
     _article         = article;
     textBoxName.DataBindings.Add(nameof(textBoxName.Text), article, nameof(ArticleViewModel.Name), false, DataSourceUpdateMode.OnPropertyChanged);
     numericNetPrice.DataBindings.Add(nameof(numericNetPrice.Value), article, nameof(ArticleViewModel.NetPrice), false, DataSourceUpdateMode.OnPropertyChanged);
     numericCount.DataBindings.Add(nameof(numericNetPrice.Value), article, nameof(ArticleViewModel.Count), false, DataSourceUpdateMode.OnPropertyChanged);
     labelGrossPrice.DataBindings.Add(nameof(labelGrossPrice.Text), article, nameof(ArticleViewModel.GrossPrice), false, DataSourceUpdateMode.OnPropertyChanged);
 }
Exemplo n.º 27
0
 public VotesController(
     ApplicationDbContext dbContext,
     UserManager <ApplicationUser> userManager,
     IArticlesService articlesService)
 {
     this.dbContext       = dbContext;
     this.userManager     = userManager;
     this.articlesService = articlesService;
 }
 public BlogController(
     IArticlesService articlesService,
     IBlogCategoriesService categoriesService,
     UserManager <ApplicationUser> userManager)
 {
     this.articlesService   = articlesService;
     this.categoriesService = categoriesService;
     this.userManager       = userManager;
 }
        public void TestsSetup()
        {
            AutoMapperConfig.RegisterMappings();

            this.recipesServiceMock = ServicesObjectFactory.GetRecipeService();
            this.imagesServiceMock = ServicesObjectFactory.GetRecipeImagesService();
            this.articlesServiceMock = ServicesObjectFactory.GetArticlesService();
            this.controller = new HomeController(this.imagesServiceMock, this.recipesServiceMock, this.articlesServiceMock);
        }
 public CategoriesController(
     ICategoriesService categoriesService,
     IArticlesService articlesService,
     IHttpContextAccessor http)
 {
     this.categoriesService = categoriesService;
     this.articlesService   = articlesService;
     this.http = http;
 }
Exemplo n.º 31
0
 public HomeController(
     IPrivacyService privacyService,
     IArticlesService articlesService,
     IRecipesService recipesService)
 {
     this.privacyService  = privacyService;
     this.articlesService = articlesService;
     this.recipesService  = recipesService;
 }
Exemplo n.º 32
0
 public ArticlesController(
     IArticlesService articlesService,
     INewsFactory newsFactory,
     IMapper mapper)
 {
     _articlesService = articlesService;
     _newsFactory     = newsFactory;
     _mapper          = mapper;
 }
Exemplo n.º 33
0
 public SubCategoriesController(
     ISubCategoriesService subCategoriesService,
     IArticlesService articleService,
     IPagingService pagingService)
 {
     this.subCategoriesService = subCategoriesService;
     this.articleService       = articleService;
     this.pagingService        = pagingService;
 }
Exemplo n.º 34
0
 public DetailsViewModel(IArticlesService articles, IBookmarkService bookmarksService)
 {
     this.articles = articles;
     this.bookmarksService = bookmarksService;
     this.Bookmark = new RelayCommand(async () =>
     {
         this.IsLoading = true;
         this.IsBookmarked = await this.bookmarksService.ToggleBookmarkAsync(this.Article.Id);
         this.IsLoading = false;
     });
 }
Exemplo n.º 35
0
        public BaseController()
        {
            this.data = new UoWData();
            this.itemsService = new ItemsService(this.data);
            this.articlesService = new ArticlesService(this.data);
            this.pagesService = new PagesService(this.data);

            LayoutModel model = new LayoutModel();
            model.ItemCategories = this.itemsService.GetItemCategories();
            model.Articles = this.articlesService.GetArticles().Take(5);
            model.Pages = this.pagesService.GetPages();

            ViewBag.LayoutModel = model;
        }
        public SetupFeedFilterViewModel(IArticlesService articlesService, IToastNotificator notificator, IUserSettings userSettings)
        {
            this.articlesService = articlesService;
            this.notificator = notificator;
            this.userSettings = userSettings;
            this.Title = "Filter erstellen";
            var canExecute = this.WhenAny(vm => vm.CategorySelect.SelectedItem, vm => vm.DistrictSelect.SelectedItem,
                (ci, di) => ci.Value != null || di.Value != null);
            this.Create = ReactiveCommand.Create(canExecute);
            this.Create.Subscribe(this.CreateFilterAction);

            canExecute.Subscribe(b =>
            {
                var titleParts =
                    this.selectViewModels.OfType<SelectViewModel>()
                        .Select(svm => (svm.SelectedItem as IdEntity)?.Name)
                        .Where(p => p != null);
                this.FilterName = string.Join(" - ", titleParts);
            });
        }
Exemplo n.º 37
0
 public VotesController(IArticlesService articles, IIdentifierProvider identifierProvider, IVotesService votes)
 {
     this.articles = articles;
     this.identifierProvider = identifierProvider;
     this.votes = votes;
 }
 public AdminArticlesController(IArticlesService articles)
 {
     this.articles = articles;
 }
 public LocalBookmarkService(IUserSettings userSettings, IArticlesService articlesService)
 {
     this.articlesService = articlesService;
     this.bookmarksSetting = userSettings.BookmarksSetting;
 }
 public DesignController(IArticlesService articles)
 {
     this.articles = articles;
 }
Exemplo n.º 41
0
 public ArticleDetailsController(IArticlesService articles, IIdentifierProvider identifierProvider)
 {
     this.articles = articles;
     this.identifierProvider = identifierProvider;
 }
        public void Setup()
        {
            this.articles = ObjectFactory.GetArticleService();
            this._controller = new ArtController(this.articles);

        }
Exemplo n.º 43
0
 public Articles(IArticlesService articles)
 {
     this.articles = articles;
 }
Exemplo n.º 44
0
 public ArticleTabStripController(IArticlesService articles)
 {
     this.articles = articles;
 }
 public HomeController(IEventsService events, IArticlesService articles)
 {
     this.events = events;
     this.articles = articles;
 }
Exemplo n.º 46
0
 public EditionsController(IEditionsService editionsService, IArticlesService articlesService)
     : base(editionsService, articlesService)
 {
 }
Exemplo n.º 47
0
 public EditorsController(ICategoriesService categories, IArticlesService articles)
 {
     this.categories = categories;
     this.articles = articles;
 }
Exemplo n.º 48
0
 public CommentsController(ICommentsService comments, IArticlesService articles)
 {
     this.comments = comments;
     this.articles = articles;
 }
Exemplo n.º 49
0
 public HomeController(IImagesService images, IRecipesService recipes, IArticlesService articles)
 {
     this.images = images;
     this.recipes = recipes;
     this.articles = articles;
 }
 public HomeController(IArticlesService articles, ICoursesService courses, ISellingItemsService sellingItems)
 {
     this.articles = articles;
     this.courses = courses;
     this.sellingItems = sellingItems;
 }
Exemplo n.º 51
0
 public BookmarksViewModel(IBookmarkService bookmarkService, IArticlesService service)
     : base(service)
 {
     this.bookmarkService = bookmarkService;
     this.Title = "Ihre Leseliste";
 }
Exemplo n.º 52
0
 public HomeController(IConfigService configService, IArticlesService articlesService)
 {
     _configService = configService;
     _articlesService = articlesService;
 }
Exemplo n.º 53
0
 public ArticlesController()
 {
     this.data = new UoWData();
     this.articlesService = new ArticlesService(this.data);
 }
Exemplo n.º 54
0
 public ByCategoryController(ICategoriesService categories, IArticlesService articles)
 {
     this.articles = articles;
 }
Exemplo n.º 55
0
 public ArticlesController()
 {
     this.uoWData = new UoWData();
     this.ArticlesService = new ArticlesService(this.uoWData);
     this.imagesService = new ImagesService(this.uoWData);
 }
 public FilteredArticlesViewModel(IArticlesService articlesService)
 {
     this.articlesService = articlesService;
     this.ShowDetails = new RelayCommand<Article>(a => this.ShowViewModel<DetailsViewModel>(new Identifier(a.Id.ToString())));
     this.Restock = new RelayCommand(this.RestockAction);
 }
 public DistrictSettingViewModel(IArticlesService articlesService, IUserSettings userSettings)
     : base(articlesService)
 {
     this.setting = userSettings.DistrictSetting;
 }
Exemplo n.º 58
0
 public BaseCommonController(IEditionsService editionsService, IArticlesService articlesService)
 {
     this.editionsService = editionsService;
     this.articlesService = articlesService;
 }
 public ArticlesController(IArticlesService articleService)
 {
     this.articleService = articleService;
 }
Exemplo n.º 60
0
 public SearchController(UserManager<User> userManager, IArticlesService articles, IEventsService events)
 {
     this.userManager = userManager;
     this.articles = articles;
     this.events = events;
 }