public object Parse(NameValueCollection data, string key, string prefix, out bool succeed) { string value = BindUtils.GetValue(data, key, prefix); decimal num = 0m; succeed = decimal.TryParse(value, out num); return(num); }
public object Parse(NameValueCollection data, string key, string prefix, out bool succeed) { string value = BindUtils.GetValue(data, key, prefix); byte b = 0; succeed = byte.TryParse(value, out b); return(b); }
public object Parse(NameValueCollection data, string key, string prefix, out bool succeed) { string value = BindUtils.GetValue(data, key, prefix); DateTime dateTime; succeed = DateTime.TryParse(value, out dateTime); return(dateTime); }
public object Parse(NameValueCollection data, string key, string prefix, out bool succeed) { string value = BindUtils.GetValue(data, key, prefix); bool flag = false; succeed = bool.TryParse(value, out flag); return(flag); }
public object Parse(NameValueCollection data, string key, string prefix, out bool succeed) { string value = BindUtils.GetValue(data, key, prefix); if (string.IsNullOrEmpty(value)) { succeed = false; } else { succeed = true; } return(value); }
public object Parse(NameValueCollection data, string key, string prefix, out bool succeed) { string value = BindUtils.GetValue(data, key, prefix); object result; if (string.IsNullOrEmpty(value)) { succeed = true; result = default(T); } else { IEnumValue enumConvert = BindUtils.GetEnumConvert(typeof(T)); result = enumConvert.GetValue(value, out succeed); } return(result); }
private bool GetValueTypeValue(System.Collections.Specialized.NameValueCollection data, string Prefix, out object value) { IConvert convert = null; value = null; Type createtype = Info.ParameterType; if (Binder != null && Binder.Convert == null && Binder.Fungible != null) { createtype = Binder.Fungible; } bool succed = false; if (Binder != null && !string.IsNullOrEmpty(Binder.Prefix)) { Prefix = Binder.Prefix; } if (Binder != null) { convert = Binder.GetConvert(); } if (convert == null) { if (BindUtils.Converts.ContainsKey(createtype)) { convert = BindUtils.Converts[createtype]; } } if (convert != null) { value = convert.Parse(data, Info.Name, Prefix, out succed); } else { if (createtype.IsEnum) { string pvalue = BindUtils.GetValue(data, Info.Name, Prefix); IEnumValue evalue = BindUtils.GetEnumConvert(createtype); value = evalue.GetValue(pvalue, out succed); } } return(succed); }