private static void ValidateDecimal(string pFieldName, object pValue, OperationResult pOperationResult) { decimal lResult; if (!Decimal.TryParse(pValue.ToString(), out lResult)) { pOperationResult.InvalidField(pFieldName, "Invalid", pValue); } }
public static void ValidateRequired(DataField pField, DataFieldCollection pValues, OperationResult pOperationResult) { if (!pValues.ContainsKey(pField)) { pOperationResult.InvalidField(pField.Name, "Required", null); } else { if (pValues[pField] == null) { pOperationResult.InvalidField(pField.Name, "Required", null); } else { if (pValues[pField].ToString() == "") pOperationResult.InvalidField(pField.Name, "Required", null); } } }
private static void ValidateDate(string pFieldName, object pValue, OperationResult pOperationResult) { DateTime lResult; if (pValue.GetType() == typeof(DateTime)) return; if (!DateTime.TryParse(pValue.ToString(), out lResult)) { pOperationResult.InvalidField(pFieldName, "Invalid", pValue); } }