Beispiel #1
0
        //自动统计
        private void AutoStatistics()
        {
            int i = 0;

            while (true)
            {
                if (IsStopped)
                {
                    try
                    {
                        if (OracleHelper.Exists(OracleHelper.conn, "SELECT count(*) FROM SYS_AUTOMATIC WHERE AUTOTYPE='IsAutoCount' AND STATIC=1"))
                        {
                            if (i % iStatisticsInterval == 0)
                            {
                                LogManager.Log("Log", "Log", "== 自动Statistics统计打开 ==");
                                this.userLoginLog.Invoke(new Action(() =>
                                {
                                    this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "== 自动Statistics统计打开 ==");
                                    this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                                }));
                                try
                                {
                                    if (DateTime.Now.Hour.Equals(04))
                                    {
                                        StatisticsData statis = new StatisticsData();
                                        statis.Statistics(this.txtDetails);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LogManager.Log("Log", "Error", ex.Message);
                                    this.userLoginLog.Invoke(new Action(() =>
                                    {
                                        this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "==自动统计失败:" + ex.Message + "==");
                                        this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                                    }));
                                }
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        LogManager.Log("Log", "Error", ex.Message);
                        this.userLoginLog.Invoke(new Action(() =>
                        {
                            this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "==自动统计失败:" + ex.Message + "==");

                            this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                        }));
                    }
                }
                else
                {
                    break;
                }
                i++;
                Thread.Sleep(1000);
            }
        }
Beispiel #2
0
        //自动合并
        private void AutoMerger()
        {
            int i = 0;

            while (true)
            {
                if (IsStopped)
                {
                    try
                    {
                        if (OracleHelper.Exists(OracleHelper.conn, "SELECT count(*) FROM SYS_AUTOMATIC WHERE AUTOTYPE='IsAutoMerger' AND STATIC=1"))
                        {
                            if (i % iMergerInterval == 0)
                            {
                                LogManager.Log("Log", "Log", "== 自动Merger合并打开 ==");
                                this.userLoginLog.Invoke(new Action(() =>
                                {
                                    this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "== 自动Merger合并打开 ==");
                                    this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                                }));
                                try
                                {
                                    MergerData merger = new MergerData();
                                    Dictionary <string, string> mapMessage = new Dictionary <string, string>();
                                    merger.Merger("", mapMessage, this.userLoginLog);
                                }
                                catch (Exception ex)
                                {
                                    LogManager.Log("Log", "Error", ex.Message);
                                    this.userLoginLog.Invoke(new Action(() =>
                                    {
                                        this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "==自动合并失败:" + ex.Message + "==");
                                        this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                                    }));
                                }
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        LogManager.Log("Log", "Error", ex.Message);
                        this.userLoginLog.Invoke(new Action(() =>
                        {
                            this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "==自动合并失败:" + ex.Message + "==");
                            this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                        }));
                    }
                }
                else
                {
                    break;
                }
                i++;
                Thread.Sleep(1000);
            }
        }
Beispiel #3
0
        //自动获取数据
        private void AutoImport()
        {
            int i = 0;

            while (true)
            {
                if (IsStopped)
                {
                    try
                    {
                        if (OracleHelper.Exists(OracleHelper.conn, "SELECT count(*) FROM SYS_AUTOMATIC WHERE AUTOTYPE='IsAutoImport' AND STATIC=1"))
                        {
                            if (i % iImportInterval == 0)
                            {
                                LogManager.Log("Log", "Log", "== 自动Socket接收打开 ==");
                                this.userLoginLog.Invoke(new Action(() =>
                                {
                                    this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "==  自动Socket接收打开 ==");
                                    this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                                }));
                                try
                                {
                                    AutoSocket socket = new AutoSocket();
                                    socket.Import(this.userLoginLog);
                                }
                                catch (Exception ex)
                                {
                                    LogManager.Log("Log", "Error", ex.Message);
                                    this.userLoginLog.Invoke(new Action(() =>
                                    {
                                        this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "==自动Socket失败:" + ex.Message + "==");
                                        this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                                    }));
                                }
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        LogManager.Log("Log", "Error", ex.Message);
                        this.userLoginLog.Invoke(new Action(() =>
                        {
                            this.userLoginLog.Items.Add(DateTime.Now.ToString("G") + "==自动Socket失败:" + ex.Message + "==");
                            this.userLoginLog.TopIndex = this.userLoginLog.Items.Count - 1;
                        }));
                    }
                }
                else
                {
                    break;
                }
                i++;
                Thread.Sleep(1000);
            }
        }