Ejemplo n.º 1
0
        public frmMain()
        {
            Thread splashthread = new Thread(new ThreadStart(clsStatus.ShowScreen));

            splashthread.IsBackground = true;
            splashthread.Start();
            InitializeComponent();

            xmlData = new clsXMLData();
            xmlData.connect();
            settings = xmlData.ReadSettings();

            clsStatus.UdpateStatusText(DateTime.Now.ToString());
            clsStatus.UdpateStatusText("\r\nTimer : " + settings.timer + " Minute(s)\r\n");
            Relicate();
            try
            {
                System.Timers.Timer replicationTimer = new System.Timers.Timer();
                replicationTimer.Interval = Convert.ToInt32(settings.timer) * 60 * 1000;
                replicationTimer.Elapsed += new System.Timers.ElapsedEventHandler(MyTimer_Elapsed);
                replicationTimer.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public DataTable GridFillSql()
        {
            clsXMLData clsXmlData = new clsXMLData();

            settings = clsXmlData.ReadSettings();

            dbinfo.ServerName = settings.serverName;
            dbinfo.DBName     = settings.dbName;
            dbinfo.DBPort     = settings.dbPort;
            dbinfo.DBUser     = settings.userName;
            dbinfo.DBPWD      = settings.password;


            DataTable dt = new DataTable();

            cnn  = new MySqlConnection(connectionString);
            conn = new MySqlConnection(connectionString1);
            try
            {
                cnn.Open();
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SELECT LASTCONNECTION,COUNT(ID),(SELECT COUNT(ID) FROM REPLICATIONLOG WHERE COMMANDSTATUS = 'SUCCESS') APPLIEDQUERY , (SELECT COUNT(ID) FROM REPLICATIONLOG WHERE UPDATESTATUS = 'SUCCESS') VERIFIEDQUERY FROM replicationinfo JOIN replicationlog ON replicationlog.DBCODE = replicationinfo.CODE ", conn);
                cmd.CommandType = CommandType.Text;
                MySqlDataAdapter sqlda = new MySqlDataAdapter(cmd);
                sqlda.Fill(dt);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Can't open connection" + ex.ToString());
            }
            finally
            {
                cnn.Close();
                conn.Close();
            }
            return(dt);
        }