Пример #1
0
        public override void set(int index, string value)
        {
            TimeSpan ts = new TimeSpan();

            if (TimeSpan.TryParse(value, out ts))
            {
                BasicTime.checkTimeSpanToTime(ts);
                base.set(index, new BasicInt(Utils.countMilliseconds(ts)));
                return;
            }
            base.set(index, value);
        }
Пример #2
0
 public override void add(object value)
 {
     if (value is TimeSpan)
     {
         BasicTime.checkTimeSpanToTime((TimeSpan)value);
         base.add(Utils.countMilliseconds((TimeSpan)value));
     }
     else if (value is DateTime)
     {
         base.add(Utils.countMilliseconds(((DateTime)value).TimeOfDay));
     }
     else
     {
         base.add(value);
     }
 }
Пример #3
0
        private IScalar getDolphinDBScalarBySystemType(Type stype, object value)
        {
            IScalar data = null;

            if (stype == Type.GetType("System.Boolean"))
            {
                data = new BasicBoolean(Convert.ToBoolean(value));
            }
            else if (stype == Type.GetType("System.Byte"))
            {
                data = new BasicByte(Convert.ToByte(value));
            }
            else if (stype == Type.GetType("System.Double"))
            {
                data = new BasicDouble(Convert.ToDouble(value));
            }
            else if (stype == Type.GetType("System.DateTime"))
            {
                data = new BasicDateTime(Convert.ToDateTime(value));
            }
            else if (stype == Type.GetType("System.TimeSpan"))
            {
                data = new BasicTime((TimeSpan)value);
            }

            else if (stype == Type.GetType("System.Int16"))
            {
                data = new BasicShort(Convert.ToInt16(value));
            }
            else if (stype == Type.GetType("System.Int32"))
            {
                data = new BasicInt(Convert.ToInt32(value));
            }
            else if (stype == Type.GetType("System.Int64"))
            {
                data = new BasicLong(Convert.ToInt64(value));
            }
            else
            {
                data = new BasicString(value.ToString());
            }
            return(data);
        }
Пример #4
0
 public virtual void setTime(int index, TimeSpan time)
 {
     BasicTime.checkTimeSpanToTime(time);
     setInt(index, (int)Utils.countMilliseconds(time.Hours, time.Minutes, time.Seconds, time.Milliseconds));
 }