private DataTable GetProgramDataInc(SensorDataHeadEntity eHead, DateTime lastReceivedDate) { SensorDataLineValueBll bllLineValue = new SensorDataLineValueBll(); DataTable dtProgramNo = bllLineValue.GetSensorSeriesValuesInc(eHead.SensorDataHeadID.ToString().ToUpper(), SystemData.ProgramNo.ToString(), lastReceivedDate); if (dtProgramNo == null || dtProgramNo.Rows.Count == 0) { return(null); } DataRow[] rowsProgramNo; if (mSyncLast == null) { mSyncLast = Convert.ToDateTime(dtProgramNo.Rows[dtProgramNo.Rows.Count - 1]["ReceivedDate"]); rowsProgramNo = dtProgramNo.Select(); } else { rowsProgramNo = dtProgramNo.Select("ReceivedDate <= '" + mSyncLast.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"); } DataTable dtProgramName = bllLineValue.GetSensorSeriesValuesInc(eHead.SensorDataHeadID.ToString().ToUpper(), SystemData.ProgramName.ToString(), lastReceivedDate); DataRow[] rowsProgramName = dtProgramName.Select("ReceivedDate <= '" + mSyncLast.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"); DataTable dtProgramPhase = bllLineValue.GetSensorSeriesValuesInc(eHead.SensorDataHeadID.ToString().ToUpper(), SystemData.ProgramPhase.ToString(), lastReceivedDate); DataRow[] rowsProgramPhase = dtProgramPhase.Select("ReceivedDate <= '" + mSyncLast.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"); DataTable dtProgramData = new DataTable("ProgramData"); dtProgramData.Columns.Add("ReceivedDate", typeof(DateTime)); dtProgramData.Columns.Add("SensorDate", typeof(DateTime)); dtProgramData.Columns.Add(Properties.Resource.ProgramNo, typeof(string)); dtProgramData.Columns.Add(Properties.Resource.ProgramName, typeof(string)); dtProgramData.Columns.Add(Properties.Resource.ProgramPhase, typeof(string)); dtProgramData.BeginLoadData(); for (int i = 0; i < rowsProgramNo.Length; i++) { DataRow row = dtProgramData.NewRow(); row["ReceivedDate"] = rowsProgramNo[i]["ReceivedDate"]; row["SensorDate"] = rowsProgramNo[i]["SensorDate"]; row[Properties.Resource.ProgramNo] = rowsProgramNo[i]["ContentString"]; row[Properties.Resource.ProgramName] = rowsProgramName[i]["ContentString"]; row[Properties.Resource.ProgramPhase] = rowsProgramPhase[i]["ContentString"]; dtProgramData.Rows.Add(row); } dtProgramData.EndLoadData(); return(dtProgramData); }
private SeriesDTO GetSeriesInc(SensorDataHeadEntity eHead, SystemData valueType, string seriesName, DateTime lastReceivedDate) { SensorDataLineValueBll bllLineValue = new SensorDataLineValueBll(); DataTable dt = bllLineValue.GetSensorSeriesValuesInc(eHead.SensorDataHeadID.ToString().ToUpper(), valueType.ToString(), lastReceivedDate); DataRow[] rows = null; if (dt != null && dt.Rows.Count > 0) { if (mSyncLast == null) { mSyncLast = Convert.ToDateTime(dt.Rows[dt.Rows.Count - 1]["ReceivedDate"]); rows = dt.Select(); } else { rows = dt.Select("ReceivedDate <= '" + mSyncLast.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"); } mDataDic.Add(seriesName, rows); } else { mDataDic.Add(seriesName, null); } return(ToSeriesDTO(eHead, seriesName, rows)); }