Exemplo n.º 1
0
        protected override void DoRun(Field field)
        {
            string value = field.Value;

            DataType dt = field.Definition.Type;

            if (dt.GetType() != typeof(DateDataType))
            {
                return;
            }

            DateDataType dataType = (DateDataType)dt;

            if (dataType.IsValid(value))
            {
                return;
            }

            // value is illegal date value
            FieldIndex fieldIndeks = field.Definition.GetIndex();

            if (!_nonDateValues.ContainsKey(fieldIndeks))
            {
                _nonDateValues.Add(fieldIndeks, new HashSet <string>());
            }

            _nonDateValues[fieldIndeks].Add(value);
        }
Exemplo n.º 2
0
 public EvaluationContext(Request req)
 {
     this._request         = req;
     this._results         = new Dictionary <string, Result>();
     this._currentdate     = new DateDataType();
     this._currenttime     = new TimeDataType();
     this._currentdatetime = new DateTimeDataType();
 }
Exemplo n.º 3
0
 public EvaluationContext(EvaluationContext context)
 {
     this._request         = new Request(context._request);
     this._results         = new Dictionary <string, Result>();
     this._currentdate     = context._currentdate;
     this._currenttime     = context._currenttime;
     this._currentdatetime = context._currentdatetime;
     this._rootPolicyId    = context._rootPolicyId;
 }
Exemplo n.º 4
0
 public override DataTypeValue Evaluate(DataTypeValue[] @params, EvaluationContext ctx)
 {
     if (@params.Length == Paramsnum && @params[0] is DateDataType && @params[1] is YearMonthDurationDataType)
     {
         var      datetime = new DateDataType(((DateDataType)@params[0]));
         var      period   = (YearMonthDurationDataType)@params[1];
         Calendar cal      = datetime.Calendar;
         cal.add(Calendar.YEAR, period.Year);
         cal.add(Calendar.MONTH, period.Month);
         return(datetime);
     }
     throw new IllegalExpressionEvaluationException(stringIdentifer);
 }
Exemplo n.º 5
0
        public static string GetMySQLDateTime(string dateTime, DateDataType dateType)
        {
            string date = dateTime;

            if (date.Trim() == "")
            {
                return(null);
            }
            try
            {
                //DateTimeFormatInfo dateTimeFormatInfo = new DateTimeFormatInfo();
                //dateTimeFormatInfo.TimeSeparator = DateFormatInfo.TimeSeparator;
                DateTime dt = DateTime.Parse(date);
                switch (dateType)
                {
                case DateDataType.Date:
                    date = dt.ToString(DateFormatInfo.MySQLFormat.DateUpdate);
                    break;

                case DateDataType.DateTime:
                    date = dt.ToString(DateFormatInfo.MySQLFormat.DateAndTimeUpdate);
                    break;

                case DateDataType.TimeStamp:
                    date = dt.ToString(DateFormatInfo.MySQLFormat.TimeStampUpdate);
                    break;

                case DateDataType.Time:
                    date = dt.ToString(DateFormatInfo.TimeFormat);
                    break;

                case DateDataType.DateNoFormatBegin:
                    date = dt.ToString(DateFormatInfo.MySQLFormat.DateAndTimeNoformatBegin);
                    break;

                case DateDataType.DateNoFormatEnd:
                    date = dt.ToString(DateFormatInfo.MySQLFormat.DateAndTimeNoformatEnd);
                    break;
                }
            }
            catch (Exception) { }

            return(date);
        }
Exemplo n.º 6
0
 static DataTypeDescriptor()
 {
     DnsName = new DnsNameDataType();
     IpAddress = new IpAddress();
     Bag = new Bag();
     Time = new Time();
     String = new StringDataType();
     Rfc822Name = new Rfc822Name();
     X500Name = new X500Name();
     Double = new DoubleDataType();
     YearMonthDuration = new YearMonthDuration();
     DaytimeDuration = new DaytimeDuration();
     DateTime = new DateTime();
     Date = new DateDataType();
     Integer = new IntegerDataType();
     Boolean = new BooleanDataType();
     HexBinary = new HexBinary();
     Base64Binary = new Base64Binary();
     AnyUri = new AnyUri();
     Function = new FunctionDataType();
 }
Exemplo n.º 7
0
 static DataTypeDescriptor()
 {
     DnsName           = new DnsNameDataType();
     IpAddress         = new IpAddress();
     Bag               = new Bag();
     Time              = new Time();
     String            = new StringDataType();
     Rfc822Name        = new Rfc822Name();
     X500Name          = new X500Name();
     Double            = new DoubleDataType();
     YearMonthDuration = new YearMonthDuration();
     DaytimeDuration   = new DaytimeDuration();
     DateTime          = new DateTime();
     Date              = new DateDataType();
     Integer           = new IntegerDataType();
     Boolean           = new BooleanDataType();
     HexBinary         = new HexBinary();
     Base64Binary      = new Base64Binary();
     AnyUri            = new AnyUri();
     Function          = new FunctionDataType();
 }
Exemplo n.º 8
0
 public DataTypeValue GetInstance(Node node)
 {
     return(DateDataType.GetInstance(node));
 }
Exemplo n.º 9
0
 public DataTypeValue GetInstance(string value)
 {
     return(DateDataType.GetInstance(value));
 }