Пример #1
0
 private void StartIISWebsite(StartIISWebsiteActivity activity, string host)
 {
     try
     {
         var startIISwebsiteScript = new ScriptWithParameters();
         startIISwebsiteScript.Script = this.ActivityScriptMap.ExecutionScript;
         startIISwebsiteScript.Params = new Dictionary <string, object>();
         startIISwebsiteScript.Params.Add("website", activity.WebsiteName);
         var response = _shellManager.ExecuteCommands(host, new List <ScriptWithParameters> {
             startIISwebsiteScript
         }, true);
     }
     catch (ApplicationException appEx)
     {
         logger.Error(appEx.Message);
         HandleException(appEx, activity);
     }
 }
Пример #2
0
        private string VerifyStartIISWebsite(StartIISWebsiteActivity activity, string host)
        {
            var status = string.Empty;

            try
            {
                var verifyScript = new ScriptWithParameters();
                verifyScript.Script = this.ActivityScriptMap.VerificationScript;
                verifyScript.Params = new Dictionary <string, object>();
                verifyScript.Params.Add("website", activity.WebsiteName);
                var result = _shellManager.ExecuteCommands(host, new List <ScriptWithParameters> {
                    verifyScript
                }, true);
                status = result.FirstOrDefault() != null ? result[0].ToString() : "0";
            }
            catch (ApplicationException appEx)
            {
                logger.Error(appEx.Message);
                HandleException(appEx, activity);
            }

            return(status);
        }
        private bool ContainsParamsFromActivity(ScriptWithParameters scriptWithParams, StartIISWebsiteActivity activity)
        {
            var parameters = scriptWithParams.Params;

            return
                (activity.WebsiteName.Equals(parameters["website"].ToString(), StringComparison.CurrentCultureIgnoreCase) &&
                 !(string.IsNullOrWhiteSpace(scriptWithParams.Script)) &&
                 !string.IsNullOrWhiteSpace(scriptWithParams.Script) &&
                 parameters.Count == 1);
        }