public void StoreLabels() { this.EnsureLabelsAreGenerated(); if (this.Values != null) { this.m_labels = new string[this.Values.Length]; for (int i = 0; i < this.Values.Length; i++) { string text = null; object obj = this.Values[i]; bool flag = false; if (this.ValidValues != null) { int num = 0; while (num < this.ValidValues.Count) { if (!ParameterBase.ParameterValuesEqual(obj, this.ValidValues[num].Value)) { num++; continue; } flag = true; text = this.ValidValues[num].Label; break; } } if (!flag && obj != null) { text = ParameterInfo.CastValueToLabelString(obj, Thread.CurrentThread.CurrentCulture); } this.m_labels[i] = text; } } }
public bool ValueIsValid() { if (this.Values != null && this.Values.Length != 0) { for (int i = 0; i < this.Values.Length; i++) { object obj = this.Values[i]; if (!base.Nullable && obj == null) { if (Global.Tracer.TraceVerbose) { Global.Tracer.Trace(TraceLevel.Verbose, "Value provided for parameter '{0}' is null and parameter is not nullable.", base.Name.MarkAsPrivate()); } return(false); } if (base.DataType == DataType.String && !base.AllowBlank && obj != null && ((string)obj).Length == 0) { if (Global.Tracer.TraceVerbose) { Global.Tracer.Trace(TraceLevel.Verbose, "Value provided for string parameter '{0}' is either null or blank and parameter does not allow blanks.", base.Name.MarkAsPrivate()); } return(false); } if (this.ValidValues != null) { bool flag = false; int num = 0; while (num < this.ValidValues.Count) { if (!ParameterBase.ParameterValuesEqual(obj, this.ValidValues[num].Value)) { num++; continue; } flag = true; break; } if (!flag) { if (Global.Tracer.TraceVerbose) { Global.Tracer.Trace(TraceLevel.Verbose, "The provided value '{0}' for parameter '{1}' is not a valid value.", obj.ToString().MarkAsPrivate(), base.Name.MarkAsPrivate()); } return(false); } } } return(true); } return(false); }