PageRenderTime 51ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/Eksponent.Dewd/Fields/Criteria/IsNullOrEmpty.cs

http://dewd.codeplex.com
C# | 26 lines | 22 code | 4 blank | 0 comment | 3 complexity | 61460cfb62cea1a43aec98103fc548c5 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Xml.Linq;
  6. using Eksponent.Dewd.Extensions;
  7. namespace Eksponent.Dewd.Fields.Criteria
  8. {
  9. public class IsNullOrEmpty : IsNull
  10. {
  11. public IsNullOrEmpty(XElement element) : base(element) { }
  12. public override bool IsTrue(object value)
  13. {
  14. if (base.IsTrue(value))
  15. return true; // is null
  16. string strValue = String.Format("{0}", value);
  17. if (CriterionElement.GetAttribute<bool>("trim"))
  18. strValue = strValue.Trim();
  19. return (strValue.Length == 0);
  20. }
  21. }
  22. }