Ejemplo n.º 1
0
        public static void CheckSql(string url, string type, string mailTo)
        {
            string          result;
            bool            indicator = true;
            OleDbConnection coonect   = new OleDbConnection(url);

            try
            {
                coonect.Open();
                coonect.Close();
            }
            catch
            {
                indicator = false;
            }

            result = indicator ? "SQL is connected" : "No SQL";

            XmlCreate.CreateXml(url, type, result);
            MailSender.EmailSend(XmlCreate.FileName, mailTo);

            Console.WriteLine($"Вы проверяете SQL Server - {url}");
            Console.WriteLine($"Результат проверки - {result}");
        }
Ejemplo n.º 2
0
        public static void  CheckSite(string url, string type, string mailTo)
        {
            string result;
            bool   indicator = true;
            Uri    uri       = new Uri(url);

            try
            {
                HttpWebRequest  httpWebRequest  = (HttpWebRequest)HttpWebRequest.Create(uri);
                HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            }
            catch
            {
                indicator = false;
            }

            result = indicator ? "Site is connected" : "No site";

            XmlCreate.CreateXml(url, type, result);
            MailSender.EmailSend(XmlCreate.FileName, mailTo);

            Console.WriteLine($"Вы проверяете сайт - {url}");
            Console.WriteLine($"Результат проверки - {result}");
        }