Esempio n. 1
0
        /// <summary>
        /// Gets all quarantined emails.
        /// </summary>
        /// <returns></returns>
        public ICollection <QuarantineEmail> GetAllQuarantinedMails()
        {
            ICollection <QuarantineEmail> functionResults = new List <QuarantineEmail>();

            using (PowerShellExecutor pse = new PowerShellExecutor())
            {
                PSDataCollection <PSObject> results = pse.ExecuteAsynchronously(Scripts.GetQuarantinedMails);
                foreach (PSObject item in results)
                {
                    if (item.BaseObject.ToString().StartsWith("Result:"))
                    {
                        string value = item.BaseObject.ToString();
                        value = value.Replace("Result:", "");
                        string[]        values = value.Split(';');
                        QuarantineEmail email  = new QuarantineEmail
                        {
                            Id     = values.FirstOrDefault(),
                            Sender = values.LastOrDefault()
                        };
                        functionResults.Add(email);
                    }
                }
            }

            return(functionResults);
        }
        public bool Retract()
        {
            using (PowerShellExecutor pse = new PowerShellExecutor())
            {
                pse.ExecuteAsynchronously(Scripts.RetractSolution);
            }

            return(true);
        }
        public bool Deploy()
        {
            using (PowerShellExecutor pse = new PowerShellExecutor())
            {
                pse.ExecuteAsynchronously(Scripts.DeploySolution);
            }

            return(true);
        }
Esempio n. 4
0
        public bool ReleaseMail(string[] mails)
        {
            using (PowerShellExecutor pse = new PowerShellExecutor())
            {
                pse.ExecuteAsynchronously(Scripts.ReleaseQuarantinedMails, new KeyValuePair <string, string>("QuarantineEmails", "NONE"));
            }

            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the status of the programm.
        /// </summary>
        /// <returns></returns>
        public bool GetStatus()
        {
            using (PowerShellExecutor pse = new PowerShellExecutor())
            {
                PSDataCollection <PSObject> results = pse.ExecuteAsynchronously(Scripts.GetSolutionStatus);
                foreach (PSObject item in results)
                {
                    if (item.BaseObject.ToString().StartsWith("Result:"))
                    {
                        string value = item.BaseObject.ToString();
                        value        = value.Replace("Result:", "");
                        Control.Text = value;
                    }
                }
            }

            return(true);
        }