예제 #1
0
        public void writeRainData(RFCLICK click, string id)
        {
            string sql    = string.Format("insert into '{0}' values('{1}','{2}','{3}','{4}')", m_dbTableName, click.tm, click.contJmp, click.numJmp, id);
            string szData = string.Format("{0}&{1}&{2}&{3}&TE", id, click.tm, click.contJmp, click.numJmp);

            WriteToTempDB(szData);
            m_sqliteManager.ExcuteSql(sql);
        }
예제 #2
0
        public override void saveClickData()
        {
            RFCLICK click = new RFCLICK();

            click.tm = Time.DateTime2DbTime(System.DateTime.Now);
            if (0 == g_nRecords)
            {
                click.numJmp = click.contJmp = 1;
                clickPoint.Clear();
                contAndDailyTime.contJumpTime = click.tm;
                XmlConfig.writeContStartTime(contAndDailyTime.contJumpTime.ToString());
                //初始化配置参数
            }
            else
            {
                if (!IsSameWorkDay(click.tm, g_pList[g_nRecords - 1].tm))
                {
                    click.numJmp = 1;
                    contAndDailyTime.numJumpTime = click.tm;
                    XmlConfig.writeDailyStartTime(click.tm.ToString());
                    if (difftime(click.tm, g_pList[g_nRecords - 1].tm) > 24 * 3600)
                    {
                        contAndDailyTime.numJumpTime = click.tm;
                        XmlConfig.writeDailyStartTime(click.tm.ToString());
                        contAndDailyTime.contJumpTime = click.tm;
                        XmlConfig.writeContStartTime(contAndDailyTime.contJumpTime.ToString());
                        click.contJmp = 1;
                        clickPoint.Clear();
                        //清空配置文件
                    }
                    else
                    {
                        click.contJmp = g_pList[g_nRecords - 1].contJmp + 1;
                    }
                }
                else
                {
                    click.numJmp  = g_pList[g_nRecords - 1].numJmp + 1;
                    click.contJmp = g_pList[g_nRecords - 1].contJmp + 1;
                }
            }
            g_pList[g_nRecords].tm      = click.tm;
            g_pList[g_nRecords].numJmp  = click.numJmp;
            g_pList[g_nRecords].contJmp = click.contJmp;
            ++g_nRecords;
            //写入数据库

            CSQLite.G_CSQLite.InertRainToDB(click);
            OneMinuteIsThan40(click.tm);
        }
예제 #3
0
 protected override void saveClickData()
 {
     for (int i = 0; i <= m_newClicks.Length - 1; i++)
     {
         RFCLICK click = new RFCLICK();
         click.tm = m_newClicks[i].tm;
         if (0 == g_nRecords)
         {
             click.numJmp = click.contJmp = 1;
             m_siteState.clearLiftDefValue();
             m_siteState.contJumpTime = click.tm;
         }
         else
         {
             if (!IsSameWorkDay(click.tm, g_pList[g_nRecords - 1].tm))
             {
                 click.numJmp            = 1;
                 m_siteState.numJumpTime = click.tm;
                 if (difftime(click.tm, g_pList[g_nRecords - 1].tm) > 24 * 3600)
                 {
                     m_siteState.numJumpTime  = click.tm;
                     m_siteState.contJumpTime = click.tm;
                     click.contJmp            = 1;
                     m_siteState.clearLiftDefValue();
                     //清空配置文件
                 }
                 else
                 {
                     click.contJmp = g_pList[g_nRecords - 1].contJmp + 1;
                 }
             }
             else
             {
                 click.numJmp  = g_pList[g_nRecords - 1].numJmp + 1;
                 click.contJmp = g_pList[g_nRecords - 1].contJmp + 1;
             }
         }
         g_pList[g_nRecords].tm      = click.tm;
         g_pList[g_nRecords].numJmp  = click.numJmp;
         g_pList[g_nRecords].contJmp = click.contJmp;
         ++g_nRecords;
         m_dbHelper.writeRainData(click, m_siteId);
     }
     drawRainMap();
     alarmLevel();
     m_siteCtrlRainInfo = m_rainCalc.getNewRainInfo(g_pList, g_nRecords, g_pList[g_nRecords - 1].contJmp);
 }
예제 #4
0
        private void writeData(RFCLICK click)
        {
            string sql = string.Format("insert into '{0}' values('{1}','{2}','{3}','{4}')", m_pTableName, click.tm, click.contJmp, click.numJmp, SiteID);

            try
            {
                if (File.Exists(m_pDbName))
                {
                    using (SQLiteConnection cn = new SQLiteConnection("data source=" + m_pDbName))
                    {
                        if (cn.State != System.Data.ConnectionState.Open)
                        {
                            cn.Open();
                            using (SQLiteCommand cmd = new SQLiteCommand())
                            {
                                cmd.Connection  = cn;
                                cmd.CommandText = sql;
                                lock (padlock)
                                {
                                    try
                                    {
                                        cmd.ExecuteNonQuery();
                                        DbHelper.SSLUploadData(click, this.SiteID);
                                    }
                                    catch { }
                                }
                                cmd.Dispose();
                            }
                            cn.Dispose();
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
예제 #5
0
        public void SSLUploadData(RFCLICK click, string id)
        {
            string szData = string.Format("{0}&{1}&{2}&{3}&TE", id, click.tm, click.contJmp, click.numJmp);

            WriteToTempDB(szData);
        }
예제 #6
0
        public override void ReceviedData(rtuClick[] newClick)
        {
            #region 雨量存储
            lock (this)
            {
                for (int i = 0; i <= newClick.Length - 1; i++)
                {
                    RFCLICK click = new RFCLICK()
                    {
                        tm = newClick[i].tm
                    };
                    if (0 == g_nRecords)
                    {
                        click.numJmp = click.contJmp = 1;
                        Cleanup();
                        ContJumpTime = click.tm;
                    }
                    else
                    {
                        if (!IsSameWorkDay(click.tm, g_pList[g_nRecords - 1].tm))
                        {
                            click.numJmp = 1;
                            NumJumpTime  = click.tm;
                            if (difftime(click.tm, g_pList[g_nRecords - 1].tm) > 24 * 3600)
                            {
                                Cleanup();
                                ContJumpTime  = NumJumpTime = click.tm;
                                click.contJmp = 1;
                                //清空配置文件
                            }
                            else
                            {
                                click.contJmp = g_pList[g_nRecords - 1].contJmp + 1;
                            }
                        }
                        else
                        {
                            click.numJmp  = g_pList[g_nRecords - 1].numJmp + 1;
                            click.contJmp = g_pList[g_nRecords - 1].contJmp + 1;
                        }
                    }
                    g_pList[g_nRecords].tm      = click.tm;
                    g_pList[g_nRecords].numJmp  = click.numJmp;
                    g_pList[g_nRecords].contJmp = click.contJmp;
                    ++g_nRecords;

                    if (this.Type.Equals("ssl"))
                    {
                        writeData(click);
                    }
                    else if (this.Type.Equals("comm"))
                    {
                        DbHelper.writeRainData(click, SiteID);
                    }
                    else
                    {
                        DbHelper.writeRainData(click, SiteID);
                    }
                }
                #endregion
                RainfallCoumpter();
                if (g_nRecords > 0)
                {
                    if (Time.DateTime2DbTime(DateTime.Now) - g_pList[g_nRecords - 1].tm > 3600)
                    {
                        //雨量图绘制
                        if (SiteObserver != null)
                        {
                            SiteObserver.DrawRainMapOnly(SiteID);
                        }
                    }
                    else
                    {
                        //区间报警 雨量图绘制
                        if (SiteObserver != null)
                        {
                            SiteObserver.Update(SiteID);
                        }
                    }
                }

                PostRefreshRainMapMessage();
            }
        }