Esempio n. 1
0
 /* Construct Object */
 public Ftp(IConfigurationKeyRepository configRepo)
 {
     repoConfig = configRepo;
     host       = repoConfig.Get(ConfigurationKeyStatic.FTP_CREDENTIAL_HOST);
     user       = repoConfig.Get(ConfigurationKeyStatic.FTP_CREDENTIAL_USER);
     pass       = repoConfig.Get(ConfigurationKeyStatic.FTP_CREDENTIAL_PASSWORD);
 }
Esempio n. 2
0
 public ViewResult EditAccount()
 {
     ViewBag.Title = Resources.EditData;
     return(View(new UserViewModel
     {
         User = user,
         PhotoUrlPath = String.Format("{0}UserProfileImage/{1}", repoConfig.Get(ConfigurationKeyStatic.CONTENT_EXTERNAL_URL), repoSession.UserPhotoUrl)
     }));
 }
Esempio n. 3
0
 public ViewResult LoggedInfo()
 {
     return(View(new LoginViewModel
     {
         ContentExternalUrl = repoConfig.Get(ConfigurationKeyStatic.CONTENT_EXTERNAL_URL),
         ImageName = repoSession.UserPhotoUrl,
         UserName = repoSession.UserNick
     }));
 }
Esempio n. 4
0
        public string GetInviteUserEmailContent(RegisterViewModel model, string action)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("<h2 style=\"border-bottom: 2px solid #bbcc28; font-weight: normal; font-family: verdana, arial, sans-serif; color: #515151;\">" + Resources.Hello + "</h2>");
            builder.AppendFormat("<p>" + Resources.ThanksForRegistering + "</p>", repoConfig.Get(ConfigurationKeyStatic.APPLICATION_NAME));
            builder.AppendFormat("<p>" + Resources.ClickToFinish + " <a href=\"{0}\">" + Resources.Here + ".</a></p>", action);
            builder.Append("<p style=\"background: #f6f5f3; border-top:2px solid #d0d0d0;border-bottom:2px solid #d0d0d0; padding: 10px\">" + Resources.IfReceivedMistake + ".</p>");
            builder.Append("<p>" + Resources.Regards + "<br>");
            builder.AppendFormat(Resources.Team + "</p>", repoConfig.Get(ConfigurationKeyStatic.APPLICATION_NAME));
            return(builder.ToString());
        }
Esempio n. 5
0
 public ActionResult Result(SearchViewModel searchViewModel, int page = 1)
 {
     if (ModelState.IsValid)
     {
         IList <Article>           articles = repoArticle.Articles(key: searchViewModel.Key, page: page, take: PageSize).OrderBy(x => x.DateAdd).ToList();
         ArticlesSearchedViewModel articleSearchViewModel = new ArticlesSearchedViewModel
         {
             SearchKey          = searchViewModel.Key,
             Articles           = articles,
             ContentExternalUrl = repoConfig.Get(ConfigurationKeyStatic.CONTENT_EXTERNAL_URL),
             PagingInfo         = new PagingInfo
             {
                 CurrentPage  = page,
                 ItemsPerPage = PageSize,
                 TotalItems   = repoArticle.Articles(key: searchViewModel.Key).Count()
             }
         };
         ViewBag.Title = String.Format("{0} - {1}", searchViewModel.Key, Resources.SearchResult);
         if (articles.Count() != 0)
         {
             ViewBag.Description = String.Format("{0} - {1}", articles.First().Lead, Resources.SearchResult);
             ViewBag.Keywords    = String.Format("{0} - {1}", articles.First().ImageDesc, Resources.ArticleByCategory);
         }
         return(View(articleSearchViewModel));
     }
     else
     {
         return(View());
     }
 }
Esempio n. 6
0
        public ViewResult EditArticle(string url = "")
        {
            IList <Tag>      tags           = repoTag.Tags();
            IList <int>      selectedTagsID = new List <int>();
            IList <Category> categories     = repoCategory.Categories();
            Article          article;
            IList <string>   imageNames = new List <string>();

            foreach (var imageName in imageHelper.IsFtp() ? imageHelper.GetAllImagesForArticleFromFtp() : imageHelper.GetAllImagesForArticleFromLocal(Server))
            {
                imageNames.Add(imageName.Split('/').Last());
            }

            if (url == string.Empty)
            {
                article = new Article
                {
                    DatePub = DateTime.Now,
                    DateExp = DateTime.Now.AddYears(50),
                    Status  = 1
                };
                ViewBag.Title = Resources.AddingArticle;
            }
            else
            {
                article       = repoArticle.Article(url: url, actual: false);
                ViewBag.Title = Resources.EditArticle;
            }

            if (article.Tags != null)
            {
                foreach (var tag in article.Tags)
                {
                    selectedTagsID.Add(tag.TagID);
                }
            }

            return(View(new EditArticleViewModel
            {
                Article = article,
                SelectedTagsId = selectedTagsID,
                Categories = categories,
                Tags = tags,
                ImageNames = imageNames,
                ContentExternalUrl = repoConfig.Get(ConfigurationKeyStatic.CONTENT_EXTERNAL_URL)
            }));
        }
Esempio n. 7
0
        public ViewResult Index()
        {
            ViewBag.HideTitle = true;
            IList <Article> latestArticles             = repoArticle.Articles(take: 11);
            IList <Article> articlesByCategorySection1 = repoCategory.Categories(page: 1, take: 1).FirstOrDefault() != null?repoArticle.Articles(categoryID : repoCategory.Categories(page : 1, take : 1).FirstOrDefault().CategoryID, take : 4) : null;

            IList <Article> articlesByCategorySection2 = repoCategory.Categories(page: 2, take: 1).FirstOrDefault() != null?repoArticle.Articles(categoryID : repoCategory.Categories(page : 2, take : 1).FirstOrDefault().CategoryID, take : 4) : null;

            IList <Article> articlesByCategorySection3 = repoCategory.Categories(page: 3, take: 1).FirstOrDefault() != null?repoArticle.Articles(categoryID : repoCategory.Categories(page : 3, take : 1).FirstOrDefault().CategoryID, take : 4) : null;

            IList <Article> articlesByCategorySection4 = repoCategory.Categories(page: 4, take: 1).FirstOrDefault() != null?repoArticle.Articles(categoryID : repoCategory.Categories(page : 4, take : 1).FirstOrDefault().CategoryID, take : 4) : null;

            ArticleListPageViewModel articleListViewModel = new ArticleListPageViewModel
            {
                LatestArticles             = latestArticles,
                ArticlesByCategorySection1 = articlesByCategorySection1,
                ArticlesByCategorySection2 = articlesByCategorySection2,
                ArticlesByCategorySection3 = articlesByCategorySection3,
                ArticlesByCategorySection4 = articlesByCategorySection4,
                ContentExternalUrl         = repoConfig.Get(ConfigurationKeyStatic.CONTENT_EXTERNAL_URL)
            };

            ViewBag.Title       = repoConfig.Get(ConfigurationKeyStatic.MAIN_TITLE);
            ViewBag.Description = repoConfig.Get(ConfigurationKeyStatic.MAIN_DESCRIPTION);
            return(View(articleListViewModel));
        }
Esempio n. 8
0
 public bool UploadArticleImagesToFtp(string imageName)
 {
     try
     {
         string path   = repoConfig.Get(ConfigurationKeyStatic.FTP_PATH);
         Image  img320 = imageModifier.ResizeImage(File, 320, 240);
         Image  img120 = imageModifier.ResizeImage(File, 120, 90);
         Image  img900 = imageModifier.ResizeImage(File, 900, 600);
         ftp.UploadImage(img320, String.Format("{0}ArticleImage/Images320/{1}", path, imageName));
         ftp.UploadImage(img120, String.Format("{0}ArticleImage/Images120/{1}", path, imageName));
         ftp.UploadImage(img900, String.Format("{0}ArticleImage/Images900/{1}", path, imageName));
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 9
0
        public static string AbsoluteAction(this UrlHelper url, string action, string controller, object routeValues, IConfigurationKeyRepository configRepo)
        {
            Uri requestUrl = url.RequestContext.HttpContext.Request.Url;

            string absoluteAction = string.Format("{0}{1}",
                                                  configRepo.Get(ConfigurationKeyStatic.URL),
                                                  url.Action(action, controller, routeValues));

            return(absoluteAction);
        }
Esempio n. 10
0
 public ViewResult Index()
 {
     ViewBag.Title       = repoConfig.Get(ConfigurationKeyStatic.MAIN_TITLE);
     ViewBag.Description = repoConfig.Get(ConfigurationKeyStatic.MAIN_DESCRIPTION);
     return(View());
 }