Esempio n. 1
0
        public ActionResult Index(
            string applicationPath           = null,
            string siteName                  = null,
            IISSiteType siteType             = IISSiteType.Default,
            IISViewActionType viewActionType = IISViewActionType.InformationComponent)
        {
            string db      = null;
            string redisDb = null;

            if (!string.IsNullOrEmpty(applicationPath))
            {
                switch (siteType)
                {
                case IISSiteType.Application:
                    db      = ConnectionStringsService.GetMssqlDb(applicationPath, false);
                    redisDb = ConnectionStringsService.GetRedisDb(applicationPath, false);
                    break;

                case IISSiteType.Site:
                    db      = ConnectionStringsService.GetMssqlDb(applicationPath, true);
                    redisDb = ConnectionStringsService.GetRedisDb(applicationPath, true);
                    break;

                default:
                    var exception = new Exception("Такой тип приложения не поддерживается");
                    NLogger.Log(exception);
                    throw exception;
                }
            }

            var viewModel = new IISIndexViewModel
            {
                SiteName            = siteName,
                ApplicationPath     = applicationPath,
                SiteType            = siteType,
                ActionViewType      = viewActionType,
                Database            = db,
                RedisDatabase       = redisDb,
                IsFeatureTableExist = !string.IsNullOrEmpty(db) &&
                                      FeatureService.GetFeatureTableExist(db).GetAwaiter().GetResult()
            };

            if (!string.IsNullOrEmpty(applicationPath))
            {
                SiteInformation information;
                // TODO Extract interface for DI
                using (var infoService = new SiteInformationService())
                {
                    information = infoService.GetInformationBySiteType(applicationPath, siteType);
                }

                viewModel.ApplicationPoolName     = information.ApplicationPoolName;
                viewModel.IsPoolStoppingOrStopped =
                    ApplicationPoolService.IsPoolStoppingOrStopped(information.ApplicationPoolName);
                viewModel.IsPoolStartingOrStarted =
                    ApplicationPoolService.IsPoolStartingOrStarted(information.ApplicationPoolName);
            }

            return(View(viewModel));
        }
Esempio n. 2
0
 public PartialViewResult GetActionComponentByType(IISViewActionType actionType)
 {
     switch (actionType)
     {
     //case IISViewActionType.InformationComponent:
     //    //return GetInformationComponent();
     //case IISViewActionType.ConnectionStringsComponent:
     //    return GetConnectionStringsComponent();
     //case IISViewActionType.FeaturesComponent:
     //    return GetFeaturesComponent();
     //case IISViewActionType.ConfigFileComponent:
     //    return GetConfigurationFileComponent();
     default:
         return(null);
     }
 }
Esempio n. 3
0
        public ActionResult Index(string applicationPath           = null,
                                  IISSiteType siteType             = IISSiteType.Default,
                                  IISViewActionType viewActionType = IISViewActionType.InformationComponent)
        {
            string db = null;

            if (!string.IsNullOrEmpty(applicationPath))
            {
                switch (siteType)
                {
                case IISSiteType.Application:
                    db = ConnectionStringsService.GetMssqlDb(applicationPath, false);
                    break;

                case IISSiteType.Site:
                    db = ConnectionStringsService.GetMssqlDb(applicationPath, true);
                    break;
                }
            }

            ViewBag.Name           = applicationPath;
            ViewBag.SiteType       = siteType;
            ViewBag.ActionViewType = viewActionType;
            ViewBag.Database       = db;

            if (!string.IsNullOrEmpty(db))
            {
                ViewBag.IsFeatureTableExist = FeatureService.GetFeatureTableExist(db).GetAwaiter().GetResult();
            }
            else
            {
                ViewBag.IsFeatureTableExist = false;
            }

            return(View());
        }