public static string GetValueInString(FactValueType factValueType, FactValue factValue) { string value = null; switch (factValueType) { case FactValueType.BOOLEAN: value = ((FactBooleanValue)factValue).GetValue().ToString(); break; case FactValueType.DATE: string[] strArray = ((FactDateValue)factValue).GetValue().ToString().Trim().Split('/'); StringBuilder sb = new StringBuilder(); Enumerable.Range(0, strArray.Length) .ToList() .ForEach(x => { sb.Append(strArray[x].Trim().PadLeft(2, '0')); if (x != strArray.Length - 1) { sb.Append("/"); } }); value = sb.ToString().Split(' ')[0].Trim(); break; case FactValueType.DEFI_STRING: value = ((FactDefiStringValue)factValue).GetValue(); break; case FactValueType.DOUBLE: case FactValueType.DECIMAL: value = ((FactDoubleValue)factValue).GetValue().ToString(); break; case FactValueType.HASH: value = ((FactHashValue)factValue).GetValue(); break; case FactValueType.URL: value = ((FactURLValue)factValue).GetValue(); break; case FactValueType.UUID: value = ((FactUUIDValue)factValue).GetValue(); break; case FactValueType.INTEGER: value = ((FactIntegerValue)factValue).GetValue().ToString(); break; case FactValueType.STRING: value = ((FactStringValue)factValue).GetValue(); break; } return(value); }
public void SetDefaultValue(FactValue defaultValue) { this.defaultValue = defaultValue; }
public void AddFactValueToListValue(FactValue fv) { this.listValue.Add(fv); }
public FactBooleanValue(FactValue fv) { this.value = Boolean.Parse(FactValue.GetValueInString(FactValueType.BOOLEAN, fv)); }
public static FactValue GenerateFactValue(FactValueType factValueType, string str) { FactValue factValue = null; switch (factValueType) { case FactValueType.BOOLEAN: factValue = Parse(Boolean.Parse(str)); break; case FactValueType.DATE: DateTime dateValue; string[] strArray = str.Trim().Split('/'); StringBuilder sb = new StringBuilder(); Enumerable.Range(0, strArray.Length) .ToList() .ForEach(x => { sb.Append(strArray[x].PadLeft(2, '0')); if (x != strArray.Length - 1) { sb.Append("/"); } }); DateTime.TryParseExact(sb.ToString(), "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out dateValue); factValue = Parse(dateValue); break; case FactValueType.DEFI_STRING: factValue = ParseDefiString(str); break; case FactValueType.DOUBLE: factValue = Parse(Double.Parse(str)); break; case FactValueType.HASH: factValue = ParseHash(str); break; case FactValueType.UUID: factValue = ParseUUID(str); break; case FactValueType.URL: factValue = ParseURL(str); break; case FactValueType.INTEGER: factValue = Parse(Int32.Parse(str)); break; case FactValueType.STRING: factValue = Parse(str); break; } return(factValue); }