Пример #1
0
        /// static ApplicationLogging AL = new ApplicationLogging("Axtension.SMS", ".\\").SetGathering(false).SetSyslogging(false);



        public void Send(string recipient, string message)
        {
            Axtension.Mail m = new Mail();
            m.Postoffice = "mail.westnet.com.au";
            m.Port       = 25;
            m.SSL        = false;
            m.Account    = "*****@*****.**";
            m.Password   = "******";
            try
            {
                m.Shriek("*****@*****.**", recipient + "@directsms.com.au", string.Empty, message);
            }
            catch (Exception exc)
            {
                /// AL.Warning().Send("Could not send SMS", exc.Message);
                Axtension.Track T = new Track(Path.GetTempPath());
                T.SetTrackType(Track.TrackTypes.UNBUFFERED);
                T.Write(exc.Message, exc.StackTrace);
                T.Commit();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            string sEXESpec = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            string sEXEName = Path.GetFileName(sEXESpec);
            string sCFGSpec = Path.ChangeExtension(sEXEName, "cfg");

            Axtension.Config cfg = new Config(sCFGSpec);

            string awaiting = cfg.Retrieve("awaiting", string.Empty);

            ifdie(string.Empty == awaiting, "awaiting not defined in " + sCFGSpec);

            string processed = cfg.Retrieve("processed", string.Empty);

            ifdie(string.Empty == processed, "processed not defined in " + sCFGSpec);

            string connection = cfg.Retrieve("connection", string.Empty);

            ifdie(string.Empty == connection, "connection not defined in " + sCFGSpec);

            string account = cfg.Retrieve("account", string.Empty);

            ifdie(account == string.Empty, "account not defined in " + sCFGSpec);

            string password = cfg.Retrieve("password", string.Empty);

            ifdie(password == string.Empty, "password not defined in " + sCFGSpec);

            string postoffice = cfg.Retrieve("postoffice", string.Empty);

            ifdie(postoffice == string.Empty, "postoffice not defined in " + sCFGSpec);

            string port = cfg.Retrieve("port");

            ifdie(port == null, "port not defined in " + sCFGSpec);

            string ssl = cfg.Retrieve("ssl");

            ifdie(ssl == null, "ssl not defined in " + sCFGSpec);

            string recipient = cfg.Retrieve("recipient", "");

            ifdie(string.Empty == recipient, "recipient not defined in " + sCFGSpec);

            Axtension.Mail oMail = new Axtension.Mail();
            oMail.Account    = account;
            oMail.Password   = password;
            oMail.Postoffice = postoffice;
            oMail.Port       = int.Parse(port);
            oMail.SSL        = ssl.ToUpper() == "Y";

            List <string> lLog = new List <string>();

            Axtension.SQL sql = new Axtension.SQL();
            sql.Connect(connection);
            try
            {
                var sqlFiles = Directory.EnumerateFiles(awaiting, "*.sql", SearchOption.TopDirectoryOnly);

                foreach (string sqlFile in sqlFiles)
                {
                    string sqlCode = File.ReadAllText(sqlFile);
                    sql.Exec(sqlCode);
                    File.Move(sqlFile, Path.Combine(processed, Path.GetFileName(sqlFile)));
                    lLog.Add(sqlCode);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            oMail.Shriek(account, recipient, "[BOSSI] " + DateTime.Now.ToString(), string.Join("\n", lLog.ToArray()));
        }