Exemplo n.º 1
0
        //private void DeleteToTempDB(string szData)
        //{
        //    string sql = string.Format("delete from tempdb where db='{0}'", szData);
        //    m_sqliteManager.ExcuteSql(sql);
        //    m_sqliteManager.ExcuteSql("vacuum");
        //}
        public void WriteWorksDoneLog(_WorksDoneLog log)
        {
            log.reg_tm = Time.DateTime2DbTime(System.DateTime.Now);
            string sql    = string.Format("insert into site_log_worksdone values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", log.reg_tm, log.tm1, log.tm2, log.value, log.typelevel, log.hourValue, log.name, log.siteId);
            string szData = string.Format("{0}&{1}&{2}&{3}&{4}&{5}&{6}&{7}&HE", log.siteId, log.reg_tm, log.tm1, log.tm2, log.value, log.typelevel, log.hourValue, log.name);

            WriteToTempDB(szData);

            m_sqliteManager.ExcuteSql(sql);
        }
Exemplo n.º 2
0
        public void Init()
        {
            _WorksDoneLog[] log = new _WorksDoneLog[1000];
            int             N   = m_dbHelper.GetMeasuresLogRecords(log);

            if (N > 0)
            {
                this.dtMeasureLog.Rows.Add(N);
                for (int i = 0; i < N; i++)
                {
                    string   szStr = null;
                    string[] infos = log[i].name.Split(',');
                    this.dtMeasureLog.Rows[i].Cells[0].Value = Time.DbTime2DateTime(log[i].reg_tm).ToString("yyyy.MM.dd HH:mm");
                    if (log[i].typelevel > 0)
                    {
                        CWorksDoneReg.GetWorksReason(log[i].tm1, log[i].tm2, log[i].value, log[i].typelevel >> 16, log[i].typelevel & 0xffff, ref szStr, log[i].hourValue);
                    }
                    else
                    {
                        CWorksDoneReg.GetWorksReason(log[i].tm1, log[i].tm2, log[i].value, 5, log[i].typelevel, ref szStr, log[i].hourValue);
                    }
                    this.dtMeasureLog.Rows[i].Cells[2].Value = szStr;
                    if (log[i].typelevel > 0)
                    {
                        CWorksDoneReg.GetWorksDone(log[i].typelevel & 0xfff, ref szStr);
                    }
                    else
                    {
                        CWorksDoneReg.GetWorksDone(log[i].typelevel, ref szStr);
                    }
                    this.dtMeasureLog.Rows[i].Cells[3].Value = szStr;
                    this.dtMeasureLog.Rows[i].Cells[4].Value = infos[0];
                    this.dtMeasureLog.Rows[i].Cells[5].Value = log[i].siteId;
                    this.dtMeasureLog.Rows[i].Cells[1].Value = infos.Length > 1 ? infos[1] : "";
                }
            }
            else
            {
                this.dtMeasureLog.Rows.Clear();
            }
            this.dtMeasureLog.Rows.Add(10);
        }