Example #1
0
        private DataTable GetProgramData(SensorDataHeadEntity eHead)
        {
            DataRow[] rowsProgramNo    = null;
            DataRow[] rowsProgramName  = null;
            DataRow[] rowsProgramPhase = null;

            if (mIsCompressed)
            {
                rowsProgramNo    = mSensorCompressedData.GetSensorSeriesValues(SystemData.ProgramNo.ToString());
                rowsProgramName  = mSensorCompressedData.GetSensorSeriesValues(SystemData.ProgramName.ToString());
                rowsProgramPhase = mSensorCompressedData.GetSensorSeriesValues(SystemData.ProgramPhase.ToString());
            }
            else
            {
                SensorDataLineValueBll bllLineValue = new SensorDataLineValueBll();

                DataTable dtProgramNo = bllLineValue.GetSensorSeriesValues(eHead.SensorDataHeadID.ToString().ToUpper(), SystemData.ProgramNo.ToString());

                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.GetSensorSeriesValues(eHead.SensorDataHeadID.ToString().ToUpper(), SystemData.ProgramName.ToString());
                rowsProgramName = dtProgramName.Select("ReceivedDate <= '" + mSyncLast.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'");

                DataTable dtProgramPhase = bllLineValue.GetSensorSeriesValues(eHead.SensorDataHeadID.ToString().ToUpper(), SystemData.ProgramPhase.ToString());
                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);
        }
Example #2
0
        public static IList <ErrorItemDTO> GetSensorErrors(SensorDataHeadEntity eHead, DateTime?dtSyncLast)
        {
            SensorDataLineValueBll bllLineValue = new SensorDataLineValueBll();

            DataTable dt = bllLineValue.GetSensorSeriesValues(eHead.SensorDataHeadID.ToString().ToUpper(), SystemData.ErrorNo.ToString());

            if (dt != null)
            {
                DataRow[] rows;
                if (dtSyncLast == null && !dtSyncLast.HasValue)
                {
                    rows = dt.Select();
                }
                else
                {
                    rows = dt.Select("ReceivedDate <= '" + dtSyncLast.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'");
                }

                IList <ErrorItemDTO> lstError = new List <ErrorItemDTO>();
                foreach (DataRow row in rows)
                {
                    ErrorItemDTO item = new ErrorItemDTO();
                    item.BeginDateTime = ParseHelper.ParseToDateTime(row["SensorDate"]);
                    item.ErrorNo       = ParseHelper.ParseString(row["ContentString"]);

                    lstError.Add(item);
                }

                return(lstError);
            }

            return(null);
        }
Example #3
0
        private SeriesDTO GetSeries(SensorDataHeadEntity eHead, SystemData valueType, string seriesName)
        {
            SensorDataLineValueBll bllLineValue = new SensorDataLineValueBll();

            DataTable dt = bllLineValue.GetSensorSeriesValues(eHead.SensorDataHeadID.ToString().ToUpper(), valueType.ToString());

            DataRow[] rows;
            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);

            return(ToSeriesDTO(eHead, seriesName, rows));
        }