Exemplo n.º 1
0
        public static KPIDataTime GetKPIDataTimeFromValue(decimal value)
        {
            if (value <= 0)
            {
                throw new ArgumentException("The value cannor be zero.");
            }

            KPIDataTime theData = null;

            try
            {
                KPIDataTimeTableAdapter            localAdapter = new KPIDataTimeTableAdapter();
                KPIDataTimeDS.KPIDataTimeDataTable theTable     = localAdapter.GetKPIDataTimeFromValue(value);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    KPIDataTimeDS.KPIDataTimeRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetKPIDataTimeFromValue para value: " + value, exc);
                throw exc;
            }

            return(theData);
        }
Exemplo n.º 2
0
        private static KPIDataTime FillRecord(KPIDataTimeDS.KPIDataTimeRow row)
        {
            KPIDataTime theNewRecord = new KPIDataTime(
                row.IsyearNull() ? 0 : row.year,
                row.IsmonthNull() ? 0 : row.month,
                row.IsdayNull() ? 0 : row.day,
                row.IshourNull() ? 0 : row.hour,
                row.IsminuteNull() ? 0 : row.minute);

            return(theNewRecord);
        }