Exemple #1
0
        public HttpResponseMessage SendEmail(EmailVM email)
        {
            try
            {
                var configService  = _configService.GetAll().FirstOrDefault();
                var companyName    = configService.CompanyName;
                var sendingEmail   = configService.Email;
                var emailPassword  = configService.EmailPassword;
                var emailPort      = configService.EmailPort;
                var emailSignature = configService.EmailSignature;
                var emailFrom      = companyName + "<" + sendingEmail + ">";

                var emailBody = "";
                if (email.Body != null)
                {
                    emailBody = email.Body + "<br /><br />" + emailSignature + "<br /><img src=\"cid:Pic1\">";
                }
                else
                {
                    emailBody = emailSignature + "<img src=\"cid:Pic1\">";
                }

                XMail.Send(sendingEmail, emailPassword, emailPort, emailFrom, email.ToEmail, "", "", email.Subject, emailBody, "");

                var responseMessage = new { message = "Gửi email thành công" };
                return(Request.CreateResponse(HttpStatusCode.OK, responseMessage));
            }
            catch (Exception)
            {
                var responseMessage = new { message = "Gửi email thất bại" };
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, responseMessage));

                throw;
            }
        }
        public IActionResult GetConfigSetting()
        {
            var configList = _configService.GetAll();
            Dictionary <string, object> dirs = new Dictionary <string, object>();
            List <dynamic> list = new List <dynamic>();

            //根据枚举描述信息获取配置信息
            foreach (var item in configList)
            {
                var configMeta = item.Key.GetEnumAttribute <AppConfigSettingAttribute>();
                if (configMeta == null)
                {
                    continue;
                }
                list.Add(new
                {
                    key         = item.Key.ToString(),
                    value       = item.Value,
                    displayName = configMeta.DisplayName,
                    type        = configMeta.Type.ToString(),
                    gruop       = configMeta.Group.ToString(),
                });
            }
            return(Ok(OperateResult.Succeed("ok", list)));
        }
Exemple #3
0
        // GET: Configurations
        public ActionResult Index(int?id)
        {
            var model = _cfgSvc.GetAll().AsQueryable().ProjectTo <ConfigurationViewModel>().ToList();

            return(id != null
                ? View("Edit", model.Where(m => m.Id == id).FirstOrDefault())
                : View(model));
        }
Exemple #4
0
        public void Can_Get_All()
        {
            Scaffold.Config();

            List <UserGroupPermissionsPoco> allPermissions = _configService.GetAll();

            Assert.NotEmpty(allPermissions);
        }
        public void Can_Get_All_Permissions()
        {
            List <UserGroupPermissionsPoco> allPermissions = _configService.GetAll();

            Assert.NotEmpty(allPermissions);
            // 23 records imported in Scaffold.Config()
            Assert.Equal(23, allPermissions.Count);
        }
        public ActionResult About()
        {
            var homepageSEOModel = _otherPageSeoService.Get(o => o.Page == "About");

            ViewBag.Keyword     = homepageSEOModel.Keyword;
            ViewBag.Description = homepageSEOModel.Description;
            ViewBag.MetaData    = homepageSEOModel.MetaData;

            ViewBag.About = _configService.GetAll().FirstOrDefault().About;
            return(View());
        }
        public HomeController(IConfigService configService, IBannerService bannerService,
                              IBannerMappingService bannerMappingService, IGroupControlService groupControlService, IControlService controlService,
                              IProjectService projectService, INewsService newsService, INewsCategoryService newsCategoryService,
                              IOtherPageSEOService otherPageSeoService)
        {
            this._configService        = configService;
            this._bannerService        = bannerService;
            this._bannerMappingService = bannerMappingService;
            this._groupControlService  = groupControlService;
            this._controlService       = controlService;
            this.configModel           = _configService.GetAll().SingleOrDefault();
            this._projectService       = projectService.GetAll();
            this._newsService          = newsService;
            this._newsCategoryService  = newsCategoryService;
            this._otherPageSeoService  = otherPageSeoService;

            this.LanguageId = int.Parse(Cookies.ReadCookie("PenDesign:Language", "129"));
        }
        public HomeController(IConfigService configService, IBannerService bannerService,
            IBannerMappingService bannerMappingService, IGroupControlService groupControlService, IControlService controlService,
            IProjectService projectService, INewsService newsService, INewsCategoryService newsCategoryService,
            IOtherPageSEOService otherPageSeoService)
        {
            this._configService = configService;
            this._bannerService = bannerService;
            this._bannerMappingService = bannerMappingService;
            this._groupControlService = groupControlService;
            this._controlService = controlService;
            this.configModel = _configService.GetAll().SingleOrDefault();
            this._projectService = projectService.GetAll();
            this._newsService = newsService;
            this._newsCategoryService = newsCategoryService;
            this._otherPageSeoService = otherPageSeoService;

            this.LanguageId = int.Parse(Cookies.ReadCookie("PenDesign:Language", "129"));
        }
Exemple #9
0
        public OtmContextManager(IConfigService configService, IStatusService statusService, ILogger logger)
        {
            ConfigService = configService;
            StatusService = statusService;

            StatusService.SetOtmContextManager(this);

            _contexts = new Dictionary <string, OtmContext>();
            // load config files
            var configFiles = ConfigService.GetAll();

            foreach (var configFile in configFiles)
            {
                var config = ConfigService.Get(configFile.Name);
                //var ColectorService = new ColectorService(config.Name);

                var otmService = new OtmContext(config, logger);
                var configName = System.IO.Path.GetFileNameWithoutExtension(configFile.Path);
                _contexts.Add(configName, otmService);
            }
        }
Exemple #10
0
 public ObjectResult GetConfig()
 {
     logger.LogDebug("Getting main config");
     return(new ObjectResult(configService.GetAll().FirstOrDefault()));
 }
Exemple #11
0
 public ActionResult Index()
 {
     ViewBag.logo = _configService.GetAll().FirstOrDefault().LogoUrl;
     return(View());
 }
 // GET: api/Configs
 public IQueryable <Config> Get()
 {
     return(_configService.GetAll());
 }