summaryrefslogtreecommitdiff
path: root/Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs')
-rw-r--r--Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs
new file mode 100644
index 0000000..e3e7793
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs
@@ -0,0 +1,24 @@
+using System.Globalization;
+using System.Windows.Controls;
+
+namespace Gestor.Common.Validation;
+
+public class ValidacaoValorDiferenteZero : ValidationRule
+{
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ //IL_004d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0053: Expected O, but got Unknown
+ //IL_0041: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0047: Expected O, but got Unknown
+ if (!string.IsNullOrWhiteSpace((value ?? "").ToString()))
+ {
+ if (!value.ToString().ValidateDouble() || (decimal)value == 0m)
+ {
+ return new ValidationResult(false, (object)"Valor Inválido");
+ }
+ return ValidationResult.ValidResult;
+ }
+ return new ValidationResult(false, (object)"Obrigatório");
+ }
+}