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); }
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(); }
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; }
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); }
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); }
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(); }
public DataTypeValue GetInstance(Node node) { return(DateDataType.GetInstance(node)); }
public DataTypeValue GetInstance(string value) { return(DateDataType.GetInstance(value)); }